Exemplo n.º 1
0
 public CommandVerb Add(string verb, string displayName = null, string command = null)
 {
     if (baseKey == null && !readOnly)
     {
         baseKey = parent.key.CreateSubKey(rootKeyName);
     }
     return(ShellRegistrar.RegisterCommandVerb(parent.key, verb, displayName, command));
 }
Exemplo n.º 2
0
 /// <summary>Initializes a new instance of the <see cref="ProgId"/> class.</summary>
 /// <param name="progId">The programmatic identifier string.</param>
 /// <param name="readOnly">if set to <c>true</c> disallow changes.</param>
 /// <param name="autoLoadVersioned">
 /// if set to <c>true</c> automatically load a referenced versioned ProgId instead of the specified ProgId.
 /// </param>
 /// <param name="systemWide">if set to <c>true</c> get the system wide value.</param>
 /// <exception cref="ArgumentException">Unable to load specified ProgId - progId</exception>
 public ProgId(string progId, bool readOnly = true, bool autoLoadVersioned = true, bool systemWide = false) :
     base(ShellRegistrar.GetRoot(systemWide, !readOnly, progId ?? throw new ArgumentNullException(nameof(progId))), readOnly)
 {
     if (autoLoadVersioned)
     {
         var cv = key.GetSubKeyDefaultValue("CurVer")?.ToString();
         if (cv != null)
         {
             key = ShellRegistrar.GetRoot(systemWide, !readOnly).OpenSubKey(cv, !readOnly);
         }
     }
     if (key == null)
     {
         throw new ArgumentException("Unable to load specified ProgId", nameof(progId));
     }
     ID    = progId;
     Verbs = new CommandVerbDictionary(this, readOnly);
 }
Exemplo n.º 3
0
 /// <inheritdoc/>
 public virtual void Dispose()
 {
     key?.Close();
     ShellRegistrar.NotifyShell();
 }