private void b_create_Click(object sender, EventArgs e) { Lama.log("NOTICE", "Save server"); if (cfg == null) //Creation mode { if (tog_remote.Checked) { var index = Lama.mainConfig[0]["servers"].count(); var configPath = @"Config\Servers\" + index + ".xml"; //MakeConfig------------------------------------------------------------------ //Actualize main Config var root = Lama.mainConfig[0]["servers"].addChild("server") .addAttribute("id", index.ToString()); root.addChild("name", tb_name.Text); root.addChild("internetServer", "true"); root.addChild("matchSettings"); root.addChild("remote").addAttribute("value", "true") .addChild("ip", tb_ip.Text); root["remote"].addChild("port", tb_port.Text); root["remote"].addChild("login", tb_login.Text); root.addChild("plugins"); Lama.mainConfig.save(); this.hl.load(); this.Close(); } else { Lama.mainConfig.save(); ConfigServ cs = new ConfigServ(tb_name.Text); cs.Show(); this.hl.load(); this.Close(); } } else //Remote Edit mode { cfg["name"].Value = tb_name.Text; cfg["remote"]["ip"].Value = tb_ip.Text; cfg["remote"]["port"].Value = tb_port.Text; cfg["remote"]["login"].Value = tb_login.Text; Lama.mainConfig.save(); hl.load(); this.Close(); } }
//Edit private void flatButton2_Click(object sender, EventArgs e) { if (flatComboBox1.SelectedIndex != -1) { int index = flatComboBox1.SelectedIndex; XmlNode cfg = Lama.mainConfig[0]["servers"].getChildByAttribute("id", index.ToString()); if (cfg["remote"].getAttribute("value").Value.ToUpper().Equals("TRUE")) { var conf = new NewServer(this, cfg); conf.Show(); } else { var conf = new ConfigServ(index); conf.Show(); } } }