Fixed edge cases for serialization and deserialization of scripts #218
|
@ -44,6 +44,8 @@ namespace SHADE
|
||||||
// Get all fields
|
// Get all fields
|
||||||
System::Collections::Generic::IEnumerable<FieldInfo^>^ fields = ReflectionUtilities::GetInstanceFields(object);
|
System::Collections::Generic::IEnumerable<FieldInfo^>^ fields = ReflectionUtilities::GetInstanceFields(object);
|
||||||
for each (FieldInfo^ field in fields)
|
for each (FieldInfo^ field in fields)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// Ignore private and non-SerialiseField
|
// Ignore private and non-SerialiseField
|
||||||
if (!ReflectionUtilities::FieldIsSerialisable(field))
|
if (!ReflectionUtilities::FieldIsSerialisable(field))
|
||||||
|
@ -52,6 +54,14 @@ namespace SHADE
|
||||||
// Serialise
|
// Serialise
|
||||||
writeFieldIntoYaml(field, object, scriptNode);
|
writeFieldIntoYaml(field, object, scriptNode);
|
||||||
}
|
}
|
||||||
|
catch (System::Exception^ e)
|
||||||
|
{
|
||||||
|
Debug::LogError
|
||||||
|
(
|
||||||
|
System::String::Format("[SerialisationUtilities] Failed to serialise field ({0}): {1}", field->Name, e->ToString())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scriptListNode.push_back(scriptNode);
|
scriptListNode.push_back(scriptNode);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +83,8 @@ namespace SHADE
|
||||||
// Get all fields
|
// Get all fields
|
||||||
System::Collections::Generic::IEnumerable<FieldInfo^>^ fields = ReflectionUtilities::GetInstanceFields(object);
|
System::Collections::Generic::IEnumerable<FieldInfo^>^ fields = ReflectionUtilities::GetInstanceFields(object);
|
||||||
for each (FieldInfo^ field in fields)
|
for each (FieldInfo^ field in fields)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// Ignore private and non-SerialiseField
|
// Ignore private and non-SerialiseField
|
||||||
if (!ReflectionUtilities::FieldIsSerialisable(field))
|
if (!ReflectionUtilities::FieldIsSerialisable(field))
|
||||||
|
@ -85,6 +97,14 @@ namespace SHADE
|
||||||
writeYamlIntoField(field, object, yamlNode[FIELD_NAME]);
|
writeYamlIntoField(field, object, yamlNode[FIELD_NAME]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (System::Exception^ e)
|
||||||
|
{
|
||||||
|
Debug::LogError
|
||||||
|
(
|
||||||
|
System::String::Format("[SerialisationUtilities] Failed to deserialise field ({0}): {1}", field->Name, e->ToString())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Serialization Helper Functions */
|
/* Serialization Helper Functions */
|
||||||
|
|
Loading…
Reference in New Issue