Exemplo n.º 1
0
        private void Button_RightTopExit_Click(object sender, EventArgs e)
        {
            DialogResult result = KxMsgBox.Show("Exit?", "Do you want to close?", KxMsgBoxIcon.QUESTION, KxMsgBoxButton.YESNO);

            if (result == DialogResult.Yes)
            {
                Application.Exit();
            }
        }
Exemplo n.º 2
0
        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;
                }
            }
        }