/// <summary> /// Write logLine list and clear list /// </summary> public override void flush() { try { StreamWriter sw = new StreamWriter(path, true); foreach (LogLine elem in lines) { sw.WriteLine(elem.toText()); } sw.Close(); lines.Clear(); } catch (Exception e) { Lama.onException(this, e); } }
private void b_newMatch_Click(object sender, EventArgs e) { string file = tb_matchFile.Text; string path = mapPath + @"MatchSettings\" + file; if (!File.Exists(path)) { try { File.Create(path).Close(); this.matchSettings = new XmlDocument(path); } catch (Exception er) { Lama.onException(this, er); } } else { Lama.onError(this, "Error", "The file : " + file + " already exists !"); } }
//Remove private void flatButton3_Click(object sender, EventArgs e) { DialogResult res = MessageBox.Show("Are you sure ?", "Are you sure to remove" + flatComboBox1.SelectedText, MessageBoxButtons.YesNo); if (res == DialogResult.No) { return; } int index = Lama.servers.getKeyFromValue(flatComboBox1.Text); XmlNode cfg = Lama.mainConfig[0]["servers"].getChildByAttribute("id", index.ToString()); try { if (cfg["remote"].getAttibuteV("value").ToUpper().Equals("FALSE")) { Directory.Delete(Application.StartupPath + @"\Servers\" + index + @"\", true); } } catch (Exception dirEx) { Lama.onException(this, dirEx); } //Update Main Config int total = Lama.mainConfig[0]["servers"].removeChildsByAttribute("server", "id", index.ToString()); if (total != 1) { Lama.onError(this, "Error", "Unable to delete server from main config, nodes affected = "); } else { Lama.mainConfig.save(); load(); } }