Small changes and bug fixes

This commit is contained in:
EntenKoeniq
2021-12-10 16:25:59 +01:00
parent d244cd393a
commit 3bcda302fe
6 changed files with 42 additions and 31 deletions

View File

@ -12,36 +12,40 @@ namespace CoopServer
{
public static List<NativeArgument> ParseNativeArguments(params object[] args)
{
List<NativeArgument> result = new();
List<NativeArgument> result = null;
foreach (object arg in args)
if (args != null && args.Length > 0)
{
Type typeOf = arg.GetType();
result = new();
if (typeOf == typeof(int))
foreach (object arg in args)
{
result.Add(new IntArgument() { Data = (int)arg });
}
else if (typeOf == typeof(bool))
{
result.Add(new BoolArgument() { Data = (bool)arg });
}
else if (typeOf == typeof(float))
{
result.Add(new FloatArgument() { Data = (float)arg });
}
else if (typeOf == typeof(string))
{
result.Add(new StringArgument() { Data = (string)arg });
}
else if (typeOf == typeof(LVector3))
{
result.Add(new LVector3Argument() { Data = (LVector3)arg });
}
else
{
Logging.Error("[Util->ParseNativeArguments(params object[] args)]: Type of argument not found!");
return null;
Type typeOf = arg.GetType();
if (typeOf == typeof(int))
{
result.Add(new IntArgument() { Data = (int)arg });
}
else if (typeOf == typeof(bool))
{
result.Add(new BoolArgument() { Data = (bool)arg });
}
else if (typeOf == typeof(float))
{
result.Add(new FloatArgument() { Data = (float)arg });
}
else if (typeOf == typeof(string))
{
result.Add(new StringArgument() { Data = (string)arg });
}
else if (typeOf == typeof(LVector3))
{
result.Add(new LVector3Argument() { Data = (LVector3)arg });
}
else
{
return null;
}
}
}