private static object DeserializeStructure(MetaEnvironment environment, BinTreeStructure structure) { Type metaClassType = environment.FindMetaClass(structure.MetaClassHash); if (metaClassType is null) { return(null); // Couldn't deserialize structure } object metaClassObject = Activator.CreateInstance(metaClassType); AssignMetaClassProperties(environment, metaClassObject, metaClassObject.GetType(), structure.Properties); return(metaClassObject); }
private static object DeserializeEmbedded(MetaEnvironment environment, BinTreeEmbedded embedded) { Type metaClassType = environment.FindMetaClass(embedded.MetaClassHash); if (metaClassType is null) { return(null); // Couldn't deserialize structure } Type embeddedWrapperType = typeof(MetaEmbedded <>).MakeGenericType(metaClassType); object metaClassObject = Activator.CreateInstance(metaClassType); AssignMetaClassProperties(environment, metaClassObject, metaClassObject.GetType(), embedded.Properties); object embeddedWrapperObject = Activator.CreateInstance(embeddedWrapperType, new[] { metaClassObject }); return(embeddedWrapperObject); }