Provides representation of verb that is used to determine mode file is being opened in. Contained within ProgID.
Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
 /// <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);
 }
Ejemplo n.º 4
0
 /// <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 }));
 }
Ejemplo n.º 5
0
 /// <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 }));
 }
Ejemplo n.º 6
0
        /// <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();
        }
Ejemplo n.º 7
0
        /// <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>
        protected void SetVerbs(ProgramVerb[] verbs)
        {
            if (!this.Exists)
            throw new Exception("Extension does not exist");

             RegistryKey root = Registry.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();
        }
Ejemplo n.º 8
0
        /// <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="verbs">Array of <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[] verbs)
        {
            if (this.Exists)
             {
            this.Delete();
             }

             this.Create();

             if (description != string.Empty)
            this.Description = description;

             if (editFlags != EditFlags.None)
            this.EditFlags = editFlags;

             this.Verbs = verbs;

             return this;
        }
Ejemplo n.º 9
0
        /// <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);
        }
Ejemplo n.º 10
0
 /// <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 });
 }
Ejemplo n.º 11
0
 /// <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="verbs">Array of <see cref="ProgramVerb"/> that contains supported verbs.</param>
 /// <returns><see cref="ProgramAssociationInfo"/> instance referring to specified extension.</returns>
 public ProgramAssociationInfo Create(string description, ProgramVerb[] verbs)
 {
     return Create(description, EditFlags.None, verbs);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates actual Programmatic Identifier key in registry that is used by other extensions.
 /// </summary>
 /// <param name="verbs">Array of <see cref="ProgramVerb"/> that contains supported verbs.</param>
 /// <returns><see cref="ProgramAssociationInfo"/> instance referring to specified extension.</returns>
 public ProgramAssociationInfo Create(ProgramVerb[] verbs)
 {
     return Create(string.Empty, EditFlags.None, verbs);
 }
Ejemplo n.º 13
0
 /// <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 });
 }
Ejemplo n.º 14
0
 /// <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);
 }