Exemplo n.º 1
0
        private static ResourceType DetermineResourceTypeByCompilerIdentifier(SpecialDependencies.SpecialDependency input)
        {
            var identifier = input.CompilerIdentifier;

            if (identifier.StartsWith("Compile", StringComparison.Ordinal))
            {
                identifier = identifier.Remove(0, "Compile".Length);
            }

            // Special mappings and otherwise different identifiers
            switch (identifier)
            {
            case "Psf": return(ResourceType.ParticleSnapshot);

            case "AnimGroup": return(ResourceType.AnimationGroup);

            case "VPhysXData": return(ResourceType.PhysicsCollisionMesh);

            case "Font": return(ResourceType.BitmapFont);

            case "RenderMesh": return(ResourceType.Mesh);

            case "Panorama":
                switch (input.String)
                {
                case "Panorama Style Compiler Version": return(ResourceType.PanoramaStyle);

                case "Panorama Script Compiler Version": return(ResourceType.PanoramaScript);

                case "Panorama Layout Compiler Version": return(ResourceType.PanoramaLayout);

                case "Panorama Dynamic Images Compiler Version": return(ResourceType.PanoramaDynamicImages);
                }

                return(ResourceType.Panorama);

            case "VectorGraphic": return(ResourceType.PanoramaVectorGraphic);
            }

            if (Enum.TryParse(identifier, false, out ResourceType resourceType))
            {
                return(resourceType);
            }

            return(ResourceType.Unknown);
        }
        private void ConstructSpecialDependencies()
        {
            var specialDependenciesRedi = new SpecialDependencies();
            var specialDependencies     = BackingData.AsKeyValueCollection().GetArray("m_SpecialDependencies");

            foreach (var specialDependency in specialDependencies)
            {
                var specialDependencyRedi = new SpecialDependencies.SpecialDependency
                {
                    String             = specialDependency.GetProperty <string>("m_String"),
                    CompilerIdentifier = specialDependency.GetProperty <string>("m_CompilerIdentifier"),
                    Fingerprint        = specialDependency.GetIntegerProperty("m_nFingerprint"),
                    UserData           = specialDependency.GetIntegerProperty("m_nUserData"),
                };

                specialDependenciesRedi.List.Add(specialDependencyRedi);
            }

            Structs.Add(REDIStruct.SpecialDependencies, specialDependenciesRedi);
        }