private void AddButton_Click(object sender, EventArgs e) { if (!validateFields()) return; ES_System newSystem = new ES_System(); newSystem.name = SysName.Text; newSystem.fullname = SysFullname.Text; newSystem.path = SysPath.Text; newSystem.extension = SysExtension.Text; newSystem.command = SysCommand.Text; newSystem.platform = SysPlatform.Text; newSystem.theme = SysTheme.Text; bool isNewSystem = true; if (FindSystemByName(newSystem.fullname) != null) { isNewSystem = false; } if (isNewSystem) { systems.Add(newSystem); ConfigList.Items.Add(newSystem.fullname); } else { systems.Remove(FindSystemByName(newSystem.fullname)); systems.Add(newSystem); ConfigList.Items.Remove(newSystem.fullname); ConfigList.Items.Add(newSystem.fullname); } SysName.Text = ""; SysFullname.Text = ""; SysPath.Text = ""; SysExtension.Text = ""; SysCommand.Text = ""; SysPlatform.Text = ""; SysTheme.Text = ""; SysName.Focus(); }
private void richTextBox1_MouseHover(object sender, EventArgs e) { ES_System newSystem = new ES_System(); newSystem.name = SysName.Text; newSystem.fullname = SysFullname.Text; newSystem.path = SysPath.Text; newSystem.extension = SysExtension.Text; newSystem.command = SysCommand.Text; newSystem.platform = SysPlatform.Text; newSystem.theme = SysTheme.Text; InstructionBox.Tag = newSystem.format(); Tooltip.SetToolTip(InstructionBox, InstructionBox.Tag.ToString()); }
private void Load_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { List<string> allLines = File.ReadAllLines(openFileDialog1.FileName).ToList<string>(); List<ES_System> _systems = new List<ES_System>(); for (int i = 0; i < allLines.Count; i++) { if (allLines[i].Contains("<name>")) { ES_System temp = new ES_System(); temp.name = allLines[i].Replace("<name>", "").Replace("</name>", "").Trim(); temp.fullname = allLines[i + 1].Replace("<fullname>", "").Replace("</fullname>", "").Trim(); temp.path = allLines[i + 2].Replace("<path>", "").Replace("</path>", "").Trim(); temp.extension = allLines[i + 3].Replace("<extension>", "").Replace("</extension>", "").Trim(); temp.command = allLines[i + 4].Replace("<command>", "").Replace("</command>", "").Trim(); temp.platform = allLines[i + 5].Replace("<platform>", "").Replace("</platform>", "").Trim(); temp.theme = allLines[i + 6].Replace("<theme>", "").Replace("</theme>", "").Trim(); _systems.Add(temp); } } ConfigList.Items.Clear(); systems = _systems; foreach (ES_System sys in systems) { ConfigList.Items.Add(sys.fullname); } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } } }