Example #1
0
        //TreeView stuff
        private void PopulateTreeView(BinaryReader stream)
        {
            //create the tree
            var rootNode = new TreeNode(filename);

            //read the file
            openPacFile = new PacFileHandling(stream);

            //What kind of file are we opening? Populate subdirecteries based on that
            if (openPacFile.pacFile.header.id == "EPK8" || openPacFile.pacFile.header.id == "EPAC")
            {
                GetDirectories(openPacFile.pacFile.dir, rootNode);
            }
            else if (openPacFile.pacFile.header.id == "PACH")
            {
                rootNode.Tag = openPacFile.pacFile.container; //Setting the root tag causes the list view to populate
                GetPACHFileDirectories(openPacFile.pacFile.container.PACHFiles, rootNode);
            }
            else if (openPacFile.pacFile.header.id == "dds\0")
            {
                rootNode.Tag = openPacFile.pacFile.textures; //Setting the root tag causes the list view to populate
            }
            //Add the root to the tree
            treeView1.Nodes.Add(rootNode);
        }
Example #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter      = "Pac Files (.pac)|*.pac|All Files (*.*)|*.*";
            openFileDialog1.FilterIndex = 1;

            // Call the ShowDialog method to show the dialog box.
            DialogResult userClickedOK = openFileDialog1.ShowDialog();

            if (userClickedOK == DialogResult.OK) // Test result.
            {
                file     = @openFileDialog1.FileName;
                filename = Path.GetFileName(file);
                try
                {
                    using (BinaryReader pacStream = new BinaryReader(File.Open(file, FileMode.Open)))
                    {
                        openPacFile = null;
                        treeView1.Nodes.Clear();
                        listView1.Items.Clear();
                        PopulateTreeView(pacStream);
                    }
                }
                catch (IOException)
                {
                }
            }
        }
Example #3
0
        //TreeView stuff
        private void PopulateTreeView(BinaryReader stream)
        {
            //create the tree
            var rootNode = new TreeNode(filename);

            //read the file
            openPacFile = new PacFileHandling(stream);

            //What kind of file are we opening? Populate subdirecteries based on that
            if (openPacFile.pacFile.header.id == "EPK8" || openPacFile.pacFile.header.id == "EPAC")
            {
                GetDirectories(openPacFile.pacFile.dir, rootNode);
            }
            else if (openPacFile.pacFile.header.id == "PACH")
            {
                rootNode.Tag = openPacFile.pacFile.container; //Setting the root tag causes the list view to populate
                GetPACHFileDirectories(openPacFile.pacFile.container.PACHFiles, rootNode);
            }
            else if (openPacFile.pacFile.header.id == "dds\0")
            {
                rootNode.Tag = openPacFile.pacFile.textures; //Setting the root tag causes the list view to populate
            }
            //Add the root to the tree
            treeView1.Nodes.Add(rootNode);
        }
Example #4
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "Pac Files (.pac)|*.pac|All Files (*.*)|*.*";
            openFileDialog1.FilterIndex = 1;

            // Call the ShowDialog method to show the dialog box.
            DialogResult userClickedOK = openFileDialog1.ShowDialog();

            if (userClickedOK == DialogResult.OK) // Test result.
            {
                file = @openFileDialog1.FileName;
                filename = Path.GetFileName(file);
                try
                {
                    using (BinaryReader pacStream = new BinaryReader(File.Open(file, FileMode.Open)))
                    {
                        openPacFile = null;
                        treeView1.Nodes.Clear();
                        listView1.Items.Clear();
                        PopulateTreeView(pacStream);
                    }
                }
                catch (IOException)
                {
                }
            }
        }