Fixed edge cases for serialization and deserialization of scripts #218
|
@ -45,12 +45,22 @@ namespace SHADE
|
|||
System::Collections::Generic::IEnumerable<FieldInfo^>^ fields = ReflectionUtilities::GetInstanceFields(object);
|
||||
for each (FieldInfo^ field in fields)
|
||||
{
|
||||
// Ignore private and non-SerialiseField
|
||||
if (!ReflectionUtilities::FieldIsSerialisable(field))
|
||||
continue;
|
||||
try
|
||||
{
|
||||
// Ignore private and non-SerialiseField
|
||||
if (!ReflectionUtilities::FieldIsSerialisable(field))
|
||||
continue;
|
||||
|
||||
// Serialise
|
||||
writeFieldIntoYaml(field, object, scriptNode);
|
||||
// Serialise
|
||||
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);
|
||||
|
@ -74,15 +84,25 @@ namespace SHADE
|
|||
System::Collections::Generic::IEnumerable<FieldInfo^>^ fields = ReflectionUtilities::GetInstanceFields(object);
|
||||
for each (FieldInfo^ field in fields)
|
||||
{
|
||||
// Ignore private and non-SerialiseField
|
||||
if (!ReflectionUtilities::FieldIsSerialisable(field))
|
||||
continue;
|
||||
|
||||
// Deserialise
|
||||
const std::string FIELD_NAME = Convert::ToNative(field->Name);
|
||||
if (yamlNode[FIELD_NAME])
|
||||
try
|
||||
{
|
||||
writeYamlIntoField(field, object, yamlNode[FIELD_NAME]);
|
||||
// Ignore private and non-SerialiseField
|
||||
if (!ReflectionUtilities::FieldIsSerialisable(field))
|
||||
continue;
|
||||
|
||||
// Deserialise
|
||||
const std::string FIELD_NAME = Convert::ToNative(field->Name);
|
||||
if (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())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue