/// <summary> /// Set a value that indicates the name of the associated application with the behavior to handle this extension. /// </summary> /// <param name="file"><see cref="FileAssociationInfo"/> that provides specifics of the extension to be changed.</param> /// <param name="progId">Associated Program ID of handling program.</param> protected void SetProgID(FileAssociationInfo file, string progId) { if (!file.Exists) { throw new Exception("Extension does not exist"); } registryWrapper.Write(file.extension, string.Empty, progId); ShellNotification.NotifyOfChange(); }
/// <summary> /// Sets a value that determines the MIME type of the file. /// </summary> /// <param name="file"><see cref="FileAssociationInfo"/> that provides specifics of the extension to be changed.</param> /// <param name="type">MIME content type of extension.</param> protected void SetContentType(FileAssociationInfo file, string type) { if (!file.Exists) { throw new Exception("Extension does not exist"); } registryWrapper.Write(file.extension, "Content Type", type); ShellNotification.NotifyOfChange(); }
/// <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(); }
/// <summary> /// Sets a value that determines numerous shell options for extension as well as limitations on how extension properties can be edited by programs that honor <see cref="EditFlags"/> /// </summary> /// <param name="flags"><see cref="EditFlags"/> for program file type.</param> protected void SetEditFlags(EditFlags flags) { if (!this.Exists) { throw new Exception("Extension does not exist"); } //registryWrapper.Write(info.progId, "EditFlags", (uint)flags); registryWrapper.Write(this.progId, "EditFlags", flags); ShellNotification.NotifyOfChange(); }
/// <summary> /// /// </summary> /// <param name="icon"></param> protected void SetDefaultIcon(ProgramIcon icon) { if (!this.Exists) { throw new Exception("Extension does not exist"); } if (icon != ProgramIcon.None) { registryWrapper.Write(this.progId, "DefaultIcon", icon.ToString()); registryWrapper.Write(this.progId + "\\DefaultIcon", "", icon.ToString()); ShellNotification.NotifyOfChange(); } }
/// <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; } this.registryWrapper.Write(file.extension + "\\" + PersistentHandler, string.Empty, persistentHandler); ShellNotification.NotifyOfChange(); }
/// <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(); }