private void MenuIniItems_Click(object sender, EventArgs e) { try { this.FileNameCombo.Enabled = false; this.Enabled = false; BinaryReader f = L2EncDec.Decrypt(((ToolStripMenuItem)sender).Text, Encoding.Default); if (f == null) { return; } char[] IniText = f.ReadChars((int)f.BaseStream.Length); f.Close(); IniEditBox dlg = new IniEditBox(((ToolStripMenuItem)sender).Text, new String(IniText)); dlg.ShowDialog(); } catch (Exception ex) { Program.log.Add(ex, true); } finally { this.Enabled = true; this.FileNameCombo.Enabled = true; } }
private void LoadBtn_Click(object sender, EventArgs e) { try { StatusLabel.Text = Localizate.getMessage(Word.PLEASE_WAIT); FileNameCombo.Enabled = false; Enabled = false; DatInfo_init(); if (DatInfo == null) { return; } if (!File.Exists(Path.Combine(RConfig.Instance.LineageDirectory, selectedComboName))) { StatusLabel.Text = Localizate.getMessage(Word.ERROR) + " " + Localizate.getMessage(Word.FILE_NOT_FOUND); return; } BinaryReader f = L2EncDec.Decrypt(selectedComboName, Encoding.Default); if (f == null) { return; } DatDatas = DatInfo.Parse(f); f.Close(); importBtn2.Enabled = true; exportBtn2.Enabled = true; SaveBtn2.Enabled = true; editorBtn.Enabled = true; _mergeButton.Enabled = true; } catch (Exception ex) { _log.Info("Exception" + ex, ex); } finally { Enabled = true; FileNameCombo.Enabled = true; onEnd(); Forms_Update(); } StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) + String.Format(Localizate.getMessage(Word.LOADED_DATA), DatDatas.Count); }
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 = ""; }
private void LoadBtn_Click(object sender, EventArgs e) { try { this.StatusLabel.Text = Program.language.getMessage(MsgList.PleaseWait); this.FileNameCombo.Enabled = false; this.Enabled = false; this.DatInfo_init(); if (!File.Exists(Path.Combine(Program.config.LineAgeDirectory, this.selectedComboName))) { this.StatusLabel.Text = Program.language.getMessage(MsgList.ERROR) + String.Format(Program.language.getMessage(MsgList.FileNotFound)); return; } BinaryReader f = L2EncDec.Decrypt(this.selectedComboName, Encoding.Default); if (f == null) { return; } this.StatusProgress.Minimum = 0; this.StatusProgress.Value = 0; this.StatusProgress.Visible = true; this.DatDatas = DatInfo.Parse(f); f.Close(); this.SaveBtn.Enabled = true; this.ExpBtn.Enabled = true; } catch (Exception ex) { Program.log.Add(ex, true); } finally { this.Enabled = true; this.FileNameCombo.Enabled = true; this.StatusProgress.Visible = false; this.Forms_Update(); } this.StatusLabel.Text = Program.language.getMessage(MsgList.COMPLETE) + String.Format(Program.language.getMessage(MsgList.CompleteLoad), this.DatDatas.Count); }
private void FastL2INIOptionForm_Load(object sender, EventArgs e) { Localizate.load(); try { BinaryReader f = L2EncDec.Decrypt("l2.ini", Encoding.Default); if (f == null) { return; } char[] IniText = f.ReadChars((int)f.BaseStream.Length); f.Close(); L2Edit.Text = new String(IniText); for (int i = 0; i < L2Edit.Lines.Length; i++) { if (L2Edit.Lines[i].StartsWith("ServerAddr=")) { String s = L2Edit.Lines[i]; char p = '='; String[] ss = s.Split(p); HostText.Text = ss[1]; } if (L2Edit.Lines[i].StartsWith("Port=")) { String s = L2Edit.Lines[i]; char p = '='; String[] ss = s.Split(p); PortText.Text = ss[1]; } if (L2Edit.Lines[i].StartsWith("IsL2NetLog=")) { String s = L2Edit.Lines[i]; char p = '='; String[] ss = s.Split(p); NetLog.Checked = Boolean.Parse(ss[1]); } if (L2Edit.Lines[i].StartsWith("L2TestServer=")) { String s = L2Edit.Lines[i]; char p = '='; String[] ss = s.Split(p); TestServer.Checked = Boolean.Parse(ss[1]); } if (L2Edit.Lines[i].StartsWith("EnableSecondWindow=")) { String s = L2Edit.Lines[i]; char p = '='; String[] ss = s.Split(p); SeccondWind.Checked = Boolean.Parse(ss[1]); } } // локализация Text = Localizate.getMessage(Word.MENU_SERVICE_FAST_SETTINGS) + " : " + "l2.ini"; InetGrop.Text = Localizate.getMessage(Word.INTERNET_GROUP); OtherGroup.Text = Localizate.getMessage(Word.OTHER_GROUP); SeccondWind.Text = Localizate.getMessage(Word.SECOND_CLIENT); TestServer.Text = Localizate.getMessage(Word.TEST_SERVER); NetLog.Text = Localizate.getMessage(Word.NETWORK_LOG); Host.Text = Localizate.getMessage(Word.HOST); Port.Text = Localizate.getMessage(Word.PORT); REfBtn.Text = Localizate.getMessage(Word.REFRESH); SaveBtn.Text = Localizate.getMessage(Word.SAVE_BUTTON); } catch (Exception ex) { _log.Info("Exception: " + ex, ex); } }