FileAssociation/ProgramAssociationInfo.cs
/// <summary>
/// Sets an array of <see cref="ProgramVerb"/> that define the verbs supported by this ProgID
/// </summary>
/// <param name="verbs">Array of <see cref="ProgramVerb"/> that contains verbs to be set.</param>
Sets an array of  that define the verbs supported by this ProgID
Sets an array of that define the verbs supported by this ProgID
protected void SetVerbs(ProgramVerb[] verbs)
      {
         if (!this.Exists)
            throw new Exception("Extension does not exist");
         RegistryKey root = RegistryWrapper.ClassesRoot;
         RegistryKey key = root.OpenSubKey(this.progId, true);
         RegistryKey tmpKey = key.OpenSubKey("shell", true);
         if (tmpKey != null)
         {
            key.DeleteSubKeyTree("shell");
         }
         tmpKey = key.CreateSubKey("shell");
         foreach (ProgramVerb verb in verbs)
         {
            RegistryKey newVerb = tmpKey.CreateSubKey(verb.Name.ToLower());
            RegistryKey command = newVerb.CreateSubKey("command");
            command.SetValue(string.Empty, verb.Command, RegistryValueKind.ExpandString);
            command.Close();
            newVerb.Close();
         }
         ShellNotification.NotifyOfChange();
      }
protected void SetVerbs ( ProgramVerb [ ] verbs ) { if ( ! this . Exists ) throw new Exception ( " " ) ; RegistryKey root = RegistryWrapper . ClassesRoot ; RegistryKey key = root . OpenSubKey ( this . progId , true ) ; RegistryKey tmpKey = key . OpenSubKey ( " " , true ) ; if ( tmpKey != null ) { key . DeleteSubKeyTree ( " " ) ; } tmpKey = key . CreateSubKey ( " " ) ; foreach ( ProgramVerb verb in verbs ) { RegistryKey newVerb = tmpKey . CreateSubKey ( verb . Name . ToLower ( ) ) ; RegistryKey command = newVerb . CreateSubKey ( " " ) ; command . SetValue ( string . Empty , verb . Command , RegistryValueKind . ExpandString ) ; command . Close ( ) ; newVerb . Close ( ) ; } ShellNotification . NotifyOfChange ( ) ; }
Sets an array of  that define the verbs supported by this ProgID
Sets an array of that define the verbs supported by this ProgID
verbs
ProgramVerb[]
Array of  that contains verbs to be set.
Array of that contains verbs to be set .