fork from 1.3

This commit is contained in:
moux23333
2024-01-27 21:06:07 +08:00
commit 22fc0b0848
1507 changed files with 24139 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
namespace FreeSR.Shared.Command.Convert
{
[AttributeUsage(AttributeTargets.Class)]
public class CommandParameterConverterAttribute : Attribute
{
public Type Type { get; }
public CommandParameterConverterAttribute(Type type)
{
Type = type;
}
}
}

View File

@@ -0,0 +1,7 @@
namespace FreeSR.Shared.Command.Convert
{
public interface ICommandParameterConverter
{
bool TryConvert(string parameter, out object result);
}
}

View File

@@ -0,0 +1,12 @@
namespace FreeSR.Shared.Command.Convert
{
[CommandParameterConverter(typeof(string))]
public class StringCommandParameterConverter : ICommandParameterConverter
{
public bool TryConvert(string parameter, out object result)
{
result = parameter;
return true;
}
}
}

View File

@@ -0,0 +1,16 @@
namespace FreeSR.Shared.Command.Convert
{
[CommandParameterConverter(typeof(uint))]
public class UIntCommandParameterConverter : ICommandParameterConverter
{
public bool TryConvert(string parameter, out object result)
{
result = null;
if (!uint.TryParse(parameter, out uint parseResult))
return false;
result = parseResult;
return true;
}
}
}