private void TreeView_PKiew_DoubleClick(object sender, EventArgs e) { if (treeView_PKiew.SelectedNode == null) { return; } if (treeView_PKiew.SelectedNode.Index == -1 || treeView_PKiew.SelectedNode == treeView_PKiew.TopNode) { return; } if (treenViewLastSelectedIndex != -1) { DATList[treenViewLastSelectedIndex].content = Center_EditorTextBox.Text; } KxSharpLib.Kal.DAT item = DATList[treeView_PKiew.SelectedNode.Index]; Center_EditorTextBox.BeginUpdate(); Center_EditorTextBox.Text = item.content; Center_EditorTextBox.EndUpdate(); treenViewLastSelectedIndex = treeView_PKiew.SelectedNode.Index; logger.Write(string.Format("[File:({0})] >> [SelectedItem:({1})]", item.name, item.index)); KxSharpLib.FormHelper.SetLabelText(label_CurrentFileTopCenter, string.Format("Current File: [{0}]", item.name)); }
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; } } }