FileAssociation/FileAssociationInfo.cs
/// <summary>
/// Sets array of containing program file names which should be displayed in the Open With List.
/// </summary>
/// <param name="file"><see cref="FileAssociationInfo"/> that provides specifics of the extension to be changed.</param>
/// <param name="programList">Program file names</param>
Sets array of containing program file names which should be displayed in the Open With List.
Sets array of containing program file names which should be displayed in the Open With List .
protected void SetOpenWithList(FileAssociationInfo file, string[] programList)
        {
            if (!file.Exists)
                throw new Exception("Extension does not exist");
            RegistryKey root = RegistryWrapper.ClassesRoot;
            RegistryKey key = root.OpenSubKey(file.extension, true);
            RegistryKey tmpkey = key.OpenSubKey("OpenWithList", true);
            if (tmpkey != null)
            {
                key.DeleteSubKeyTree("OpenWithList");
            }
            key = key.CreateSubKey("OpenWithList");
            foreach (string s in programList)
            {
                key.CreateSubKey(s);
            }
            ShellNotification.NotifyOfChange();
        }
protected void SetOpenWithList ( FileAssociationInfo file , string [ ] programList ) { if ( ! file . Exists ) throw new Exception ( " " ) ; RegistryKey root = RegistryWrapper . ClassesRoot ; RegistryKey key = root . OpenSubKey ( file . extension , true ) ; RegistryKey tmpkey = key . OpenSubKey ( " " , true ) ; if ( tmpkey != null ) { key . DeleteSubKeyTree ( " " ) ; } key = key . CreateSubKey ( " " ) ; foreach ( string s in programList ) { key . CreateSubKey ( s ) ; } ShellNotification . NotifyOfChange ( ) ; }
Sets array of containing program file names which should be displayed in the Open With List.
Sets array of containing program file names which should be displayed in the Open With List .
file
FileAssociationInfo
that provides specifics of the extension to be changed.
that provides specifics of the extension to be changed .
programList
string[]
Program file names
Program file names