Пример #1
0
        private void LoadSDSContent(FileInfo info)
        {
            if (!info.Name.Contains("SDSContent") && info.Extension != "xml")
            {
                return;
            }

            XmlDocument document = new XmlDocument();

            document.Load(info.FullName);

            XPathNavigator nav   = document.CreateNavigator();
            var            nodes = nav.Select("/SDSResource/ResourceEntry");

            while (nodes.MoveNext() == true)
            {
                nodes.Current.MoveToFirstChild();
                string       resourceType = nodes.Current.Value;
                BaseResource resource     = null;

                if (!resources.ContainsKey(resourceType))
                {
                    resources.Add(resourceType, new List <TreeNode>());
                }

                switch (resourceType)
                {
                case "FrameResource":
                case "Effects":
                case "PREFAB":
                case "ItemDesc":
                case "FrameNameTable":
                case "Actors":
                case "NAV_AIWORLD_DATA":
                case "NAV_OBJ_DATA":
                case "NAV_HPD_DATA":
                case "Cutscene":
                case "FxActor":
                case "FxAnimSet":
                case "Translokator":
                case "Speech":
                case "SoundTable":
                case "AnimalTrafficPaths":
                case "AudioSectors":
                case "Animated Texture":
                case "Collisions":
                case "IndexBufferPool":
                case "VertexBufferPool":
                case "EntityDataStorage":
                case "Animation2":
                case "Mipmap":
                case "Sound":
                case "MemFile":
                    resource = new BaseResource();
                    resource.ReadResourceEntry(nodes);
                    break;

                case "Texture":
                    resource = new TextureResource();
                    resource.ReadResourceEntry(nodes);
                    break;

                case "XML":
                    resource = new XMLResource();
                    resource.ReadResourceEntry(nodes);
                    break;

                case "Script":
                    resource = new ScriptResource();
                    resource.ReadResourceEntry(nodes);
                    break;

                case "Table":
                    resource = new TableResource();
                    resource.ReadResourceEntry(nodes);
                    break;

                default:
                    MessageBox.Show("Did not pack type: " + resourceType, "Toolkit", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                }

                TreeNode node = BuildTreeNode(resource.GetFileName(), resource);
                resources[resourceType].Add(node);
            }
        }
Пример #2
0
        private void LoadSDSContent(FileInfo info)
        {
            if (!info.Name.Contains("SDSContent") && info.Extension != "xml")
            {
                return;
            }

            XmlDocument document = new XmlDocument();

            document.Load(info.FullName);

            XPathNavigator nav   = document.CreateNavigator();
            var            nodes = nav.Select("/SDSResource/ResourceEntry");

            while (nodes.MoveNext() == true)
            {
                nodes.Current.MoveToFirstChild();
                string resourceType = nodes.Current.Value;
                nodes.Current.MoveToNext();
                string file = nodes.Current.Value;

                switch (resourceType)
                {
                case "Video":
                    treeView1.Nodes[0].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Script":
                    ScriptResource script = new ScriptResource();
                    script.ReadResourceEntry(nodes);
                    treeView1.Nodes[1].Nodes.Add(BuildTreeNode(file, info.Directory, script));
                    break;

                case "ItemDesc":
                    treeView1.Nodes[2].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Collisions":
                    treeView1.Nodes[3].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "FxAnimSet":
                    treeView1.Nodes[4].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "FxActor":
                    treeView1.Nodes[5].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Tables":
                    treeView1.Nodes[6].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "XML":
                    treeView1.Nodes[7].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Texture":
                    TextureResource texture = new TextureResource();
                    texture.ReadResourceEntry(nodes);
                    treeView1.Nodes[8].Nodes.Add(BuildTreeNode(file, info.Directory, texture));
                    break;

                case "Mipmap":
                    treeView1.Nodes[9].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "MemFile":
                    treeView1.Nodes[10].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "FrameResource":
                    treeView1.Nodes[11].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "ExtraData":
                    treeView1.Nodes[12].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "IndexBufferPool":
                    treeView1.Nodes[13].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "VertexBufferPool":
                    treeView1.Nodes[14].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Animated Texture":
                    treeView1.Nodes[15].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "AnimSet":
                    treeView1.Nodes[16].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Effects":
                    treeView1.Nodes[17].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Translokator":
                    treeView1.Nodes[18].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Cutscene":
                    treeView1.Nodes[19].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "SoundTable":
                    treeView1.Nodes[20].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Sound":
                    treeView1.Nodes[21].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "AudioSectors":
                    treeView1.Nodes[22].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Animation2":
                    treeView1.Nodes[23].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "AnimalTrafficPaths":
                    treeView1.Nodes[24].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "FrameNameTable":
                    treeView1.Nodes[25].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "EntityDataStorage":
                    treeView1.Nodes[26].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Actors":
                    treeView1.Nodes[27].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "Speech":
                    treeView1.Nodes[28].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "PREFAB":
                    treeView1.Nodes[29].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "NAV_AIWORLD_DATA":
                    treeView1.Nodes[30].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "NAV_OBJ_DATA":
                    treeView1.Nodes[31].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                case "NAV_HPD_DATA":
                    treeView1.Nodes[32].Nodes.Add(BuildTreeNode(file, info.Directory));
                    break;

                default:
                    Console.WriteLine("Failed to add " + file);
                    break;
                }
            }
        }