private void LoadAtomicRTButton_Click(object sender, EventArgs e) { // msdn 4054d980-18f4-4857-bb47-0917ccdf4f4d atomicRT.AtomicsPath = AtomicRTPathTextbox.Text; Properties.Settings.Default.main_AtomicPath = AtomicRTPathTextbox.Text; // the following line will parse the "windows-index.md" file in the supplied folder for the atomics Dictionary <string, string> keyValues = atomicRT.ParseWindowsIndex(); if (keyValues != null) { // if windows-index.md parses without errors, then populate the technique listview. TechniqueListView.BeginUpdate(); TechniqueListView.Clear(); TechniqueListView.Columns.Add("Technique"); TechniqueListView.Columns.Add("Description"); TechniqueListView.View = View.Details; int i = 0; while (i < keyValues.Count) { TechniqueListView.Items.Add(new ListViewItem(new[] { keyValues.Keys.ElementAt(i), keyValues.Values.ElementAt(i) }) { Checked = true }); i++; } TechniqueListView.Columns[0].Width = -2; TechniqueListView.Columns[1].Width = -2; TechniqueListView.EndUpdate(); LoadCommandsButton.Enabled = true; } }
private void Editor_Load(object sender, EventArgs e) { atomicRT.AtomicsPath = Properties.Settings.Default.main_AtomicPath; if (!string.IsNullOrWhiteSpace(atomicRT.AtomicsPath)) { try { Dictionary <string, string> keyValues = atomicRT.ParseWindowsIndex(); AtomicListBox.BeginUpdate(); AtomicListBox.Items.Clear(); foreach (KeyValuePair <string, string> valuePair in keyValues) { AtomicListBox.Items.Add(string.Join("\t", valuePair.Key, valuePair.Value)); } AtomicListBox.EndUpdate(); } catch (Exception err) { MessageBox.Show("Error loading atomics: \n\n" + err.ToString()); this.Close(); } } }