示例#1
0
        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);
        }
示例#2
0
        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);
        }