Пример #1
0
        /// <summary>
        /// Sets a value that indicates the filter component that is used to search for text within documents of this type.
        /// </summary>
        /// <param name="file"><see cref="FileAssociationInfo"/> that provides specifics of the extension to be changed.</param>
        /// <param name="persistentHandler">Guid of filter component.</param>
        protected void SetPersistentHandler(FileAssociationInfo file, Guid persistentHandler)
        {
            if (!file.Exists)
            {
                throw new Exception("Extension does not exist");
            }

            if (persistentHandler == Guid.Empty)
            {
                return;
            }

            _registryWrapper.Write(file._extension + "\\" + PersistentHandler, string.Empty, persistentHandler);

            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();
        }