Write() public method

Writes specified value to the registry.
public Write ( string path, string valueName, object value ) : void
path string Full registry key (minus root) that will contain the value.
valueName string Name of the value within key that will be written.
value object Value to be written
return void
示例#1
0
        /// <summary>
        /// Sets a value that determines the <see cref="PerceivedType"/>PerceivedType of the file.
        /// </summary>
        /// <param name="file"><see cref="FileAssociationInfo"/> that provides specifics of the extension to be changed.</param>
        /// <param name="type"><see cref="PerceivedTypes"/> to be set that specifies Perceived Type of extension.</param>
        protected void SetPerceivedType(FileAssociationInfo file, PerceivedTypes type)
        {
            if (!file.Exists)
            {
                throw new Exception("Extension does not exist");
            }

            registryWrapper.Write(file.extension, "PerceivedType", type.ToString());

            ShellNotification.NotifyOfChange();
        }
示例#2
0
        /// <summary>
        /// Sets a value that determines if the file's extension will always be shown.
        /// </summary>
        /// <param name="value">Value that specifies if the file's extension should be always displayed.</param>
        protected void SetAlwaysShowExt(bool value)
        {
            if (!this.Exists)
            {
                throw new Exception("Extension does not exist");
            }

            if (value)
            {
                registryWrapper.Write(this.progId, "AlwaysShowExt", string.Empty);
            }
            else
            {
                registryWrapper.Delete(this.progId, "AlwaysShowExt");
            }

            ShellNotification.NotifyOfChange();
        }