示例#1
0
        private void savel2ini_Click(object sender, EventArgs e)
        {
            if (selectedIniComboName == null || selectedIniIntFile == null)
            {
                return;
            }

            Lineage2Ver ver = (Lineage2Ver)selectedIniIntFile.GetType().GetField(selectedIniIntFile.ToString()).GetCustomAttributes(typeof(Lineage2Ver), true)[0];

            string dst_fname = Path.Combine(RConfig.Instance.LineageDirectory, selectedIniComboName);

            if (RConfig.Instance.SaveBakFiles)
            {
                try
                {
                    if (File.Exists(Path.ChangeExtension(dst_fname, ".bak")))
                    {
                        File.Delete(Path.ChangeExtension(dst_fname, ".bak"));
                    }

                    File.Move(dst_fname, Path.ChangeExtension(dst_fname, ".bak"));
                }
                catch
                {
                }
            }

            IniTextBox.SaveFile(dst_fname, RichTextBoxStreamType.PlainText);

            L2EncDec.Encrypt(selectedIniComboName, ver.Ver);

            clearl2ini_Click(sender, e);
        }
示例#2
0
        private void OpenIniButton_Click(object sender, EventArgs e)
        {
            if (selectedIniComboName == null || selectedIniIntFile == null)
            {
                return;
            }

            Lineage2Ver ver = (Lineage2Ver)selectedIniIntFile.GetType().GetField(selectedIniIntFile.ToString()).GetCustomAttributes(typeof(Lineage2Ver), true)[0];

            // пожалуста подождите
            StatusLabel.Text = Localizate.getMessage(Word.PLEASE_WAIT);

            if (!File.Exists(Path.Combine(RConfig.Instance.LineageDirectory, selectedIniComboName)))
            {
                StatusLabel.Text = Localizate.getMessage(Word.ERROR) + " " + Localizate.getMessage(Word.FILE_NOT_FOUND);
                return;
            }

            try
            {
                BinaryReader f = L2EncDec.Decrypt(selectedIniComboName, Encoding.Default);
                if (f == null)
                {
                    return;
                }
                char[] IniText = f.ReadChars((int)f.BaseStream.Length);
                f.Close();
                IniTextBox.Text = new String(IniText);
            }
            catch (Exception ex)
            {
                _log.Info("Exception: " + ex, ex);
            }
            finally
            {
                Enabled = true;
                FileNameCombo.Enabled = true;
                savel2ini.Enabled     = true;
                clearl2ini.Enabled    = true;
                IniTextBox.Enabled    = true;
                EnCod.Text            = ver.Ver.ToString();
                Char     c  = '\n';
                String[] st = IniTextBox.Text.Split(c);
                Counts.Text = st.Length.ToString();
                IniTextBox.Update();
            }
            StatusLabel.Text = "";
        }
示例#3
0
 private void clearl2ini_Click(object sender, EventArgs e)
 {
     IniTextBox.Clear();
     savel2ini.Enabled     = false;
     IniTextBox.Enabled    = false;
     clearl2ini.Enabled    = false;
     OpenL2iniText.Enabled = false;
     Counts.Text           = "0";
     EnCod.Text            = "0";
     selectedIniComboName  = null;
     try
     {
         FileIniComboName.SelectedIndex = -1;
     }
     catch
     {
     }
 }
示例#4
0
 private void SelectAll_Click(object sender, EventArgs e)
 {
     IniTextBox.SelectAll();
 }
示例#5
0
 private void PasteR_Click(object sender, EventArgs e)
 {
     IniTextBox.Paste();
 }
示例#6
0
 private void CopyR_Click(object sender, EventArgs e)
 {
     IniTextBox.Copy();
 }
示例#7
0
 private void CutR_Click(object sender, EventArgs e)
 {
     IniTextBox.Cut();
 }