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); }
private void SaveBtn_Click(object sender, EventArgs e) { try { StatusLabel.Text = Localizate.getMessage(Word.PLEASE_WAIT); FileNameCombo.Enabled = false; Enabled = false; if (DatDatas.Count == 0) { StatusLabel.Text = Localizate.getMessage(Word.ERROR) + Localizate.getMessage(Word.SYSTEM_FOLDER_IS_EMPTY); return; } string fname = Path.Combine(RConfig.Instance.LineageDirectory, selectedComboName); if (RConfig.Instance.SaveBakFiles) { try { if (File.Exists(Path.ChangeExtension(fname, ".bak"))) { File.Delete(Path.ChangeExtension(fname, ".bak")); } File.Move(fname, Path.ChangeExtension(fname, ".bak")); } catch (Exception) { } } var f = new BinaryWriter(File.OpenWrite(fname), Encoding.Default); if (f == null) { return; } DatInfo.Compile(f, DatDatas); f.Close(); L2EncDec.Encrypt(selectedComboName, 413); } catch (Exception ex) { _log.Info("Exception: " + ex, ex); } finally { Enabled = true; FileNameCombo.Enabled = true; onEnd(); } StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) + String.Format(Localizate.getMessage(Word.SAVED_DATA), DatDatas.Count); }
private void SaveBtn_Click(object sender, EventArgs e) { try { this.StatusLabel.Text = Program.language.getMessage(MsgList.PleaseWait); this.FileNameCombo.Enabled = false; this.Enabled = false; if (this.DatDatas.Count == 0) { this.StatusLabel.Text = Program.language.getMessage(MsgList.ERROR) + String.Format(Program.language.getMessage(MsgList.DataIsEmpty)); return; } string fname = Path.Combine(Program.config.LineAgeDirectory, this.selectedComboName); if (Program.config.LineAgeSaveBakFiles) { try { File.Move(fname, Path.ChangeExtension(fname, ".bak")); } catch { } } BinaryWriter f = new BinaryWriter(File.OpenWrite(fname), Encoding.Default); if (f == null) { return; } this.StatusProgress.Minimum = 0; this.StatusProgress.Value = 0; this.StatusProgress.Visible = true; DatInfo.Compile(f, this.DatDatas); f.Close(); L2EncDec.Encrypt(this.selectedComboName); } catch (Exception ex) { Program.log.Add(ex, true); } finally { this.Enabled = true; this.FileNameCombo.Enabled = true; this.StatusProgress.Visible = false; } this.StatusLabel.Text = Program.language.getMessage(MsgList.COMPLETE) + String.Format(Program.language.getMessage(MsgList.CompleteSave), this.DatDatas.Count); }
private void SaveButton_Click(object sender, EventArgs e) { string dst_fname = Path.Combine(Program.config.LineAgeDirectory, IniFileName); if (Program.config.LineAgeSaveBakFiles) { try { File.Move(dst_fname, Path.ChangeExtension(dst_fname, ".bak")); } catch { } } this.IniEditer.SaveFile(dst_fname, RichTextBoxStreamType.PlainText); L2EncDec.Encrypt(IniFileName); this.Close(); }
private void SaveBtn_Click(object sender, EventArgs e) { REfBtn_Click(sender, e); string dst_fname = Path.Combine(RConfig.Instance.LineageDirectory, "l2.ini"); if (RConfig.Instance.SaveBakFiles) { try { File.Move(dst_fname, Path.ChangeExtension(dst_fname, ".bak")); } catch { } } L2Edit.SaveFile(dst_fname, RichTextBoxStreamType.PlainText); L2EncDec.Encrypt("l2.ini", 413); Close(); }