예제 #1
0
파일: Form1.cs 프로젝트: kkzero241/AT7View
        //EXTRACT ALL FILES
        private void buttonExtractAll_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog toExtractTo = new FolderBrowserDialog();

            toExtractTo.Description = "Extract the contents to where?";

            DialogResult result = toExtractTo.ShowDialog();

            if (result == DialogResult.OK)
            {
                BinaryWriter currentOutput;
                string       selFolder = toExtractTo.SelectedPath;
                using (BinaryReader fileReader = new BinaryReader(File.Open(archiveName, FileMode.Open))) //Read the open archive to go through all the files
                {
                    foreach (TreeNode currentFile in treeView1.Nodes)
                    {
                        AT7FileNode dealingWith = currentFile.Tag as AT7FileNode;
                        Console.WriteLine($"{selFolder}\\{dealingWith.getName()}");
                        currentOutput = new BinaryWriter(File.Open($"{selFolder}\\{dealingWith.getName()}", FileMode.Create));
                        fileReader.BaseStream.Position = dealingWith.getOffset();
                        currentOutput.Write(fileReader.ReadBytes((int)dealingWith.getSize()));
                        currentOutput.Close();
                    }
                }

                DialogResult extractedYay = new DialogResult();
                extractedYay = MessageBox.Show($"All files of {Path.GetFileName(archiveName)} extracted to {selFolder}.");
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: kkzero241/AT7View
 private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     fileDetailsNode = e.Node.Tag as AT7FileNode;
     //Console.WriteLine(fileDetailsNode.ToString());
     infoTools.Text      = fileDetailsNode.ToString();
     fileExtension       = fileDetailsNode.getExt();
     fileName            = fileDetailsNode.getName();
     fileOffset          = fileDetailsNode.getOffset();
     fileSize            = fileDetailsNode.getSize();
     fileExtInfoBox.Text = fileExtension;
     AT7FileTypes.fileTypesDict.TryGetValue(fileExtension, out fileDesc); //Nabs the file description for the display label
     fileTypeDesc.Text      = fileDesc;
     buttonExtract.Enabled  = true;
     buttonExportAs.Enabled = false;
     buttonExportAs.Text    = "Export As";
     if (fileName.Equals("gmm.txt"))
     {
         buttonExportAs.Enabled = true;
         buttonExportAs.Text    = "Export .csv";
     }
     else if (fileExtension.Equals(".tex"))
     {
         buttonExportAs.Enabled = true;
         buttonExportAs.Text    = "Export .tpl";
     }
     buttonReplace.Enabled = true;
     //Console.WriteLine(treeView1.Nodes[0].Tag.ToString());
     //Console.WriteLine("Offset: {0:X}", fileDetailsNode.getOffset() + "\n Size: {0:X}", fileDetailsNode.getSize());
 }