//Wipes out existing open with list and replaces them with provided list private void addOpenWith_Click(object sender, EventArgs e) { string extension = (string)extensionsListBox.SelectedItem; FileAssociationInfo fa = new FileAssociationInfo(extension); if (!fa.Exists) { return; } AddOpenWithDialog f = new AddOpenWithDialog(); if (f.ShowDialog() == DialogResult.OK) { List <string> l = new List <string>(); l.AddRange(fa.OpenWithList); if (!l.Contains(f.ProgramName)) { l.Add(f.ProgramName); fa.OpenWithList = l.ToArray(); refreshExtensionsButton_Click(null, null); extensionsListBox.SelectedItem = extension; } } }
//Wipes out existing open with list and replaces them with provided list private void addOpenWith_Click(object sender, EventArgs e) { string extension = (string)extensionsListBox.SelectedItem; FileAssociationInfo fa = new FileAssociationInfo(extension); if (!fa.Exists) { return; } AddOpenWithDialog f = new AddOpenWithDialog(); if (f.ShowDialog() == DialogResult.OK) { List<string> l = new List<string>(); l.AddRange(fa.OpenWithList); if (!l.Contains(f.ProgramName)) { l.Add(f.ProgramName); fa.OpenWithList = l.ToArray(); refreshExtensionsButton_Click(null, null); extensionsListBox.SelectedItem = extension; } } }