/// <summary> /// Adds single <see cref="ProgramVerb"/> that define the verb supported by this ProgID. /// </summary> /// <param name="verb">Single <see cref="ProgramVerb"/> that contains supported verb.</param> protected void AddVerbInternal(ProgramVerb verb) { RegistryKey root = Registry.ClassesRoot; RegistryKey key = root.OpenSubKey(this.progId).OpenSubKey("shell", true); if (key == null) { key = root.OpenSubKey(this.progId, true).CreateSubKey("shell"); } RegistryKey tmpkey = key.OpenSubKey(verb.Name, true); if (tmpkey == null) { tmpkey = key.CreateSubKey(verb.Name); } key = tmpkey; tmpkey = key.OpenSubKey("command", true); if (tmpkey == null) { tmpkey = key.CreateSubKey("command"); } tmpkey.SetValue(string.Empty, verb.Command, RegistryValueKind.ExpandString); tmpkey.Close(); key.Close(); root.Close(); ShellNotification.NotifyOfChange(); }
/// <summary> /// Removes single <see cref="ProgramVerb"/> that define the verb supported by this ProgID. /// </summary> /// <param name="verb">Single <see cref="ProgramVerb"/> that contains supported verb.</param> public void RemoveVerb(ProgramVerb verb) { if (verb == null) { throw new NullReferenceException(); } RemoveVerb(verb.Name); }
/// <summary> /// Adds single <see cref="ProgramVerb"/> that define the verb supported by this ProgID. /// </summary> /// <param name="verb">Single <see cref="ProgramVerb"/> that contains supported verb.</param> public void AddVerb(ProgramVerb verb) { AddVerbInternal(verb); }
/// <summary> /// Creates actual Programmatic Identifier key in registry that is used by other extensions. /// </summary> /// <param name="description">Friendly description of file type.</param> /// <param name="editFlags"><see cref="EditFlags"/> for program file type.</param> /// <param name="verb">Single <see cref="ProgramVerb"/> that contains supported verbs.</param> /// <returns><see cref="ProgramAssociationInfo"/> instance referring to specified extension.</returns> public ProgramAssociationInfo Create(string description, EditFlags editFlags, ProgramVerb verb) { return(Create(description, editFlags, new ProgramVerb[] { verb })); }
/// <summary> /// Creates actual Programmatic Identifier key in registry that is used by other extensions. /// </summary> /// <param name="verb">Single <see cref="ProgramVerb"/> that contains supported verb.</param> /// <returns><see cref="ProgramAssociationInfo"/> instance referring to specified extension.</returns> public ProgramAssociationInfo Create(ProgramVerb verb) { return(Create(string.Empty, EditFlags.None, new ProgramVerb[] { verb })); }