private void Button_MenuLeftSaveFile_Click(object sender, EventArgs e) { if (DATList != null) { PackageHandler.Save(); } else { logger.Write(string.Format("Load a File before trying to save!")); } }
private void Button_MenuLeftFileOpen_Click(object sender, EventArgs e) { if (Setting_CryptTable_comboBox.SelectedIndex == -1 || KxSharpLib.Security.Kal.Crypto.GUseCrypt == KxSharpLib.Security.Kal.Crypto.EUseCrypt.Unknown) { logger.Write("[Unknown CryptTable, Please set a valid table!]"); return; } if (DATList != null) { logger.Write("[There is already a file loaded!]"); DialogResult diaResult = KxMsgBox.Show("Already open!", "There is already a file loaded!\nClose without saving ?", KxMsgBoxIcon.WARNING, KxMsgBoxButton.YESNO); switch (diaResult) { case DialogResult.Yes: { Center_EditorTextBox.Clear(); LoadedPK = new KxSharpLib.Kal.PK(); DATList.Clear(); DATList = null; treeView_PKiew.Nodes.Clear(); Setting_CryptTable_comboBox.Enabled = true; KxSharpLib.FormHelper.SetLabelText(label_CurrentFileTopCenter, "Current File: [None]"); break; } case DialogResult.No: return; default: return; } } using (OpenFileDialog filedia = new OpenFileDialog()) { filedia.Title = "Open PK File"; filedia.Filter = "PK files|*.pk"; filedia.CheckFileExists = true; filedia.CheckPathExists = true; switch (filedia.ShowDialog(this)) { case DialogResult.OK: { _ = new PackageHandler(filedia.FileName); Setting_CryptTable_comboBox.Enabled = false; textBox_FileInfo_Name.Text = Path.GetFileName(filedia.FileName); textBox_FileInfo_Path.Text = filedia.FileName; using (var md5 = MD5.Create()) { textBox_FileInfo_MD5.Text = BitConverter.ToString(md5.ComputeHash(File.ReadAllBytes(filedia.FileName))).Replace("-", "").ToLower(); } break; } default: break; } } }