/// <summary> /// Associate the SoundArchive file extension to the program /// </summary> public static void AssocFiles() { ShellFileType fileType = ShellFileType.GetOrCreateType(FileExtension); fileType.DefaultIcon = FileIconPath; fileType.Description = Translations.Get("scheme_file_desc"); fileType.MenuItems[FileExtAction] = new ShellFileType.MenuItem(Translations.Get("button_open"), FileExtCommand); fileType.DefaultAction = FileExtAction; fileType.Save(); }
/// <summary> /// Remove association to the SoundArchive file extension /// </summary> public static void UnAssocFiles() { try { ShellFileType fileType = ShellFileType.GetType(FileExtension); fileType.DefaultIcon = null; fileType.DefaultAction = null; fileType.Description = null; fileType.MenuItems.Clear(); fileType.Save(); } catch (KeyNotFoundException) { // Missing file type, nothing to remove } }