Fix reading Variant Type in C#

This commit is contained in:
Wojtek Figat
2025-03-26 19:47:39 +01:00
parent 7e145c56fd
commit bf2974b6cc

View File

@@ -354,6 +354,8 @@ namespace FlaxEngine.Utilities
if (typeNameLength == int.MaxValue)
{
typeNameLength = stream.ReadInt32();
if (typeNameLength > 0)
{
var data = new byte[typeNameLength];
for (int i = 0; i < typeNameLength; i++)
{
@@ -363,6 +365,7 @@ namespace FlaxEngine.Utilities
var typeName = System.Text.Encoding.ASCII.GetString(data);
return TypeUtils.GetType(typeName);
}
}
if (typeNameLength > 0)
{
// [Deprecated on 27.08.2020, expires on 27.08.2021]
@@ -426,6 +429,8 @@ namespace FlaxEngine.Utilities
if (typeNameLength == int.MaxValue)
{
typeNameLength = stream.ReadInt32();
if (typeNameLength > 0)
{
var data = new byte[typeNameLength];
for (int i = 0; i < typeNameLength; i++)
{
@@ -435,6 +440,7 @@ namespace FlaxEngine.Utilities
var typeName = System.Text.Encoding.ASCII.GetString(data);
return TypeUtils.GetManagedType(typeName);
}
}
if (typeNameLength > 0)
{
// [Deprecated on 27.08.2020, expires on 27.08.2021]
@@ -500,6 +506,8 @@ namespace FlaxEngine.Utilities
if (typeNameLength == int.MaxValue)
{
typeNameLength = stream.ReadInt32();
if (typeNameLength > 0)
{
var data = new byte[typeNameLength];
for (int i = 0; i < typeNameLength; i++)
{
@@ -509,6 +517,7 @@ namespace FlaxEngine.Utilities
typeName = System.Text.Encoding.ASCII.GetString(data);
type = TypeUtils.GetManagedType(typeName);
}
}
else if (typeNameLength > 0)
{
// [Deprecated on 27.08.2020, expires on 27.08.2021]