Fix Version marshaling as parameter
This commit is contained in:
@@ -232,7 +232,13 @@ namespace FlaxEngine
|
||||
|
||||
internal static ManagedHandle VersionToManaged(int major, int minor, int build, int revision)
|
||||
{
|
||||
Version version = new Version(major, minor, Math.Max(build, 0), Math.Max(revision, 0));
|
||||
Version version;
|
||||
if (revision >= 0)
|
||||
version = new Version(major, minor, Math.Max(build, 0), revision);
|
||||
else if (build >= 0)
|
||||
version = new Version(major, minor, build);
|
||||
else
|
||||
version = new Version(major, minor);
|
||||
return ManagedHandle.Alloc(version);
|
||||
}
|
||||
|
||||
@@ -245,15 +251,6 @@ namespace FlaxEngine
|
||||
return ManagedHandle.Alloc(new CultureInfo(lcid));
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct VersionNative
|
||||
{
|
||||
public int Major;
|
||||
public int Minor;
|
||||
public int Build;
|
||||
public int Revision;
|
||||
}
|
||||
|
||||
internal static void VersionToNative(ManagedHandle versionHandle, ref int major, ref int minor, ref int build, ref int revision)
|
||||
{
|
||||
Version version = Unsafe.As<Version>(versionHandle.Target);
|
||||
|
||||
Reference in New Issue
Block a user