private void fileBrowser1_OnRename(object sender, EventArgs e)
        {
            var         file          = Root.GetFileByPath(fileBrowser1.SelectedPath);
            SARCFileAdd fileAddDialog = new SARCFileAdd(Archive, file.FileName);

            fileAddDialog.ShowDialog();
            if (fileAddDialog.DialogResult == DialogResult.OK)
            {
                file.FileID   = (Int32)fileAddDialog.calculatedHash;
                file.FileName = string.Format("0x{0:X8}", fileAddDialog.calculatedHash);
                bool NameFound = false;
                if (SARCHashTable.DefaultHashTable != null)
                {
                    var vv = SARCHashTable.DefaultHashTable.GetEntryByHash(fileAddDialog.calculatedHash);
                    if (vv != null)
                    {
                        file.FileName = vv.Name; NameFound = true;
                    }
                }
                if (Archive.SarcFilename != null && !NameFound)
                {
                    var SarcName = System.IO.Path.GetFileNameWithoutExtension(Archive.SarcFilename);
                    foreach (var ext in Archive.MK7_szs_extensions)
                    {
                        string vv = SarcName + ext;
                        if (fileAddDialog.calculatedHash == Archive.GetHashFromName(vv))
                        {
                            file.FileName = vv;
                        }
                    }
                }
                Archive.FromFileSystem(Root);
                fileBrowser1.UpdateDirectories(Root.GetTreeNodes(), true);
            }
        }
 private void menuAdd_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK &&
         openFileDialog1.FileName.Length > 0)
     {
         SARCFileAdd fileAddDialog = new SARCFileAdd(Archive, openFileDialog1.FileName);
         fileAddDialog.ShowDialog();
         if (fileAddDialog.DialogResult == DialogResult.OK)
         {
             if (Archive.checkHashExists(fileAddDialog.calculatedHash))
             {
                 MessageBox.Show("File already exists!", "Error", MessageBoxButtons.OK);
                 return;
             }
             SFSFile newfile   = new SFSFile((Int32)fileAddDialog.calculatedHash, string.Format("0x{0:X8}", fileAddDialog.calculatedHash), Root);
             bool    NameFound = false;
             if (SARCHashTable.DefaultHashTable != null)
             {
                 var vv = SARCHashTable.DefaultHashTable.GetEntryByHash(fileAddDialog.calculatedHash);
                 if (vv != null)
                 {
                     newfile.FileName = vv.Name; NameFound = true;
                 }
             }
             if (Archive.SarcFilename != null && !NameFound)
             {
                 var SarcName = System.IO.Path.GetFileNameWithoutExtension(Archive.SarcFilename);
                 foreach (var ext in Archive.MK7_szs_extensions)
                 {
                     string vv = SarcName + ext;
                     if (fileAddDialog.calculatedHash == Archive.GetHashFromName(vv))
                     {
                         newfile.FileName = vv;
                     }
                 }
             }
             newfile.Data = System.IO.File.ReadAllBytes(openFileDialog1.FileName);
             Root.Files.Add(newfile);
             Archive.FromFileSystem(Root);
             fileBrowser1.UpdateDirectories(Root.GetTreeNodes(), true);
         }
     }
 }