Example #1
0
 public static BinTreePropertyViewModel ConstructTreePropertyViewModel(BinTreeParentViewModel parent, BinTreeProperty genericProperty)
 {
     return(genericProperty switch
     {
         BinTreeNone property => new BinTreePropertyViewModel(parent, property),
         BinTreeBool property => new BinTreeBoolViewModel(parent, property),
         BinTreeSByte property => new BinTreeSByteViewModel(parent, property),
         BinTreeByte property => new BinTreeByteViewModel(parent, property),
         BinTreeInt16 property => new BinTreeInt16ViewModel(parent, property),
         BinTreeUInt16 property => new BinTreeUInt16ViewModel(parent, property),
         BinTreeInt32 property => new BinTreeInt32ViewModel(parent, property),
         BinTreeUInt32 property => new BinTreeUInt32ViewModel(parent, property),
         BinTreeInt64 property => new BinTreeInt64ViewModel(parent, property),
         BinTreeUInt64 property => new BinTreeUInt64ViewModel(parent, property),
         BinTreeFloat property => new BinTreeFloatViewModel(parent, property),
         BinTreeVector2 property => new BinTreeVector2ViewModel(parent, property),
         BinTreeVector3 property => new BinTreeVector3ViewModel(parent, property),
         BinTreeVector4 property => new BinTreeVector4ViewModel(parent, property),
         BinTreeMatrix44 property => new BinTreeMatrix44ViewModel(parent, property),
         BinTreeColor property => new BinTreeColorViewModel(parent, property),
         BinTreeHash property => new BinTreeHashViewModel(parent, property),
         BinTreeWadEntryLink property => new BinTreeWadEntryLinkViewModel(parent, property),
         BinTreeUnorderedContainer property => new BinTreeUnorderedContainerViewModel(parent, property),
         BinTreeContainer property => new BinTreeContainerViewModel(parent, property),
         BinTreeString property => new BinTreeStringViewModel(parent, property),
         BinTreeEmbedded property => new BinTreeEmbeddedViewModel(parent, property),
         BinTreeStructure property => new BinTreeStructureViewModel(parent, property),
         BinTreeObjectLink property => new BinTreeObjectLinkViewModel(parent, property),
         BinTreeOptional property => new BinTreeOptionalViewModel(parent, property),
         BinTreeMap property => new BinTreeMapViewModel(parent, property),
         BinTreeBitBool property => new BinTreeBitBoolViewModel(parent, property),
         _ => null,
     });
Example #2
0
 private static IEnumerable <string> ProcessBinTreeProperty(BinTreeProperty treeProperty)
 {
     return(treeProperty switch
     {
         BinTreeString property => ProcessBinTreeString(property),
         BinTreeOptional property => ProcessBinTreeOptional(property),
         BinTreeContainer property => ProcessBinTreeContainer(property),
         BinTreeStructure property => ProcessBinTreeStructure(property),
         BinTreeMap property => ProcessBinTreeMap(property),
         _ => Enumerable.Empty <string>()
     });
Example #3
0
        private static object DeserializeContainer(MetaEnvironment environment, Type propertyType, BinTreeContainer container)
        {
            object     containerList     = Activator.CreateInstance(propertyType);
            Type       containerListType = containerList.GetType();
            MethodInfo addMethod         = containerListType.GetMethod("Add");

            foreach (BinTreeProperty containerItem in container.Properties)
            {
                addMethod.Invoke(containerList, new[] { DeserializeTreeProperty(environment, containerItem) });
            }

            return(containerList);
        }