commit 2ab351ddab2550a8034dc10ec03ea6fd9dfaddc3 Author: Marius Ungureanu Date: Wed Mar 19 15:31:15 2014 +0200 [WindowsPlatform] Initial binary replacement with sources. diff --git a/Core/AppRestartRecovery/ApplicationRecoveryException.cs b/Core/AppRestartRecovery/ApplicationRecoveryException.cs new file mode 100644 index 0000000..14eb5bf --- /dev/null +++ b/Core/AppRestartRecovery/ApplicationRecoveryException.cs @@ -0,0 +1,56 @@ +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// This exception is thrown when there are problems with registering, unregistering or updating + /// applications using Application Restart Recovery. + /// + [Serializable] + public class ApplicationRecoveryException : ExternalException + { + /// + /// Default constructor. + /// + public ApplicationRecoveryException() { } + + /// + /// Initializes an exception with a custom message. + /// + /// A custom message for the exception. + public ApplicationRecoveryException(string message) : base(message) { } + + /// + /// Initializes an exception with custom message and inner exception. + /// + /// A custom message for the exception. + /// Inner exception. + public ApplicationRecoveryException(string message, Exception innerException) + : base(message, innerException) + { + // Empty + } + + /// + /// Initializes an exception with custom message and error code. + /// + /// A custom message for the exception. + /// An error code (hresult) from which to generate the exception. + public ApplicationRecoveryException(string message, int errorCode) : base(message, errorCode) { } + + /// + /// Initializes an exception from serialization info and a context. + /// + /// Serialization info from which to create exception. + /// Streaming context from which to create exception. + protected ApplicationRecoveryException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + // Empty + } + + } +} diff --git a/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs b/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs new file mode 100644 index 0000000..b0d9e28 --- /dev/null +++ b/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs @@ -0,0 +1,163 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// Provides access to the Application Restart and Recovery + /// features available in Windows Vista or higher. Application Restart and Recovery lets an + /// application do some recovery work to save data before the process exits. + /// + public static class ApplicationRestartRecoveryManager + { + /// + /// Registers an application for recovery by Application Restart and Recovery. + /// + /// An object that specifies + /// the callback method, an optional parameter to pass to the callback + /// method and a time interval. + /// + /// The registration failed due to an invalid parameter. + /// + /// + /// The registration failed. + /// The time interval is the period of time within + /// which the recovery callback method + /// calls the method to indicate + /// that it is still performing recovery work. + public static void RegisterForApplicationRecovery(RecoverySettings settings) + { + CoreHelpers.ThrowIfNotVista(); + + if (settings == null) { throw new ArgumentNullException("settings"); } + + GCHandle handle = GCHandle.Alloc(settings.RecoveryData); + + HResult hr = AppRestartRecoveryNativeMethods.RegisterApplicationRecoveryCallback( + AppRestartRecoveryNativeMethods.InternalCallback, (IntPtr)handle, settings.PingInterval, (uint)0); + + if (!CoreErrorHelper.Succeeded(hr)) + { + if (hr == HResult.InvalidArguments) + { + throw new ArgumentException(LocalizedMessages.ApplicationRecoveryBadParameters, "settings"); + } + + throw new ApplicationRecoveryException(LocalizedMessages.ApplicationRecoveryFailedToRegister); + } + } + + /// + /// Removes an application's recovery registration. + /// + /// + /// The attempt to unregister for recovery failed. + public static void UnregisterApplicationRecovery() + { + CoreHelpers.ThrowIfNotVista(); + + HResult hr = AppRestartRecoveryNativeMethods.UnregisterApplicationRecoveryCallback(); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ApplicationRecoveryException(LocalizedMessages.ApplicationRecoveryFailedToUnregister); + } + } + + /// + /// Removes an application's restart registration. + /// + /// + /// The attempt to unregister for restart failed. + public static void UnregisterApplicationRestart() + { + CoreHelpers.ThrowIfNotVista(); + + HResult hr = AppRestartRecoveryNativeMethods.UnregisterApplicationRestart(); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ApplicationRecoveryException(LocalizedMessages.ApplicationRecoveryFailedToUnregisterForRestart); + } + } + + /// + /// Called by an application's method + /// to indicate that it is still performing recovery work. + /// + /// A value indicating whether the user + /// canceled the recovery. + /// + /// This method must be called from a registered callback method. + public static bool ApplicationRecoveryInProgress() + { + CoreHelpers.ThrowIfNotVista(); + + bool canceled = false; + HResult hr = AppRestartRecoveryNativeMethods.ApplicationRecoveryInProgress(out canceled); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new InvalidOperationException(LocalizedMessages.ApplicationRecoveryMustBeCalledFromCallback); + } + + return canceled; + } + + /// + /// Called by an application's method to + /// indicate that the recovery work is complete. + /// + /// + /// This should + /// be the last call made by the method because + /// Windows Error Reporting will terminate the application + /// after this method is invoked. + /// + /// true to indicate the the program was able to complete its recovery + /// work before terminating; otherwise false. + public static void ApplicationRecoveryFinished(bool success) + { + CoreHelpers.ThrowIfNotVista(); + + AppRestartRecoveryNativeMethods.ApplicationRecoveryFinished(success); + } + + /// + /// Registers an application for automatic restart if + /// the application + /// is terminated by Windows Error Reporting. + /// + /// An object that specifies + /// the command line arguments used to restart the + /// application, and + /// the conditions under which the application should not be + /// restarted. + /// Registration failed due to an invalid parameter. + /// The attempt to register failed. + /// A registered application will not be restarted if it executed for less than 60 seconds before terminating. + public static void RegisterForApplicationRestart(RestartSettings settings) + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + if (settings == null) { throw new ArgumentNullException("settings"); } + + HResult hr = AppRestartRecoveryNativeMethods.RegisterApplicationRestart(settings.Command, settings.Restrictions); + + if (hr == HResult.Fail) + { + throw new InvalidOperationException(LocalizedMessages.ApplicationRecoveryFailedToRegisterForRestart); + } + else if (hr == HResult.InvalidArguments) + { + throw new ArgumentException(LocalizedMessages.ApplicationRecoverFailedToRegisterForRestartBadParameters); + } + } + + } +} + diff --git a/Core/AppRestartRecovery/RecoveryData.cs b/Core/AppRestartRecovery/RecoveryData.cs new file mode 100644 index 0000000..0989c0d --- /dev/null +++ b/Core/AppRestartRecovery/RecoveryData.cs @@ -0,0 +1,54 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// The that represents the callback method invoked + /// by the system when an application has registered for + /// application recovery. + /// + /// An application-defined state object that is passed to the callback method. + /// The callback method will be invoked + /// prior to the application being terminated by Windows Error Reporting (WER). To keep WER from terminating the application before + /// the callback method completes, the callback method must + /// periodically call the method. + /// + public delegate int RecoveryCallback(object state); + + /// + /// Defines a class that contains a callback delegate and properties of the application + /// as defined by the user. + /// + public class RecoveryData + { + /// + /// Initializes a recovery data wrapper with a callback method and the current + /// state of the application. + /// + /// The callback delegate. + /// The current state of the application. + public RecoveryData(RecoveryCallback callback, object state) + { + Callback = callback; + State = state; + } + + /// + /// Gets or sets a value that determines the recovery callback function. + /// + public RecoveryCallback Callback { get; set; } + + /// + /// Gets or sets a value that determines the application state. + /// + public object State { get; set; } + + /// + /// Invokes the recovery callback function. + /// + public void Invoke() + { + if (Callback != null) { Callback(State); } + } + } +} diff --git a/Core/AppRestartRecovery/RecoverySettings.cs b/Core/AppRestartRecovery/RecoverySettings.cs new file mode 100644 index 0000000..95a3f27 --- /dev/null +++ b/Core/AppRestartRecovery/RecoverySettings.cs @@ -0,0 +1,74 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// Defines methods and properties for recovery settings, and specifies options for an application that attempts + /// to perform final actions after a fatal event, such as an + /// unhandled exception. + /// + /// This class is used to register for application recovery. + /// See the class. + /// + public class RecoverySettings + { + private RecoveryData recoveryData; + private uint pingInterval; + + /// + /// Initializes a new instance of the RecoverySettings class. + /// + /// A recovery data object that contains the callback method (invoked by the system + /// before Windows Error Reporting terminates the application) and an optional state object. + /// The time interval within which the + /// callback method must invoke to + /// prevent WER from terminating the application. + /// + public RecoverySettings(RecoveryData data, uint interval) + { + this.recoveryData = data; + this.pingInterval = interval; + } + + /// + /// Gets the recovery data object that contains the callback method and an optional + /// parameter (usually the state of the application) to be passed to the + /// callback method. + /// + /// A object. + public RecoveryData RecoveryData + { + get { return recoveryData; } + } + + /// + /// Gets the time interval for notifying Windows Error Reporting. + /// The method must invoke + /// within this interval to prevent WER from terminating the application. + /// + /// + /// The recovery ping interval is specified in milliseconds. + /// By default, the interval is 5 seconds. + /// If you specify zero, the default interval is used. + /// + public uint PingInterval { get { return pingInterval; } } + + /// + /// Returns a string representation of the current state + /// of this object. + /// + /// A object. + public override string ToString() + { + return string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.RecoverySettingsFormatString, + this.recoveryData.Callback.Method.ToString(), + this.recoveryData.State.ToString(), + this.PingInterval); + } + } +} + diff --git a/Core/AppRestartRecovery/RestartRestrictions.cs b/Core/AppRestartRecovery/RestartRestrictions.cs new file mode 100644 index 0000000..7ea35b1 --- /dev/null +++ b/Core/AppRestartRecovery/RestartRestrictions.cs @@ -0,0 +1,38 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// Specifies the conditions when Windows Error Reporting + /// should not restart an application that has registered + /// for automatic restart. + /// + [Flags] + public enum RestartRestrictions + { + /// + /// Always restart the application. + /// + None = 0, + /// + /// Do not restart when the application has crashed. + /// + NotOnCrash = 1, + /// + /// Do not restart when the application is hung. + /// + NotOnHang = 2, + /// + /// Do not restart when the application is terminated + /// due to a system update. + /// + NotOnPatch = 4, + /// + /// Do not restart when the application is terminated + /// because of a system reboot. + /// + NotOnReboot = 8 + } +} diff --git a/Core/AppRestartRecovery/RestartSettings.cs b/Core/AppRestartRecovery/RestartSettings.cs new file mode 100644 index 0000000..2162806 --- /dev/null +++ b/Core/AppRestartRecovery/RestartSettings.cs @@ -0,0 +1,70 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// Specifies the options for an application to be automatically + /// restarted by Windows Error Reporting. + /// + /// Regardless of these + /// settings, the application + /// will not be restarted if it executed for less than 60 seconds before + /// terminating. + public class RestartSettings + { + private string command; + private RestartRestrictions restrictions; + + /// + /// Creates a new instance of the RestartSettings class. + /// + /// The command line arguments + /// used to restart the application. + /// A bitwise combination of the RestartRestrictions + /// values that specify + /// when the application should not be restarted. + /// + public RestartSettings(string command, RestartRestrictions restrictions) + { + this.command = command; + this.restrictions = restrictions; + } + + /// + /// Gets the command line arguments used to restart the application. + /// + /// A object. + public string Command + { + get { return command; } + } + + /// + /// Gets the set of conditions when the application + /// should not be restarted. + /// + /// A set of values. + public RestartRestrictions Restrictions + { + get { return restrictions; } + } + + /// + /// Returns a string representation of the current state + /// of this object. + /// + /// A that displays + /// the command line arguments + /// and restrictions for restarting the application. + public override string ToString() + { + return string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.RestartSettingsFormatString, + command, restrictions.ToString()); + } + } +} + diff --git a/Core/Core.csproj b/Core/Core.csproj new file mode 100644 index 0000000..59e67c4 --- /dev/null +++ b/Core/Core.csproj @@ -0,0 +1,217 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57} + Library + Properties + Microsoft.WindowsAPICodePack + Microsoft.WindowsAPICodePack + v3.5 + 512 + + + 3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\Microsoft.WindowsAPICodePack.XML + + + false + AllRules.ruleset + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AllRules.ruleset + + + true + bin\x64\Debug\ + CODE_ANALYSIS;DEBUG;TRACE + bin\Debug\Microsoft.WindowsAPICodePack.XML + full + x64 + bin\Debug\Microsoft.WindowsAPICodePack.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + AllRules.ruleset + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + true + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + true + false + 4 + false + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + bin\Release\Microsoft.WindowsAPICodePack.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + AllRules.ruleset + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + true + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + true + 4 + + + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + LocalizedMessages.resx + + + + + + + + + + + + + + + + + + + + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + ResXFileCodeGenerator + LocalizedMessages.Designer.cs + Designer + + + + + Designer + + + + + \ No newline at end of file diff --git a/Core/CustomDictionary.xml b/Core/CustomDictionary.xml new file mode 100644 index 0000000..5f69010 --- /dev/null +++ b/Core/CustomDictionary.xml @@ -0,0 +1,16 @@ + + + + + IPv4 + IPv6 + comctl + Wh + + + + + API + + + \ No newline at end of file diff --git a/Core/Dialogs/Common/DialogControl.cs b/Core/Dialogs/Common/DialogControl.cs new file mode 100644 index 0000000..be0049f --- /dev/null +++ b/Core/Dialogs/Common/DialogControl.cs @@ -0,0 +1,147 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Abstract base class for all dialog controls + /// + public abstract class DialogControl + { + private static int nextId = DialogsDefaults.MinimumDialogControlId; + + /// + /// Creates a new instance of a dialog control + /// + protected DialogControl() + { + Id = nextId; + + // Support wrapping of control IDs in case you create a lot of custom controls + if (nextId == Int32.MaxValue) { nextId = DialogsDefaults.MinimumDialogControlId; } + else { nextId++; } + } + + /// + /// Creates a new instance of a dialog control with the specified name. + /// + /// The name for this dialog. + protected DialogControl(string name) + : this() + { + Name = name; + } + + /// + /// The native dialog that is hosting this control. This property is null is + /// there is not associated dialog + /// + public IDialogControlHost HostingDialog { get; set; } + + private string name; + /// + /// Gets the name for this control. + /// + /// A value. + public string Name + { + get { return name; } + set + { + // Names for controls need to be quite stable, + // as we are going to maintain a mapping between + // the names and the underlying Win32/COM control IDs. + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentException(LocalizedMessages.DialogControlNameCannotBeEmpty); + } + + if (!string.IsNullOrEmpty(name)) + { + throw new InvalidOperationException(LocalizedMessages.DialogControlsCannotBeRenamed); + } + + // Note that we don't notify the hosting dialog of + // the change, as the initial set of name is (must be) + // always legal, and renames are always illegal. + this.name = value; + } + } + + /// + /// Gets the identifier for this control. + /// + /// An value. + public int Id { get; private set; } + + /// + /// Calls the hosting dialog, if it exists, to check whether the + /// property can be set in the dialog's current state. + /// The host should throw an exception if the change is not supported. + /// Note that if the dialog isn't set yet, + /// there are no restrictions on setting the property. + /// + /// The name of the property that is changing + protected void CheckPropertyChangeAllowed(string propName) + { + Debug.Assert(!string.IsNullOrEmpty(propName), "Property to change was not specified"); + + if (HostingDialog != null) + { + // This will throw if the property change is not allowed. + HostingDialog.IsControlPropertyChangeAllowed(propName, this); + } + } + + /// + /// Calls the hosting dialog, if it exists, to + /// to indicate that a property has changed, and that + /// the dialog should do whatever is necessary + /// to propagate the change to the native control. + /// Note that if the dialog isn't set yet, + /// there are no restrictions on setting the property. + /// + /// The name of the property that is changing. + protected void ApplyPropertyChange(string propName) + { + Debug.Assert(!string.IsNullOrEmpty(propName), "Property changed was not specified"); + + if (HostingDialog != null) + { + HostingDialog.ApplyControlPropertyChange(propName, this); + } + } + + /// + /// Compares two objects to determine whether they are equal + /// + /// The object to compare against. + /// A value. + public override bool Equals(object obj) + { + DialogControl control = obj as DialogControl; + + if (control != null) + return (this.Id == control.Id); + + return false; + } + + /// + /// Serves as a hash function for a particular type. + /// + /// An hash code for this control. + public override int GetHashCode() + { + if (Name == null) + { + return this.ToString().GetHashCode(); + } + + return Name.GetHashCode(); + } + } +} \ No newline at end of file diff --git a/Core/Dialogs/Common/DialogControlCollection.cs b/Core/Dialogs/Common/DialogControlCollection.cs new file mode 100644 index 0000000..7323d66 --- /dev/null +++ b/Core/Dialogs/Common/DialogControlCollection.cs @@ -0,0 +1,120 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.ObjectModel; +using System.Linq; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Strongly typed collection for dialog controls. + /// + /// DialogControl + public sealed class DialogControlCollection : Collection where T : DialogControl + { + private IDialogControlHost hostingDialog; + + internal DialogControlCollection(IDialogControlHost host) + { + hostingDialog = host; + } + + /// + /// Inserts an dialog control at the specified index. + /// + /// The location to insert the control. + /// The item to insert. + /// A control with + /// the same name already exists in this collection -or- + /// the control is being hosted by another dialog -or- the associated dialog is + /// showing and cannot be modified. + protected override void InsertItem(int index, T control) + { + // Check for duplicates, lack of host, + // and during-show adds. + if (Items.Contains(control)) + { + throw new InvalidOperationException(LocalizedMessages.DialogCollectionCannotHaveDuplicateNames); + } + if (control.HostingDialog != null) + { + throw new InvalidOperationException(LocalizedMessages.DialogCollectionControlAlreadyHosted); + } + if (!hostingDialog.IsCollectionChangeAllowed()) + { + throw new InvalidOperationException(LocalizedMessages.DialogCollectionModifyShowingDialog); + } + + // Reparent, add control. + control.HostingDialog = hostingDialog; + base.InsertItem(index, control); + + // Notify that we've added a control. + hostingDialog.ApplyCollectionChanged(); + } + + /// + /// Removes the control at the specified index. + /// + /// The location of the control to remove. + /// + /// The associated dialog is + /// showing and cannot be modified. + protected override void RemoveItem(int index) + { + // Notify that we're about to remove a control. + // Throw if dialog showing. + if (!hostingDialog.IsCollectionChangeAllowed()) + { + throw new InvalidOperationException(LocalizedMessages.DialogCollectionModifyShowingDialog); + } + + DialogControl control = (DialogControl)Items[index]; + + // Unparent and remove. + control.HostingDialog = null; + base.RemoveItem(index); + + hostingDialog.ApplyCollectionChanged(); + } + + /// + /// Defines the indexer that supports accessing controls by name. + /// + /// + /// Control names are case sensitive. + /// This indexer is useful when the dialog is created in XAML + /// rather than constructed in code. + /// + /// The name cannot be null or a zero-length string. + /// If there is more than one control with the same name, only the first control will be returned. + public T this[string name] + { + get + { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException(LocalizedMessages.DialogCollectionControlNameNull, "name"); + } + + return Items.FirstOrDefault(x => x.Name == name); + } + } + + /// + /// Searches for the control who's id matches the value + /// passed in the parameter. + /// + /// + /// An integer containing the identifier of the + /// control being searched for. + /// + /// A DialogControl who's id matches the value of the + /// parameter. + internal DialogControl GetControlbyId(int id) + { + return Items.FirstOrDefault(x => x.Id == id); + } + } +} diff --git a/Core/Dialogs/Common/DialogsDefaults.cs b/Core/Dialogs/Common/DialogsDefaults.cs new file mode 100644 index 0000000..999f1cb --- /dev/null +++ b/Core/Dialogs/Common/DialogsDefaults.cs @@ -0,0 +1,23 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using Microsoft.WindowsAPICodePack.Resources; +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + internal static class DialogsDefaults + { + internal static string Caption { get { return LocalizedMessages.DialogDefaultCaption; } } + internal static string MainInstruction { get { return LocalizedMessages.DialogDefaultMainInstruction; } } + internal static string Content { get { return LocalizedMessages.DialogDefaultContent; } } + + internal const int ProgressBarStartingValue = 0; + internal const int ProgressBarMinimumValue = 0; + internal const int ProgressBarMaximumValue = 100; + + internal const int IdealWidth = 0; + + // For generating control ID numbers that won't + // collide with the standard button return IDs. + internal const int MinimumDialogControlId = + (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Close + 1; + } +} diff --git a/Core/Dialogs/Common/IDialogControlHost.cs b/Core/Dialogs/Common/IDialogControlHost.cs new file mode 100644 index 0000000..9516952 --- /dev/null +++ b/Core/Dialogs/Common/IDialogControlHost.cs @@ -0,0 +1,43 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Indicates that the implementing class is a dialog that can host + /// customizable dialog controls (subclasses of DialogControl). + /// + public interface IDialogControlHost + { + /// + /// Returns if changes to the collection are allowed. + /// + /// true if collection change is allowed. + bool IsCollectionChangeAllowed(); + + /// + /// Applies changes to the collection. + /// + void ApplyCollectionChanged(); + + /// + /// Handle notifications of individual child + /// pseudo-controls' properties changing.. + /// Prefilter should throw if the property + /// cannot be set in the dialog's current state. + /// PostProcess should pass on changes to native control, + /// if appropriate. + /// + /// The name of the property. + /// The control propertyName applies to. + /// true if the property change is allowed. + bool IsControlPropertyChangeAllowed(string propertyName, DialogControl control); + + /// + /// Called when a control currently in the collection + /// has a property changed. + /// + /// The name of the property changed. + /// The control whose property has changed. + void ApplyControlPropertyChange(string propertyName, DialogControl control); + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialog.cs b/Core/Dialogs/TaskDialogs/TaskDialog.cs new file mode 100644 index 0000000..962d1a3 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialog.cs @@ -0,0 +1,1253 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.WindowsAPICodePack.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Encapsulates a new-to-Vista Win32 TaskDialog window + /// - a powerful successor to the MessageBox available + /// in previous versions of Windows. + /// + public sealed class TaskDialog : IDialogControlHost, IDisposable + { + // Global instance of TaskDialog, to be used by static Show() method. + // As most parameters of a dialog created via static Show() will have + // identical parameters, we'll create one TaskDialog and treat it + // as a NativeTaskDialog generator for all static Show() calls. + private static TaskDialog staticDialog; + + // Main current native dialog. + private NativeTaskDialog nativeDialog; + + private List buttons = new List(); + private List radioButtons = new List(); + private List commandLinks = new List(); + private IntPtr ownerWindow; + + #region Public Properties + /// + /// Occurs when a progress bar changes. + /// + public event EventHandler Tick; + + /// + /// Occurs when a user clicks a hyperlink. + /// + public event EventHandler HyperlinkClick; + + /// + /// Occurs when the TaskDialog is closing. + /// + public event EventHandler Closing; + + /// + /// Occurs when a user clicks on Help. + /// + public event EventHandler HelpInvoked; + + /// + /// Occurs when the TaskDialog is opened. + /// + public event EventHandler Opened; + + /// + /// Gets or sets a value that contains the owner window's handle. + /// + public IntPtr OwnerWindowHandle + { + get { return ownerWindow; } + set + { + ThrowIfDialogShowing(LocalizedMessages.OwnerCannotBeChanged); + ownerWindow = value; + } + } + + // Main content (maps to MessageBox's "message"). + private string text; + /// + /// Gets or sets a value that contains the message text. + /// + public string Text + { + get { return text; } + set + { + // Set local value, then update native dialog if showing. + text = value; + if (NativeDialogShowing) { nativeDialog.UpdateText(text); } + } + } + + private string instructionText; + /// + /// Gets or sets a value that contains the instruction text. + /// + public string InstructionText + { + get { return instructionText; } + set + { + // Set local value, then update native dialog if showing. + instructionText = value; + if (NativeDialogShowing) { nativeDialog.UpdateInstruction(instructionText); } + } + } + + private string caption; + /// + /// Gets or sets a value that contains the caption text. + /// + public string Caption + { + get { return caption; } + set + { + ThrowIfDialogShowing(LocalizedMessages.CaptionCannotBeChanged); + caption = value; + } + } + + private string footerText; + /// + /// Gets or sets a value that contains the footer text. + /// + public string FooterText + { + get { return footerText; } + set + { + // Set local value, then update native dialog if showing. + footerText = value; + if (NativeDialogShowing) { nativeDialog.UpdateFooterText(footerText); } + } + } + + private string checkBoxText; + /// + /// Gets or sets a value that contains the footer check box text. + /// + public string FooterCheckBoxText + { + get { return checkBoxText; } + set + { + ThrowIfDialogShowing(LocalizedMessages.CheckBoxCannotBeChanged); + checkBoxText = value; + } + } + + private string detailsExpandedText; + /// + /// Gets or sets a value that contains the expanded text in the details section. + /// + public string DetailsExpandedText + { + get { return detailsExpandedText; } + set + { + // Set local value, then update native dialog if showing. + detailsExpandedText = value; + if (NativeDialogShowing) { nativeDialog.UpdateExpandedText(detailsExpandedText); } + } + } + + private bool detailsExpanded; + /// + /// Gets or sets a value that determines if the details section is expanded. + /// + public bool DetailsExpanded + { + get { return detailsExpanded; } + set + { + ThrowIfDialogShowing(LocalizedMessages.ExpandingStateCannotBeChanged); + detailsExpanded = value; + } + } + + private string detailsExpandedLabel; + /// + /// Gets or sets a value that contains the expanded control text. + /// + public string DetailsExpandedLabel + { + get { return detailsExpandedLabel; } + set + { + ThrowIfDialogShowing(LocalizedMessages.ExpandedLabelCannotBeChanged); + detailsExpandedLabel = value; + } + } + + private string detailsCollapsedLabel; + /// + /// Gets or sets a value that contains the collapsed control text. + /// + public string DetailsCollapsedLabel + { + get { return detailsCollapsedLabel; } + set + { + ThrowIfDialogShowing(LocalizedMessages.CollapsedTextCannotBeChanged); + detailsCollapsedLabel = value; + } + } + + private bool cancelable; + /// + /// Gets or sets a value that determines if Cancelable is set. + /// + public bool Cancelable + { + get { return cancelable; } + set + { + ThrowIfDialogShowing(LocalizedMessages.CancelableCannotBeChanged); + cancelable = value; + } + } + + private TaskDialogStandardIcon icon; + /// + /// Gets or sets a value that contains the TaskDialog main icon. + /// + public TaskDialogStandardIcon Icon + { + get { return icon; } + set + { + // Set local value, then update native dialog if showing. + icon = value; + if (NativeDialogShowing) { nativeDialog.UpdateMainIcon(icon); } + } + } + + private TaskDialogStandardIcon footerIcon; + /// + /// Gets or sets a value that contains the footer icon. + /// + public TaskDialogStandardIcon FooterIcon + { + get { return footerIcon; } + set + { + // Set local value, then update native dialog if showing. + footerIcon = value; + if (NativeDialogShowing) { nativeDialog.UpdateFooterIcon(footerIcon); } + } + } + + private TaskDialogStandardButtons standardButtons = TaskDialogStandardButtons.None; + /// + /// Gets or sets a value that contains the standard buttons. + /// + public TaskDialogStandardButtons StandardButtons + { + get { return standardButtons; } + set + { + ThrowIfDialogShowing(LocalizedMessages.StandardButtonsCannotBeChanged); + standardButtons = value; + } + } + + private DialogControlCollection controls; + /// + /// Gets a value that contains the TaskDialog controls. + /// + public DialogControlCollection Controls + { + // "Show protection" provided by collection itself, + // as well as individual controls. + get { return controls; } + } + + private bool hyperlinksEnabled; + /// + /// Gets or sets a value that determines if hyperlinks are enabled. + /// + public bool HyperlinksEnabled + { + get { return hyperlinksEnabled; } + set + { + ThrowIfDialogShowing(LocalizedMessages.HyperlinksCannotBetSet); + hyperlinksEnabled = value; + } + } + + private bool? footerCheckBoxChecked = null; + /// + /// Gets or sets a value that indicates if the footer checkbox is checked. + /// + public bool? FooterCheckBoxChecked + { + get { return footerCheckBoxChecked.GetValueOrDefault(false); } + set + { + // Set local value, then update native dialog if showing. + footerCheckBoxChecked = value; + if (NativeDialogShowing) { nativeDialog.UpdateCheckBoxChecked(footerCheckBoxChecked.Value); } + } + } + + private TaskDialogExpandedDetailsLocation expansionMode; + /// + /// Gets or sets a value that contains the expansion mode for this dialog. + /// + public TaskDialogExpandedDetailsLocation ExpansionMode + { + get { return expansionMode; } + set + { + ThrowIfDialogShowing(LocalizedMessages.ExpandedDetailsCannotBeChanged); + expansionMode = value; + } + } + + private TaskDialogStartupLocation startupLocation; + /// + /// Gets or sets a value that contains the startup location. + /// + public TaskDialogStartupLocation StartupLocation + { + get { return startupLocation; } + set + { + ThrowIfDialogShowing(LocalizedMessages.StartupLocationCannotBeChanged); + startupLocation = value; + } + } + + private TaskDialogProgressBar progressBar; + /// + /// Gets or sets the progress bar on the taskdialog. ProgressBar a visual representation + /// of the progress of a long running operation. + /// + public TaskDialogProgressBar ProgressBar + { + get { return progressBar; } + set + { + ThrowIfDialogShowing(LocalizedMessages.ProgressBarCannotBeChanged); + if (value != null) + { + if (value.HostingDialog != null) + { + throw new InvalidOperationException(LocalizedMessages.ProgressBarCannotBeHostedInMultipleDialogs); + } + + value.HostingDialog = this; + } + progressBar = value; + } + } + + #endregion + + #region Constructors + + /// + /// Creates a basic TaskDialog window + /// + public TaskDialog() + { + CoreHelpers.ThrowIfNotVista(); + + // Initialize various data structs. + controls = new DialogControlCollection(this); + } + + #endregion + + #region Static Show Methods + + /// + /// Creates and shows a task dialog with the specified message text. + /// + /// The text to display. + /// The dialog result. + public static TaskDialogResult Show(string text) + { + return ShowCoreStatic( + text, + TaskDialogDefaults.MainInstruction, + TaskDialogDefaults.Caption); + } + + /// + /// Creates and shows a task dialog with the specified supporting text and main instruction. + /// + /// The supporting text to display. + /// The main instruction text to display. + /// The dialog result. + public static TaskDialogResult Show(string text, string instructionText) + { + return ShowCoreStatic( + text, + instructionText, + TaskDialogDefaults.Caption); + } + + /// + /// Creates and shows a task dialog with the specified supporting text, main instruction, and dialog caption. + /// + /// The supporting text to display. + /// The main instruction text to display. + /// The caption for the dialog. + /// The dialog result. + public static TaskDialogResult Show(string text, string instructionText, string caption) + { + return ShowCoreStatic(text, instructionText, caption); + } + #endregion + + #region Instance Show Methods + + /// + /// Creates and shows a task dialog. + /// + /// The dialog result. + public TaskDialogResult Show() + { + return ShowCore(); + } + #endregion + + #region Core Show Logic + + // CORE SHOW METHODS: + // All static Show() calls forward here - + // it is responsible for retrieving + // or creating our cached TaskDialog instance, getting it configured, + // and in turn calling the appropriate instance Show. + + private static TaskDialogResult ShowCoreStatic( + string text, + string instructionText, + string caption) + { + CoreHelpers.ThrowIfNotVista(); + + // If no instance cached yet, create it. + if (staticDialog == null) + { + // New TaskDialog will automatically pick up defaults when + // a new config structure is created as part of ShowCore(). + staticDialog = new TaskDialog(); + } + + // Set the few relevant properties, + // and go with the defaults for the others. + staticDialog.text = text; + staticDialog.instructionText = instructionText; + staticDialog.caption = caption; + + return staticDialog.Show(); + } + + private TaskDialogResult ShowCore() + { + TaskDialogResult result; + + try + { + // Populate control lists, based on current + // contents - note we are somewhat late-bound + // on our control lists, to support XAML scenarios. + SortDialogControls(); + + // First, let's make sure it even makes + // sense to try a show. + ValidateCurrentDialogSettings(); + + // Create settings object for new dialog, + // based on current state. + NativeTaskDialogSettings settings = new NativeTaskDialogSettings(); + ApplyCoreSettings(settings); + ApplySupplementalSettings(settings); + + // Show the dialog. + // NOTE: this is a BLOCKING call; the dialog proc callbacks + // will be executed by the same thread as the + // Show() call before the thread of execution + // contines to the end of this method. + nativeDialog = new NativeTaskDialog(settings, this); + nativeDialog.NativeShow(); + + // Build and return dialog result to public API - leaving it + // null after an exception is thrown is fine in this case + result = ConstructDialogResult(nativeDialog); + footerCheckBoxChecked = nativeDialog.CheckBoxChecked; + } + finally + { + CleanUp(); + nativeDialog = null; + } + + return result; + } + + // Helper that looks at the current state of the TaskDialog and verifies + // that there aren't any abberant combinations of properties. + // NOTE that this method is designed to throw + // rather than return a bool. + private void ValidateCurrentDialogSettings() + { + if (footerCheckBoxChecked.HasValue && + footerCheckBoxChecked.Value == true && + string.IsNullOrEmpty(checkBoxText)) + { + throw new InvalidOperationException(LocalizedMessages.TaskDialogCheckBoxTextRequiredToEnableCheckBox); + } + + // Progress bar validation. + // Make sure the progress bar values are valid. + // the Win32 API will valiantly try to rationalize + // bizarre min/max/value combinations, but we'll save + // it the trouble by validating. + if (progressBar != null && !progressBar.HasValidValues) + { + throw new InvalidOperationException(LocalizedMessages.TaskDialogProgressBarValueInRange); + } + + // Validate Buttons collection. + // Make sure we don't have buttons AND + // command-links - the Win32 API treats them as different + // flavors of a single button struct. + if (buttons.Count > 0 && commandLinks.Count > 0) + { + throw new NotSupportedException(LocalizedMessages.TaskDialogSupportedButtonsAndLinks); + } + if (buttons.Count > 0 && standardButtons != TaskDialogStandardButtons.None) + { + throw new NotSupportedException(LocalizedMessages.TaskDialogSupportedButtonsAndButtons); + } + } + + // Analyzes the final state of the NativeTaskDialog instance and creates the + // final TaskDialogResult that will be returned from the public API + private static TaskDialogResult ConstructDialogResult(NativeTaskDialog native) + { + Debug.Assert(native.ShowState == DialogShowState.Closed, "dialog result being constructed for unshown dialog."); + + TaskDialogResult result = TaskDialogResult.Cancel; + + TaskDialogStandardButtons standardButton = MapButtonIdToStandardButton(native.SelectedButtonId); + + // If returned ID isn't a standard button, let's fetch + if (standardButton == TaskDialogStandardButtons.None) + { + result = TaskDialogResult.CustomButtonClicked; + } + else { result = (TaskDialogResult)standardButton; } + + return result; + } + + /// + /// Close TaskDialog + /// + /// if TaskDialog is not showing. + public void Close() + { + if (!NativeDialogShowing) + { + throw new InvalidOperationException(LocalizedMessages.TaskDialogCloseNonShowing); + } + + nativeDialog.NativeClose(TaskDialogResult.Cancel); + // TaskDialog's own cleanup code - + // which runs post show - will handle disposal of native dialog. + } + + /// + /// Close TaskDialog with a given TaskDialogResult + /// + /// TaskDialogResult to return from the TaskDialog.Show() method + /// if TaskDialog is not showing. + public void Close(TaskDialogResult closingResult) + { + if (!NativeDialogShowing) + { + throw new InvalidOperationException(LocalizedMessages.TaskDialogCloseNonShowing); + } + + nativeDialog.NativeClose(closingResult); + // TaskDialog's own cleanup code - + // which runs post show - will handle disposal of native dialog. + } + + #endregion + + #region Configuration Construction + + private void ApplyCoreSettings(NativeTaskDialogSettings settings) + { + ApplyGeneralNativeConfiguration(settings.NativeConfiguration); + ApplyTextConfiguration(settings.NativeConfiguration); + ApplyOptionConfiguration(settings.NativeConfiguration); + ApplyControlConfiguration(settings); + } + + private void ApplyGeneralNativeConfiguration(TaskDialogNativeMethods.TaskDialogConfiguration dialogConfig) + { + // If an owner wasn't specifically specified, + // we'll use the app's main window. + if (ownerWindow != IntPtr.Zero) + { + dialogConfig.parentHandle = ownerWindow; + } + + // Other miscellaneous sets. + dialogConfig.mainIcon = new TaskDialogNativeMethods.IconUnion((int)icon); + dialogConfig.footerIcon = new TaskDialogNativeMethods.IconUnion((int)footerIcon); + dialogConfig.commonButtons = (TaskDialogNativeMethods.TaskDialogCommonButtons)standardButtons; + } + + /// + /// Sets important text properties. + /// + /// An instance of a object. + private void ApplyTextConfiguration(TaskDialogNativeMethods.TaskDialogConfiguration dialogConfig) + { + // note that nulls or empty strings are fine here. + dialogConfig.content = text; + dialogConfig.windowTitle = caption; + dialogConfig.mainInstruction = instructionText; + dialogConfig.expandedInformation = detailsExpandedText; + dialogConfig.expandedControlText = detailsExpandedLabel; + dialogConfig.collapsedControlText = detailsCollapsedLabel; + dialogConfig.footerText = footerText; + dialogConfig.verificationText = checkBoxText; + } + + private void ApplyOptionConfiguration(TaskDialogNativeMethods.TaskDialogConfiguration dialogConfig) + { + // Handle options - start with no options set. + TaskDialogNativeMethods.TaskDialogOptions options = TaskDialogNativeMethods.TaskDialogOptions.None; + if (cancelable) + { + options |= TaskDialogNativeMethods.TaskDialogOptions.AllowCancel; + } + if (footerCheckBoxChecked.HasValue && footerCheckBoxChecked.Value) + { + options |= TaskDialogNativeMethods.TaskDialogOptions.CheckVerificationFlag; + } + if (hyperlinksEnabled) + { + options |= TaskDialogNativeMethods.TaskDialogOptions.EnableHyperlinks; + } + if (detailsExpanded) + { + options |= TaskDialogNativeMethods.TaskDialogOptions.ExpandedByDefault; + } + if (Tick != null) + { + options |= TaskDialogNativeMethods.TaskDialogOptions.UseCallbackTimer; + } + if (startupLocation == TaskDialogStartupLocation.CenterOwner) + { + options |= TaskDialogNativeMethods.TaskDialogOptions.PositionRelativeToWindow; + } + + // Note: no validation required, as we allow this to + // be set even if there is no expanded information + // text because that could be added later. + // Default for Win32 API is to expand into (and after) + // the content area. + if (expansionMode == TaskDialogExpandedDetailsLocation.ExpandFooter) + { + options |= TaskDialogNativeMethods.TaskDialogOptions.ExpandFooterArea; + } + + // Finally, apply options to config. + dialogConfig.taskDialogFlags = options; + } + + // Builds the actual configuration + // that the NativeTaskDialog (and underlying Win32 API) + // expects, by parsing the various control + // lists, marshalling to the unmanaged heap, etc. + + private void ApplyControlConfiguration(NativeTaskDialogSettings settings) + { + // Deal with progress bars/marquees. + if (progressBar != null) + { + if (progressBar.State == TaskDialogProgressBarState.Marquee) + { + settings.NativeConfiguration.taskDialogFlags |= TaskDialogNativeMethods.TaskDialogOptions.ShowMarqueeProgressBar; + } + else + { + settings.NativeConfiguration.taskDialogFlags |= TaskDialogNativeMethods.TaskDialogOptions.ShowProgressBar; + } + } + + // Build the native struct arrays that NativeTaskDialog + // needs - though NTD will handle + // the heavy lifting marshalling to make sure + // all the cleanup is centralized there. + if (buttons.Count > 0 || commandLinks.Count > 0) + { + // These are the actual arrays/lists of + // the structs that we'll copy to the + // unmanaged heap. + List sourceList = (buttons.Count > 0 ? buttons : commandLinks); + settings.Buttons = BuildButtonStructArray(sourceList); + + // Apply option flag that forces all + // custom buttons to render as command links. + if (commandLinks.Count > 0) + { + settings.NativeConfiguration.taskDialogFlags |= TaskDialogNativeMethods.TaskDialogOptions.UseCommandLinks; + } + + // Set default button and add elevation icons + // to appropriate buttons. + settings.NativeConfiguration.defaultButtonIndex = FindDefaultButtonId(sourceList); + + ApplyElevatedIcons(settings, sourceList); + } + + if (radioButtons.Count > 0) + { + settings.RadioButtons = BuildButtonStructArray(radioButtons); + + // Set default radio button - radio buttons don't support. + int defaultRadioButton = FindDefaultButtonId(radioButtons); + settings.NativeConfiguration.defaultRadioButtonIndex = defaultRadioButton; + + if (defaultRadioButton == TaskDialogNativeMethods.NoDefaultButtonSpecified) + { + settings.NativeConfiguration.taskDialogFlags |= TaskDialogNativeMethods.TaskDialogOptions.NoDefaultRadioButton; + } + } + } + + private static TaskDialogNativeMethods.TaskDialogButton[] BuildButtonStructArray(List controls) + { + TaskDialogNativeMethods.TaskDialogButton[] buttonStructs; + TaskDialogButtonBase button; + + int totalButtons = controls.Count; + buttonStructs = new TaskDialogNativeMethods.TaskDialogButton[totalButtons]; + for (int i = 0; i < totalButtons; i++) + { + button = controls[i]; + buttonStructs[i] = new TaskDialogNativeMethods.TaskDialogButton(button.Id, button.ToString()); + } + return buttonStructs; + } + + // Searches list of controls and returns the ID of + // the default control, or 0 if no default was specified. + private static int FindDefaultButtonId(List controls) + { + var defaults = controls.FindAll(control => control.Default); + + if (defaults.Count == 1) { return defaults[0].Id; } + else if (defaults.Count > 1) + { + throw new InvalidOperationException(LocalizedMessages.TaskDialogOnlyOneDefaultControl); + } + + return TaskDialogNativeMethods.NoDefaultButtonSpecified; + } + + private static void ApplyElevatedIcons(NativeTaskDialogSettings settings, List controls) + { + foreach (TaskDialogButton control in controls) + { + if (control.UseElevationIcon) + { + if (settings.ElevatedButtons == null) { settings.ElevatedButtons = new List(); } + settings.ElevatedButtons.Add(control.Id); + } + } + } + + private void ApplySupplementalSettings(NativeTaskDialogSettings settings) + { + if (progressBar != null) + { + if (progressBar.State != TaskDialogProgressBarState.Marquee) + { + settings.ProgressBarMinimum = progressBar.Minimum; + settings.ProgressBarMaximum = progressBar.Maximum; + settings.ProgressBarValue = progressBar.Value; + settings.ProgressBarState = progressBar.State; + } + } + + if (HelpInvoked != null) { settings.InvokeHelp = true; } + } + + // Here we walk our controls collection and + // sort the various controls by type. + private void SortDialogControls() + { + foreach (TaskDialogControl control in controls) + { + TaskDialogButtonBase buttonBase = control as TaskDialogButtonBase; + TaskDialogCommandLink commandLink = control as TaskDialogCommandLink; + + if (buttonBase != null && string.IsNullOrEmpty(buttonBase.Text) && + commandLink != null && string.IsNullOrEmpty(commandLink.Instruction)) + { + throw new InvalidOperationException(LocalizedMessages.TaskDialogButtonTextEmpty); + } + + TaskDialogRadioButton radButton; + TaskDialogProgressBar progBar; + + // Loop through child controls + // and sort the controls based on type. + if (commandLink != null) + { + commandLinks.Add(commandLink); + } + else if ((radButton = control as TaskDialogRadioButton) != null) + { + if (radioButtons == null) { radioButtons = new List(); } + radioButtons.Add(radButton); + } + else if (buttonBase != null) + { + if (buttons == null) { buttons = new List(); } + buttons.Add(buttonBase); + } + else if ((progBar = control as TaskDialogProgressBar) != null) + { + progressBar = progBar; + } + else + { + throw new InvalidOperationException(LocalizedMessages.TaskDialogUnkownControl); + } + } + } + + #endregion + + #region Helpers + + // Helper to map the standard button IDs returned by + // TaskDialogIndirect to the standard button ID enum - + // note that we can't just cast, as the Win32 + // typedefs differ incoming and outgoing. + + private static TaskDialogStandardButtons MapButtonIdToStandardButton(int id) + { + switch ((TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds)id) + { + case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Ok: + return TaskDialogStandardButtons.Ok; + case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Cancel: + return TaskDialogStandardButtons.Cancel; + case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Abort: + // Included for completeness in API - + // we can't pass in an Abort standard button. + return TaskDialogStandardButtons.None; + case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Retry: + return TaskDialogStandardButtons.Retry; + case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Ignore: + // Included for completeness in API - + // we can't pass in an Ignore standard button. + return TaskDialogStandardButtons.None; + case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Yes: + return TaskDialogStandardButtons.Yes; + case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.No: + return TaskDialogStandardButtons.No; + case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Close: + return TaskDialogStandardButtons.Close; + default: + return TaskDialogStandardButtons.None; + } + } + + private void ThrowIfDialogShowing(string message) + { + if (NativeDialogShowing) { throw new NotSupportedException(message); } + } + + private bool NativeDialogShowing + { + get + { + return (nativeDialog != null) + && (nativeDialog.ShowState == DialogShowState.Showing + || nativeDialog.ShowState == DialogShowState.Closing); + } + } + + // NOTE: we are going to require names be unique + // across both buttons and radio buttons, + // even though the Win32 API allows them to be separate. + private TaskDialogButtonBase GetButtonForId(int id) + { + return (TaskDialogButtonBase)controls.GetControlbyId(id); + } + + #endregion + + #region IDialogControlHost Members + + // We're explicitly implementing this interface + // as the user will never need to know about it + // or use it directly - it is only for the internal + // implementation of "pseudo controls" within + // the dialogs. + + // Called whenever controls are being added + // to or removed from the dialog control collection. + bool IDialogControlHost.IsCollectionChangeAllowed() + { + // Only allow additions to collection if dialog is NOT showing. + return !NativeDialogShowing; + } + + // Called whenever controls have been added or removed. + void IDialogControlHost.ApplyCollectionChanged() + { + // If we're showing, we should never get here - + // the changing notification would have thrown and the + // property would not have been changed. + Debug.Assert(!NativeDialogShowing, + "Collection changed notification received despite show state of dialog"); + } + + // Called when a control currently in the collection + // has a property changing - this is + // basically to screen out property changes that + // cannot occur while the dialog is showing + // because the Win32 API has no way for us to + // propagate the changes until we re-invoke the Win32 call. + bool IDialogControlHost.IsControlPropertyChangeAllowed(string propertyName, DialogControl control) + { + Debug.Assert(control is TaskDialogControl, + "Property changing for a control that is not a TaskDialogControl-derived type"); + Debug.Assert(propertyName != "Name", + "Name changes at any time are not supported - public API should have blocked this"); + + bool canChange = false; + + if (!NativeDialogShowing) + { + // Certain properties can't be changed if the dialog is not showing + // we need a handle created before we can set these... + switch (propertyName) + { + case "Enabled": + canChange = false; + break; + default: + canChange = true; + break; + } + } + else + { + // If the dialog is showing, we can only + // allow some properties to change. + switch (propertyName) + { + // Properties that CAN'T be changed while dialog is showing. + case "Text": + case "Default": + canChange = false; + break; + + // Properties that CAN be changed while dialog is showing. + case "ShowElevationIcon": + case "Enabled": + canChange = true; + break; + default: + Debug.Assert(true, "Unknown property name coming through property changing handler"); + break; + } + } + return canChange; + } + + // Called when a control currently in the collection + // has a property changed - this handles propagating + // the new property values to the Win32 API. + // If there isn't a way to change the Win32 value, then we + // should have already screened out the property set + // in NotifyControlPropertyChanging. + void IDialogControlHost.ApplyControlPropertyChange(string propertyName, DialogControl control) + { + // We only need to apply changes to the + // native dialog when it actually exists. + if (NativeDialogShowing) + { + TaskDialogButton button; + TaskDialogRadioButton radioButton; + if (control is TaskDialogProgressBar) + { + if (!progressBar.HasValidValues) + { + throw new ArgumentException(LocalizedMessages.TaskDialogProgressBarValueInRange); + } + + switch (propertyName) + { + case "State": + nativeDialog.UpdateProgressBarState(progressBar.State); + break; + case "Value": + nativeDialog.UpdateProgressBarValue(progressBar.Value); + break; + case "Minimum": + case "Maximum": + nativeDialog.UpdateProgressBarRange(); + break; + default: + Debug.Assert(true, "Unknown property being set"); + break; + } + } + else if ((button = control as TaskDialogButton) != null) + { + switch (propertyName) + { + case "ShowElevationIcon": + nativeDialog.UpdateElevationIcon(button.Id, button.UseElevationIcon); + break; + case "Enabled": + nativeDialog.UpdateButtonEnabled(button.Id, button.Enabled); + break; + default: + Debug.Assert(true, "Unknown property being set"); + break; + } + } + else if ((radioButton = control as TaskDialogRadioButton) != null) + { + switch (propertyName) + { + case "Enabled": + nativeDialog.UpdateRadioButtonEnabled(radioButton.Id, radioButton.Enabled); + break; + default: + Debug.Assert(true, "Unknown property being set"); + break; + } + } + else + { + // Do nothing with property change - + // note that this shouldn't ever happen, we should have + // either thrown on the changing event, or we handle above. + Debug.Assert(true, "Control property changed notification not handled properly - being ignored"); + } + } + } + + #endregion + + #region Event Percolation Methods + + // All Raise*() methods are called by the + // NativeTaskDialog when various pseudo-controls + // are triggered. + internal void RaiseButtonClickEvent(int id) + { + // First check to see if the ID matches a custom button. + TaskDialogButtonBase button = GetButtonForId(id); + + // If a custom button was found, + // raise the event - if not, it's a standard button, and + // we don't support custom event handling for the standard buttons + if (button != null) { button.RaiseClickEvent(); } + } + + internal void RaiseHyperlinkClickEvent(string link) + { + EventHandler handler = HyperlinkClick; + if (handler != null) + { + handler(this, new TaskDialogHyperlinkClickedEventArgs(link)); + } + } + + // Gives event subscriber a chance to prevent + // the dialog from closing, based on + // the current state of the app and the button + // used to commit. Note that we don't + // have full access at this stage to + // the full dialog state. + internal int RaiseClosingEvent(int id) + { + EventHandler handler = Closing; + if (handler != null) + { + TaskDialogButtonBase customButton = null; + TaskDialogClosingEventArgs e = new TaskDialogClosingEventArgs(); + + // Try to identify the button - is it a standard one? + TaskDialogStandardButtons buttonClicked = MapButtonIdToStandardButton(id); + + // If not, it had better be a custom button... + if (buttonClicked == TaskDialogStandardButtons.None) + { + customButton = GetButtonForId(id); + + // ... or we have a problem. + if (customButton == null) + { + throw new InvalidOperationException(LocalizedMessages.TaskDialogBadButtonId); + } + + e.CustomButton = customButton.Name; + e.TaskDialogResult = TaskDialogResult.CustomButtonClicked; + } + else + { + e.TaskDialogResult = (TaskDialogResult)buttonClicked; + } + + // Raise the event and determine how to proceed. + handler(this, e); + if (e.Cancel) { return (int)HResult.False; } + } + + // It's okay to let the dialog close. + return (int)HResult.Ok; + } + + internal void RaiseHelpInvokedEvent() + { + if (HelpInvoked != null) { HelpInvoked(this, EventArgs.Empty); } + } + + internal void RaiseOpenedEvent() + { + if (Opened != null) { Opened(this, EventArgs.Empty); } + } + + internal void RaiseTickEvent(int ticks) + { + if (Tick != null) { Tick(this, new TaskDialogTickEventArgs(ticks)); } + } + + #endregion + + #region Cleanup Code + + // Cleans up data and structs from a single + // native dialog Show() invocation. + private void CleanUp() + { + // Reset values that would be considered + // 'volatile' in a given instance. + if (progressBar != null) + { + progressBar.Reset(); + } + + // Clean out sorted control lists - + // though we don't of course clear the main controls collection, + // so the controls are still around; we'll + // resort on next show, since the collection may have changed. + if (buttons != null) { buttons.Clear(); } + if (commandLinks != null) { commandLinks.Clear(); } + if (radioButtons != null) { radioButtons.Clear(); } + progressBar = null; + + // Have the native dialog clean up the rest. + if (nativeDialog != null) + { + nativeDialog.Dispose(); + } + } + + + // Dispose pattern - cleans up data and structs for + // a) any native dialog currently showing, and + // b) anything else that the outer TaskDialog has. + private bool disposed; + + /// + /// Dispose TaskDialog Resources + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// TaskDialog Finalizer + /// + ~TaskDialog() + { + Dispose(false); + } + + /// + /// Dispose TaskDialog Resources + /// + /// If true, indicates that this is being called via Dispose rather than via the finalizer. + public void Dispose(bool disposing) + { + if (!disposed) + { + disposed = true; + + if (disposing) + { + // Clean up managed resources. + if (nativeDialog != null && nativeDialog.ShowState == DialogShowState.Showing) + { + nativeDialog.NativeClose(TaskDialogResult.Cancel); + } + + buttons = null; + radioButtons = null; + commandLinks = null; + } + + // Clean up unmanaged resources SECOND, NTD counts on + // being closed before being disposed. + if (nativeDialog != null) + { + nativeDialog.Dispose(); + nativeDialog = null; + } + + if (staticDialog != null) + { + staticDialog.Dispose(); + staticDialog = null; + } + + + } + } + + #endregion + + /// + /// Indicates whether this feature is supported on the current platform. + /// + public static bool IsPlatformSupported + { + get + { + // We need Windows Vista onwards ... + return CoreHelpers.RunningOnVista; + } + } + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogBar.cs b/Core/Dialogs/TaskDialogs/TaskDialogBar.cs new file mode 100644 index 0000000..f812d8d --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogBar.cs @@ -0,0 +1,43 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Defines a common class for all task dialog bar controls, such as the progress and marquee bars. + /// + public class TaskDialogBar : TaskDialogControl + { + /// + /// Creates a new instance of this class. + /// + public TaskDialogBar() { } + /// + /// Creates a new instance of this class with the specified name. + /// + /// The name for this control. + protected TaskDialogBar(string name) : base(name) { } + + private TaskDialogProgressBarState state; + /// + /// Gets or sets the state of the progress bar. + /// + public TaskDialogProgressBarState State + { + get { return state; } + set + { + CheckPropertyChangeAllowed("State"); + state = value; + ApplyPropertyChange("State"); + } + } + /// + /// Resets the state of the control to normal. + /// + protected internal virtual void Reset() + { + state = TaskDialogProgressBarState.Normal; + } + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogButton.cs b/Core/Dialogs/TaskDialogs/TaskDialogButton.cs new file mode 100644 index 0000000..5a3070e --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogButton.cs @@ -0,0 +1,37 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Implements a button that can be hosted in a task dialog. + /// + public class TaskDialogButton : TaskDialogButtonBase + { + /// + /// Creates a new instance of this class. + /// + public TaskDialogButton() { } + + /// + /// Creates a new instance of this class with the specified property settings. + /// + /// The name of the button. + /// The button label. + public TaskDialogButton(string name, string text) : base(name, text) { } + + private bool useElevationIcon; + /// + /// Gets or sets a value that controls whether the elevation icon is displayed. + /// + public bool UseElevationIcon + { + get { return useElevationIcon; } + set + { + CheckPropertyChangeAllowed("ShowElevationIcon"); + useElevationIcon = value; + ApplyPropertyChange("ShowElevationIcon"); + } + } + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogButtonBase.cs b/Core/Dialogs/TaskDialogs/TaskDialogButtonBase.cs new file mode 100644 index 0000000..bc0fe89 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogButtonBase.cs @@ -0,0 +1,112 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + // ContentProperty allows us to specify the text + // of the button as the child text of + // a button element in XAML, as well as explicitly + // set with 'Text=""' + // Note that this attribute is inherited, so it + // applies to command-links and radio buttons as well. + /// + /// Defines the abstract base class for task dialog buttons. + /// Classes that inherit from this class will inherit + /// the Text property defined in this class. + /// + public abstract class TaskDialogButtonBase : TaskDialogControl + { + + /// + /// Creates a new instance on a task dialog button. + /// + protected TaskDialogButtonBase() { } + /// + /// Creates a new instance on a task dialog button with + /// the specified name and text. + /// + /// The name for this button. + /// The label for this button. + protected TaskDialogButtonBase(string name, string text) : base(name) + { + this.text = text; + } + + // Note that we don't need to explicitly + // implement the add/remove delegate for the Click event; + // the hosting dialog only needs the delegate + // information when the Click event is + // raised (indirectly) by NativeTaskDialog, + // so the latest delegate is always available. + /// + /// Raised when the task dialog button is clicked. + /// + public event EventHandler Click; + + internal void RaiseClickEvent() + { + // Only perform click if the button is enabled. + if (!enabled) { return; } + + if (Click != null) { Click(this, EventArgs.Empty); } + } + + private string text; + /// + /// Gets or sets the button text. + /// + public string Text + { + get { return text; } + set + { + CheckPropertyChangeAllowed("Text"); + text = value; + ApplyPropertyChange("Text"); + } + } + + private bool enabled = true; + /// + /// Gets or sets a value that determines whether the + /// button is enabled. The enabled state can cannot be changed + /// before the dialog is shown. + /// + public bool Enabled + { + get { return enabled; } + set + { + CheckPropertyChangeAllowed("Enabled"); + enabled = value; + ApplyPropertyChange("Enabled"); + } + } + + private bool defaultControl; + /// + /// Gets or sets a value that indicates whether + /// this button is the default button. + /// + public bool Default + { + get { return defaultControl; } + set + { + CheckPropertyChangeAllowed("Default"); + defaultControl = value; + ApplyPropertyChange("Default"); + } + } + + /// + /// Returns the Text property value for this button. + /// + /// A . + public override string ToString() + { + return text ?? string.Empty; + } + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogClosingEventArgs.cs b/Core/Dialogs/TaskDialogs/TaskDialogClosingEventArgs.cs new file mode 100644 index 0000000..5c3aa76 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogClosingEventArgs.cs @@ -0,0 +1,34 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.ComponentModel; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Data associated with event. + /// + public class TaskDialogClosingEventArgs : CancelEventArgs + { + private TaskDialogResult taskDialogResult; + /// + /// Gets or sets the standard button that was clicked. + /// + public TaskDialogResult TaskDialogResult + { + get { return taskDialogResult; } + set { taskDialogResult = value; } + } + + private string customButton; + /// + /// Gets or sets the text of the custom button that was clicked. + /// + public string CustomButton + { + get { return customButton; } + set { customButton = value; } + } + + + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogCommandLink.cs b/Core/Dialogs/TaskDialogs/TaskDialogCommandLink.cs new file mode 100644 index 0000000..7e75730 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogCommandLink.cs @@ -0,0 +1,59 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Globalization; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Represents a command-link. + /// + public class TaskDialogCommandLink : TaskDialogButton + { + /// + /// Creates a new instance of this class. + /// + public TaskDialogCommandLink() { } + + /// + /// Creates a new instance of this class with the specified name and label. + /// + /// The name for this button. + /// The label for this button. + public TaskDialogCommandLink(string name, string text) : base(name, text) { } + + /// + /// Creates a new instance of this class with the specified name,label, and instruction. + /// + /// The name for this button. + /// The label for this button. + /// The instruction for this command link. + public TaskDialogCommandLink(string name, string text, string instruction) + : base(name, text) + { + this.instruction = instruction; + } + + private string instruction; + /// + /// Gets or sets the instruction associated with this command link button. + /// + public string Instruction + { + get { return instruction; } + set { instruction = value; } + } + + /// + /// Returns a string representation of this object. + /// + /// A + public override string ToString() + { + return string.Format(CultureInfo.CurrentCulture, "{0}{1}{2}", + Text ?? string.Empty, + (!string.IsNullOrEmpty(Text) && !string.IsNullOrEmpty(instruction)) ? Environment.NewLine : string.Empty, + instruction ?? string.Empty); + } + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogControl.cs b/Core/Dialogs/TaskDialogs/TaskDialogControl.cs new file mode 100644 index 0000000..3f0ed35 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogControl.cs @@ -0,0 +1,20 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Declares the abstract base class for all custom task dialog controls. + /// + public abstract class TaskDialogControl : DialogControl + { + /// + /// Creates a new instance of a task dialog control. + /// + protected TaskDialogControl() { } + /// + /// Creates a new instance of a task dialog control with the specified name. + /// + /// The name for this control. + protected TaskDialogControl(string name) : base(name) { } + } +} \ No newline at end of file diff --git a/Core/Dialogs/TaskDialogs/TaskDialogDefaults.cs b/Core/Dialogs/TaskDialogs/TaskDialogDefaults.cs new file mode 100644 index 0000000..e9018e5 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogDefaults.cs @@ -0,0 +1,23 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + internal static class TaskDialogDefaults + { + public static string Caption { get { return LocalizedMessages.TaskDialogDefaultCaption; } } + public static string MainInstruction { get { return LocalizedMessages.TaskDialogDefaultMainInstruction; } } + public static string Content { get { return LocalizedMessages.TaskDialogDefaultContent; } } + + public const int ProgressBarMinimumValue = 0; + public const int ProgressBarMaximumValue = 100; + + public const int IdealWidth = 0; + + // For generating control ID numbers that won't + // collide with the standard button return IDs. + public const int MinimumDialogControlId = + (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Close + 1; + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogExpandedInfoMode.cs b/Core/Dialogs/TaskDialogs/TaskDialogExpandedInfoMode.cs new file mode 100644 index 0000000..d2ac518 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogExpandedInfoMode.cs @@ -0,0 +1,25 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Specifies the options for expand/collapse sections in dialogs. + /// + public enum TaskDialogExpandedDetailsLocation + { + /// + /// Do not show the content. + /// + Hide, + + /// + /// Show the content. + /// + ExpandContent, + + /// + /// Expand the footer content. + /// + ExpandFooter + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogHyperlinkClickedEventArgs.cs b/Core/Dialogs/TaskDialogs/TaskDialogHyperlinkClickedEventArgs.cs new file mode 100644 index 0000000..b1e72af --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogHyperlinkClickedEventArgs.cs @@ -0,0 +1,26 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Defines event data associated with a HyperlinkClick event. + /// + public class TaskDialogHyperlinkClickedEventArgs : EventArgs + { + /// + /// Creates a new instance of this class with the specified link text. + /// + /// The text of the hyperlink that was clicked. + public TaskDialogHyperlinkClickedEventArgs(string linkText) + { + LinkText = linkText; + } + + /// + /// Gets or sets the text of the hyperlink that was clicked. + /// + public string LinkText { get; set; } + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogProgressBar.cs b/Core/Dialogs/TaskDialogs/TaskDialogProgressBar.cs new file mode 100644 index 0000000..e632365 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogProgressBar.cs @@ -0,0 +1,123 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Provides a visual representation of the progress of a long running operation. + /// + public class TaskDialogProgressBar : TaskDialogBar + { + /// + /// Creates a new instance of this class. + /// + public TaskDialogProgressBar() { } + + /// + /// Creates a new instance of this class with the specified name. + /// And using the default values: Min = 0, Max = 100, Current = 0 + /// + /// The name of the control. + public TaskDialogProgressBar(string name) : base(name) { } + + /// + /// Creates a new instance of this class with the specified + /// minimum, maximum and current values. + /// + /// The minimum value for this control. + /// The maximum value for this control. + /// The current value for this control. + public TaskDialogProgressBar(int minimum, int maximum, int value) + { + Minimum = minimum; + Maximum = maximum; + Value = value; + } + + private int _minimum; + private int _value; + private int _maximum = TaskDialogDefaults.ProgressBarMaximumValue; + + /// + /// Gets or sets the minimum value for the control. + /// + public int Minimum + { + get { return _minimum; } + set + { + CheckPropertyChangeAllowed("Minimum"); + + // Check for positive numbers + if (value < 0) + { + throw new System.ArgumentException(LocalizedMessages.TaskDialogProgressBarMinValueGreaterThanZero, "value"); + } + + // Check if min / max differ + if (value >= Maximum) + { + throw new System.ArgumentException(LocalizedMessages.TaskDialogProgressBarMinValueLessThanMax, "value"); + } + + _minimum = value; + ApplyPropertyChange("Minimum"); + } + } + /// + /// Gets or sets the maximum value for the control. + /// + public int Maximum + { + get { return _maximum; } + set + { + CheckPropertyChangeAllowed("Maximum"); + + // Check if min / max differ + if (value < Minimum) + { + throw new System.ArgumentException(LocalizedMessages.TaskDialogProgressBarMaxValueGreaterThanMin, "value"); + } + _maximum = value; + ApplyPropertyChange("Maximum"); + } + } + /// + /// Gets or sets the current value for the control. + /// + public int Value + { + get { return this._value; } + set + { + CheckPropertyChangeAllowed("Value"); + // Check for positive numbers + if (value < Minimum || value > Maximum) + { + throw new System.ArgumentException(LocalizedMessages.TaskDialogProgressBarValueInRange, "value"); + } + this._value = value; + ApplyPropertyChange("Value"); + } + } + + /// + /// Verifies that the progress bar's value is between its minimum and maximum. + /// + internal bool HasValidValues + { + get { return _minimum <= _value && _value <= _maximum; } + } + + /// + /// Resets the control to its minimum value. + /// + protected internal override void Reset() + { + base.Reset(); + _value = _minimum; + } + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogProgressBarState.cs b/Core/Dialogs/TaskDialogs/TaskDialogProgressBarState.cs new file mode 100644 index 0000000..6f86451 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogProgressBarState.cs @@ -0,0 +1,35 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Sets the state of a task dialog progress bar. + /// + public enum TaskDialogProgressBarState + { + /// + /// Uninitialized state, this should never occur. + /// + None = 0, + + /// + /// Normal state. + /// + Normal = TaskDialogNativeMethods.ProgressBarState.Normal, + + /// + /// An error occurred. + /// + Error = TaskDialogNativeMethods.ProgressBarState.Error, + + /// + /// The progress is paused. + /// + Paused = TaskDialogNativeMethods.ProgressBarState.Paused, + + /// + /// Displays marquee (indeterminate) style progress + /// + Marquee + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogRadioButton.cs b/Core/Dialogs/TaskDialogs/TaskDialogRadioButton.cs new file mode 100644 index 0000000..93333d3 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogRadioButton.cs @@ -0,0 +1,25 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Defines a radio button that can be hosted in by a + /// object. + /// + public class TaskDialogRadioButton : TaskDialogButtonBase + { + /// + /// Creates a new instance of this class. + /// + public TaskDialogRadioButton() { } + + /// + /// Creates a new instance of this class with + /// the specified name and text. + /// + /// The name for this control. + /// The value for this controls + /// property. + public TaskDialogRadioButton(string name, string text) : base(name, text) { } + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogResult.cs b/Core/Dialogs/TaskDialogs/TaskDialogResult.cs new file mode 100644 index 0000000..fc1a816 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogResult.cs @@ -0,0 +1,50 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Indicates the various buttons and options clicked by the user on the task dialog. + /// + public enum TaskDialogResult + { + /// + /// No button was selected. + /// + None = 0x0000, + + /// + /// "OK" button was clicked + /// + Ok = 0x0001, + + /// + /// "Yes" button was clicked + /// + Yes = 0x0002, + + /// + /// "No" button was clicked + /// + No = 0x0004, + + /// + /// "Cancel" button was clicked + /// + Cancel = 0x0008, + + /// + /// "Retry" button was clicked + /// + Retry = 0x0010, + + /// + /// "Close" button was clicked + /// + Close = 0x0020, + + /// + /// A custom button was clicked. + /// + CustomButtonClicked = 0x0100, + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogStandardButton.cs b/Core/Dialogs/TaskDialogs/TaskDialogStandardButton.cs new file mode 100644 index 0000000..f371db8 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogStandardButton.cs @@ -0,0 +1,49 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Identifies one of the standard buttons that + /// can be displayed via TaskDialog. + /// + [Flags] + public enum TaskDialogStandardButtons + { + /// + /// No buttons on the dialog. + /// + None = 0x0000, + + /// + /// An "OK" button. + /// + Ok = 0x0001, + + /// + /// A "Yes" button. + /// + Yes = 0x0002, + + /// + /// A "No" button. + /// + No = 0x0004, + + /// + /// A "Cancel" button. + /// + Cancel = 0x0008, + + /// + /// A "Retry" button. + /// + Retry = 0x0010, + + /// + /// A "Close" button. + /// + Close = 0x0020 + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogStandardIcon.cs b/Core/Dialogs/TaskDialogs/TaskDialogStandardIcon.cs new file mode 100644 index 0000000..bb8b2f3 --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogStandardIcon.cs @@ -0,0 +1,35 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Specifies the icon displayed in a task dialog. + /// + public enum TaskDialogStandardIcon + { + /// + /// Displays no icons (default). + /// + None = 0, + + /// + /// Displays the warning icon. + /// + Warning = 65535, + + /// + /// Displays the error icon. + /// + Error = 65534, + + /// + /// Displays the Information icon. + /// + Information = 65533, + + /// + /// Displays the User Account Control shield. + /// + Shield = 65532 + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogStartupLocation.cs b/Core/Dialogs/TaskDialogs/TaskDialogStartupLocation.cs new file mode 100644 index 0000000..592283a --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogStartupLocation.cs @@ -0,0 +1,20 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Specifies the initial display location for a task dialog. + /// + public enum TaskDialogStartupLocation + { + /// + /// The window placed in the center of the screen. + /// + CenterScreen, + + /// + /// The window centered relative to the window that launched the dialog. + /// + CenterOwner + } +} diff --git a/Core/Dialogs/TaskDialogs/TaskDialogTickEventArgs.cs b/Core/Dialogs/TaskDialogs/TaskDialogTickEventArgs.cs new file mode 100644 index 0000000..ab0cbbe --- /dev/null +++ b/Core/Dialogs/TaskDialogs/TaskDialogTickEventArgs.cs @@ -0,0 +1,26 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// The event data for a TaskDialogTick event. + /// + public class TaskDialogTickEventArgs : EventArgs + { + /// + /// Initializes the data associated with the TaskDialog tick event. + /// + /// The total number of ticks since the control was activated. + public TaskDialogTickEventArgs(int ticks) + { + Ticks = ticks; + } + + /// + /// Gets a value that determines the current number of ticks. + /// + public int Ticks { get; private set; } + } +} diff --git a/Core/GlobalSuppressions.cs b/Core/GlobalSuppressions.cs new file mode 100644 index 0000000..f4e4a58 --- /dev/null +++ b/Core/GlobalSuppressions.cs @@ -0,0 +1,100 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. +// +// To add a suppression to this file, right-click the message in the +// Error List, point to "Suppress Message(s)", and click +// "In Project Suppression File". +// You do not need to add suppressions to this file manually. + + +#region CA1709 Identifers should use proper casing - "API" acronym chosen for clarity +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.ApplicationServices", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Net", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Dialogs", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "MS.WindowsAPICodePack.Internal", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", MessageId = "API")] +#endregion + + +#region CA1709 - Identifiers should use proper casing - "v" for "Version" chosen for clarity +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv6Internet", MessageId = "Pv")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv6NoTraffic", MessageId = "Pv")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv4Subnet", MessageId = "Pv")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv4NoTraffic", MessageId = "Pv")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv4Internet", MessageId = "Pv")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv4LocalNetwork", MessageId = "Pv")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv6Subnet", MessageId = "Pv")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv6LocalNetwork", MessageId = "Pv")] +#endregion + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.PowerPersonalityGuids.#All")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#.cctor()")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "Microsoft.WindowsAPICodePack.Resources.LocalizedMessages.resources", MessageId = "comctl")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "Microsoft.WindowsAPICodePack.Resources.LocalizedMessages.resources", MessageId = "Wh")] + +#region CA1811 - Potentially uncalled code +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropVariantNativeMethods.#InitPropVariantFromPropVariantVectorElem(MS.WindowsAPICodePack.Internal.PropVariant,System.UInt32,MS.WindowsAPICodePack.Internal.PropVariant)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.DialogsDefaults.#get_Caption()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.DialogsDefaults.#get_Content()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreErrorHelper.#HResultFromWin32(System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreErrorHelper.#Failed(System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods+Size.#get_Height()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods+Size.#set_Height(System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods+Size.#set_Width(System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods+Size.#get_Width()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.DialogsDefaults.#get_MainInstruction()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialogSettings.#get_InvokeHelp()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#get_SelectedRadioButtonId()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+IconUnion.#get_MainIcon()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#SendMessage(System.IntPtr,MS.WindowsAPICodePack.Internal.WindowMessage,System.IntPtr,System.IntPtr)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#SendMessage(System.IntPtr,System.UInt32,System.IntPtr,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#SendMessage(System.IntPtr,System.UInt32,System.Int32,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#GetLoWord(System.Int64)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#GetHiWord(System.Int64,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#PostMessage(System.IntPtr,MS.WindowsAPICodePack.Internal.WindowMessage,System.IntPtr,System.IntPtr)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#SendMessage(System.IntPtr,System.UInt32,System.Int32&,System.Text.StringBuilder)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreErrorHelper.#Matches(System.Int32,System.Int32)")] +#endregion + + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant", Justification = "There are places where unsigned values are used, which is considered not Cls compliant.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", Justification = "Uses nested classes to organize the namespce, there is a workitem to resolve this.")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Dialogs.TaskDialogResult", Justification = "Does not represent flags.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#Value", Justification = "Uses a switch statement.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Justification = "These return snapshots of a state, which are likely to change between calls.", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.PowerManager.#GetCurrentBatteryState()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Justification = "These return snapshots of a state, which are likely to change between calls.", Target = "Microsoft.WindowsAPICodePack.Net.NetworkListManager.#GetNetworkConnections()")] + +#region CA2122, CA2123 - LinkDemand related +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#.ctor(System.Single[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#.ctor(System.Decimal[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.ApplicationRestartRecoveryManager.#RegisterForApplicationRecovery(Microsoft.WindowsAPICodePack.ApplicationServices.RecoverySettings)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#AllocateAndMarshalButtons(Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+TaskDialogButton[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#FreeOldString(Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+TaskDialogElements)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#MakeNewString(System.String,Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+TaskDialogElements)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#NativeShow()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialogSettings.#.ctor()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#GetBlobData()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#.ctor(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#Value")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.SafeWindowHandle.#ReleaseHandle()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.Power.#GetSystemBatteryState()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.Power.#GetSystemPowerCapabilities()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.ZeroInvalidHandle.#.ctor()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.SafeIconHandle.#ReleaseHandle()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.SafeRegionHandle.#ReleaseHandle()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.SafeWindowHandle.#ReleaseHandle()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.ZeroInvalidHandle.#IsInvalid")] +#endregion + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods.#TaskDialogIndirect(Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+TaskDialogConfiguration,System.Int32&,System.Int32&,System.Boolean&)", Justification="This does exist, I believe it is caused by FxCop using the wrong version of the DLL.")] diff --git a/Core/Interop/AppRestartRecovery/AppRestartRecoveryNativeMethods.cs b/Core/Interop/AppRestartRecovery/AppRestartRecoveryNativeMethods.cs new file mode 100644 index 0000000..a86c712 --- /dev/null +++ b/Core/Interop/AppRestartRecovery/AppRestartRecoveryNativeMethods.cs @@ -0,0 +1,65 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + internal static class AppRestartRecoveryNativeMethods + { + #region Application Restart and Recovery Definitions + + internal delegate UInt32 InternalRecoveryCallback(IntPtr state); + + private static InternalRecoveryCallback internalCallback = new InternalRecoveryCallback(InternalRecoveryHandler); + internal static InternalRecoveryCallback InternalCallback { get { return internalCallback; } } + + private static UInt32 InternalRecoveryHandler(IntPtr parameter) + { + bool cancelled = false; + ApplicationRecoveryInProgress(out cancelled); + + GCHandle handle = GCHandle.FromIntPtr(parameter); + RecoveryData data = handle.Target as RecoveryData; + data.Invoke(); + handle.Free(); + + return (0); + } + + + + [DllImport("kernel32.dll")] + internal static extern void ApplicationRecoveryFinished( + [MarshalAs(UnmanagedType.Bool)] bool success); + + [DllImport("kernel32.dll")] + [PreserveSig] + internal static extern HResult ApplicationRecoveryInProgress( + [Out, MarshalAs(UnmanagedType.Bool)] out bool canceled); + + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + [PreserveSig] + internal static extern HResult RegisterApplicationRecoveryCallback( + InternalRecoveryCallback callback, IntPtr param, + uint pingInterval, + uint flags); // Unused. + + [DllImport("kernel32.dll")] + [PreserveSig] + internal static extern HResult RegisterApplicationRestart( + [MarshalAs(UnmanagedType.BStr)] string commandLineArgs, + RestartRestrictions flags); + + [DllImport("kernel32.dll")] + [PreserveSig] + internal static extern HResult UnregisterApplicationRecoveryCallback(); + + [DllImport("kernel32.dll")] + [PreserveSig] + internal static extern HResult UnregisterApplicationRestart(); + + #endregion + } +} diff --git a/Core/Interop/CoreErrorHelper.cs b/Core/Interop/CoreErrorHelper.cs new file mode 100644 index 0000000..ba51a70 --- /dev/null +++ b/Core/Interop/CoreErrorHelper.cs @@ -0,0 +1,161 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// HRESULT Wrapper + /// + public enum HResult + { + /// + /// S_OK + /// + Ok = 0x0000, + + /// + /// S_FALSE + /// + False = 0x0001, + + /// + /// E_INVALIDARG + /// + InvalidArguments = unchecked((int)0x80070057), + + /// + /// E_OUTOFMEMORY + /// + OutOfMemory = unchecked((int)0x8007000E), + + /// + /// E_NOINTERFACE + /// + NoInterface = unchecked((int)0x80004002), + + /// + /// E_FAIL + /// + Fail = unchecked((int)0x80004005), + + /// + /// E_ELEMENTNOTFOUND + /// + ElementNotFound = unchecked((int)0x80070490), + + /// + /// TYPE_E_ELEMENTNOTFOUND + /// + TypeElementNotFound = unchecked((int)0x8002802B), + + /// + /// NO_OBJECT + /// + NoObject = unchecked((int)0x800401E5), + + /// + /// Win32 Error code: ERROR_CANCELLED + /// + Win32ErrorCanceled = 1223, + + /// + /// ERROR_CANCELLED + /// + Canceled = unchecked((int)0x800704C7), + + /// + /// The requested resource is in use + /// + ResourceInUse = unchecked((int)0x800700AA), + + /// + /// The requested resources is read-only. + /// + AccessDenied = unchecked((int)0x80030005) + } + + /// + /// Provide Error Message Helper Methods. + /// This is intended for Library Internal use only. + /// + internal static class CoreErrorHelper + { + /// + /// This is intended for Library Internal use only. + /// + private const int FacilityWin32 = 7; + + /// + /// This is intended for Library Internal use only. + /// + public const int Ignored = (int)HResult.Ok; + + /// + /// This is intended for Library Internal use only. + /// + /// The Windows API error code. + /// The equivalent HRESULT. + public static int HResultFromWin32(int win32ErrorCode) + { + if (win32ErrorCode > 0) + { + win32ErrorCode = + (int)(((uint)win32ErrorCode & 0x0000FFFF) | (FacilityWin32 << 16) | 0x80000000); + } + return win32ErrorCode; + + } + + /// + /// This is intended for Library Internal use only. + /// + /// The error code. + /// True if the error code indicates success. + public static bool Succeeded(int result) + { + return result >= 0; + } + + /// + /// This is intended for Library Internal use only. + /// + /// The error code. + /// True if the error code indicates success. + public static bool Succeeded(HResult result) + { + return Succeeded((int)result); + } + + /// + /// This is intended for Library Internal use only. + /// + /// The error code. + /// True if the error code indicates failure. + public static bool Failed(HResult result) + { + return !Succeeded(result); + } + + /// + /// This is intended for Library Internal use only. + /// + /// The error code. + /// True if the error code indicates failure. + public static bool Failed(int result) + { + return !Succeeded(result); + } + + /// + /// This is intended for Library Internal use only. + /// + /// The COM error code. + /// The Win32 error code. + /// Inticates that the Win32 error code corresponds to the COM error code. + public static bool Matches(int result, int win32ErrorCode) + { + return (result == HResultFromWin32(win32ErrorCode)); + } + + + } +} diff --git a/Core/Interop/CoreHelpers.cs b/Core/Interop/CoreHelpers.cs new file mode 100644 index 0000000..878803c --- /dev/null +++ b/Core/Interop/CoreHelpers.cs @@ -0,0 +1,118 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Globalization; +using System.Text; +using Microsoft.WindowsAPICodePack.Resources; + +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// Common Helper methods + /// + public static class CoreHelpers + { + /// + /// Determines if the application is running on XP + /// + public static bool RunningOnXP + { + get + { + return Environment.OSVersion.Platform == PlatformID.Win32NT && + Environment.OSVersion.Version.Major >= 5; + } + } + + /// + /// Throws PlatformNotSupportedException if the application is not running on Windows XP + /// + public static void ThrowIfNotXP() + { + if (!CoreHelpers.RunningOnXP) + { + throw new PlatformNotSupportedException(LocalizedMessages.CoreHelpersRunningOnXp); + } + } + + /// + /// Determines if the application is running on Vista + /// + public static bool RunningOnVista + { + get + { + return Environment.OSVersion.Version.Major >= 6; + } + } + + /// + /// Throws PlatformNotSupportedException if the application is not running on Windows Vista + /// + public static void ThrowIfNotVista() + { + if (!CoreHelpers.RunningOnVista) + { + throw new PlatformNotSupportedException(LocalizedMessages.CoreHelpersRunningOnVista); + } + } + + /// + /// Determines if the application is running on Windows 7 + /// + public static bool RunningOnWin7 + { + get + { + // Verifies that OS version is 6.1 or greater, and the Platform is WinNT. + return Environment.OSVersion.Platform == PlatformID.Win32NT && + Environment.OSVersion.Version.CompareTo(new Version(6, 1)) >= 0; + } + } + + /// + /// Throws PlatformNotSupportedException if the application is not running on Windows 7 + /// + public static void ThrowIfNotWin7() + { + if (!CoreHelpers.RunningOnWin7) + { + throw new PlatformNotSupportedException(LocalizedMessages.CoreHelpersRunningOn7); + } + } + + /// + /// Get a string resource given a resource Id + /// + /// The resource Id + /// The string resource corresponding to the given resource Id. Returns null if the resource id + /// is invalid or the string cannot be retrieved for any other reason. + public static string GetStringResource(string resourceId) + { + string[] parts; + string library; + int index; + + if (string.IsNullOrEmpty(resourceId)) { return string.Empty; } + + // Known folder "Recent" has a malformed resource id + // for its tooltip. This causes the resource id to + // parse into 3 parts instead of 2 parts if we don't fix. + resourceId = resourceId.Replace("shell32,dll", "shell32.dll"); + parts = resourceId.Split(new char[] { ',' }); + + library = parts[0]; + library = library.Replace(@"@", string.Empty); + library = Environment.ExpandEnvironmentVariables(library); + IntPtr handle = CoreNativeMethods.LoadLibrary(library); + + parts[1] = parts[1].Replace("-", string.Empty); + index = int.Parse(parts[1], CultureInfo.InvariantCulture); + + StringBuilder stringValue = new StringBuilder(255); + int retval = CoreNativeMethods.LoadString(handle, index, stringValue, 255); + + return retval != 0 ? stringValue.ToString() : null; + } + } +} diff --git a/Core/Interop/CoreNativeMethods.cs b/Core/Interop/CoreNativeMethods.cs new file mode 100644 index 0000000..4a645fb --- /dev/null +++ b/Core/Interop/CoreNativeMethods.cs @@ -0,0 +1,280 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// Wrappers for Native Methods and Structs. + /// This type is intended for internal use only + /// + internal static class CoreNativeMethods + { + #region General Definitions + + /// + /// Places (posts) a message in the message queue associated with the thread that created + /// the specified window and returns without waiting for the thread to process the message. + /// + /// Handle to the window whose window procedure will receive the message. + /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, + /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows; + /// but the message is not sent to child windows. + /// + /// Specifies the message to be sent. + /// Specifies additional message-specific information. + /// Specifies additional message-specific information. + /// A return code specific to the message being sent. + [DllImport("user32.dll", CharSet = CharSet.Auto, PreserveSig=false, SetLastError = true)] + public static extern void PostMessage( + IntPtr windowHandle, + WindowMessage message, + IntPtr wparam, + IntPtr lparam + ); + + /// + /// Sends the specified message to a window or windows. The SendMessage function calls + /// the window procedure for the specified window and does not return until the window + /// procedure has processed the message. + /// + /// Handle to the window whose window procedure will receive the message. + /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, + /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows; + /// but the message is not sent to child windows. + /// + /// Specifies the message to be sent. + /// Specifies additional message-specific information. + /// Specifies additional message-specific information. + /// A return code specific to the message being sent. + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr SendMessage( + IntPtr windowHandle, + WindowMessage message, + IntPtr wparam, + IntPtr lparam + ); + + /// + /// Sends the specified message to a window or windows. The SendMessage function calls + /// the window procedure for the specified window and does not return until the window + /// procedure has processed the message. + /// + /// Handle to the window whose window procedure will receive the message. + /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, + /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows; + /// but the message is not sent to child windows. + /// + /// Specifies the message to be sent. + /// Specifies additional message-specific information. + /// Specifies additional message-specific information. + /// A return code specific to the message being sent. + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr SendMessage( + IntPtr windowHandle, + uint message, + IntPtr wparam, + IntPtr lparam + ); + + /// + /// Sends the specified message to a window or windows. The SendMessage function calls + /// the window procedure for the specified window and does not return until the window + /// procedure has processed the message. + /// + /// Handle to the window whose window procedure will receive the message. + /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, + /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows; + /// but the message is not sent to child windows. + /// + /// Specifies the message to be sent. + /// Specifies additional message-specific information. + /// Specifies additional message-specific information. + /// A return code specific to the message being sent. + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr SendMessage( + IntPtr windowHandle, + uint message, + IntPtr wparam, + [MarshalAs(UnmanagedType.LPWStr)] string lparam); + + /// + /// Sends the specified message to a window or windows. The SendMessage function calls + /// the window procedure for the specified window and does not return until the window + /// procedure has processed the message. + /// + /// Handle to the window whose window procedure will receive the message. + /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, + /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows; + /// but the message is not sent to child windows. + /// + /// Specifies the message to be sent. + /// Specifies additional message-specific information. + /// Specifies additional message-specific information. + /// A return code specific to the message being sent. + public static IntPtr SendMessage( + IntPtr windowHandle, + uint message, + int wparam, + string lparam) + { + return SendMessage(windowHandle, message, (IntPtr)wparam, lparam); + } + + /// + /// Sends the specified message to a window or windows. The SendMessage function calls + /// the window procedure for the specified window and does not return until the window + /// procedure has processed the message. + /// + /// Handle to the window whose window procedure will receive the message. + /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, + /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows; + /// but the message is not sent to child windows. + /// + /// Specifies the message to be sent. + /// Specifies additional message-specific information. + /// Specifies additional message-specific information. + /// A return code specific to the message being sent. + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr SendMessage( + IntPtr windowHandle, + uint message, + ref int wparam, + [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lparam); + + // Various helpers for forcing binding to proper + // version of Comctl32 (v6). + [DllImport("kernel32.dll", SetLastError = true, ThrowOnUnmappableChar = true, BestFitMapping = false)] + internal static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string fileName); + + [DllImport("gdi32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool DeleteObject(IntPtr graphicsObjectHandle); + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + internal static extern int LoadString( + IntPtr instanceHandle, + int id, + StringBuilder buffer, + int bufferSize); + + [DllImport("Kernel32.dll", EntryPoint = "LocalFree")] + internal static extern IntPtr LocalFree(ref Guid guid); + + /// + /// Destroys an icon and frees any memory the icon occupied. + /// + /// Handle to the icon to be destroyed. The icon must not be in use. + /// If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. + [DllImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool DestroyIcon(IntPtr hIcon); + + #endregion + + #region Window Handling + + [DllImport("user32.dll", SetLastError = true, EntryPoint = "DestroyWindow", CallingConvention = CallingConvention.StdCall)] + internal static extern int DestroyWindow(IntPtr handle); + + #endregion + + #region General Declarations + + // Various important window messages + internal const int UserMessage = 0x0400; + internal const int EnterIdleMessage = 0x0121; + + // FormatMessage constants and structs. + internal const int FormatMessageFromSystem = 0x00001000; + + // App recovery and restart return codes + internal const uint ResultFailed = 0x80004005; + internal const uint ResultInvalidArgument = 0x80070057; + internal const uint ResultFalse = 1; + internal const uint ResultNotFound = 0x80070490; + + /// + /// Gets the HiWord + /// + /// The value to get the hi word from. + /// Size + /// The upper half of the dword. + public static int GetHiWord(long value, int size) + { + return (short)(value >> size); + } + + /// + /// Gets the LoWord + /// + /// The value to get the low word from. + /// The lower half of the dword. + public static int GetLoWord(long value) + { + return (short)(value & 0xFFFF); + } + + #endregion + + #region GDI and DWM Declarations + + /// + /// A Wrapper for a SIZE struct + /// + [StructLayout(LayoutKind.Sequential)] + public struct Size + { + private int width; + private int height; + + /// + /// Width + /// + public int Width { get { return width; } set { width = value; } } + + /// + /// Height + /// + public int Height { get { return height; } set { height = value; } } + }; + + // Enable/disable non-client rendering based on window style. + internal const int DWMNCRP_USEWINDOWSTYLE = 0; + + // Disabled non-client rendering; window style is ignored. + internal const int DWMNCRP_DISABLED = 1; + + // Enabled non-client rendering; window style is ignored. + internal const int DWMNCRP_ENABLED = 2; + + // Enable/disable non-client rendering Use DWMNCRP_* values. + internal const int DWMWA_NCRENDERING_ENABLED = 1; + + // Non-client rendering policy. + internal const int DWMWA_NCRENDERING_POLICY = 2; + + // Potentially enable/forcibly disable transitions 0 or 1. + internal const int DWMWA_TRANSITIONS_FORCEDISABLED = 3; + + #endregion + + #region Windows OS structs and consts + + internal const uint StatusAccessDenied = 0xC0000022; + + + + public delegate int WNDPROC(IntPtr hWnd, + uint uMessage, + IntPtr wParam, + IntPtr lParam); + + #endregion + } + + +} diff --git a/Core/Interop/Dialogs/DialogShowState.cs b/Core/Interop/Dialogs/DialogShowState.cs new file mode 100644 index 0000000..a285747 --- /dev/null +++ b/Core/Interop/Dialogs/DialogShowState.cs @@ -0,0 +1,30 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Dialog Show State + /// + public enum DialogShowState + { + /// + /// Pre Show + /// + PreShow, + + /// + /// Currently Showing + /// + Showing, + + /// + /// Currently Closing + /// + Closing, + + /// + /// Closed + /// + Closed + } +} diff --git a/Core/Interop/NetworkList/INetwork.cs b/Core/Interop/NetworkList/INetwork.cs new file mode 100644 index 0000000..de81e31 --- /dev/null +++ b/Core/Interop/NetworkList/INetwork.cs @@ -0,0 +1,67 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Net +{ + [ComImport] + [TypeLibType((short)0x1040)] + [Guid("DCB00002-570F-4A9B-8D69-199FDBA5723B")] + internal interface INetwork + { + [return: MarshalAs(UnmanagedType.BStr)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + string GetName(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetName([In, MarshalAs(UnmanagedType.BStr)] string szNetworkNewName); + + [return: MarshalAs(UnmanagedType.BStr)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + string GetDescription(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetDescription([In, MarshalAs(UnmanagedType.BStr)] string szDescription); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + Guid GetNetworkId(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + DomainType GetDomainType(); + + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + IEnumerable GetNetworkConnections(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetTimeCreatedAndConnected( + out uint pdwLowDateTimeCreated, + out uint pdwHighDateTimeCreated, + out uint pdwLowDateTimeConnected, + out uint pdwHighDateTimeConnected); + + bool IsConnectedToInternet + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + get; + } + + bool IsConnected + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + get; + } + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + ConnectivityStates GetConnectivity(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + NetworkCategory GetCategory(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetCategory([In] NetworkCategory NewCategory); + } +} \ No newline at end of file diff --git a/Core/Interop/NetworkList/INetworkConnection.cs b/Core/Interop/NetworkList/INetworkConnection.cs new file mode 100644 index 0000000..05cab73 --- /dev/null +++ b/Core/Interop/NetworkList/INetworkConnection.cs @@ -0,0 +1,43 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Net +{ + [ComImport] + [TypeLibType((short)0x1040)] + [Guid("DCB00005-570F-4A9B-8D69-199FDBA5723B")] + internal interface INetworkConnection + { + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + INetwork GetNetwork(); + + bool IsConnectedToInternet + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + get; + } + + bool IsConnected + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + get; + } + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + ConnectivityStates GetConnectivity(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + Guid GetConnectionId(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + Guid GetAdapterId(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + DomainType GetDomainType(); + } +} \ No newline at end of file diff --git a/Core/Interop/NetworkList/INetworkListManager.cs b/Core/Interop/NetworkList/INetworkListManager.cs new file mode 100644 index 0000000..5a7bb47 --- /dev/null +++ b/Core/Interop/NetworkList/INetworkListManager.cs @@ -0,0 +1,46 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Net +{ + [ComImport] + [Guid("DCB00000-570F-4A9B-8D69-199FDBA5723B")] + [TypeLibType((short)0x1040)] + internal interface INetworkListManager + { + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + IEnumerable GetNetworks([In] NetworkConnectivityLevels Flags); + + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + INetwork GetNetwork([In] Guid gdNetworkId); + + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + IEnumerable GetNetworkConnections(); + + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + INetworkConnection GetNetworkConnection([In] Guid gdNetworkConnectionId); + + bool IsConnectedToInternet + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + get; + } + + bool IsConnected + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + get; + } + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + ConnectivityStates GetConnectivity(); + } +} \ No newline at end of file diff --git a/Core/Interop/NetworkList/NetworkListManagerClass.cs b/Core/Interop/NetworkList/NetworkListManagerClass.cs new file mode 100644 index 0000000..d5b808c --- /dev/null +++ b/Core/Interop/NetworkList/NetworkListManagerClass.cs @@ -0,0 +1,47 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Net +{ + [ComImport, ClassInterface((short)0), Guid("DCB00C01-570F-4A9B-8D69-199FDBA5723B")] + [ComSourceInterfaces("Microsoft.Windows.NetworkList.Internal.INetworkEvents\0Microsoft.Windows.NetworkList.Internal.INetworkConnectionEvents\0Microsoft.Windows.NetworkList.Internal.INetworkListManagerEvents\0"), TypeLibType((short)2)] + internal class NetworkListManagerClass : INetworkListManager + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] + public virtual extern ConnectivityStates GetConnectivity(); + + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] + public virtual extern INetwork GetNetwork([In] Guid gdNetworkId); + + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] + public virtual extern INetworkConnection GetNetworkConnection([In] Guid gdNetworkConnectionId); + + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] + public virtual extern IEnumerable GetNetworkConnections(); + + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] + public virtual extern IEnumerable GetNetworks([In] NetworkConnectivityLevels Flags); + + [DispId(6)] + public virtual extern bool IsConnected + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] + get; + } + + [DispId(5)] + public virtual extern bool IsConnectedToInternet + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] + get; + } + } +} \ No newline at end of file diff --git a/Core/Interop/PowerManagement/PowerManagementNativeMethods.cs b/Core/Interop/PowerManagement/PowerManagementNativeMethods.cs new file mode 100644 index 0000000..98fff9f --- /dev/null +++ b/Core/Interop/PowerManagement/PowerManagementNativeMethods.cs @@ -0,0 +1,227 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + internal static class PowerManagementNativeMethods + { + #region Power Management + + internal const uint PowerBroadcastMessage = 536; + internal const uint PowerSettingChangeMessage = 32787; + internal const uint ScreenSaverSetActive = 0x0011; + internal const uint UpdateInFile = 0x0001; + internal const uint SendChange = 0x0002; + + // This structure is sent when the PBT_POWERSETTINGSCHANGE message is sent. + // It describes the power setting that has changed and + // contains data about the change. + [StructLayout(LayoutKind.Sequential, Pack = 4)] + public struct PowerBroadcastSetting + { + public Guid PowerSetting; + public Int32 DataLength; + } + + // This structure is used when calling CallNtPowerInformation + // to retrieve SystemPowerCapabilities + [StructLayout(LayoutKind.Sequential)] + public struct SystemPowerCapabilities + { + [MarshalAs(UnmanagedType.I1)] + public bool PowerButtonPresent; + [MarshalAs(UnmanagedType.I1)] + public bool SleepButtonPresent; + [MarshalAs(UnmanagedType.I1)] + public bool LidPresent; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS1; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS2; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS3; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS4; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS5; + [MarshalAs(UnmanagedType.I1)] + public bool HiberFilePresent; + [MarshalAs(UnmanagedType.I1)] + public bool FullWake; + [MarshalAs(UnmanagedType.I1)] + public bool VideoDimPresent; + [MarshalAs(UnmanagedType.I1)] + public bool ApmPresent; + [MarshalAs(UnmanagedType.I1)] + public bool UpsPresent; + [MarshalAs(UnmanagedType.I1)] + public bool ThermalControl; + [MarshalAs(UnmanagedType.I1)] + public bool ProcessorThrottle; + public byte ProcessorMinimumThrottle; + public byte ProcessorMaximumThrottle; + [MarshalAs(UnmanagedType.I1)] + public bool FastSystemS4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] spare2; + [MarshalAs(UnmanagedType.I1)] + public bool DiskSpinDown; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] spare3; + [MarshalAs(UnmanagedType.I1)] + public bool SystemBatteriesPresent; + [MarshalAs(UnmanagedType.I1)] + public bool BatteriesAreShortTerm; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public BatteryReportingScale[] BatteryScale; + public SystemPowerState AcOnlineWake; + public SystemPowerState SoftLidWake; + public SystemPowerState RtcWake; + public SystemPowerState MinimumDeviceWakeState; + public SystemPowerState DefaultLowLatencyWake; + } + + public enum PowerInformationLevel + { + SystemPowerPolicyAc, + SystemPowerPolicyDc, + VerifySystemPolicyAc, + VerifySystemPolicyDc, + SystemPowerCapabilities, + SystemBatteryState, + SystemPowerStateHandler, + ProcessorStateHandler, + SystemPowerPolicyCurrent, + AdministratorPowerPolicy, + SystemReserveHiberFile, + ProcessorInformation, + SystemPowerInformation, + ProcessorStateHandler2, + LastWakeTime, + LastSleepTime, + SystemExecutionState, + SystemPowerStateNotifyHandler, + ProcessorPowerPolicyAc, + ProcessorPowerPolicyDc, + VerifyProcessorPowerPolicyAc, + VerifyProcessorPowerPolicyDc, + ProcessorPowerPolicyCurrent, + SystemPowerStateLogging, + SystemPowerLoggingEntry, + SetPowerSettingValue, + NotifyUserPowerSetting, + PowerInformationLevelUnused0, + PowerInformationLevelUnused1, + SystemVideoState, + TraceApplicationPowerMessage, + TraceApplicationPowerMessageEnd, + ProcessorPerfStates, + ProcessorIdleStates, + ProcessorCap, + SystemWakeSource, + SystemHiberFileInformation, + TraceServicePowerMessage, + ProcessorLoad, + PowerShutdownNotification, + MonitorCapabilities, + SessionPowerInit, + SessionDisplayState, + PowerRequestCreate, + PowerRequestAction, + GetPowerRequestList, + ProcessorInformationEx, + NotifyUserModeLegacyPowerEvent, + GroupPark, + ProcessorIdleDomains, + WakeTimerList, + SystemHiberFileSize, + PowerInformationLevelMaximum + } + + [StructLayout(LayoutKind.Sequential)] + public struct BatteryReportingScale + { + public UInt32 Granularity; + public UInt32 Capacity; + } + + public enum SystemPowerState + { + Unspecified = 0, + Working = 1, + Sleeping1 = 2, + Sleeping2 = 3, + Sleeping3 = 4, + Hibernate = 5, + Shutdown = 6, + Maximum = 7 + } + + [StructLayout(LayoutKind.Sequential)] + public struct SystemBatteryState + { + [MarshalAs(UnmanagedType.I1)] + public bool AcOnLine; + [MarshalAs(UnmanagedType.I1)] + public bool BatteryPresent; + [MarshalAs(UnmanagedType.I1)] + public bool Charging; + [MarshalAs(UnmanagedType.I1)] + public bool Discharging; + public byte Spare1; + public byte Spare2; + public byte Spare3; + public byte Spare4; + public uint MaxCapacity; + public uint RemainingCapacity; + public uint Rate; + public uint EstimatedTime; + public uint DefaultAlert1; + public uint DefaultAlert2; + } + + [DllImport("powrprof.dll")] + internal static extern UInt32 CallNtPowerInformation( + PowerInformationLevel informationLevel, + IntPtr inputBuffer, + UInt32 inputBufferSize, + out SystemPowerCapabilities outputBuffer, + UInt32 outputBufferSize + ); + + [DllImport("powrprof.dll")] + internal static extern UInt32 CallNtPowerInformation( + PowerInformationLevel informationLevel, + IntPtr inputBuffer, + UInt32 inputBufferSize, + out SystemBatteryState outputBuffer, + UInt32 outputBufferSize + ); + + /// + /// Gets the Guid relating to the currently active power scheme. + /// + /// Reserved for future use, this must be set to IntPtr.Zero + /// Returns a Guid referring to the currently active power scheme. + [DllImport("powrprof.dll")] + internal static extern void PowerGetActiveScheme( + IntPtr rootPowerKey, + [MarshalAs(UnmanagedType.LPStruct)] + out Guid activePolicy); + + [DllImport("User32", SetLastError = true, + EntryPoint = "RegisterPowerSettingNotification", + CallingConvention = CallingConvention.StdCall)] + internal static extern int RegisterPowerSettingNotification( + IntPtr hRecipient, + ref Guid PowerSettingGuid, + Int32 Flags); + + [DllImport("kernel32.dll", SetLastError = true)] + internal static extern ExecutionStates SetThreadExecutionState(ExecutionStates esFlags); + + #endregion + } +} diff --git a/Core/Interop/TaskDialogs/NativeTaskDialog.cs b/Core/Interop/TaskDialogs/NativeTaskDialog.cs new file mode 100644 index 0000000..5a685ed --- /dev/null +++ b/Core/Interop/TaskDialogs/NativeTaskDialog.cs @@ -0,0 +1,612 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Encapsulates the native logic required to create, + /// configure, and show a TaskDialog, + /// via the TaskDialogIndirect() Win32 function. + /// + /// A new instance of this class should + /// be created for each messagebox show, as + /// the HWNDs for TaskDialogs do not remain constant + /// across calls to TaskDialogIndirect. + /// + internal class NativeTaskDialog : IDisposable + { + private TaskDialogNativeMethods.TaskDialogConfiguration nativeDialogConfig; + private NativeTaskDialogSettings settings; + private IntPtr hWndDialog; + private TaskDialog outerDialog; + + private IntPtr[] updatedStrings = new IntPtr[Enum.GetNames(typeof(TaskDialogNativeMethods.TaskDialogElements)).Length]; + private IntPtr buttonArray, radioButtonArray; + + // Flag tracks whether our first radio + // button click event has come through. + private bool firstRadioButtonClicked = true; + + #region Constructors + + // Configuration is applied at dialog creation time. + internal NativeTaskDialog(NativeTaskDialogSettings settings, TaskDialog outerDialog) + { + nativeDialogConfig = settings.NativeConfiguration; + this.settings = settings; + + // Wireup dialog proc message loop for this instance. + nativeDialogConfig.callback = new TaskDialogNativeMethods.TaskDialogCallback(DialogProc); + + ShowState = DialogShowState.PreShow; + + // Keep a reference to the outer shell, so we can notify. + this.outerDialog = outerDialog; + } + + #endregion + + #region Public Properties + + public DialogShowState ShowState { get; private set; } + + public int SelectedButtonId { get; private set; } + + public int SelectedRadioButtonId { get; private set; } + + public bool CheckBoxChecked { get; private set; } + + #endregion + + internal void NativeShow() + { + // Applies config struct and other settings, then + // calls main Win32 function. + if (settings == null) + { + throw new InvalidOperationException(LocalizedMessages.NativeTaskDialogConfigurationError); + } + + // Do a last-minute parse of the various dialog control lists, + // and only allocate the memory at the last minute. + + MarshalDialogControlStructs(); + + // Make the call and show the dialog. + // NOTE: this call is BLOCKING, though the thread + // WILL re-enter via the DialogProc. + try + { + ShowState = DialogShowState.Showing; + + int selectedButtonId; + int selectedRadioButtonId; + bool checkBoxChecked; + + // Here is the way we use "vanilla" P/Invoke to call TaskDialogIndirect(). + HResult hresult = TaskDialogNativeMethods.TaskDialogIndirect( + nativeDialogConfig, + out selectedButtonId, + out selectedRadioButtonId, + out checkBoxChecked); + + if (CoreErrorHelper.Failed(hresult)) + { + string msg; + switch (hresult) + { + case HResult.InvalidArguments: + msg = LocalizedMessages.NativeTaskDialogInternalErrorArgs; + break; + case HResult.OutOfMemory: + msg = LocalizedMessages.NativeTaskDialogInternalErrorComplex; + break; + default: + msg = string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.NativeTaskDialogInternalErrorUnexpected, + hresult); + break; + } + Exception e = Marshal.GetExceptionForHR((int)hresult); + throw new Win32Exception(msg, e); + } + + SelectedButtonId = selectedButtonId; + SelectedRadioButtonId = selectedRadioButtonId; + CheckBoxChecked = checkBoxChecked; + } + catch (EntryPointNotFoundException exc) + { + throw new NotSupportedException(LocalizedMessages.NativeTaskDialogVersionError, exc); + } + finally + { + ShowState = DialogShowState.Closed; + } + } + + // The new task dialog does not support the existing + // Win32 functions for closing (e.g. EndDialog()); instead, + // a "click button" message is sent. In this case, we're + // abstracting out to say that the TaskDialog consumer can + // simply call "Close" and we'll "click" the cancel button. + // Note that the cancel button doesn't actually + // have to exist for this to work. + internal void NativeClose(TaskDialogResult result) + { + ShowState = DialogShowState.Closing; + + int id; + switch (result) + { + case TaskDialogResult.Close: + id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Close; + break; + case TaskDialogResult.CustomButtonClicked: + id = DialogsDefaults.MinimumDialogControlId; // custom buttons + break; + case TaskDialogResult.No: + id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.No; + break; + case TaskDialogResult.Ok: + id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Ok; + break; + case TaskDialogResult.Retry: + id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Retry; + break; + case TaskDialogResult.Yes: + id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Yes; + break; + default: + id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Cancel; + break; + } + + SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.ClickButton, id, 0); + } + + #region Main Dialog Proc + + private int DialogProc( + IntPtr windowHandle, + uint message, + IntPtr wparam, + IntPtr lparam, + IntPtr referenceData) + { + // Fetch the HWND - it may be the first time we're getting it. + hWndDialog = windowHandle; + + // Big switch on the various notifications the + // dialog proc can get. + switch ((TaskDialogNativeMethods.TaskDialogNotifications)message) + { + case TaskDialogNativeMethods.TaskDialogNotifications.Created: + int result = PerformDialogInitialization(); + outerDialog.RaiseOpenedEvent(); + return result; + case TaskDialogNativeMethods.TaskDialogNotifications.ButtonClicked: + return HandleButtonClick((int)wparam); + case TaskDialogNativeMethods.TaskDialogNotifications.RadioButtonClicked: + return HandleRadioButtonClick((int)wparam); + case TaskDialogNativeMethods.TaskDialogNotifications.HyperlinkClicked: + return HandleHyperlinkClick(lparam); + case TaskDialogNativeMethods.TaskDialogNotifications.Help: + return HandleHelpInvocation(); + case TaskDialogNativeMethods.TaskDialogNotifications.Timer: + return HandleTick((int)wparam); + case TaskDialogNativeMethods.TaskDialogNotifications.Destroyed: + return PerformDialogCleanup(); + default: + break; + } + return (int)HResult.Ok; + } + + // Once the task dialog HWND is open, we need to send + // additional messages to configure it. + private int PerformDialogInitialization() + { + // Initialize Progress or Marquee Bar. + if (IsOptionSet(TaskDialogNativeMethods.TaskDialogOptions.ShowProgressBar)) + { + UpdateProgressBarRange(); + + // The order of the following is important - + // state is more important than value, + // and non-normal states turn off the bar value change + // animation, which is likely the intended + // and preferable behavior. + UpdateProgressBarState(settings.ProgressBarState); + UpdateProgressBarValue(settings.ProgressBarValue); + + // Due to a bug that wasn't fixed in time for RTM of Vista, + // second SendMessage is required if the state is non-Normal. + UpdateProgressBarValue(settings.ProgressBarValue); + } + else if (IsOptionSet(TaskDialogNativeMethods.TaskDialogOptions.ShowMarqueeProgressBar)) + { + // TDM_SET_PROGRESS_BAR_MARQUEE is necessary + // to cause the marquee to start animating. + // Note that this internal task dialog setting is + // round-tripped when the marquee is + // is set to different states, so it never has to + // be touched/sent again. + SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarMarquee, 1, 0); + UpdateProgressBarState(settings.ProgressBarState); + } + + if (settings.ElevatedButtons != null && settings.ElevatedButtons.Count > 0) + { + foreach (int id in settings.ElevatedButtons) + { + UpdateElevationIcon(id, true); + } + } + + return CoreErrorHelper.Ignored; + } + + private int HandleButtonClick(int id) + { + // First we raise a Click event, if there is a custom button + // However, we implement Close() by sending a cancel button, so + // we don't want to raise a click event in response to that. + if (ShowState != DialogShowState.Closing) + { + outerDialog.RaiseButtonClickEvent(id); + } + + // Once that returns, we raise a Closing event for the dialog + // The Win32 API handles button clicking-and-closing + // as an atomic action, + // but it is more .NET friendly to split them up. + // Unfortunately, we do NOT have the return values at this stage. + if (id < DialogsDefaults.MinimumDialogControlId) + { + return outerDialog.RaiseClosingEvent(id); + } + + return (int)HResult.False; + } + + private int HandleRadioButtonClick(int id) + { + // When the dialog sets the radio button to default, + // it (somewhat confusingly)issues a radio button clicked event + // - we mask that out - though ONLY if + // we do have a default radio button + if (firstRadioButtonClicked + && !IsOptionSet(TaskDialogNativeMethods.TaskDialogOptions.NoDefaultRadioButton)) + { + firstRadioButtonClicked = false; + } + else + { + outerDialog.RaiseButtonClickEvent(id); + } + + // Note: we don't raise Closing, as radio + // buttons are non-committing buttons + return CoreErrorHelper.Ignored; + } + + private int HandleHyperlinkClick(IntPtr href) + { + string link = Marshal.PtrToStringUni(href); + outerDialog.RaiseHyperlinkClickEvent(link); + + return CoreErrorHelper.Ignored; + } + + + private int HandleTick(int ticks) + { + outerDialog.RaiseTickEvent(ticks); + return CoreErrorHelper.Ignored; + } + + private int HandleHelpInvocation() + { + outerDialog.RaiseHelpInvokedEvent(); + return CoreErrorHelper.Ignored; + } + + // There should be little we need to do here, + // as the use of the NativeTaskDialog is + // that it is instantiated for a single show, then disposed of. + private int PerformDialogCleanup() + { + firstRadioButtonClicked = true; + + return CoreErrorHelper.Ignored; + } + + #endregion + + #region Update members + + internal void UpdateProgressBarValue(int i) + { + AssertCurrentlyShowing(); + SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarPosition, i, 0); + } + + internal void UpdateProgressBarRange() + { + AssertCurrentlyShowing(); + + // Build range LPARAM - note it is in REVERSE intuitive order. + long range = NativeTaskDialog.MakeLongLParam( + settings.ProgressBarMaximum, + settings.ProgressBarMinimum); + + SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarRange, 0, range); + } + + internal void UpdateProgressBarState(TaskDialogProgressBarState state) + { + AssertCurrentlyShowing(); + SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarState, (int)state, 0); + } + + internal void UpdateText(string text) + { + UpdateTextCore(text, TaskDialogNativeMethods.TaskDialogElements.Content); + } + + internal void UpdateInstruction(string instruction) + { + UpdateTextCore(instruction, TaskDialogNativeMethods.TaskDialogElements.MainInstruction); + } + + internal void UpdateFooterText(string footerText) + { + UpdateTextCore(footerText, TaskDialogNativeMethods.TaskDialogElements.Footer); + } + + internal void UpdateExpandedText(string expandedText) + { + UpdateTextCore(expandedText, TaskDialogNativeMethods.TaskDialogElements.ExpandedInformation); + } + + private void UpdateTextCore(string s, TaskDialogNativeMethods.TaskDialogElements element) + { + AssertCurrentlyShowing(); + + FreeOldString(element); + SendMessageHelper( + TaskDialogNativeMethods.TaskDialogMessages.SetElementText, + (int)element, + (long)MakeNewString(s, element)); + } + + internal void UpdateMainIcon(TaskDialogStandardIcon mainIcon) + { + UpdateIconCore(mainIcon, TaskDialogNativeMethods.TaskDialogIconElement.Main); + } + + internal void UpdateFooterIcon(TaskDialogStandardIcon footerIcon) + { + UpdateIconCore(footerIcon, TaskDialogNativeMethods.TaskDialogIconElement.Footer); + } + + private void UpdateIconCore(TaskDialogStandardIcon icon, TaskDialogNativeMethods.TaskDialogIconElement element) + { + AssertCurrentlyShowing(); + SendMessageHelper( + TaskDialogNativeMethods.TaskDialogMessages.UpdateIcon, + (int)element, + (long)icon); + } + + internal void UpdateCheckBoxChecked(bool cbc) + { + AssertCurrentlyShowing(); + SendMessageHelper( + TaskDialogNativeMethods.TaskDialogMessages.ClickVerification, + (cbc ? 1 : 0), + 1); + } + + internal void UpdateElevationIcon(int buttonId, bool showIcon) + { + AssertCurrentlyShowing(); + SendMessageHelper( + TaskDialogNativeMethods.TaskDialogMessages.SetButtonElevationRequiredState, + buttonId, + Convert.ToInt32(showIcon)); + } + + internal void UpdateButtonEnabled(int buttonID, bool enabled) + { + AssertCurrentlyShowing(); + SendMessageHelper( + TaskDialogNativeMethods.TaskDialogMessages.EnableButton, buttonID, enabled == true ? 1 : 0); + } + + internal void UpdateRadioButtonEnabled(int buttonID, bool enabled) + { + AssertCurrentlyShowing(); + SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.EnableRadioButton, + buttonID, enabled == true ? 1 : 0); + } + + internal void AssertCurrentlyShowing() + { + Debug.Assert(ShowState == DialogShowState.Showing, + "Update*() methods should only be called while native dialog is showing"); + } + + #endregion + + #region Helpers + + private int SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages message, int wparam, long lparam) + { + // Be sure to at least assert here - + // messages to invalid handles often just disappear silently + Debug.Assert(hWndDialog != null, "HWND for dialog is null during SendMessage"); + + return (int)CoreNativeMethods.SendMessage( + hWndDialog, + (uint)message, + (IntPtr)wparam, + new IntPtr(lparam)); + } + + private bool IsOptionSet(TaskDialogNativeMethods.TaskDialogOptions flag) + { + return ((nativeDialogConfig.taskDialogFlags & flag) == flag); + } + + // Allocates a new string on the unmanaged heap, + // and stores the pointer so we can free it later. + + private IntPtr MakeNewString(string text, TaskDialogNativeMethods.TaskDialogElements element) + { + IntPtr newStringPtr = Marshal.StringToHGlobalUni(text); + updatedStrings[(int)element] = newStringPtr; + return newStringPtr; + } + + // Checks to see if the given element already has an + // updated string, and if so, + // frees it. This is done in preparation for a call to + // MakeNewString(), to prevent + // leaks from multiple updates calls on the same element + // within a single native dialog lifetime. + private void FreeOldString(TaskDialogNativeMethods.TaskDialogElements element) + { + int elementIndex = (int)element; + if (updatedStrings[elementIndex] != IntPtr.Zero) + { + Marshal.FreeHGlobal(updatedStrings[elementIndex]); + updatedStrings[elementIndex] = IntPtr.Zero; + } + } + + // Based on the following defines in WinDef.h and WinUser.h: + // #define MAKELPARAM(l, h) ((LPARAM)(DWORD)MAKELONG(l, h)) + // #define MAKELONG(a, b) ((LONG)(((WORD)(((DWORD_PTR)(a)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(b)) & 0xffff))) << 16)) + private static long MakeLongLParam(int a, int b) + { + return (a << 16) + b; + } + + // Builds the actual configuration that the + // NativeTaskDialog (and underlying Win32 API) + // expects, by parsing the various control lists, + // marshaling to the unmanaged heap, etc. + private void MarshalDialogControlStructs() + { + if (settings.Buttons != null && settings.Buttons.Length > 0) + { + buttonArray = AllocateAndMarshalButtons(settings.Buttons); + settings.NativeConfiguration.buttons = buttonArray; + settings.NativeConfiguration.buttonCount = (uint)settings.Buttons.Length; + } + + if (settings.RadioButtons != null && settings.RadioButtons.Length > 0) + { + radioButtonArray = AllocateAndMarshalButtons(settings.RadioButtons); + settings.NativeConfiguration.radioButtons = radioButtonArray; + settings.NativeConfiguration.radioButtonCount = (uint)settings.RadioButtons.Length; + } + } + + private static IntPtr AllocateAndMarshalButtons(TaskDialogNativeMethods.TaskDialogButton[] structs) + { + IntPtr initialPtr = Marshal.AllocHGlobal( + Marshal.SizeOf(typeof(TaskDialogNativeMethods.TaskDialogButton)) * structs.Length); + + IntPtr currentPtr = initialPtr; + foreach (TaskDialogNativeMethods.TaskDialogButton button in structs) + { + Marshal.StructureToPtr(button, currentPtr, false); + currentPtr = (IntPtr)((int)currentPtr + Marshal.SizeOf(button)); + } + + return initialPtr; + } + + #endregion + + #region IDispose Pattern + + private bool disposed; + + // Finalizer and IDisposable implementation. + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + ~NativeTaskDialog() + { + Dispose(false); + } + + // Core disposing logic. + protected void Dispose(bool disposing) + { + if (!disposed) + { + disposed = true; + + // Single biggest resource - make sure the dialog + // itself has been instructed to close. + + if (ShowState == DialogShowState.Showing) + { + NativeClose(TaskDialogResult.Cancel); + } + + // Clean up custom allocated strings that were updated + // while the dialog was showing. Note that the strings + // passed in the initial TaskDialogIndirect call will + // be cleaned up automagically by the default + // marshalling logic. + + if (updatedStrings != null) + { + for (int i = 0; i < updatedStrings.Length; i++) + { + if (updatedStrings[i] != IntPtr.Zero) + { + Marshal.FreeHGlobal(updatedStrings[i]); + updatedStrings[i] = IntPtr.Zero; + } + } + } + + // Clean up the button and radio button arrays, if any. + if (buttonArray != IntPtr.Zero) + { + Marshal.FreeHGlobal(buttonArray); + buttonArray = IntPtr.Zero; + } + if (radioButtonArray != IntPtr.Zero) + { + Marshal.FreeHGlobal(radioButtonArray); + radioButtonArray = IntPtr.Zero; + } + + if (disposing) + { + // Clean up managed resources - currently there are none + // that are interesting. + } + } + } + + #endregion + } +} diff --git a/Core/Interop/TaskDialogs/NativeTaskDialogSettings.cs b/Core/Interop/TaskDialogs/NativeTaskDialogSettings.cs new file mode 100644 index 0000000..ab7b883 --- /dev/null +++ b/Core/Interop/TaskDialogs/NativeTaskDialogSettings.cs @@ -0,0 +1,58 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Encapsulates additional configuration needed by NativeTaskDialog + /// that it can't get from the TASKDIALOGCONFIG struct. + /// + internal class NativeTaskDialogSettings + { + internal NativeTaskDialogSettings() + { + NativeConfiguration = new TaskDialogNativeMethods.TaskDialogConfiguration(); + + // Apply standard settings. + NativeConfiguration.size = (uint)Marshal.SizeOf(NativeConfiguration); + NativeConfiguration.parentHandle = IntPtr.Zero; + NativeConfiguration.instance = IntPtr.Zero; + NativeConfiguration.taskDialogFlags = TaskDialogNativeMethods.TaskDialogOptions.AllowCancel; + NativeConfiguration.commonButtons = TaskDialogNativeMethods.TaskDialogCommonButtons.Ok; + NativeConfiguration.mainIcon = new TaskDialogNativeMethods.IconUnion(0); + NativeConfiguration.footerIcon = new TaskDialogNativeMethods.IconUnion(0); + NativeConfiguration.width = TaskDialogDefaults.IdealWidth; + + // Zero out all the custom button fields. + NativeConfiguration.buttonCount = 0; + NativeConfiguration.radioButtonCount = 0; + NativeConfiguration.buttons = IntPtr.Zero; + NativeConfiguration.radioButtons = IntPtr.Zero; + NativeConfiguration.defaultButtonIndex = 0; + NativeConfiguration.defaultRadioButtonIndex = 0; + + // Various text defaults. + NativeConfiguration.windowTitle = TaskDialogDefaults.Caption; + NativeConfiguration.mainInstruction = TaskDialogDefaults.MainInstruction; + NativeConfiguration.content = TaskDialogDefaults.Content; + NativeConfiguration.verificationText = null; + NativeConfiguration.expandedInformation = null; + NativeConfiguration.expandedControlText = null; + NativeConfiguration.collapsedControlText = null; + NativeConfiguration.footerText = null; + } + + public int ProgressBarMinimum { get; set; } + public int ProgressBarMaximum { get; set; } + public int ProgressBarValue { get; set; } + public TaskDialogProgressBarState ProgressBarState { get; set; } + public bool InvokeHelp { get; set; } + public TaskDialogNativeMethods.TaskDialogConfiguration NativeConfiguration { get; private set; } + public TaskDialogNativeMethods.TaskDialogButton[] Buttons { get; set; } + public TaskDialogNativeMethods.TaskDialogButton[] RadioButtons { get; set; } + public List ElevatedButtons { get; set; } + } +} diff --git a/Core/Interop/TaskDialogs/TaskDialogNativeMethods.cs b/Core/Interop/TaskDialogs/TaskDialogNativeMethods.cs new file mode 100644 index 0000000..48ac352 --- /dev/null +++ b/Core/Interop/TaskDialogs/TaskDialogNativeMethods.cs @@ -0,0 +1,233 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + + /// + /// Internal class containing most native interop declarations used + /// throughout the library. + /// Functions that are not performance intensive belong in this class. + /// + + internal static class TaskDialogNativeMethods + { + #region TaskDialog Definitions + + [DllImport("Comctl32.dll", SetLastError = true)] + internal static extern HResult TaskDialogIndirect( + [In] TaskDialogNativeMethods.TaskDialogConfiguration taskConfig, + [Out] out int button, + [Out] out int radioButton, + [MarshalAs(UnmanagedType.Bool), Out] out bool verificationFlagChecked); + + // Main task dialog configuration struct. + // NOTE: Packing must be set to 4 to make this work on 64-bit platforms. + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] + internal class TaskDialogConfiguration + { + internal uint size; + internal IntPtr parentHandle; + internal IntPtr instance; + internal TaskDialogOptions taskDialogFlags; + internal TaskDialogCommonButtons commonButtons; + [MarshalAs(UnmanagedType.LPWStr)] + internal string windowTitle; + internal IconUnion mainIcon; // NOTE: 32-bit union field, holds pszMainIcon as well + [MarshalAs(UnmanagedType.LPWStr)] + internal string mainInstruction; + [MarshalAs(UnmanagedType.LPWStr)] + internal string content; + internal uint buttonCount; + internal IntPtr buttons; // Ptr to TASKDIALOG_BUTTON structs + internal int defaultButtonIndex; + internal uint radioButtonCount; + internal IntPtr radioButtons; // Ptr to TASKDIALOG_BUTTON structs + internal int defaultRadioButtonIndex; + [MarshalAs(UnmanagedType.LPWStr)] + internal string verificationText; + [MarshalAs(UnmanagedType.LPWStr)] + internal string expandedInformation; + [MarshalAs(UnmanagedType.LPWStr)] + internal string expandedControlText; + [MarshalAs(UnmanagedType.LPWStr)] + internal string collapsedControlText; + internal IconUnion footerIcon; // NOTE: 32-bit union field, holds pszFooterIcon as well + [MarshalAs(UnmanagedType.LPWStr)] + internal string footerText; + internal TaskDialogCallback callback; + internal IntPtr callbackData; + internal uint width; + } + + internal const int TaskDialogIdealWidth = 0; // Value for TASKDIALOGCONFIG.cxWidth + internal const int TaskDialogButtonShieldIcon = 1; + + // NOTE: We include a "spacer" so that the struct size varies on + // 64-bit architectures. + [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Auto)] + internal struct IconUnion + { + internal IconUnion(int i) + { + mainIcon = i; + spacer = IntPtr.Zero; + } + + [FieldOffset(0)] + private int mainIcon; + + // This field is used to adjust the length of the structure on 32/64bit OS. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + [FieldOffset(0)] + private IntPtr spacer; + + /// + /// Gets the handle to the Icon + /// + public int MainIcon { get { return mainIcon; } } + } + + // NOTE: Packing must be set to 4 to make this work on 64-bit platforms. + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] + internal struct TaskDialogButton + { + public TaskDialogButton(int buttonId, string text) + { + this.buttonId = buttonId; + buttonText = text; + } + + internal int buttonId; + [MarshalAs(UnmanagedType.LPWStr)] + internal string buttonText; + } + + // Task Dialog - identifies common buttons. + [Flags] + internal enum TaskDialogCommonButtons + { + Ok = 0x0001, // selected control return value IDOK + Yes = 0x0002, // selected control return value IDYES + No = 0x0004, // selected control return value IDNO + Cancel = 0x0008, // selected control return value IDCANCEL + Retry = 0x0010, // selected control return value IDRETRY + Close = 0x0020 // selected control return value IDCLOSE + } + + // Identify button *return values* - note that, unfortunately, these are different + // from the inbound button values. + internal enum TaskDialogCommonButtonReturnIds + { + Ok = 1, + Cancel = 2, + Abort = 3, + Retry = 4, + Ignore = 5, + Yes = 6, + No = 7, + Close = 8 + } + + internal enum TaskDialogElements + { + Content, + ExpandedInformation, + Footer, + MainInstruction + } + + internal enum TaskDialogIconElement + { + Main, + Footer + } + + // Task Dialog - flags + [Flags] + internal enum TaskDialogOptions + { + None = 0, + EnableHyperlinks = 0x0001, + UseMainIcon = 0x0002, + UseFooterIcon = 0x0004, + AllowCancel = 0x0008, + UseCommandLinks = 0x0010, + UseNoIconCommandLinks = 0x0020, + ExpandFooterArea = 0x0040, + ExpandedByDefault = 0x0080, + CheckVerificationFlag = 0x0100, + ShowProgressBar = 0x0200, + ShowMarqueeProgressBar = 0x0400, + UseCallbackTimer = 0x0800, + PositionRelativeToWindow = 0x1000, + RightToLeftLayout = 0x2000, + NoDefaultRadioButton = 0x4000 + } + + internal enum TaskDialogMessages + { + NavigatePage = CoreNativeMethods.UserMessage + 101, + ClickButton = CoreNativeMethods.UserMessage + 102, // wParam = Button ID + SetMarqueeProgressBar = CoreNativeMethods.UserMessage + 103, // wParam = 0 (nonMarque) wParam != 0 (Marquee) + SetProgressBarState = CoreNativeMethods.UserMessage + 104, // wParam = new progress state + SetProgressBarRange = CoreNativeMethods.UserMessage + 105, // lParam = MAKELPARAM(nMinRange, nMaxRange) + SetProgressBarPosition = CoreNativeMethods.UserMessage + 106, // wParam = new position + SetProgressBarMarquee = CoreNativeMethods.UserMessage + 107, // wParam = 0 (stop marquee), wParam != 0 (start marquee), lparam = speed (milliseconds between repaints) + SetElementText = CoreNativeMethods.UserMessage + 108, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR) + ClickRadioButton = CoreNativeMethods.UserMessage + 110, // wParam = Radio Button ID + EnableButton = CoreNativeMethods.UserMessage + 111, // lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID + EnableRadioButton = CoreNativeMethods.UserMessage + 112, // lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID + ClickVerification = CoreNativeMethods.UserMessage + 113, // wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus) + UpdateElementText = CoreNativeMethods.UserMessage + 114, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR) + SetButtonElevationRequiredState = CoreNativeMethods.UserMessage + 115, // wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required) + UpdateIcon = CoreNativeMethods.UserMessage + 116 // wParam = icon element (TASKDIALOG_ICON_ELEMENTS), lParam = new icon (hIcon if TDF_USE_HICON_* was set, PCWSTR otherwise) + } + + internal enum TaskDialogNotifications + { + Created = 0, + Navigated = 1, + ButtonClicked = 2, // wParam = Button ID + HyperlinkClicked = 3, // lParam = (LPCWSTR)pszHREF + Timer = 4, // wParam = Milliseconds since dialog created or timer reset + Destroyed = 5, + RadioButtonClicked = 6, // wParam = Radio Button ID + Constructed = 7, + VerificationClicked = 8, // wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0 + Help = 9, + ExpandButtonClicked = 10 // wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded) + } + + // Used in the various SET_DEFAULT* TaskDialog messages + internal const int NoDefaultButtonSpecified = 0; + + // Task Dialog config and related structs (for TaskDialogIndirect()) + internal delegate int TaskDialogCallback( + IntPtr hwnd, + uint message, + IntPtr wparam, + IntPtr lparam, + IntPtr referenceData); + + internal enum ProgressBarState + { + Normal = 0x0001, + Error = 0x0002, + Paused = 0x0003 + } + + internal enum TaskDialogIcons + { + Warning = 65535, + Error = 65534, + Information = 65533, + Shield = 65532 + } + + #endregion + } +} diff --git a/Core/Interop/WindowMessage.cs b/Core/Interop/WindowMessage.cs new file mode 100644 index 0000000..4ff7840 --- /dev/null +++ b/Core/Interop/WindowMessage.cs @@ -0,0 +1,234 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace MS.WindowsAPICodePack.Internal +{ + internal enum WindowMessage + { + Null = 0x00, + Create = 0x01, + Destroy = 0x02, + Move = 0x03, + Size = 0x05, + Activate = 0x06, + SetFocus = 0x07, + KillFocus = 0x08, + Enable = 0x0A, + SetRedraw = 0x0B, + SetText = 0x0C, + GetText = 0x0D, + GetTextLength = 0x0E, + Paint = 0x0F, + Close = 0x10, + QueryEndSession = 0x11, + Quit = 0x12, + QueryOpen = 0x13, + EraseBackground = 0x14, + SystemColorChange = 0x15, + EndSession = 0x16, + SystemError = 0x17, + ShowWindow = 0x18, + ControlColor = 0x19, + WinIniChange = 0x1A, + SettingChange = 0x1A, + DevModeChange = 0x1B, + ActivateApplication = 0x1C, + FontChange = 0x1D, + TimeChange = 0x1E, + CancelMode = 0x1F, + SetCursor = 0x20, + MouseActivate = 0x21, + ChildActivate = 0x22, + QueueSync = 0x23, + GetMinMaxInfo = 0x24, + PaintIcon = 0x26, + IconEraseBackground = 0x27, + NextDialogControl = 0x28, + SpoolerStatus = 0x2A, + DrawItem = 0x2B, + MeasureItem = 0x2C, + DeleteItem = 0x2D, + VKeyToItem = 0x2E, + CharToItem = 0x2F, + + SetFont = 0x30, + GetFont = 0x31, + SetHotkey = 0x32, + GetHotkey = 0x33, + QueryDragIcon = 0x37, + CompareItem = 0x39, + Compacting = 0x41, + WindowPositionChanging = 0x46, + WindowPositionChanged = 0x47, + Power = 0x48, + CopyData = 0x4A, + CancelJournal = 0x4B, + Notify = 0x4E, + InputLanguageChangeRequest = 0x50, + InputLanguageChange = 0x51, + TCard = 0x52, + Help = 0x53, + UserChanged = 0x54, + NotifyFormat = 0x55, + ContextMenu = 0x7B, + StyleChanging = 0x7C, + StyleChanged = 0x7D, + DisplayChange = 0x7E, + GetIcon = 0x7F, + SetIcon = 0x80, + + NCCreate = 0x81, + NCDestroy = 0x82, + NCCalculateSize = 0x83, + NCHitTest = 0x84, + NCPaint = 0x85, + NCActivate = 0x86, + GetDialogCode = 0x87, + NCMouseMove = 0xA0, + NCLeftButtonDown = 0xA1, + NCLeftButtonUp = 0xA2, + NCLeftButtonDoubleClick = 0xA3, + NCRightButtonDown = 0xA4, + NCRightButtonUp = 0xA5, + NCRightButtonDoubleClick = 0xA6, + NCMiddleButtonDown = 0xA7, + NCMiddleButtonUp = 0xA8, + NCMiddleButtonDoubleClick = 0xA9, + + KeyFirst = 0x100, + KeyDown = 0x100, + KeyUp = 0x101, + Char = 0x102, + DeadChar = 0x103, + SystemKeyDown = 0x104, + SystemKeyUp = 0x105, + SystemChar = 0x106, + SystemDeadChar = 0x107, + KeyLast = 0x108, + + IMEStartComposition = 0x10D, + IMEEndComposition = 0x10E, + IMEComposition = 0x10F, + IMEKeyLast = 0x10F, + + InitializeDialog = 0x110, + Command = 0x111, + SystemCommand = 0x112, + Timer = 0x113, + HorizontalScroll = 0x114, + VerticalScroll = 0x115, + InitializeMenu = 0x116, + InitializeMenuPopup = 0x117, + MenuSelect = 0x11F, + MenuChar = 0x120, + EnterIdle = 0x121, + + CTLColorMessageBox = 0x132, + CTLColorEdit = 0x133, + CTLColorListbox = 0x134, + CTLColorButton = 0x135, + CTLColorDialog = 0x136, + CTLColorScrollBar = 0x137, + CTLColorStatic = 0x138, + + MouseFirst = 0x200, + MouseMove = 0x200, + LeftButtonDown = 0x201, + LeftButtonUp = 0x202, + LeftButtonDoubleClick = 0x203, + RightButtonDown = 0x204, + RightButtonUp = 0x205, + RightButtonDoubleClick = 0x206, + MiddleButtonDown = 0x207, + MiddleButtonUp = 0x208, + MiddleButtonDoubleClick = 0x209, + MouseWheel = 0x20A, + MouseHorizontalWheel = 0x20E, + + ParentNotify = 0x210, + EnterMenuLoop = 0x211, + ExitMenuLoop = 0x212, + NextMenu = 0x213, + Sizing = 0x214, + CaptureChanged = 0x215, + Moving = 0x216, + PowerBroadcast = 0x218, + DeviceChange = 0x219, + + MDICreate = 0x220, + MDIDestroy = 0x221, + MDIActivate = 0x222, + MDIRestore = 0x223, + MDINext = 0x224, + MDIMaximize = 0x225, + MDITile = 0x226, + MDICascade = 0x227, + MDIIconArrange = 0x228, + MDIGetActive = 0x229, + MDISetMenu = 0x230, + EnterSizeMove = 0x231, + ExitSizeMove = 0x232, + DropFiles = 0x233, + MDIRefreshMenu = 0x234, + + IMESetContext = 0x281, + IMENotify = 0x282, + IMEControl = 0x283, + IMECompositionFull = 0x284, + IMESelect = 0x285, + IMEChar = 0x286, + IMEKeyDown = 0x290, + IMEKeyUp = 0x291, + + MouseHover = 0x2A1, + NCMouseLeave = 0x2A2, + MouseLeave = 0x2A3, + + Cut = 0x300, + Copy = 0x301, + Paste = 0x302, + Clear = 0x303, + Undo = 0x304, + + RenderFormat = 0x305, + RenderAllFormats = 0x306, + DestroyClipboard = 0x307, + DrawClipbard = 0x308, + PaintClipbard = 0x309, + VerticalScrollClipBoard = 0x30A, + SizeClipbard = 0x30B, + AskClipboardFormatname = 0x30C, + ChangeClipboardChain = 0x30D, + HorizontalScrollClipboard = 0x30E, + QueryNewPalette = 0x30F, + PaletteIsChanging = 0x310, + PaletteChanged = 0x311, + + Hotkey = 0x312, + Print = 0x317, + PrintClient = 0x318, + + HandHeldFirst = 0x358, + HandHeldlast = 0x35F, + PenWinFirst = 0x380, + PenWinLast = 0x38F, + CoalesceFirst = 0x390, + CoalesceLast = 0x39F, + DDE_First = 0x3E0, + DDE_Initiate = 0x3E0, + DDE_Terminate = 0x3E1, + DDE_Advise = 0x3E2, + DDE_Unadvise = 0x3E3, + DDE_Ack = 0x3E4, + DDE_Data = 0x3E5, + DDE_Request = 0x3E6, + DDE_Poke = 0x3E7, + DDE_Execute = 0x3E8, + DDE_Last = 0x3E8, + + User = 0x400, + App = 0x8000, + } +} \ No newline at end of file diff --git a/Core/Makefile.am b/Core/Makefile.am new file mode 100644 index 0000000..24e07e9 --- /dev/null +++ b/Core/Makefile.am @@ -0,0 +1,5 @@ +include $(top_srcdir)/xbuild.include + +if ! ENABLE_WINDOWSPLATFORM +SKIP=y +endif diff --git a/Core/NetworkList/Network.cs b/Core/NetworkList/Network.cs new file mode 100644 index 0000000..93cccb5 --- /dev/null +++ b/Core/NetworkList/Network.cs @@ -0,0 +1,201 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Net +{ + /// + /// Represents a network on the local machine. + /// It can also represent a collection of network + /// connections with a similar network signature. + /// + /// + /// Instances of this class are obtained by calling + /// methods on the class. + /// + public class Network + { + #region Private Fields + + INetwork network; + + #endregion // Private Fields + + internal Network(INetwork network) + { + this.network = network; + } + + /// + /// Gets or sets the category of a network. The + /// categories are trusted, untrusted, or + /// authenticated. + /// + /// A value. + public NetworkCategory Category + { + get + { + return network.GetCategory(); + } + + set + { + network.SetCategory(value); + } + } + + /// + /// Gets the local date and time when the network + /// was connected. + /// + /// A object. + public DateTime ConnectedTime + { + get + { + uint low, high, dummy1, dummy2; + network.GetTimeCreatedAndConnected(out dummy1, out dummy2, out low, out high); + long time = high; + // Shift the day info into the high order bits. + time <<= 32; + time |= low; + return DateTime.FromFileTimeUtc(time); + } + } + + /// + /// Gets the network connections for the network. + /// + /// A object. + public NetworkConnectionCollection Connections + { + get + { + return new NetworkConnectionCollection(network.GetNetworkConnections()); + } + } + + /// + /// Gets the connectivity state of the network. + /// + /// A value. + /// Connectivity provides information on whether + /// the network is connected, and the protocols + /// in use for network traffic. + public ConnectivityStates Connectivity + { + get + { + return network.GetConnectivity(); + } + } + + /// + /// Gets the local date and time when the + /// network was created. + /// + /// A object. + public DateTime CreatedTime + { + get + { + uint low, high, dummy1, dummy2; + network.GetTimeCreatedAndConnected(out low, out high, out dummy1, out dummy2); + long time = high; + //Shift the value into the high order bits. + time <<= 32; + time |= low; + return DateTime.FromFileTimeUtc(time); + } + } + + /// + /// Gets or sets a description for the network. + /// + /// A value. + public string Description + { + get + { + return network.GetDescription(); + } + + set + { + network.SetDescription(value); + } + } + + /// + /// Gets the domain type of the network. + /// + /// A value. + /// The domain + /// indictates whether the network is an Active + /// Directory Network, and whether the machine + /// has been authenticated by Active Directory. + public DomainType DomainType + { + get + { + return network.GetDomainType(); + } + } + + /// + /// Gets a value that indicates whether there is + /// network connectivity. + /// + /// A value. + public bool IsConnected + { + get + { + return network.IsConnected; + } + } + + /// + /// Gets a value that indicates whether there is + /// Internet connectivity. + /// + /// A value. + public bool IsConnectedToInternet + { + get + { + return network.IsConnectedToInternet; + } + } + + /// + /// Gets or sets the name of the network. + /// + /// A value. + public string Name + { + get + { + return network.GetName(); + } + + set + { + network.SetName(value); + } + } + + /// + /// Gets a unique identifier for the network. + /// + /// A value. + public Guid NetworkId + { + get + { + return network.GetNetworkId(); + } + } + } +} \ No newline at end of file diff --git a/Core/NetworkList/NetworkCollection.cs b/Core/NetworkList/NetworkCollection.cs new file mode 100644 index 0000000..dc079a0 --- /dev/null +++ b/Core/NetworkList/NetworkCollection.cs @@ -0,0 +1,60 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Net +{ + /// + /// An enumerable collection of objects. + /// + public class NetworkCollection : IEnumerable + { + #region Private Fields + + IEnumerable networkEnumerable; + + #endregion // Private Fields + + internal NetworkCollection(IEnumerable networkEnumerable) + { + this.networkEnumerable = networkEnumerable; + } + + #region IEnumerable Members + + /// + /// Returns the strongly typed enumerator for this collection. + /// + /// An object. + public IEnumerator GetEnumerator() + { + foreach (INetwork network in networkEnumerable) + { + yield return new Network(network); + } + } + + #endregion + + #region IEnumerable Members + + /// + /// Returns the enumerator for this collection. + /// + ///An object. + IEnumerator IEnumerable.GetEnumerator() + { + foreach (INetwork network in networkEnumerable) + { + yield return new Network(network); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Core/NetworkList/NetworkConnection.cs b/Core/NetworkList/NetworkConnection.cs new file mode 100644 index 0000000..71363a0 --- /dev/null +++ b/Core/NetworkList/NetworkConnection.cs @@ -0,0 +1,115 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Net +{ + /// + /// Represents a connection to a network. + /// + /// A collection containing instances of this class is obtained by calling + /// the property. + public class NetworkConnection + { + #region Private Fields + + INetworkConnection networkConnection; + + #endregion // Private Fields + + internal NetworkConnection(INetworkConnection networkConnection) + { + this.networkConnection = networkConnection; + } + + /// + /// Retrieves an object that represents the network + /// associated with this connection. + /// + /// A object. + public Network Network + { + get + { + return new Network(networkConnection.GetNetwork()); + } + } + + /// + /// Gets the adapter identifier for this connection. + /// + /// A object. + public Guid AdapterId + { + get + { + return networkConnection.GetAdapterId(); + } + } + /// + /// Gets the unique identifier for this connection. + /// + /// A object. + public Guid ConnectionId + { + get + { + return networkConnection.GetConnectionId(); + } + } + /// + /// Gets a value that indicates the connectivity of this connection. + /// + /// A value. + public ConnectivityStates Connectivity + { + get + { + return networkConnection.GetConnectivity(); + } + } + + /// + /// Gets a value that indicates whether the network associated + /// with this connection is + /// an Active Directory network and whether the machine + /// has been authenticated by Active Directory. + /// + /// A value. + public DomainType DomainType + { + get + { + return networkConnection.GetDomainType(); + } + } + /// + /// Gets a value that indicates whether this + /// connection has Internet access. + /// + /// A value. + public bool IsConnectedToInternet + { + get + { + return networkConnection.IsConnectedToInternet; + } + } + + /// + /// Gets a value that indicates whether this connection has + /// network connectivity. + /// + /// A value. + public bool IsConnected + { + get + { + return networkConnection.IsConnected; + } + } + } +} \ No newline at end of file diff --git a/Core/NetworkList/NetworkConnectionCollection.cs b/Core/NetworkList/NetworkConnectionCollection.cs new file mode 100644 index 0000000..4618e36 --- /dev/null +++ b/Core/NetworkList/NetworkConnectionCollection.cs @@ -0,0 +1,60 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Net +{ + /// + /// An enumerable collection of objects. + /// + public class NetworkConnectionCollection : IEnumerable + { + #region Private Fields + + IEnumerable networkConnectionEnumerable; + + #endregion // Private Fields + + internal NetworkConnectionCollection(IEnumerable networkConnectionEnumerable) + { + this.networkConnectionEnumerable = networkConnectionEnumerable; + } + + #region IEnumerable Members + + /// + /// Returns the strongly typed enumerator for this collection. + /// + /// A object. + public IEnumerator GetEnumerator() + { + foreach (INetworkConnection networkConnection in networkConnectionEnumerable) + { + yield return new NetworkConnection(networkConnection); + } + } + + #endregion + + #region IEnumerable Members + + /// + /// Returns the enumerator for this collection. + /// + ///A object. + IEnumerator IEnumerable.GetEnumerator() + { + foreach (INetworkConnection networkConnection in networkConnectionEnumerable) + { + yield return new NetworkConnection(networkConnection); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Core/NetworkList/NetworkListEnums.cs b/Core/NetworkList/NetworkListEnums.cs new file mode 100644 index 0000000..1b14b50 --- /dev/null +++ b/Core/NetworkList/NetworkListEnums.cs @@ -0,0 +1,124 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +namespace Microsoft.WindowsAPICodePack.Net +{ + /// + /// Specifies types of network connectivity. + /// + [Flags] + public enum ConnectivityStates + { + /// + /// The underlying network interfaces have no + /// connectivity to any network. + /// + None = 0, + /// + /// There is connectivity to the Internet + /// using the IPv4 protocol. + /// + IPv4Internet = 0x40, + /// + /// There is connectivity to a routed network + /// using the IPv4 protocol. + /// + IPv4LocalNetwork = 0x20, + /// + /// There is connectivity to a network, but + /// the service cannot detect any IPv4 + /// network traffic. + /// + IPv4NoTraffic = 1, + /// + /// There is connectivity to the local + /// subnet using the IPv4 protocol. + /// + IPv4Subnet = 0x10, + /// + /// There is connectivity to the Internet + /// using the IPv4 protocol. + /// + IPv6Internet = 0x400, + /// + /// There is connectivity to a local + /// network using the IPv6 protocol. + /// + IPv6LocalNetwork = 0x200, + /// + /// There is connectivity to a network, + /// but the service cannot detect any + /// IPv6 network traffic + /// + IPv6NoTraffic = 2, + /// + /// There is connectivity to the local + /// subnet using the IPv6 protocol. + /// + IPv6Subnet = 0x100 + } + + /// + /// Specifies the domain type of a network. + /// + public enum DomainType + { + /// + /// The network is not an Active Directory network. + /// + NonDomainNetwork = 0, + /// + /// The network is an Active Directory network, but this machine is not authenticated against it. + /// + DomainNetwork = 1, + /// + /// The network is an Active Directory network, and this machine is authenticated against it. + /// + DomainAuthenticated = 2, + } + + /// + /// Specifies the trust level for a + /// network. + /// + public enum NetworkCategory + { + /// + /// The network is a public (untrusted) network. + /// + Public, + /// + /// The network is a private (trusted) network. + /// + Private, + /// + /// The network is authenticated against an Active Directory domain. + /// + Authenticated + } + + /// + /// Specifies the level of connectivity for + /// networks returned by the + /// + /// class. + /// + [Flags] + public enum NetworkConnectivityLevels + { + /// + /// Networks that the machine is connected to. + /// + Connected = 1, + /// + /// Networks that the machine is not connected to. + /// + Disconnected = 2, + /// + /// All networks. + /// + All = 3, + } + + +} diff --git a/Core/NetworkList/NetworkListManager.cs b/Core/NetworkList/NetworkListManager.cs new file mode 100644 index 0000000..808ed47 --- /dev/null +++ b/Core/NetworkList/NetworkListManager.cs @@ -0,0 +1,132 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Net +{ + /// + /// Provides access to objects that represent networks and network connections. + /// + public static class NetworkListManager + { + #region Private Fields + + static NetworkListManagerClass manager = new NetworkListManagerClass(); + + #endregion // Private Fields + + /// + /// Retrieves a collection of objects that represent the networks defined for this machine. + /// + /// + /// The that specify the connectivity level of the returned objects. + /// + /// + /// A of objects. + /// + public static NetworkCollection GetNetworks(NetworkConnectivityLevels level) + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + + return new NetworkCollection(manager.GetNetworks(level)); + } + + /// + /// Retrieves the identified by the specified network identifier. + /// + /// + /// A that specifies the unique identifier for the network. + /// + /// + /// The that represents the network identified by the identifier. + /// + public static Network GetNetwork(Guid networkId) + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + + return new Network(manager.GetNetwork(networkId)); + } + + /// + /// Retrieves a collection of objects that represent the connections for this machine. + /// + /// + /// A containing the network connections. + /// + public static NetworkConnectionCollection GetNetworkConnections() + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + + return new NetworkConnectionCollection(manager.GetNetworkConnections()); + } + + /// + /// Retrieves the identified by the specified connection identifier. + /// + /// + /// A that specifies the unique identifier for the network connection. + /// + /// + /// The identified by the specified identifier. + /// + public static NetworkConnection GetNetworkConnection(Guid networkConnectionId) + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + + return new NetworkConnection(manager.GetNetworkConnection(networkConnectionId)); + } + + /// + /// Gets a value that indicates whether this machine + /// has Internet connectivity. + /// + /// A value. + public static bool IsConnectedToInternet + { + get + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + + return manager.IsConnectedToInternet; + } + } + + /// + /// Gets a value that indicates whether this machine + /// has network connectivity. + /// + /// A value. + public static bool IsConnected + { + get + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + + return manager.IsConnected; + } + } + + /// + /// Gets the connectivity state of this machine. + /// + /// A value. + public static ConnectivityStates Connectivity + { + get + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + + return manager.GetConnectivity(); + } + } + } + +} \ No newline at end of file diff --git a/Core/PowerManagement/BatteryState.cs b/Core/PowerManagement/BatteryState.cs new file mode 100644 index 0000000..0ee82cf --- /dev/null +++ b/Core/PowerManagement/BatteryState.cs @@ -0,0 +1,113 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// A snapshot of the state of the battery. + /// + public class BatteryState + { + internal BatteryState() + { + var state = Power.GetSystemBatteryState(); + + if (!state.BatteryPresent) + { + throw new InvalidOperationException(LocalizedMessages.PowerManagerBatteryNotPresent); + } + + ACOnline = state.AcOnLine; + MaxCharge = (int)state.MaxCapacity; + CurrentCharge = (int)state.RemainingCapacity; + ChargeRate = (int)state.Rate; + + uint estimatedTime = state.EstimatedTime; + if (estimatedTime != uint.MaxValue) // uint.MaxValue signifies indefinite estimated time (plugged in) + { + EstimatedTimeRemaining = new TimeSpan(0, 0, (int)estimatedTime); + } + else + { + EstimatedTimeRemaining = TimeSpan.MaxValue; + } + + SuggestedCriticalBatteryCharge = (int)state.DefaultAlert1; + SuggestedBatteryWarningCharge = (int)state.DefaultAlert2; + } + + #region Public properties + + /// + /// Gets a value that indicates whether the battery charger is + /// operating on external power. + /// + /// A value. True indicates the battery charger is operating on AC power. + public bool ACOnline { get; private set; } + + /// + /// Gets the maximum charge of the battery (in mW). + /// + /// An value. + public int MaxCharge { get; private set; } + + /// + /// Gets the current charge of the battery (in mW). + /// + /// An value. + public int CurrentCharge { get; private set; } + /// + /// Gets the rate of discharge for the battery (in mW). + /// + /// + /// If plugged in, fully charged: DischargeRate = 0. + /// If plugged in, charging: DischargeRate = positive mW per hour. + /// If unplugged: DischargeRate = negative mW per hour. + /// + /// An value. + public int ChargeRate { get; private set; } + + /// + /// Gets the estimated time remaining until the battery is empty. + /// + /// A object. + public TimeSpan EstimatedTimeRemaining { get; private set; } + + /// + /// Gets the manufacturer's suggested battery charge level + /// that should cause a critical alert to be sent to the user. + /// + /// An value. + public int SuggestedCriticalBatteryCharge { get; private set; } + + /// + /// Gets the manufacturer's suggested battery charge level + /// that should cause a warning to be sent to the user. + /// + /// An value. + public int SuggestedBatteryWarningCharge { get; private set; } + + #endregion + + /// + /// Generates a string that represents this BatteryState object. + /// + /// A representation of this object's current state. + public override string ToString() + { + return string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.BatteryStateStringRepresentation, + Environment.NewLine, + ACOnline, + MaxCharge, + CurrentCharge, + ChargeRate, + EstimatedTimeRemaining, + SuggestedCriticalBatteryCharge, + SuggestedBatteryWarningCharge + ); + } + } +} diff --git a/Core/PowerManagement/EventManager.cs b/Core/PowerManagement/EventManager.cs new file mode 100644 index 0000000..c4449e5 --- /dev/null +++ b/Core/PowerManagement/EventManager.cs @@ -0,0 +1,91 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Threading; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// This class keeps track of the current state of each type of event. + /// The MessageManager class tracks event handlers. + /// This class only deals with each event type (i.e. + /// BatteryLifePercentChanged) as a whole. + /// + internal static class EventManager + { + // Prevents reading from PowerManager members while they are still null. + // MessageManager notifies the PowerManager that the member + // has been set and can be used. + internal static AutoResetEvent monitorOnReset = new AutoResetEvent(false); + + #region Hardcoded GUIDS for each event + + internal static readonly Guid PowerPersonalityChange = new Guid(0x245d8541, 0x3943, 0x4422, 0xb0, 0x25, 0x13, 0xA7, 0x84, 0xF6, 0x79, 0xB7); + internal static readonly Guid PowerSourceChange = new Guid(0x5d3e9a59, 0xe9D5, 0x4b00, 0xa6, 0xbd, 0xff, 0x34, 0xff, 0x51, 0x65, 0x48); + internal static readonly Guid BatteryCapacityChange = new Guid(0xa7ad8041, 0xb45a, 0x4cae, 0x87, 0xa3, 0xee, 0xcb, 0xb4, 0x68, 0xa9, 0xe1); + internal static readonly Guid BackgroundTaskNotification = new Guid(0x515c31d8, 0xf734, 0x163d, 0xa0, 0xfd, 0x11, 0xa0, 0x8c, 0x91, 0xe8, 0xf1); + internal static readonly Guid MonitorPowerStatus = new Guid(0x02731015, 0x4510, 0x4526, 0x99, 0xe6, 0xe5, 0xa1, 0x7e, 0xbd, 0x1a, 0xea); + + #endregion + + #region private static members + + // Used to catch the initial message Windows sends when + // you first register for a power notification. + // We do not want to fire any event handlers when this happens. + private static bool personalityCaught; + private static bool powerSrcCaught; + private static bool batteryLifeCaught; + private static bool monitorOnCaught; + + #endregion + + /// + /// Determines if a message should be caught, preventing + /// the event handler from executing. + /// This is needed when an event is initially registered. + /// + /// The event to check. + /// A boolean value. Returns true if the + /// message should be caught. + internal static bool IsMessageCaught(Guid eventGuid) + { + bool isMessageCaught = false; + + if (eventGuid == EventManager.BatteryCapacityChange) + { + if (!batteryLifeCaught) + { + batteryLifeCaught = true; + isMessageCaught = true; + } + } + else if (eventGuid == EventManager.MonitorPowerStatus) + { + if (!monitorOnCaught) + { + monitorOnCaught = true; + isMessageCaught = true; + } + } + else if (eventGuid == EventManager.PowerPersonalityChange) + { + if (!personalityCaught) + { + personalityCaught = true; + isMessageCaught = true; + } + } + else if (eventGuid == EventManager.PowerSourceChange) + { + if (!powerSrcCaught) + { + powerSrcCaught = true; + isMessageCaught = true; + } + } + + return isMessageCaught; + } + } +} diff --git a/Core/PowerManagement/ExecutionState.cs b/Core/PowerManagement/ExecutionState.cs new file mode 100644 index 0000000..bd2ce7f --- /dev/null +++ b/Core/PowerManagement/ExecutionState.cs @@ -0,0 +1,41 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// Enumeration of execution states. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags")] + [Flags] + public enum ExecutionStates + { + /// + /// No state configured. + /// + None = 0, + + /// + /// Forces the system to be in the working state by resetting the system idle timer. + /// + SystemRequired = 0x1, + + /// + /// Forces the display to be on by resetting the display idle timer. + /// + DisplayRequired = 0x2, + + /// + /// Enables away mode. This value must be specified with ES_CONTINUOUS. + /// Away mode should be used only by media-recording and media-distribution applications that must perform critical background processing on desktop computers while the computer appears to be sleeping. See Remarks. + /// + /// Windows Server 2003 and Windows XP/2000: ES_AWAYMODE_REQUIRED is not supported. + /// + AwayModeRequired = 0x40, + + /// + /// Informs the system that the state being set should remain in effect until the next call that uses ES_CONTINUOUS and one of the other state flags is cleared. + /// + Continuous = unchecked((int)0x80000000) + } +} diff --git a/Core/PowerManagement/MessageManager.cs b/Core/PowerManagement/MessageManager.cs new file mode 100644 index 0000000..eb656a5 --- /dev/null +++ b/Core/PowerManagement/MessageManager.cs @@ -0,0 +1,180 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Runtime.InteropServices; +using System.Threading; +using System.Windows.Forms; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// This class generates .NET events based on Windows messages. + /// The PowerRegWindow class processes the messages from Windows. + /// + internal static class MessageManager + { + private static object lockObject = new object(); + private static PowerRegWindow window; + + #region Internal static methods + + /// + /// Registers a callback for a power event. + /// + /// Guid for the event. + /// Event handler for the specified event. + internal static void RegisterPowerEvent(Guid eventId, EventHandler eventToRegister) + { + EnsureInitialized(); + window.RegisterPowerEvent(eventId, eventToRegister); + } + + /// + /// Unregisters an event handler for a power event. + /// + /// Guid for the event. + /// Event handler to unregister. + internal static void UnregisterPowerEvent(Guid eventId, EventHandler eventToUnregister) + { + EnsureInitialized(); + window.UnregisterPowerEvent(eventId, eventToUnregister); + } + + #endregion + + /// + /// Ensures that the hidden window is initialized and + /// listening for messages. + /// + private static void EnsureInitialized() + { + lock (lockObject) + { + if (window == null) + { + // Create a new hidden window to listen + // for power management related window messages. + window = new PowerRegWindow(); + } + } + } + + /// + /// Catch Windows messages and generates events for power specific + /// messages. + /// + internal class PowerRegWindow : Form + { + private Hashtable eventList = new Hashtable(); + private ReaderWriterLock readerWriterLock = new ReaderWriterLock(); + + internal PowerRegWindow() + : base() + { + + } + + #region Internal Methods + + /// + /// Adds an event handler to call when Windows sends + /// a message for an event. + /// + /// Guid for the event. + /// Event handler for the event. + internal void RegisterPowerEvent(Guid eventId, EventHandler eventToRegister) + { + readerWriterLock.AcquireWriterLock(Timeout.Infinite); + if (!eventList.Contains(eventId)) + { + Power.RegisterPowerSettingNotification(this.Handle, eventId); + ArrayList newList = new ArrayList(); + newList.Add(eventToRegister); + eventList.Add(eventId, newList); + } + else + { + ArrayList currList = (ArrayList)eventList[eventId]; + currList.Add(eventToRegister); + } + readerWriterLock.ReleaseWriterLock(); + } + + /// + /// Removes an event handler. + /// + /// Guid for the event. + /// Event handler to remove. + /// Cannot unregister + /// a function that is not registered. + internal void UnregisterPowerEvent(Guid eventId, EventHandler eventToUnregister) + { + readerWriterLock.AcquireWriterLock(Timeout.Infinite); + if (eventList.Contains(eventId)) + { + ArrayList currList = (ArrayList)eventList[eventId]; + currList.Remove(eventToUnregister); + } + else + { + throw new InvalidOperationException(LocalizedMessages.MessageManagerHandlerNotRegistered); + } + readerWriterLock.ReleaseWriterLock(); + } + + #endregion + + /// + /// Executes any registered event handlers. + /// + /// ArrayList of event handlers. + private static void ExecuteEvents(ArrayList eventHandlerList) + { + foreach (EventHandler handler in eventHandlerList) + { + handler.Invoke(null, new EventArgs()); + } + } + + /// + /// This method is called when a Windows message + /// is sent to this window. + /// The method calls the registered event handlers. + /// + protected override void WndProc(ref Message m) + { + // Make sure it is a Power Management message. + if (m.Msg == PowerManagementNativeMethods.PowerBroadcastMessage && + (int)m.WParam == PowerManagementNativeMethods.PowerSettingChangeMessage) + { + PowerManagementNativeMethods.PowerBroadcastSetting ps = + (PowerManagementNativeMethods.PowerBroadcastSetting)Marshal.PtrToStructure( + m.LParam, typeof(PowerManagementNativeMethods.PowerBroadcastSetting)); + + IntPtr pData = new IntPtr(m.LParam.ToInt64() + Marshal.SizeOf(ps)); + Guid currentEvent = ps.PowerSetting; + + // IsMonitorOn + if (ps.PowerSetting == EventManager.MonitorPowerStatus && + ps.DataLength == Marshal.SizeOf(typeof(Int32))) + { + Int32 monitorStatus = (Int32)Marshal.PtrToStructure(pData, typeof(Int32)); + PowerManager.IsMonitorOn = monitorStatus != 0; + EventManager.monitorOnReset.Set(); + } + + if (!EventManager.IsMessageCaught(currentEvent)) + { + ExecuteEvents((ArrayList)eventList[currentEvent]); + } + } + else + base.WndProc(ref m); + + } + + } + } +} diff --git a/Core/PowerManagement/PersonalityGuids.cs b/Core/PowerManagement/PersonalityGuids.cs new file mode 100644 index 0000000..30659a6 --- /dev/null +++ b/Core/PowerManagement/PersonalityGuids.cs @@ -0,0 +1,27 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + internal static class PowerPersonalityGuids + { + internal static readonly Guid HighPerformance = new Guid(0x8c5e7fda, 0xe8bf, 0x4a96, 0x9a, 0x85, 0xa6, 0xe2, 0x3a, 0x8c, 0x63, 0x5c); + internal static readonly Guid PowerSaver = new Guid(0xa1841308, 0x3541, 0x4fab, 0xbc, 0x81, 0xf7, 0x15, 0x56, 0xf2, 0x0b, 0x4a); + internal static readonly Guid Automatic = new Guid(0x381b4222, 0xf694, 0x41f0, 0x96, 0x85, 0xff, 0x5b, 0xb2, 0x60, 0xdf, 0x2e); + + internal static readonly Guid All = new Guid(0x68A1E95E, 0x13EA, 0x41E1, 0x80, 0x11, 0x0C, 0x49, 0x6C, 0xA4, 0x90, 0xB0); + + internal static PowerPersonality GuidToEnum(Guid guid) + { + if (guid == HighPerformance) + return PowerPersonality.HighPerformance; + else if (guid == PowerSaver) + return PowerPersonality.PowerSaver; + else if (guid == Automatic) + return PowerPersonality.Automatic; + else + return PowerPersonality.Unknown; + } + } +} diff --git a/Core/PowerManagement/Power.cs b/Core/PowerManagement/Power.cs new file mode 100644 index 0000000..c7488b2 --- /dev/null +++ b/Core/PowerManagement/Power.cs @@ -0,0 +1,72 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + internal static class Power + { + internal static PowerManagementNativeMethods.SystemPowerCapabilities + GetSystemPowerCapabilities() + { + PowerManagementNativeMethods.SystemPowerCapabilities powerCap; + + uint retval = PowerManagementNativeMethods.CallNtPowerInformation( + PowerManagementNativeMethods.PowerInformationLevel.SystemPowerCapabilities, + IntPtr.Zero, 0, out powerCap, + (UInt32)Marshal.SizeOf(typeof(PowerManagementNativeMethods.SystemPowerCapabilities)) + ); + + if (retval == CoreNativeMethods.StatusAccessDenied) + { + throw new UnauthorizedAccessException(LocalizedMessages.PowerInsufficientAccessCapabilities); + } + + return powerCap; + } + + internal static PowerManagementNativeMethods.SystemBatteryState GetSystemBatteryState() + { + PowerManagementNativeMethods.SystemBatteryState batteryState; + + uint retval = PowerManagementNativeMethods.CallNtPowerInformation( + PowerManagementNativeMethods.PowerInformationLevel.SystemBatteryState, + IntPtr.Zero, 0, out batteryState, + (UInt32)Marshal.SizeOf(typeof(PowerManagementNativeMethods.SystemBatteryState)) + ); + + if (retval == CoreNativeMethods.StatusAccessDenied) + { + throw new UnauthorizedAccessException(LocalizedMessages.PowerInsufficientAccessBatteryState); + } + + return batteryState; + } + + /// + /// Registers the application to receive power setting notifications + /// for the specific power setting event. + /// + /// Handle indicating where the power setting + /// notifications are to be sent. + /// The GUID of the power setting for + /// which notifications are to be sent. + /// Returns a notification handle for unregistering + /// power notifications. + internal static int RegisterPowerSettingNotification( + IntPtr handle, Guid powerSetting) + { + int outHandle = PowerManagementNativeMethods.RegisterPowerSettingNotification( + handle, + ref powerSetting, + 0); + + return outHandle; + } + } +} \ No newline at end of file diff --git a/Core/PowerManagement/PowerManager.cs b/Core/PowerManagement/PowerManager.cs new file mode 100644 index 0000000..731fda9 --- /dev/null +++ b/Core/PowerManagement/PowerManager.cs @@ -0,0 +1,404 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics.CodeAnalysis; +using Microsoft.WindowsAPICodePack.Resources; +using MS.WindowsAPICodePack.Internal; +using System.ComponentModel; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// Enables registration for + /// power-related event notifications and provides access to power settings. + /// + public static class PowerManager + { + private static bool? isMonitorOn; + private static bool monitorRequired; + private static bool requestBlockSleep; + + private static readonly object monitoronlock = new object(); + + + #region Notifications + + /// + /// Raised each time the active power scheme changes. + /// + /// The event handler specified for removal was not registered. + /// Requires Vista/Windows Server 2008. + public static event EventHandler PowerPersonalityChanged + { + add + { + + + MessageManager.RegisterPowerEvent( + EventManager.PowerPersonalityChange, value); + } + + remove + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.UnregisterPowerEvent( + EventManager.PowerPersonalityChange, value); + } + } + + /// + /// Raised when the power source changes. + /// + /// The event handler specified for removal was not registered. + /// Requires Vista/Windows Server 2008. + public static event EventHandler PowerSourceChanged + { + add + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.RegisterPowerEvent( + EventManager.PowerSourceChange, value); + } + + remove + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.UnregisterPowerEvent( + EventManager.PowerSourceChange, value); + } + } + + /// + /// Raised when the remaining battery life changes. + /// + /// The event handler specified for removal was not registered. + /// Requires Vista/Windows Server 2008. + public static event EventHandler BatteryLifePercentChanged + { + add + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.RegisterPowerEvent( + EventManager.BatteryCapacityChange, value); + } + remove + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.UnregisterPowerEvent( + EventManager.BatteryCapacityChange, value); + } + } + + /// + /// Raised when the monitor status changes. + /// + /// The event handler specified for removal was not registered. + /// Requires Vista/Windows Server 2008. + public static event EventHandler IsMonitorOnChanged + { + add + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.RegisterPowerEvent( + EventManager.MonitorPowerStatus, value); + } + remove + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.UnregisterPowerEvent( + EventManager.MonitorPowerStatus, value); + } + } + + /// + /// Raised when the system will not be moving into an idle + /// state in the near future so applications should + /// perform any tasks that + /// would otherwise prevent the computer from entering an idle state. + /// + /// The event handler specified for removal was not registered. + /// Requires Vista/Windows Server 2008. + public static event EventHandler SystemBusyChanged + { + add + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.RegisterPowerEvent( + EventManager.BackgroundTaskNotification, value); + } + remove + { + CoreHelpers.ThrowIfNotVista(); + + MessageManager.UnregisterPowerEvent( + EventManager.BackgroundTaskNotification, value); + } + } + #endregion + + /// + /// Gets a snapshot of the current battery state. + /// + /// A instance that represents + /// the state of the battery at the time this method was called. + /// The system does not have a battery. + /// Requires XP/Windows Server 2003 or higher. + public static BatteryState GetCurrentBatteryState() + { + CoreHelpers.ThrowIfNotXP(); + return new BatteryState(); + } + + #region Power System Properties + + /// + /// Gets or sets a value that indicates whether the monitor is + /// set to remain active. + /// + /// Requires XP/Windows Server 2003 or higher. + /// The caller does not have sufficient privileges to set this property. + /// + /// This information is typically used by applications + /// that display information but do not require + /// user interaction. For example, video playback applications. + /// to set this property. Demand value: ; Named Permission Sets: FullTrust. + /// A value. True if the monitor + /// is required to remain on. + public static bool MonitorRequired + { + get + { + CoreHelpers.ThrowIfNotXP(); + return monitorRequired; + } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] + set + { + CoreHelpers.ThrowIfNotXP(); + + if (value) + { + PowerManager.SetThreadExecutionState(ExecutionStates.Continuous | ExecutionStates.DisplayRequired); + } + else + { + PowerManager.SetThreadExecutionState(ExecutionStates.Continuous); + } + + monitorRequired = value; + } + } + + /// + /// Gets or sets a value that indicates whether the system + /// is required to be in the working state. + /// + /// Requires XP/Windows Server 2003 or higher. + /// The caller does not have sufficient privileges to set this property. + /// + /// to set this property. Demand value: ; Named Permission Sets: FullTrust. + /// A value. + public static bool RequestBlockSleep + { + get + { + CoreHelpers.ThrowIfNotXP(); + + return requestBlockSleep; + } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] + set + { + CoreHelpers.ThrowIfNotXP(); + + if (value) + PowerManager.SetThreadExecutionState(ExecutionStates.Continuous | ExecutionStates.SystemRequired); + else + PowerManager.SetThreadExecutionState(ExecutionStates.Continuous); + + requestBlockSleep = value; + } + } + + /// + /// Gets a value that indicates whether a battery is present. + /// The battery can be a short term battery. + /// + /// Requires XP/Windows Server 2003 or higher. + /// A value. + public static bool IsBatteryPresent + { + get + { + CoreHelpers.ThrowIfNotXP(); + + return Power.GetSystemBatteryState().BatteryPresent; + } + } + + /// + /// Gets a value that indicates whether the battery is a short term battery. + /// + /// Requires XP/Windows Server 2003 or higher. + /// A value. + public static bool IsBatteryShortTerm + { + get + { + CoreHelpers.ThrowIfNotXP(); + return Power.GetSystemPowerCapabilities().BatteriesAreShortTerm; + } + } + + /// + /// Gets a value that indicates a UPS is present to prevent + /// sudden loss of power. + /// + /// Requires XP/Windows Server 2003 or higher. + /// A value. + public static bool IsUpsPresent + { + get + { + CoreHelpers.ThrowIfNotXP(); + + // Because the native method doesn't return the correct value for .UpsPresent, + // use .BatteriesAreShortTerm and .SystemBatteriesPresent to check for UPS + PowerManagementNativeMethods.SystemPowerCapabilities batt = Power.GetSystemPowerCapabilities(); + + return (batt.BatteriesAreShortTerm && batt.SystemBatteriesPresent); + } + } + + /// + /// Gets a value that indicates the current power scheme. + /// + /// Requires Vista/Windows Server 2008. + /// A value. + public static PowerPersonality PowerPersonality + { + get + { + Guid guid; + PowerManagementNativeMethods.PowerGetActiveScheme(IntPtr.Zero, out guid); + + try + { + return PowerPersonalityGuids.GuidToEnum(guid); + } + finally + { + CoreNativeMethods.LocalFree(ref guid); + } + } + } + + + + /// + /// Gets a value that indicates the remaining battery life + /// (as a percentage of the full battery charge). + /// This value is in the range 0-100, + /// where 0 is not charged and 100 is fully charged. + /// + /// The system does not have a battery. + /// Requires Vista/Windows Server 2008. + /// An value. + public static int BatteryLifePercent + { + get + { + // Because of the way this value is being calculated, it should not be limited to granularity + // as the data from the event (old way) was. + CoreHelpers.ThrowIfNotVista(); + if (!Power.GetSystemBatteryState().BatteryPresent) + throw new InvalidOperationException(LocalizedMessages.PowerManagerBatteryNotPresent); + + var state = Power.GetSystemBatteryState(); + + int percent = (int)Math.Round(((double)state.RemainingCapacity / state.MaxCapacity * 100), 0); + return percent; + } + } + + /// + /// Gets a value that indictates whether the monitor is on. + /// + /// Requires Vista/Windows Server 2008. + /// A value. + public static bool IsMonitorOn + { + get + { + CoreHelpers.ThrowIfNotVista(); + + lock (monitoronlock) + { + if (isMonitorOn == null) + { + EventHandler dummy = delegate(object sender, EventArgs args) { }; + IsMonitorOnChanged += dummy; + // Wait until Windows updates the power source + // (through RegisterPowerSettingNotification) + EventManager.monitorOnReset.WaitOne(); + } + } + + return (bool)isMonitorOn; + } + internal set { isMonitorOn = value; } + } + + /// + /// Gets the current power source. + /// + /// Requires Vista/Windows Server 2008. + /// A value. + public static PowerSource PowerSource + { + get + { + CoreHelpers.ThrowIfNotVista(); + + if (IsUpsPresent) + { + return PowerSource.Ups; + } + + if (!IsBatteryPresent || GetCurrentBatteryState().ACOnline) + { + return PowerSource.AC; + } + + return PowerSource.Battery; + } + } + #endregion + + /// + /// Allows an application to inform the system that it + /// is in use, thereby preventing the system from entering + /// the sleeping power state or turning off the display + /// while the application is running. + /// + /// The thread's execution requirements. + /// Thrown if the SetThreadExecutionState call fails. + public static void SetThreadExecutionState(ExecutionStates executionStateOptions) + { + ExecutionStates ret = PowerManagementNativeMethods.SetThreadExecutionState(executionStateOptions); + if (ret == ExecutionStates.None) + { + throw new Win32Exception(LocalizedMessages.PowerExecutionStateFailed); + } + } + + } +} diff --git a/Core/PowerManagement/PowerManagerException.cs b/Core/PowerManagement/PowerManagerException.cs new file mode 100644 index 0000000..725e46c --- /dev/null +++ b/Core/PowerManagement/PowerManagerException.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// This exception is thrown when there are problems with getting piece of data within PowerManager. + /// + [Serializable] + public class PowerManagerException : Exception + { + /// + /// Default constructor. + /// + public PowerManagerException() { } + + /// + /// Initializes an excpetion with a custom message. + /// + /// A custom message for the exception. + public PowerManagerException(string message) : base(message) { } + + /// + /// Initializes an exception with custom message and inner exception. + /// + /// A custom message for the exception. + /// An inner exception on which to base this exception. + public PowerManagerException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes an exception from serialization info and a context. + /// + /// SerializationInfo for the exception. + /// StreamingContext for the exception. + protected PowerManagerException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + } +} diff --git a/Core/PowerManagement/PowerPersonality.cs b/Core/PowerManagement/PowerPersonality.cs new file mode 100644 index 0000000..8eb4cc9 --- /dev/null +++ b/Core/PowerManagement/PowerPersonality.cs @@ -0,0 +1,33 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// Specifies the supported power personalities. + /// + public enum PowerPersonality + { + /// + /// The power personality Guid does not match a known value. + /// + Unknown, + /// + /// Power settings designed to deliver maximum performance + /// at the expense of power consumption savings. + /// + HighPerformance, + + /// + /// Power settings designed consume minimum power + /// at the expense of system performance and responsiveness. + /// + PowerSaver, + + /// + /// Power settings designed to balance performance + /// and power consumption. + /// + Automatic + } + +} diff --git a/Core/PowerManagement/PowerSource.cs b/Core/PowerManagement/PowerSource.cs new file mode 100644 index 0000000..b38ce3c --- /dev/null +++ b/Core/PowerManagement/PowerSource.cs @@ -0,0 +1,34 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.ApplicationServices +{ + /// + /// Specifies the power source currently supplying power to the system. + /// + /// Application should be aware of the power source because + /// some power sources provide a finite power supply. + /// An application might take steps to conserve power while + /// the system is using such a source. + /// + public enum PowerSource + { + /// + /// The computer is powered by an AC power source + /// or a similar device, such as a laptop powered + /// by a 12V automotive adapter. + /// + AC = 0, + /// + /// The computer is powered by a built-in battery. + /// A battery has a limited + /// amount of power; applications should conserve resources + /// where possible. + /// + Battery = 1, + /// + /// The computer is powered by a short-term power source + /// such as a UPS device. + /// + Ups = 2 + } +} diff --git a/Core/Properties/AssemblyInfo.cs b/Core/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..58b5bbb --- /dev/null +++ b/Core/Properties/AssemblyInfo.cs @@ -0,0 +1,43 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft.WindowsAPICodePack")] +[assembly: AssemblyDescription("WindowsAPICodePack Core")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Microsoft Windows API Code Pack for .NET Framework")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + + +[assembly: InternalsVisibleTo("Microsoft.WindowsAPICodePack.Shell")] +[assembly: InternalsVisibleTo("Microsoft.WindowsAPICodePack.Sensors")] +[assembly: InternalsVisibleTo("Microsoft.WindowsAPICodePack.ShellExtensions")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ac9740bc-3035-43ee-9a68-1dde36ab1f5e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: NeutralResourcesLanguageAttribute("en")] diff --git a/Core/PropertySystem/PropVariant.cs b/Core/PropertySystem/PropVariant.cs new file mode 100644 index 0000000..cab1623 --- /dev/null +++ b/Core/PropertySystem/PropVariant.cs @@ -0,0 +1,808 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Resources; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; + +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// Represents the OLE struct PROPVARIANT. + /// This class is intended for internal use only. + /// + /// + /// Originally sourced from http://blogs.msdn.com/adamroot/pages/interop-with-propvariants-in-net.aspx + /// and modified to support additional types including vectors and ability to set values + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1900:ValueTypeFieldsShouldBePortable", MessageId = "_ptr2")] + [StructLayout(LayoutKind.Explicit)] + public sealed class PropVariant : IDisposable + { + #region Vector Action Cache + + // A static dictionary of delegates to get data from array's contained within PropVariants + private static Dictionary> _vectorActions = null; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] + private static Dictionary> GenerateVectorActions() + { + Dictionary> cache = new Dictionary>(); + + cache.Add(typeof(Int16), (pv, array, i) => + { + short val; + PropVariantNativeMethods.PropVariantGetInt16Elem(pv, i, out val); + array.SetValue(val, i); + }); + + cache.Add(typeof(UInt16), (pv, array, i) => + { + ushort val; + PropVariantNativeMethods.PropVariantGetUInt16Elem(pv, i, out val); + array.SetValue(val, i); + }); + + cache.Add(typeof(Int32), (pv, array, i) => + { + int val; + PropVariantNativeMethods.PropVariantGetInt32Elem(pv, i, out val); + array.SetValue(val, i); + }); + + cache.Add(typeof(UInt32), (pv, array, i) => + { + uint val; + PropVariantNativeMethods.PropVariantGetUInt32Elem(pv, i, out val); + array.SetValue(val, i); + }); + + cache.Add(typeof(Int64), (pv, array, i) => + { + long val; + PropVariantNativeMethods.PropVariantGetInt64Elem(pv, i, out val); + array.SetValue(val, i); + }); + + cache.Add(typeof(UInt64), (pv, array, i) => + { + ulong val; + PropVariantNativeMethods.PropVariantGetUInt64Elem(pv, i, out val); + array.SetValue(val, i); + }); + + cache.Add(typeof(DateTime), (pv, array, i) => + { + System.Runtime.InteropServices.ComTypes.FILETIME val; + PropVariantNativeMethods.PropVariantGetFileTimeElem(pv, i, out val); + + long fileTime = GetFileTimeAsLong(ref val); + + array.SetValue(DateTime.FromFileTime(fileTime), i); + }); + + cache.Add(typeof(Boolean), (pv, array, i) => + { + bool val; + PropVariantNativeMethods.PropVariantGetBooleanElem(pv, i, out val); + array.SetValue(val, i); + }); + + cache.Add(typeof(Double), (pv, array, i) => + { + double val; + PropVariantNativeMethods.PropVariantGetDoubleElem(pv, i, out val); + array.SetValue(val, i); + }); + + cache.Add(typeof(Single), (pv, array, i) => // float + { + float[] val = new float[1]; + Marshal.Copy(pv._ptr2, val, (int)i, 1); + array.SetValue(val[0], (int)i); + }); + + cache.Add(typeof(Decimal), (pv, array, i) => + { + int[] val = new int[4]; + for (int a = 0; a < val.Length; a++) + { + val[a] = Marshal.ReadInt32(pv._ptr2, + (int)i * sizeof(decimal) + a * sizeof(int)); //index * size + offset quarter + } + array.SetValue(new decimal(val), i); + }); + + cache.Add(typeof(String), (pv, array, i) => + { + string val = string.Empty; + PropVariantNativeMethods.PropVariantGetStringElem(pv, i, ref val); + array.SetValue(val, i); + }); + + return cache; + } + #endregion + + #region Dynamic Construction / Factory (Expressions) + + /// + /// Attempts to create a PropVariant by finding an appropriate constructor. + /// + /// Object from which PropVariant should be created. + public static PropVariant FromObject(object value) + { + if (value == null) + { + return new PropVariant(); + } + else + { + var func = GetDynamicConstructor(value.GetType()); + return func(value); + } + } + + // A dictionary and lock to contain compiled expression trees for constructors + private static Dictionary> _cache = new Dictionary>(); + private static object _padlock = new object(); + + // Retrieves a cached constructor expression. + // If no constructor has been cached, it attempts to find/add it. If it cannot be found + // an exception is thrown. + // This method looks for a public constructor with the same parameter type as the object. + private static Func GetDynamicConstructor(Type type) + { + lock (_padlock) + { + // initial check, if action is found, return it + Func action; + if (!_cache.TryGetValue(type, out action)) + { + // iterates through all constructors + ConstructorInfo constructor = typeof(PropVariant) + .GetConstructor(new Type[] { type }); + + if (constructor == null) + { // if the method was not found, throw. + throw new ArgumentException(LocalizedMessages.PropVariantTypeNotSupported); + } + else // if the method was found, create an expression to call it. + { + // create parameters to action + var arg = Expression.Parameter(typeof(object), "arg"); + + // create an expression to invoke the constructor with an argument cast to the correct type + var create = Expression.New(constructor, Expression.Convert(arg, type)); + + // compiles expression into an action delegate + action = Expression.Lambda>(create, arg).Compile(); + _cache.Add(type, action); + } + } + return action; + } + } + + #endregion + + #region Fields + + [FieldOffset(0)] + decimal _decimal; + + // This is actually a VarEnum value, but the VarEnum type + // requires 4 bytes instead of the expected 2. + [FieldOffset(0)] + ushort _valueType; + + // Reserved Fields + //[FieldOffset(2)] + //ushort _wReserved1; + //[FieldOffset(4)] + //ushort _wReserved2; + //[FieldOffset(6)] + //ushort _wReserved3; + + // In order to allow x64 compat, we need to allow for + // expansion of the IntPtr. However, the BLOB struct + // uses a 4-byte int, followed by an IntPtr, so + // although the valueData field catches most pointer values, + // we need an additional 4-bytes to get the BLOB + // pointer. The valueDataExt field provides this, as well as + // the last 4-bytes of an 8-byte value on 32-bit + // architectures. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] + [FieldOffset(12)] + IntPtr _ptr2; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] + [FieldOffset(8)] + IntPtr _ptr; + [FieldOffset(8)] + Int32 _int32; + [FieldOffset(8)] + UInt32 _uint32; + [FieldOffset(8)] + byte _byte; + [FieldOffset(8)] + sbyte _sbyte; + [FieldOffset(8)] + short _short; + [FieldOffset(8)] + ushort _ushort; + [FieldOffset(8)] + long _long; + [FieldOffset(8)] + ulong _ulong; + [FieldOffset(8)] + double _double; + [FieldOffset(8)] + float _float; + + #endregion // struct fields + + #region Constructors + + /// + /// Default constrcutor + /// + public PropVariant() + { + // left empty + } + + /// + /// Set a string value + /// + public PropVariant(string value) + { + if (value == null) + { + throw new ArgumentException(LocalizedMessages.PropVariantNullString, "value"); + } + + _valueType = (ushort)VarEnum.VT_LPWSTR; + _ptr = Marshal.StringToCoTaskMemUni(value); + } + + /// + /// Set a string vector + /// + public PropVariant(string[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromStringVector(value, (uint)value.Length, this); + } + + /// + /// Set a bool vector + /// + public PropVariant(bool[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromBooleanVector(value, (uint)value.Length, this); + } + + /// + /// Set a short vector + /// + public PropVariant(short[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromInt16Vector(value, (uint)value.Length, this); + } + + /// + /// Set a short vector + /// + public PropVariant(ushort[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromUInt16Vector(value, (uint)value.Length, this); + + } + + /// + /// Set an int vector + /// + public PropVariant(int[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromInt32Vector(value, (uint)value.Length, this); + } + + /// + /// Set an uint vector + /// + public PropVariant(uint[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromUInt32Vector(value, (uint)value.Length, this); + } + + /// + /// Set a long vector + /// + public PropVariant(long[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromInt64Vector(value, (uint)value.Length, this); + } + + /// + /// Set a ulong vector + /// + public PropVariant(ulong[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromUInt64Vector(value, (uint)value.Length, this); + } + + /// > + /// Set a double vector + /// + public PropVariant(double[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + PropVariantNativeMethods.InitPropVariantFromDoubleVector(value, (uint)value.Length, this); + } + + + /// + /// Set a DateTime vector + /// + public PropVariant(DateTime[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + System.Runtime.InteropServices.ComTypes.FILETIME[] fileTimeArr = + new System.Runtime.InteropServices.ComTypes.FILETIME[value.Length]; + + for (int i = 0; i < value.Length; i++) + { + fileTimeArr[i] = DateTimeToFileTime(value[i]); + } + + PropVariantNativeMethods.InitPropVariantFromFileTimeVector(fileTimeArr, (uint)fileTimeArr.Length, this); + } + + /// + /// Set a bool value + /// + public PropVariant(bool value) + { + _valueType = (ushort)VarEnum.VT_BOOL; + _int32 = (value == true) ? -1 : 0; + } + + /// + /// Set a DateTime value + /// + public PropVariant(DateTime value) + { + _valueType = (ushort)VarEnum.VT_FILETIME; + + System.Runtime.InteropServices.ComTypes.FILETIME ft = DateTimeToFileTime(value); + PropVariantNativeMethods.InitPropVariantFromFileTime(ref ft, this); + } + + + /// + /// Set a byte value + /// + public PropVariant(byte value) + { + _valueType = (ushort)VarEnum.VT_UI1; + _byte = value; + } + + /// + /// Set a sbyte value + /// + public PropVariant(sbyte value) + { + _valueType = (ushort)VarEnum.VT_I1; + _sbyte = value; + } + + /// + /// Set a short value + /// + public PropVariant(short value) + { + _valueType = (ushort)VarEnum.VT_I2; + _short = value; + } + + /// + /// Set an unsigned short value + /// + public PropVariant(ushort value) + { + _valueType = (ushort)VarEnum.VT_UI2; + _ushort = value; + } + + /// + /// Set an int value + /// + public PropVariant(int value) + { + _valueType = (ushort)VarEnum.VT_I4; + _int32 = value; + } + + /// + /// Set an unsigned int value + /// + public PropVariant(uint value) + { + _valueType = (ushort)VarEnum.VT_UI4; + _uint32 = value; + } + + /// + /// Set a decimal value + /// + public PropVariant(decimal value) + { + _decimal = value; + + // It is critical that the value type be set after the decimal value, because they overlap. + // If valuetype is written first, its value will be lost when _decimal is written. + _valueType = (ushort)VarEnum.VT_DECIMAL; + } + + /// + /// Create a PropVariant with a contained decimal array. + /// + /// Decimal array to wrap. + public PropVariant(decimal[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + _valueType = (ushort)(VarEnum.VT_DECIMAL | VarEnum.VT_VECTOR); + _int32 = value.Length; + + // allocate required memory for array with 128bit elements + _ptr2 = Marshal.AllocCoTaskMem(value.Length * sizeof(decimal)); + for (int i = 0; i < value.Length; i++) + { + int[] bits = decimal.GetBits(value[i]); + Marshal.Copy(bits, 0, _ptr2, bits.Length); + } + } + + /// + /// Create a PropVariant containing a float type. + /// + public PropVariant(float value) + { + _valueType = (ushort)VarEnum.VT_R4; + + _float = value; + } + + /// + /// Creates a PropVariant containing a float[] array. + /// + public PropVariant(float[] value) + { + if (value == null) { throw new ArgumentNullException("value"); } + + _valueType = (ushort)(VarEnum.VT_R4 | VarEnum.VT_VECTOR); + _int32 = value.Length; + + _ptr2 = Marshal.AllocCoTaskMem(value.Length * sizeof(float)); + + Marshal.Copy(value, 0, _ptr2, value.Length); + } + + /// + /// Set a long + /// + public PropVariant(long value) + { + _long = value; + _valueType = (ushort)VarEnum.VT_I8; + } + + /// + /// Set a ulong + /// + public PropVariant(ulong value) + { + _valueType = (ushort)VarEnum.VT_UI8; + _ulong = value; + } + + /// + /// Set a double + /// + public PropVariant(double value) + { + _valueType = (ushort)VarEnum.VT_R8; + _double = value; + } + + #endregion + + #region Uncalled methods - These are currently not called, but I think may be valid in the future. + + /// + /// Set an IUnknown value + /// + /// The new value to set. + internal void SetIUnknown(object value) + { + _valueType = (ushort)VarEnum.VT_UNKNOWN; + _ptr = Marshal.GetIUnknownForObject(value); + } + + + /// + /// Set a safe array value + /// + /// The new value to set. + internal void SetSafeArray(Array array) + { + if (array == null) { throw new ArgumentNullException("array"); } + const ushort vtUnknown = 13; + IntPtr psa = PropVariantNativeMethods.SafeArrayCreateVector(vtUnknown, 0, (uint)array.Length); + + IntPtr pvData = PropVariantNativeMethods.SafeArrayAccessData(psa); + try // to remember to release lock on data + { + for (int i = 0; i < array.Length; ++i) + { + object obj = array.GetValue(i); + IntPtr punk = (obj != null) ? Marshal.GetIUnknownForObject(obj) : IntPtr.Zero; + Marshal.WriteIntPtr(pvData, i * IntPtr.Size, punk); + } + } + finally + { + PropVariantNativeMethods.SafeArrayUnaccessData(psa); + } + + _valueType = (ushort)VarEnum.VT_ARRAY | (ushort)VarEnum.VT_UNKNOWN; + _ptr = psa; + } + + #endregion + + #region public Properties + + /// + /// Gets or sets the variant type. + /// + public VarEnum VarType + { + get { return (VarEnum)_valueType; } + set { _valueType = (ushort)value; } + } + + /// + /// Checks if this has an empty or null value + /// + /// + public bool IsNullOrEmpty + { + get + { + return (_valueType == (ushort)VarEnum.VT_EMPTY || _valueType == (ushort)VarEnum.VT_NULL); + } + } + + /// + /// Gets the variant value. + /// + public object Value + { + get + { + switch ((VarEnum)_valueType) + { + case VarEnum.VT_I1: + return _sbyte; + case VarEnum.VT_UI1: + return _byte; + case VarEnum.VT_I2: + return _short; + case VarEnum.VT_UI2: + return _ushort; + case VarEnum.VT_I4: + case VarEnum.VT_INT: + return _int32; + case VarEnum.VT_UI4: + case VarEnum.VT_UINT: + return _uint32; + case VarEnum.VT_I8: + return _long; + case VarEnum.VT_UI8: + return _ulong; + case VarEnum.VT_R4: + return _float; + case VarEnum.VT_R8: + return _double; + case VarEnum.VT_BOOL: + return _int32 == -1; + case VarEnum.VT_ERROR: + return _long; + case VarEnum.VT_CY: + return _decimal; + case VarEnum.VT_DATE: + return DateTime.FromOADate(_double); + case VarEnum.VT_FILETIME: + return DateTime.FromFileTime(_long); + case VarEnum.VT_BSTR: + return Marshal.PtrToStringBSTR(_ptr); + case VarEnum.VT_BLOB: + return GetBlobData(); + case VarEnum.VT_LPSTR: + return Marshal.PtrToStringAnsi(_ptr); + case VarEnum.VT_LPWSTR: + return Marshal.PtrToStringUni(_ptr); + case VarEnum.VT_UNKNOWN: + return Marshal.GetObjectForIUnknown(_ptr); + case VarEnum.VT_DISPATCH: + return Marshal.GetObjectForIUnknown(_ptr); + case VarEnum.VT_DECIMAL: + return _decimal; + case VarEnum.VT_ARRAY | VarEnum.VT_UNKNOWN: + return CrackSingleDimSafeArray(_ptr); + case (VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_I2): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_UI2): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_I4): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_UI4): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_I8): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_UI8): + return GetVector(); + case (VarEnum.VT_VECTOR|VarEnum.VT_R4): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_R8): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_BOOL): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_FILETIME): + return GetVector(); + case (VarEnum.VT_VECTOR | VarEnum.VT_DECIMAL): + return GetVector(); + default: + // if the value cannot be marshaled + return null; + } + } + } + + #endregion + + #region Private Methods + + private static long GetFileTimeAsLong(ref System.Runtime.InteropServices.ComTypes.FILETIME val) + { + return (((long)val.dwHighDateTime) << 32) + val.dwLowDateTime; + } + + private static System.Runtime.InteropServices.ComTypes.FILETIME DateTimeToFileTime(DateTime value) + { + long hFT = value.ToFileTime(); + System.Runtime.InteropServices.ComTypes.FILETIME ft = + new System.Runtime.InteropServices.ComTypes.FILETIME(); + ft.dwLowDateTime = (int)(hFT & 0xFFFFFFFF); + ft.dwHighDateTime = (int)(hFT >> 32); + return ft; + } + + private object GetBlobData() + { + byte[] blobData = new byte[_int32]; + + IntPtr pBlobData = _ptr2; + Marshal.Copy(pBlobData, blobData, 0, _int32); + + return blobData; + } + + private Array GetVector() + { + int count = PropVariantNativeMethods.PropVariantGetElementCount(this); + if (count <= 0) { return null; } + + lock (_padlock) + { + if (_vectorActions == null) + { + _vectorActions = GenerateVectorActions(); + } + } + + Action action; + if (!_vectorActions.TryGetValue(typeof(T), out action)) + { + throw new InvalidCastException(LocalizedMessages.PropVariantUnsupportedType); + } + + Array array = new T[count]; + for (uint i = 0; i < count; i++) + { + action(this, array, i); + } + + return array; + } + + private static Array CrackSingleDimSafeArray(IntPtr psa) + { + uint cDims = PropVariantNativeMethods.SafeArrayGetDim(psa); + if (cDims != 1) + throw new ArgumentException(LocalizedMessages.PropVariantMultiDimArray, "psa"); + + int lBound = PropVariantNativeMethods.SafeArrayGetLBound(psa, 1U); + int uBound = PropVariantNativeMethods.SafeArrayGetUBound(psa, 1U); + + int n = uBound - lBound + 1; // uBound is inclusive + + object[] array = new object[n]; + for (int i = lBound; i <= uBound; ++i) + { + array[i] = PropVariantNativeMethods.SafeArrayGetElement(psa, ref i); + } + + return array; + } + + #endregion + + #region IDisposable Members + + /// + /// Disposes the object, calls the clear function. + /// + public void Dispose() + { + PropVariantNativeMethods.PropVariantClear(this); + + GC.SuppressFinalize(this); + } + + /// + /// Finalizer + /// + ~PropVariant() + { + Dispose(); + } + + #endregion + + /// + /// Provides an simple string representation of the contained data and type. + /// + /// + public override string ToString() + { + return string.Format(System.Globalization.CultureInfo.InvariantCulture, + "{0}: {1}", Value, VarType.ToString()); + } + + } + +} diff --git a/Core/PropertySystem/PropVariantNativeMethods.cs b/Core/PropertySystem/PropVariantNativeMethods.cs new file mode 100644 index 0000000..a685ffb --- /dev/null +++ b/Core/PropertySystem/PropVariantNativeMethods.cs @@ -0,0 +1,107 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + internal static class PropVariantNativeMethods + { + [DllImport("Ole32.dll", PreserveSig = false)] // returns hresult + internal extern static void PropVariantClear([In, Out] PropVariant pvar); + + [DllImport("OleAut32.dll", PreserveSig = true)] // psa is actually returned, not hresult + internal extern static IntPtr SafeArrayCreateVector(ushort vt, int lowerBound, uint cElems); + + [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult + internal extern static IntPtr SafeArrayAccessData(IntPtr psa); + + [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult + internal extern static void SafeArrayUnaccessData(IntPtr psa); + + [DllImport("OleAut32.dll", PreserveSig = true)] // retuns uint32 + internal extern static uint SafeArrayGetDim(IntPtr psa); + + [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult + internal extern static int SafeArrayGetLBound(IntPtr psa, uint nDim); + + [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult + internal extern static int SafeArrayGetUBound(IntPtr psa, uint nDim); + + // This decl for SafeArrayGetElement is only valid for cDims==1! + [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult + [return: MarshalAs(UnmanagedType.IUnknown)] + internal extern static object SafeArrayGetElement(IntPtr psa, ref int rgIndices); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromPropVariantVectorElem([In] PropVariant propvarIn, uint iElem, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromFileTime([In] ref System.Runtime.InteropServices.ComTypes.FILETIME pftIn, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [return: MarshalAs(UnmanagedType.I4)] + internal static extern int PropVariantGetElementCount([In] PropVariant propVar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetBooleanElem([In] PropVariant propVar, [In]uint iElem, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetInt16Elem([In] PropVariant propVar, [In] uint iElem, [Out] out short pnVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetUInt16Elem([In] PropVariant propVar, [In] uint iElem, [Out] out ushort pnVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetInt32Elem([In] PropVariant propVar, [In] uint iElem, [Out] out int pnVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetUInt32Elem([In] PropVariant propVar, [In] uint iElem, [Out] out uint pnVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetInt64Elem([In] PropVariant propVar, [In] uint iElem, [Out] out Int64 pnVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetUInt64Elem([In] PropVariant propVar, [In] uint iElem, [Out] out UInt64 pnVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetDoubleElem([In] PropVariant propVar, [In] uint iElem, [Out] out double pnVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetFileTimeElem([In] PropVariant propVar, [In] uint iElem, [Out, MarshalAs(UnmanagedType.Struct)] out System.Runtime.InteropServices.ComTypes.FILETIME pftVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void PropVariantGetStringElem([In] PropVariant propVar, [In] uint iElem, [MarshalAs(UnmanagedType.LPWStr)] ref string ppszVal); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromBooleanVector([In, MarshalAs(UnmanagedType.LPArray)] bool[] prgf, uint cElems, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromInt16Vector([In, Out] Int16[] prgn, uint cElems, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromUInt16Vector([In, Out] UInt16[] prgn, uint cElems, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromInt32Vector([In, Out] Int32[] prgn, uint cElems, [Out] PropVariant propVar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromUInt32Vector([In, Out] UInt32[] prgn, uint cElems, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromInt64Vector([In, Out] Int64[] prgn, uint cElems, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromUInt64Vector([In, Out] UInt64[] prgn, uint cElems, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromDoubleVector([In, Out] double[] prgn, uint cElems, [Out] PropVariant propvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromFileTimeVector([In, Out] System.Runtime.InteropServices.ComTypes.FILETIME[] prgft, uint cElems, [Out] PropVariant ppropvar); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)] + internal static extern void InitPropVariantFromStringVector([In, Out] string[] prgsz, uint cElems, [Out] PropVariant ppropvar); + } +} diff --git a/Core/PropertySystem/PropertyKey.cs b/Core/PropertySystem/PropertyKey.cs new file mode 100644 index 0000000..474668a --- /dev/null +++ b/Core/PropertySystem/PropertyKey.cs @@ -0,0 +1,150 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Defines a unique key for a Shell Property + /// + [StructLayout(LayoutKind.Sequential, Pack = 4)] + public struct PropertyKey : IEquatable + { + #region Private Fields + + private Guid formatId; + private Int32 propertyId; + + #endregion + + #region Public Properties + /// + /// A unique GUID for the property + /// + public Guid FormatId + { + get + { + return formatId; + } + } + + /// + /// Property identifier (PID) + /// + public Int32 PropertyId + { + get + { + return propertyId; + } + } + + #endregion + + #region Public Construction + + /// + /// PropertyKey Constructor + /// + /// A unique GUID for the property + /// Property identifier (PID) + public PropertyKey(Guid formatId, Int32 propertyId) + { + this.formatId = formatId; + this.propertyId = propertyId; + } + + /// + /// PropertyKey Constructor + /// + /// A string represenstion of a GUID for the property + /// Property identifier (PID) + public PropertyKey(string formatId, Int32 propertyId) + { + this.formatId = new Guid(formatId); + this.propertyId = propertyId; + } + + #endregion + + #region IEquatable Members + + /// + /// Returns whether this object is equal to another. This is vital for performance of value types. + /// + /// The object to compare against. + /// Equality result. + public bool Equals(PropertyKey other) + { + return other.Equals((object)this); + } + + #endregion + + #region equality and hashing + + /// + /// Returns the hash code of the object. This is vital for performance of value types. + /// + /// + public override int GetHashCode() + { + return formatId.GetHashCode() ^ propertyId; + } + + /// + /// Returns whether this object is equal to another. This is vital for performance of value types. + /// + /// The object to compare against. + /// Equality result. + public override bool Equals(object obj) + { + if (obj == null) + return false; + + if (!(obj is PropertyKey)) + return false; + + PropertyKey other = (PropertyKey)obj; + return other.formatId.Equals(formatId) && (other.propertyId == propertyId); + } + + /// + /// Implements the == (equality) operator. + /// + /// First property key to compare. + /// Second property key to compare. + /// true if object a equals object b. false otherwise. + public static bool operator ==(PropertyKey propKey1, PropertyKey propKey2) + { + return propKey1.Equals(propKey2); + } + + /// + /// Implements the != (inequality) operator. + /// + /// First property key to compare + /// Second property key to compare. + /// true if object a does not equal object b. false otherwise. + public static bool operator !=(PropertyKey propKey1, PropertyKey propKey2) + { + return !propKey1.Equals(propKey2); + } + + /// + /// Override ToString() to provide a user friendly string representation + /// + /// String representing the property key + public override string ToString() + { + return string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.PropertyKeyFormatString, + formatId.ToString("B"), propertyId); + } + + #endregion + } +} diff --git a/Core/Resources/LocalizedMessages.Designer.cs b/Core/Resources/LocalizedMessages.Designer.cs new file mode 100644 index 0000000..4a8de63 --- /dev/null +++ b/Core/Resources/LocalizedMessages.Designer.cs @@ -0,0 +1,675 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.WindowsAPICodePack.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class LocalizedMessages { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal LocalizedMessages() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WindowsAPICodePack.Resources.LocalizedMessages", typeof(LocalizedMessages).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Failed to register application for restart due to bad parameters.. + /// + internal static string ApplicationRecoverFailedToRegisterForRestartBadParameters { + get { + return ResourceManager.GetString("ApplicationRecoverFailedToRegisterForRestartBadParameters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Application was not registered for recovery due to bad parameters.. + /// + internal static string ApplicationRecoveryBadParameters { + get { + return ResourceManager.GetString("ApplicationRecoveryBadParameters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Application failed to register for recovery.. + /// + internal static string ApplicationRecoveryFailedToRegister { + get { + return ResourceManager.GetString("ApplicationRecoveryFailedToRegister", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Application failed to registered for restart.. + /// + internal static string ApplicationRecoveryFailedToRegisterForRestart { + get { + return ResourceManager.GetString("ApplicationRecoveryFailedToRegisterForRestart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unregister for recovery failed.. + /// + internal static string ApplicationRecoveryFailedToUnregister { + get { + return ResourceManager.GetString("ApplicationRecoveryFailedToUnregister", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unregister for restart failed.. + /// + internal static string ApplicationRecoveryFailedToUnregisterForRestart { + get { + return ResourceManager.GetString("ApplicationRecoveryFailedToUnregisterForRestart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This method must be called from the registered callback method.. + /// + internal static string ApplicationRecoveryMustBeCalledFromCallback { + get { + return ResourceManager.GetString("ApplicationRecoveryMustBeCalledFromCallback", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ACOnline: {1}{0}Max Charge: {2} mWh{0}Current Charge: {3} mWh{0}Discharge Rate: {4} mWh{0}Estimated Time Remaining: {5}{0}Suggested Critical Battery Charge: {6} mWh{0}Suggested Battery Warning Charge: {7} mWh{0}. + /// + internal static string BatteryStateStringRepresentation { + get { + return ResourceManager.GetString("BatteryStateStringRepresentation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cancelable cannot be changed while dialog is showing.. + /// + internal static string CancelableCannotBeChanged { + get { + return ResourceManager.GetString("CancelableCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog caption cannot be changed while dialog is showing.. + /// + internal static string CaptionCannotBeChanged { + get { + return ResourceManager.GetString("CaptionCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CheckBox text cannot be changed while dialog is showing.. + /// + internal static string CheckBoxCannotBeChanged { + get { + return ResourceManager.GetString("CheckBoxCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Collapsed control text cannot be changed while dialog is showing.. + /// + internal static string CollapsedTextCannotBeChanged { + get { + return ResourceManager.GetString("CollapsedTextCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Only supported on Windows 7 or newer.. + /// + internal static string CoreHelpersRunningOn7 { + get { + return ResourceManager.GetString("CoreHelpersRunningOn7", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Only supported on Windows Vista or newer.. + /// + internal static string CoreHelpersRunningOnVista { + get { + return ResourceManager.GetString("CoreHelpersRunningOnVista", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Only supported on Windows XP or newer.. + /// + internal static string CoreHelpersRunningOnXp { + get { + return ResourceManager.GetString("CoreHelpersRunningOnXp", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog cannot have more than one control with the same name.. + /// + internal static string DialogCollectionCannotHaveDuplicateNames { + get { + return ResourceManager.GetString("DialogCollectionCannotHaveDuplicateNames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog control must be removed from current collections first.. + /// + internal static string DialogCollectionControlAlreadyHosted { + get { + return ResourceManager.GetString("DialogCollectionControlAlreadyHosted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Control name cannot be null or zero length.. + /// + internal static string DialogCollectionControlNameNull { + get { + return ResourceManager.GetString("DialogCollectionControlNameNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Modifying controls collection while dialog is showing is not supported.. + /// + internal static string DialogCollectionModifyShowingDialog { + get { + return ResourceManager.GetString("DialogCollectionModifyShowingDialog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog control name cannot be empty or null.. + /// + internal static string DialogControlNameCannotBeEmpty { + get { + return ResourceManager.GetString("DialogControlNameCannotBeEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog controls cannot be renamed.. + /// + internal static string DialogControlsCannotBeRenamed { + get { + return ResourceManager.GetString("DialogControlsCannotBeRenamed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Application. + /// + internal static string DialogDefaultCaption { + get { + return ResourceManager.GetString("DialogDefaultCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to . + /// + internal static string DialogDefaultContent { + get { + return ResourceManager.GetString("DialogDefaultContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to . + /// + internal static string DialogDefaultMainInstruction { + get { + return ResourceManager.GetString("DialogDefaultMainInstruction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expanded information mode cannot be changed while dialog is showing.. + /// + internal static string ExpandedDetailsCannotBeChanged { + get { + return ResourceManager.GetString("ExpandedDetailsCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expanded control label cannot be changed while dialog is showing.. + /// + internal static string ExpandedLabelCannotBeChanged { + get { + return ResourceManager.GetString("ExpandedLabelCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expanding state of the dialog cannot be changed while dialog is showing.. + /// + internal static string ExpandingStateCannotBeChanged { + get { + return ResourceManager.GetString("ExpandingStateCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hyperlinks cannot be enabled/disabled while dialog is showing.. + /// + internal static string HyperlinksCannotBetSet { + get { + return ResourceManager.GetString("HyperlinksCannotBetSet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Reference path is invalid.. + /// + internal static string InvalidReferencePath { + get { + return ResourceManager.GetString("InvalidReferencePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified event handler has not been registered.. + /// + internal static string MessageManagerHandlerNotRegistered { + get { + return ResourceManager.GetString("MessageManagerHandlerNotRegistered", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An error has occurred in dialog configuration.. + /// + internal static string NativeTaskDialogConfigurationError { + get { + return ResourceManager.GetString("NativeTaskDialogConfigurationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid arguments to Win32 call.. + /// + internal static string NativeTaskDialogInternalErrorArgs { + get { + return ResourceManager.GetString("NativeTaskDialogInternalErrorArgs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog contents too complex.. + /// + internal static string NativeTaskDialogInternalErrorComplex { + get { + return ResourceManager.GetString("NativeTaskDialogInternalErrorComplex", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An unexpected internal error occurred in the Win32 call: {0:x}. + /// + internal static string NativeTaskDialogInternalErrorUnexpected { + get { + return ResourceManager.GetString("NativeTaskDialogInternalErrorUnexpected", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory.. + /// + internal static string NativeTaskDialogVersionError { + get { + return ResourceManager.GetString("NativeTaskDialogVersionError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog owner cannot be changed while dialog is showing.. + /// + internal static string OwnerCannotBeChanged { + get { + return ResourceManager.GetString("OwnerCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SetThreadExecutionState call failed.. + /// + internal static string PowerExecutionStateFailed { + get { + return ResourceManager.GetString("PowerExecutionStateFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The caller had insufficient access rights to get the system battery state.. + /// + internal static string PowerInsufficientAccessBatteryState { + get { + return ResourceManager.GetString("PowerInsufficientAccessBatteryState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The caller had insufficient access rights to get the system power capabilities.. + /// + internal static string PowerInsufficientAccessCapabilities { + get { + return ResourceManager.GetString("PowerInsufficientAccessCapabilities", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to get active power scheme.. + /// + internal static string PowerManagerActiveSchemeFailed { + get { + return ResourceManager.GetString("PowerManagerActiveSchemeFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Battery is not present on this system.. + /// + internal static string PowerManagerBatteryNotPresent { + get { + return ResourceManager.GetString("PowerManagerBatteryNotPresent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Progress bar cannot be changed while dialog is showing.. + /// + internal static string ProgressBarCannotBeChanged { + get { + return ResourceManager.GetString("ProgressBarCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Progress bar cannot be hosted in multiple dialogs.. + /// + internal static string ProgressBarCannotBeHostedInMultipleDialogs { + get { + return ResourceManager.GetString("ProgressBarCannotBeHostedInMultipleDialogs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}, {1}. + /// + internal static string PropertyKeyFormatString { + get { + return ResourceManager.GetString("PropertyKeyFormatString", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to initialize PropVariant.. + /// + internal static string PropVariantInitializationError { + get { + return ResourceManager.GetString("PropVariantInitializationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multi-dimensional SafeArrays not supported.. + /// + internal static string PropVariantMultiDimArray { + get { + return ResourceManager.GetString("PropVariantMultiDimArray", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to String argument cannot be null or empty.. + /// + internal static string PropVariantNullString { + get { + return ResourceManager.GetString("PropVariantNullString", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This Value type is not supported.. + /// + internal static string PropVariantTypeNotSupported { + get { + return ResourceManager.GetString("PropVariantTypeNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot be cast to unsupported type.. + /// + internal static string PropVariantUnsupportedType { + get { + return ResourceManager.GetString("PropVariantUnsupportedType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to delegate: {0}, state: {1}, ping: {2}. + /// + internal static string RecoverySettingsFormatString { + get { + return ResourceManager.GetString("RecoverySettingsFormatString", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to command: {0} restrictions: {1}. + /// + internal static string RestartSettingsFormatString { + get { + return ResourceManager.GetString("RestartSettingsFormatString", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to StandardButtons cannot be changed while dialog is showing.. + /// + internal static string StandardButtonsCannotBeChanged { + get { + return ResourceManager.GetString("StandardButtonsCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Startup location cannot be changed while dialog is showing.. + /// + internal static string StartupLocationCannotBeChanged { + get { + return ResourceManager.GetString("StartupLocationCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bad button ID in closing event.. + /// + internal static string TaskDialogBadButtonId { + get { + return ResourceManager.GetString("TaskDialogBadButtonId", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Button text must be non-empty.. + /// + internal static string TaskDialogButtonTextEmpty { + get { + return ResourceManager.GetString("TaskDialogButtonTextEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Check box text must be provided to enable the dialog check box.. + /// + internal static string TaskDialogCheckBoxTextRequiredToEnableCheckBox { + get { + return ResourceManager.GetString("TaskDialogCheckBoxTextRequiredToEnableCheckBox", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Attempting to close a non-showing dialog.. + /// + internal static string TaskDialogCloseNonShowing { + get { + return ResourceManager.GetString("TaskDialogCloseNonShowing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Application. + /// + internal static string TaskDialogDefaultCaption { + get { + return ResourceManager.GetString("TaskDialogDefaultCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to . + /// + internal static string TaskDialogDefaultContent { + get { + return ResourceManager.GetString("TaskDialogDefaultContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to . + /// + internal static string TaskDialogDefaultMainInstruction { + get { + return ResourceManager.GetString("TaskDialogDefaultMainInstruction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot have more than one default button of a given type.. + /// + internal static string TaskDialogOnlyOneDefaultControl { + get { + return ResourceManager.GetString("TaskDialogOnlyOneDefaultControl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Maximum value provided must be greater than the minimum value.. + /// + internal static string TaskDialogProgressBarMaxValueGreaterThanMin { + get { + return ResourceManager.GetString("TaskDialogProgressBarMaxValueGreaterThanMin", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Minimum value provided must be a positive number.. + /// + internal static string TaskDialogProgressBarMinValueGreaterThanZero { + get { + return ResourceManager.GetString("TaskDialogProgressBarMinValueGreaterThanZero", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Minimum value provided must less than the maximum value.. + /// + internal static string TaskDialogProgressBarMinValueLessThanMax { + get { + return ResourceManager.GetString("TaskDialogProgressBarMinValueLessThanMax", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Value provided must be greater than equal to the minimum value and less than the maximum value.. + /// + internal static string TaskDialogProgressBarValueInRange { + get { + return ResourceManager.GetString("TaskDialogProgressBarValueInRange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog cannot display both non-standard buttons and standard buttons.. + /// + internal static string TaskDialogSupportedButtonsAndButtons { + get { + return ResourceManager.GetString("TaskDialogSupportedButtonsAndButtons", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog cannot display both non-standard buttons and command links.. + /// + internal static string TaskDialogSupportedButtonsAndLinks { + get { + return ResourceManager.GetString("TaskDialogSupportedButtonsAndLinks", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unknown dialog control type.. + /// + internal static string TaskDialogUnkownControl { + get { + return ResourceManager.GetString("TaskDialogUnkownControl", resourceCulture); + } + } + } +} diff --git a/Core/Resources/LocalizedMessages.resx b/Core/Resources/LocalizedMessages.resx new file mode 100644 index 0000000..40600e1 --- /dev/null +++ b/Core/Resources/LocalizedMessages.resx @@ -0,0 +1,324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Failed to register application for restart due to bad parameters. + + + Application was not registered for recovery due to bad parameters. + + + Application failed to register for recovery. + + + Application failed to registered for restart. + + + Unregister for recovery failed. + + + Unregister for restart failed. + + + This method must be called from the registered callback method. + + + ACOnline: {1}{0}Max Charge: {2} mWh{0}Current Charge: {3} mWh{0}Discharge Rate: {4} mWh{0}Estimated Time Remaining: {5}{0}Suggested Critical Battery Charge: {6} mWh{0}Suggested Battery Warning Charge: {7} mWh{0} + + + Cancelable cannot be changed while dialog is showing. + + + Dialog caption cannot be changed while dialog is showing. + + + CheckBox text cannot be changed while dialog is showing. + + + Collapsed control text cannot be changed while dialog is showing. + + + Only supported on Windows 7 or newer. + + + Only supported on Windows Vista or newer. + + + Only supported on Windows XP or newer. + + + Dialog cannot have more than one control with the same name. + + + Dialog control must be removed from current collections first. + + + Control name cannot be null or zero length. + + + Modifying controls collection while dialog is showing is not supported. + + + Dialog control name cannot be empty or null. + + + Dialog controls cannot be renamed. + + + Application + + + + + + + + + Expanded information mode cannot be changed while dialog is showing. + + + Expanded control label cannot be changed while dialog is showing. + + + Expanding state of the dialog cannot be changed while dialog is showing. + + + Hyperlinks cannot be enabled/disabled while dialog is showing. + + + Reference path is invalid. + + + The specified event handler has not been registered. + + + An error has occurred in dialog configuration. + + + Invalid arguments to Win32 call. + + + Dialog contents too complex. + + + An unexpected internal error occurred in the Win32 call: {0:x} + + + TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory. + + + Dialog owner cannot be changed while dialog is showing. + + + SetThreadExecutionState call failed. + + + The caller had insufficient access rights to get the system battery state. + + + The caller had insufficient access rights to get the system power capabilities. + + + Battery is not present on this system. + + + Progress bar cannot be changed while dialog is showing. + + + Progress bar cannot be hosted in multiple dialogs. + + + {0}, {1} + + + Multi-dimensional SafeArrays not supported. + + + String argument cannot be null or empty. + + + This Value type is not supported. + + + delegate: {0}, state: {1}, ping: {2} + + + command: {0} restrictions: {1} + + + StandardButtons cannot be changed while dialog is showing. + + + Startup location cannot be changed while dialog is showing. + + + Bad button ID in closing event. + + + Button text must be non-empty. + + + Check box text must be provided to enable the dialog check box. + + + Attempting to close a non-showing dialog. + + + Application + + + + + + + + + Cannot have more than one default button of a given type. + + + Maximum value provided must be greater than the minimum value. + + + Minimum value provided must be a positive number. + + + Minimum value provided must less than the maximum value. + + + Value provided must be greater than equal to the minimum value and less than the maximum value. + + + Dialog cannot display both non-standard buttons and standard buttons. + + + Dialog cannot display both non-standard buttons and command links. + + + Unknown dialog control type. + + + Unable to initialize PropVariant. + + + Failed to get active power scheme. + + + Cannot be cast to unsupported type. + + \ No newline at end of file diff --git a/Core/SafeHandles/SafeIconHandle.cs b/Core/SafeHandles/SafeIconHandle.cs new file mode 100644 index 0000000..33c9122 --- /dev/null +++ b/Core/SafeHandles/SafeIconHandle.cs @@ -0,0 +1,26 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// Safe Icon Handle + /// + public class SafeIconHandle : ZeroInvalidHandle + { + /// + /// Release the handle + /// + /// true if handled is release successfully, false otherwise + protected override bool ReleaseHandle() + { + if (CoreNativeMethods.DestroyIcon(handle)) + { + return true; + } + else + { + return false; + } + } + } +} diff --git a/Core/SafeHandles/SafeRegionHandle.cs b/Core/SafeHandles/SafeRegionHandle.cs new file mode 100644 index 0000000..1c341c0 --- /dev/null +++ b/Core/SafeHandles/SafeRegionHandle.cs @@ -0,0 +1,27 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Security.Permissions; +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// Safe Region Handle + /// + public class SafeRegionHandle : ZeroInvalidHandle + { + /// + /// Release the handle + /// + /// true if handled is release successfully, false otherwise + protected override bool ReleaseHandle() + { + if (CoreNativeMethods.DeleteObject(handle)) + { + return true; + } + else + { + return false; + } + } + } +} diff --git a/Core/SafeHandles/SafeWindowHandle.cs b/Core/SafeHandles/SafeWindowHandle.cs new file mode 100644 index 0000000..9f65eb5 --- /dev/null +++ b/Core/SafeHandles/SafeWindowHandle.cs @@ -0,0 +1,32 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Security.Permissions; +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// Safe Window Handle + /// + public class SafeWindowHandle : ZeroInvalidHandle + { + /// + /// Release the handle + /// + /// true if handled is release successfully, false otherwise + protected override bool ReleaseHandle() + { + if (IsInvalid) + { + return true; + } + + if (CoreNativeMethods.DestroyWindow(handle) != 0) + { + return true; + } + else + { + return false; + } + } + } +} diff --git a/Core/SafeHandles/ZeroInvalidHandle.cs b/Core/SafeHandles/ZeroInvalidHandle.cs new file mode 100644 index 0000000..7619741 --- /dev/null +++ b/Core/SafeHandles/ZeroInvalidHandle.cs @@ -0,0 +1,32 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using System.Security.Permissions; + +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// Base class for Safe handles with Null IntPtr as invalid + /// + public abstract class ZeroInvalidHandle : SafeHandle + { + /// + /// Default constructor + /// + protected ZeroInvalidHandle() + : base(IntPtr.Zero, true) + { + } + + /// + /// Determines if this is a valid handle + /// + public override bool IsInvalid + { + get { return handle == IntPtr.Zero; } + } + + } +} + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..8410937 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,4 @@ + +SUBDIRS = \ + Core \ + Shell diff --git a/Shell/Common/DefaultShellImageSizes.cs b/Shell/Common/DefaultShellImageSizes.cs new file mode 100644 index 0000000..8c94f47 --- /dev/null +++ b/Shell/Common/DefaultShellImageSizes.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Defines the read-only properties for default shell icon sizes. + /// + public static class DefaultIconSize + { + /// + /// The small size property for a 16x16 pixel Shell Icon. + /// + public static readonly System.Windows.Size Small = new System.Windows.Size(16, 16); + + /// + /// The medium size property for a 32x32 pixel Shell Icon. + /// + public static readonly System.Windows.Size Medium = new System.Windows.Size(32, 32); + + /// + /// The large size property for a 48x48 pixel Shell Icon. + /// + public static readonly System.Windows.Size Large = new System.Windows.Size(48, 48); + + /// + /// The extra-large size property for a 256x256 pixel Shell Icon. + /// + public static readonly System.Windows.Size ExtraLarge = new System.Windows.Size(256, 256); + + /// + /// The maximum size for a Shell Icon, 256x256 pixels. + /// + public static readonly System.Windows.Size Maximum = new System.Windows.Size(256, 256); + + } + + /// + /// Defines the read-only properties for default shell thumbnail sizes. + /// + public static class DefaultThumbnailSize + { + /// + /// Gets the small size property for a 32x32 pixel Shell Thumbnail. + /// + public static readonly System.Windows.Size Small = new System.Windows.Size(32, 32); + + /// + /// Gets the medium size property for a 96x96 pixel Shell Thumbnail. + /// + public static readonly System.Windows.Size Medium = new System.Windows.Size(96, 96); + + /// + /// Gets the large size property for a 256x256 pixel Shell Thumbnail. + /// + public static readonly System.Windows.Size Large = new System.Windows.Size(256, 256); + + /// + /// Gets the extra-large size property for a 1024x1024 pixel Shell Thumbnail. + /// + public static readonly System.Windows.Size ExtraLarge = new System.Windows.Size(1024, 1024); + + /// + /// Maximum size for the Shell Thumbnail, 1024x1024 pixels. + /// + public static readonly System.Windows.Size Maximum = new System.Windows.Size(1024, 1024); + } +} diff --git a/Shell/Common/EnumUnknown.cs b/Shell/Common/EnumUnknown.cs new file mode 100644 index 0000000..5368349 --- /dev/null +++ b/Shell/Common/EnumUnknown.cs @@ -0,0 +1,63 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal class EnumUnknownClass : IEnumUnknown + { + List conditionList = new List(); + int current = -1; + + internal EnumUnknownClass(ICondition[] conditions) + { + conditionList.AddRange(conditions); + } + + #region IEnumUnknown Members + + public HResult Next(uint requestedNumber, ref IntPtr buffer, ref uint fetchedNumber) + { + current++; + + if (current < conditionList.Count) + { + buffer = Marshal.GetIUnknownForObject(conditionList[current]); + fetchedNumber = 1; + return HResult.Ok; + } + + return HResult.False; + } + + public HResult Skip(uint number) + { + int temp = current + (int)number; + + if (temp > (conditionList.Count - 1)) + { + return HResult.False; + } + + current = temp; + return HResult.Ok; + } + + public HResult Reset() + { + current = -1; + return HResult.Ok; + } + + public HResult Clone(out IEnumUnknown result) + { + result = new EnumUnknownClass(this.conditionList.ToArray()); + return HResult.Ok; + } + + #endregion + } +} \ No newline at end of file diff --git a/Shell/Common/EventHandlerExtensionMethods.cs b/Shell/Common/EventHandlerExtensionMethods.cs new file mode 100644 index 0000000..bc324f1 --- /dev/null +++ b/Shell/Common/EventHandlerExtensionMethods.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Diagnostics; +using System.Threading; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Provides extension methods for raising events safely. + /// + public static class EventHandlerExtensionMethods + { + /// + /// Safely raises an event using EventArgs.Empty + /// + /// EventHandler to raise + /// Event sender + public static void SafeRaise(this EventHandler eventHandler, object sender) + { + if (eventHandler != null) + { + eventHandler(sender, EventArgs.Empty); + } + } + + /// + /// Safely raises an event. + /// + /// Type of event args + /// EventHandler<T> to raise + /// Event sender + /// Event args + public static void SafeRaise(this EventHandler eventHandler, object sender, T args) where T : EventArgs + { + if (eventHandler != null) + { + eventHandler(sender, args); + } + } + + /// + /// Safely raises an event using EventArgs.Empty + /// + /// EventHandler<EventArgs> to raise + /// Event sender + public static void SafeRaise(this EventHandler eventHandler, object sender) + { + SafeRaise(eventHandler, sender, EventArgs.Empty); + } + } +} diff --git a/Shell/Common/IconReference.cs b/Shell/Common/IconReference.cs new file mode 100644 index 0000000..9ddcf9b --- /dev/null +++ b/Shell/Common/IconReference.cs @@ -0,0 +1,168 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using Microsoft.WindowsAPICodePack.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// A refence to an icon resource + /// + public struct IconReference + { + #region Private members + + private string moduleName; + private string referencePath; + static private char[] commaSeparator = new char[] { ',' }; + + #endregion + + /// + /// Overloaded constructor takes in the module name and resource id for the icon reference. + /// + /// String specifying the name of an executable file, DLL, or icon file + /// Zero-based index of the icon + public IconReference(string moduleName, int resourceId) + : this() + { + if (string.IsNullOrEmpty(moduleName)) + { + throw new ArgumentNullException("moduleName"); + } + + this.moduleName = moduleName; + ResourceId = resourceId; + referencePath = string.Format(System.Globalization.CultureInfo.InvariantCulture, + "{0},{1}", moduleName, resourceId); + } + + /// + /// Overloaded constructor takes in the module name and resource id separated by a comma. + /// + /// Reference path for the icon consiting of the module name and resource id. + public IconReference(string refPath) + : this() + { + if (string.IsNullOrEmpty(refPath)) + { + throw new ArgumentNullException("refPath"); + } + + string[] refParams = refPath.Split(commaSeparator); + + if (refParams.Length != 2 || string.IsNullOrEmpty(refParams[0]) || string.IsNullOrEmpty(refParams[1])) + { + throw new ArgumentException(LocalizedMessages.InvalidReferencePath, "refPath"); + } + + moduleName = refParams[0]; + ResourceId = int.Parse(refParams[1], System.Globalization.CultureInfo.InvariantCulture); + + this.referencePath = refPath; + } + + /// + /// String specifying the name of an executable file, DLL, or icon file + /// + public string ModuleName + { + get + { + return moduleName; + } + set + { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value"); + } + moduleName = value; + } + } + + /// + /// Zero-based index of the icon + /// + public int ResourceId { get; set; } + + /// + /// Reference to a specific icon within a EXE, DLL or icon file. + /// + public string ReferencePath + { + get + { + return referencePath; + } + set + { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value"); + } + + string[] refParams = value.Split(commaSeparator); + + if (refParams.Length != 2 || string.IsNullOrEmpty(refParams[0]) || string.IsNullOrEmpty(refParams[1])) + { + throw new ArgumentException(LocalizedMessages.InvalidReferencePath, "value"); + } + + ModuleName = refParams[0]; + ResourceId = int.Parse(refParams[1], System.Globalization.CultureInfo.InvariantCulture); + + referencePath = value; + } + } + + /// + /// Implements the == (equality) operator. + /// + /// First object to compare. + /// Second object to compare. + /// True if icon1 equals icon1; false otherwise. + public static bool operator ==(IconReference icon1, IconReference icon2) + { + return (icon1.moduleName == icon2.moduleName) && + (icon1.referencePath == icon2.referencePath) && + (icon1.ResourceId == icon2.ResourceId); + } + + /// + /// Implements the != (unequality) operator. + /// + /// First object to compare. + /// Second object to compare. + /// True if icon1 does not equals icon1; false otherwise. + public static bool operator !=(IconReference icon1, IconReference icon2) + { + return !(icon1 == icon2); + } + + /// + /// Determines if this object is equal to another. + /// + /// The object to compare + /// Returns true if the objects are equal; false otherwise. + public override bool Equals(object obj) + { + if (obj == null || !(obj is IconReference)) { return false; } + return (this == (IconReference)obj); + } + + /// + /// Generates a nearly unique hashcode for this structure. + /// + /// A hash code. + public override int GetHashCode() + { + int hash = this.moduleName.GetHashCode(); + hash = hash * 31 + this.referencePath.GetHashCode(); + hash = hash * 31 + this.ResourceId.GetHashCode(); + return hash; + } + + } + +} diff --git a/Shell/Common/NativePoint.cs b/Shell/Common/NativePoint.cs new file mode 100644 index 0000000..fae3e25 --- /dev/null +++ b/Shell/Common/NativePoint.cs @@ -0,0 +1,78 @@ +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// A wrapper for the native POINT structure. + /// + [StructLayout(LayoutKind.Sequential)] + public struct NativePoint + { + /// + /// Initialize the NativePoint + /// + /// The x coordinate of the point. + /// The y coordinate of the point. + public NativePoint(int x, int y) + : this() + { + X = x; + Y = y; + } + + /// + /// The X coordinate of the point + /// + public int X { get; set; } + + /// + /// The Y coordinate of the point + /// + public int Y { get; set; } + + /// + /// Determines if two NativePoints are equal. + /// + /// First NativePoint + /// Second NativePoint + /// True if first NativePoint is equal to the second; false otherwise. + public static bool operator ==(NativePoint first, NativePoint second) + { + return first.X == second.X + && first.Y == second.Y; + } + + /// + /// Determines if two NativePoints are not equal. + /// + /// First NativePoint + /// Second NativePoint + /// True if first NativePoint is not equal to the second; false otherwise. + public static bool operator !=(NativePoint first, NativePoint second) + { + return !(first == second); + } + + /// + /// Determines if this NativePoint is equal to another. + /// + /// Another NativePoint to compare + /// True if this NativePoint is equal obj; false otherwise. + public override bool Equals(object obj) + { + return (obj != null && obj is NativePoint) ? this == (NativePoint)obj : false; + } + + /// + /// Gets a hash code for the NativePoint. + /// + /// Hash code for the NativePoint + public override int GetHashCode() + { + int hash = X.GetHashCode(); + hash = hash * 31 + Y.GetHashCode(); + return hash; + } + } + +} diff --git a/Shell/Common/NativeRect.cs b/Shell/Common/NativeRect.cs new file mode 100644 index 0000000..fea2364 --- /dev/null +++ b/Shell/Common/NativeRect.cs @@ -0,0 +1,96 @@ +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// A wrapper for a RECT struct + /// + [StructLayout(LayoutKind.Sequential)] + public struct NativeRect + { + /// + /// Position of left edge + /// + public int Left { get; set; } + + /// + /// Position of top edge + /// + public int Top { get; set; } + + /// + /// Position of right edge + /// + public int Right { get; set; } + + /// + /// Position of bottom edge + /// + public int Bottom { get; set; } + + /// + /// Creates a new NativeRect initialized with supplied values. + /// + /// Position of left edge + /// Position of top edge + /// Position of right edge + /// Position of bottom edge + public NativeRect(int left, int top, int right, int bottom) + : this() + { + Left = left; + Top = top; + Right = right; + Bottom = bottom; + } + + /// + /// Determines if two NativeRects are equal. + /// + /// First NativeRect + /// Second NativeRect + /// True if first NativeRect is equal to second; false otherwise. + public static bool operator ==(NativeRect first, NativeRect second) + { + return first.Left == second.Left + && first.Top == second.Top + && first.Right == second.Right + && first.Bottom == second.Bottom; + } + + /// + /// Determines if two NativeRects are not equal + /// + /// First NativeRect + /// Second NativeRect + /// True if first is not equal to second; false otherwise. + public static bool operator !=(NativeRect first, NativeRect second) + { + return !(first == second); + } + + /// + /// Determines if the NativeRect is equal to another Rect. + /// + /// Another NativeRect to compare + /// True if this NativeRect is equal to the one provided; false otherwise. + public override bool Equals(object obj) + { + return (obj != null && obj is NativeRect) ? this == (NativeRect)obj : false; + } + + /// + /// Creates a hash code for the NativeRect + /// + /// Returns hash code for this NativeRect + public override int GetHashCode() + { + int hash = Left.GetHashCode(); + hash = hash * 31 + Top.GetHashCode(); + hash = hash * 31 + Right.GetHashCode(); + hash = hash * 31 + Bottom.GetHashCode(); + return hash; + } + } + +} diff --git a/Shell/Common/SearchCondition.cs b/Shell/Common/SearchCondition.cs new file mode 100644 index 0000000..6906ede --- /dev/null +++ b/Shell/Common/SearchCondition.cs @@ -0,0 +1,181 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Exposes properties and methods for retrieving information about a search condition. + /// + public class SearchCondition : IDisposable + { + internal SearchCondition(ICondition nativeSearchCondition) + { + if (nativeSearchCondition == null) + { + throw new ArgumentNullException("nativeSearchCondition"); + } + + NativeSearchCondition = nativeSearchCondition; + + HResult hr = NativeSearchCondition.GetConditionType(out conditionType); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + + if (ConditionType == SearchConditionType.Leaf) + { + using (PropVariant propVar = new PropVariant()) + { + hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, propVar); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + + PropertyValue = propVar.Value.ToString(); + } + } + } + + internal ICondition NativeSearchCondition { get; set; } + + private string canonicalName; + /// + /// The name of a property to be compared or NULL for an unspecified property. + /// + public string PropertyCanonicalName + { + get { return canonicalName; } + } + + private PropertyKey propertyKey; + private PropertyKey emptyPropertyKey = new PropertyKey(); + /// + /// The property key for the property that is to be compared. + /// + public PropertyKey PropertyKey + { + get + { + if (propertyKey == emptyPropertyKey) + { + int hr = PropertySystemNativeMethods.PSGetPropertyKeyFromName(PropertyCanonicalName, out propertyKey); + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + } + + return propertyKey; + } + } + + /// + /// A value (in format) to which the property is compared. + /// + public string PropertyValue { get; internal set; } + + private SearchConditionOperation conditionOperation = SearchConditionOperation.Implicit; + /// + /// Search condition operation to be performed on the property/value combination. + /// See for more details. + /// + public SearchConditionOperation ConditionOperation + { + get { return conditionOperation; } + } + + private SearchConditionType conditionType = SearchConditionType.Leaf; + /// + /// Represents the condition type for the given node. + /// + public SearchConditionType ConditionType + { + get { return conditionType; } + } + + /// + /// Retrieves an array of the sub-conditions. + /// + public IEnumerable GetSubConditions() + { + // Our list that we'll return + List subConditionsList = new List(); + + // Get the sub-conditions from the native API + object subConditionObj; + Guid guid = new Guid(ShellIIDGuid.IEnumUnknown); + + HResult hr = NativeSearchCondition.GetSubConditions(ref guid, out subConditionObj); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + + // Convert each ICondition to SearchCondition + if (subConditionObj != null) + { + IEnumUnknown enumUnknown = subConditionObj as IEnumUnknown; + + IntPtr buffer = IntPtr.Zero; + uint fetched = 0; + + while (hr == HResult.Ok) + { + hr = enumUnknown.Next(1, ref buffer, ref fetched); + + if (hr == HResult.Ok && fetched == 1) + { + subConditionsList.Add(new SearchCondition((ICondition)Marshal.GetObjectForIUnknown(buffer))); + } + } + } + + return subConditionsList; + } + + #region IDisposable Members + + /// + /// + /// + ~SearchCondition() + { + Dispose(false); + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Release the native objects. + /// + /// + protected virtual void Dispose(bool disposing) + { + if (NativeSearchCondition != null) + { + Marshal.ReleaseComObject(NativeSearchCondition); + NativeSearchCondition = null; + } + } + + #endregion + + } +} diff --git a/Shell/Common/SearchConditionFactory.cs b/Shell/Common/SearchConditionFactory.cs new file mode 100644 index 0000000..3c25dc5 --- /dev/null +++ b/Shell/Common/SearchConditionFactory.cs @@ -0,0 +1,481 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Provides methods for creating or resolving a condition tree + /// that was obtained by parsing a query string. + /// + public static class SearchConditionFactory + { + /// + /// Creates a leaf condition node that represents a comparison of property value and constant value. + /// + /// The name of a property to be compared, or null for an unspecified property. + /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT. + /// The constant value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(string propertyName, string value, SearchConditionOperation operation) + { + using (PropVariant propVar = new PropVariant(value)) + { + return CreateLeafCondition(propertyName, propVar, null, operation); + } + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and constant value. + /// Overload method takes a DateTime parameter for the comparison value. + /// + /// The name of a property to be compared, or null for an unspecified property. + /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT. + /// The DateTime value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(string propertyName, DateTime value, SearchConditionOperation operation) + { + using (PropVariant propVar = new PropVariant(value)) + { + return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.DateTime", operation); + } + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and Integer value. + /// + /// The name of a property to be compared, or null for an unspecified property. + /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT. + /// The Integer value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(string propertyName, int value, SearchConditionOperation operation) + { + using (PropVariant propVar = new PropVariant(value)) + { + return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.Integer", operation); + } + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and Boolean value. + /// + /// The name of a property to be compared, or null for an unspecified property. + /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT. + /// The Boolean value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(string propertyName, bool value, SearchConditionOperation operation) + { + using (PropVariant propVar = new PropVariant(value)) + { + return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.Boolean", operation); + } + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and Floating Point value. + /// + /// The name of a property to be compared, or null for an unspecified property. + /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT. + /// The Floating Point value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(string propertyName, double value, SearchConditionOperation operation) + { + using (PropVariant propVar = new PropVariant(value)) + { + return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.FloatingPoint", operation); + } + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] + private static SearchCondition CreateLeafCondition(string propertyName, PropVariant propVar, string valueType, SearchConditionOperation operation) + { + IConditionFactory nativeConditionFactory = null; + SearchCondition condition = null; + + try + { + // Same as the native "IConditionFactory:MakeLeaf" method + nativeConditionFactory = (IConditionFactory)new ConditionFactoryCoClass(); + + ICondition nativeCondition = null; + + if (string.IsNullOrEmpty(propertyName) || propertyName.ToUpperInvariant() == "SYSTEM.NULL") + { + propertyName = null; + } + + HResult hr = HResult.Fail; + + hr = nativeConditionFactory.MakeLeaf(propertyName, operation, valueType, + propVar, null, null, null, false, out nativeCondition); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + + // Create our search condition and set the various properties. + condition = new SearchCondition(nativeCondition); + } + finally + { + if (nativeConditionFactory != null) + { + Marshal.ReleaseComObject(nativeConditionFactory); + } + } + + return condition; + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and constant value. + /// + /// The property to be compared. + /// The constant value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, string value, SearchConditionOperation operation) + { + string canonicalName; + PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName); + + if (string.IsNullOrEmpty(canonicalName)) + { + throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey"); + } + + return CreateLeafCondition(canonicalName, value, operation); + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and constant value. + /// Overload method takes a DateTime parameter for the comparison value. + /// + /// The property to be compared. + /// The DateTime value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, DateTime value, SearchConditionOperation operation) + { + string canonicalName; + PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName); + + if (string.IsNullOrEmpty(canonicalName)) + { + throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey"); + } + return CreateLeafCondition(canonicalName, value, operation); + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and Boolean value. + /// Overload method takes a DateTime parameter for the comparison value. + /// + /// The property to be compared. + /// The boolean value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, bool value, SearchConditionOperation operation) + { + string canonicalName; + PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName); + + if (string.IsNullOrEmpty(canonicalName)) + { + throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey"); + } + return CreateLeafCondition(canonicalName, value, operation); + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and Floating Point value. + /// Overload method takes a DateTime parameter for the comparison value. + /// + /// The property to be compared. + /// The Floating Point value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, double value, SearchConditionOperation operation) + { + string canonicalName; + PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName); + + if (string.IsNullOrEmpty(canonicalName)) + { + throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey"); + } + return CreateLeafCondition(canonicalName, value, operation); + } + + /// + /// Creates a leaf condition node that represents a comparison of property value and Integer value. + /// Overload method takes a DateTime parameter for the comparison value. + /// + /// The property to be compared. + /// The Integer value against which the property value should be compared. + /// Specific condition to be used when comparing the actual value and the expected value of the given property + /// SearchCondition based on the given parameters + /// + /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find + /// the properties that are indexed, look for the specific property's property description and + /// property for IsQueryable flag. + /// + public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, int value, SearchConditionOperation operation) + { + string canonicalName; + PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName); + + if (string.IsNullOrEmpty(canonicalName)) + { + throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey"); + } + return CreateLeafCondition(canonicalName, value, operation); + } + + /// + /// Creates a condition node that is a logical conjunction ("AND") or disjunction ("OR") + /// of a collection of subconditions. + /// + /// The SearchConditionType of the condition node. + /// Must be either AndCondition or OrCondition. + /// TRUE to logically simplify the result, if possible; + /// then the result will not necessarily to be of the specified kind. FALSE if the result should + /// have exactly the prescribed structure. An application that plans to execute a query based on the + /// condition tree would typically benefit from setting this parameter to TRUE. + /// Array of subconditions + /// New SearchCondition based on the operation + public static SearchCondition CreateAndOrCondition(SearchConditionType conditionType, bool simplify, params SearchCondition[] conditionNodes) + { + // Same as the native "IConditionFactory:MakeAndOr" method + IConditionFactory nativeConditionFactory = (IConditionFactory)new ConditionFactoryCoClass(); + ICondition result = null; + + try + { + // + List conditionList = new List(); + if (conditionNodes != null) + { + foreach (SearchCondition c in conditionNodes) + { + conditionList.Add(c.NativeSearchCondition); + } + } + + IEnumUnknown subConditions = new EnumUnknownClass(conditionList.ToArray()); + + HResult hr = nativeConditionFactory.MakeAndOr(conditionType, subConditions, simplify, out result); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + finally + { + if (nativeConditionFactory != null) + { + Marshal.ReleaseComObject(nativeConditionFactory); + } + } + + return new SearchCondition(result); + } + + /// + /// Creates a condition node that is a logical negation (NOT) of another condition + /// (a subnode of this node). + /// + /// SearchCondition node to be negated. + /// True to logically simplify the result if possible; False otherwise. + /// In a query builder scenario, simplyfy should typically be set to false. + /// New SearchCondition + public static SearchCondition CreateNotCondition(SearchCondition conditionToBeNegated, bool simplify) + { + if (conditionToBeNegated == null) + { + throw new ArgumentNullException("conditionToBeNegated"); + } + + // Same as the native "IConditionFactory:MakeNot" method + IConditionFactory nativeConditionFactory = (IConditionFactory)new ConditionFactoryCoClass(); + ICondition result; + + try + { + HResult hr = nativeConditionFactory.MakeNot(conditionToBeNegated.NativeSearchCondition, simplify, out result); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + finally + { + if (nativeConditionFactory != null) + { + Marshal.ReleaseComObject(nativeConditionFactory); + } + } + + return new SearchCondition(result); + } + + /// + /// Parses an input string that contains Structured Query keywords (using Advanced Query Syntax + /// or Natural Query Syntax) and produces a SearchCondition object. + /// + /// The query to be parsed + /// Search condition resulting from the query + /// For more information on structured query syntax, visit http://msdn.microsoft.com/en-us/library/bb233500.aspx and + /// http://www.microsoft.com/windows/products/winfamily/desktopsearch/technicalresources/advquery.mspx + public static SearchCondition ParseStructuredQuery(string query) + { + return ParseStructuredQuery(query, null); + } + + /// + /// Parses an input string that contains Structured Query keywords (using Advanced Query Syntax + /// or Natural Query Syntax) and produces a SearchCondition object. + /// + /// The query to be parsed + /// The culture used to select the localized language for keywords. + /// Search condition resulting from the query + /// For more information on structured query syntax, visit http://msdn.microsoft.com/en-us/library/bb233500.aspx and + /// http://www.microsoft.com/windows/products/winfamily/desktopsearch/technicalresources/advquery.mspx + public static SearchCondition ParseStructuredQuery(string query, CultureInfo cultureInfo) + { + if (string.IsNullOrEmpty(query)) + { + throw new ArgumentNullException("query"); + } + + IQueryParserManager nativeQueryParserManager = (IQueryParserManager)new QueryParserManagerCoClass(); + IQueryParser queryParser = null; + IQuerySolution querySolution = null; + ICondition result = null; + + IEntity mainType = null; + SearchCondition searchCondition = null; + try + { + // First, try to create a new IQueryParser using IQueryParserManager + Guid guid = new Guid(ShellIIDGuid.IQueryParser); + HResult hr = nativeQueryParserManager.CreateLoadedParser( + "SystemIndex", + cultureInfo == null ? (ushort)0 : (ushort)cultureInfo.LCID, + ref guid, + out queryParser); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + + if (queryParser != null) + { + // If user specified natural query, set the option on the query parser + using (PropVariant optionValue = new PropVariant(true)) + { + hr = queryParser.SetOption(StructuredQuerySingleOption.NaturalSyntax, optionValue); + } + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + + // Next, try to parse the query. + // Result would be IQuerySolution that we can use for getting the ICondition and other + // details about the parsed query. + hr = queryParser.Parse(query, null, out querySolution); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + + if (querySolution != null) + { + // Lastly, try to get the ICondition from this parsed query + hr = querySolution.GetQuery(out result, out mainType); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + } + + searchCondition = new SearchCondition(result); + return searchCondition; + } + catch + { + if (searchCondition != null) { searchCondition.Dispose(); } + throw; + } + finally + { + if (nativeQueryParserManager != null) + { + Marshal.ReleaseComObject(nativeQueryParserManager); + } + + if (queryParser != null) + { + Marshal.ReleaseComObject(queryParser); + } + + if (querySolution != null) + { + Marshal.ReleaseComObject(querySolution); + } + + if (mainType != null) + { + Marshal.ReleaseComObject(mainType); + } + } + } + } +} diff --git a/Shell/Common/ShellEnums.cs b/Shell/Common/ShellEnums.cs new file mode 100644 index 0000000..c60a328 --- /dev/null +++ b/Shell/Common/ShellEnums.cs @@ -0,0 +1,535 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// CommonFileDialog AddPlace locations + /// + public enum FileDialogAddPlaceLocation + { + /// + /// At the bottom of the Favorites or Places list. + /// + Bottom = 0x00000000, + + /// + /// At the top of the Favorites or Places list. + /// + Top = 0x00000001, + } + + /// + /// One of the values that indicates how the ShellObject DisplayName should look. + /// + public enum DisplayNameType + { + /// + /// Returns the display name relative to the desktop. + /// + Default = 0x00000000, + + /// + /// Returns the parsing name relative to the parent folder. + /// + RelativeToParent = unchecked((int)0x80018001), + + /// + /// Returns the path relative to the parent folder in a + /// friendly format as displayed in an address bar. + /// + RelativeToParentAddressBar = unchecked((int)0x8007c001), + + /// + /// Returns the parsing name relative to the desktop. + /// + RelativeToDesktop = unchecked((int)0x80028000), + + /// + /// Returns the editing name relative to the parent folder. + /// + RelativeToParentEditing = unchecked((int)0x80031001), + + /// + /// Returns the editing name relative to the desktop. + /// + RelativeToDesktopEditing = unchecked((int)0x8004c000), + + /// + /// Returns the display name relative to the file system path. + /// + FileSystemPath = unchecked((int)0x80058000), + + /// + /// Returns the display name relative to a URL. + /// + Url = unchecked((int)0x80068000), + } + /// + /// Available Library folder types + /// + public enum LibraryFolderType + { + /// + /// General Items + /// + Generic = 0, + + /// + /// Documents + /// + Documents, + + /// + /// Music + /// + Music, + + /// + /// Pictures + /// + Pictures, + + /// + /// Videos + /// + Videos + + } + + /// + /// Flags controlling the appearance of a window + /// + public enum WindowShowCommand + { + /// + /// Hides the window and activates another window. + /// + Hide = 0, + + /// + /// Activates and displays the window (including restoring + /// it to its original size and position). + /// + Normal = 1, + + /// + /// Minimizes the window. + /// + Minimized = 2, + + /// + /// Maximizes the window. + /// + Maximized = 3, + + /// + /// Similar to , except that the window + /// is not activated. + /// + ShowNoActivate = 4, + + /// + /// Activates the window and displays it in its current size + /// and position. + /// + Show = 5, + + /// + /// Minimizes the window and activates the next top-level window. + /// + Minimize = 6, + + /// + /// Minimizes the window and does not activate it. + /// + ShowMinimizedNoActivate = 7, + + /// + /// Similar to , except that the window is not + /// activated. + /// + ShowNA = 8, + + /// + /// Activates and displays the window, restoring it to its original + /// size and position. + /// + Restore = 9, + + /// + /// Sets the show state based on the initial value specified when + /// the process was created. + /// + Default = 10, + + /// + /// Minimizes a window, even if the thread owning the window is not + /// responding. Use this only to minimize windows from a different + /// thread. + /// + ForceMinimize = 11 + } + + /// + /// Provides a set of flags to be used with + /// to indicate the operation in methods. + /// + public enum SearchConditionOperation + { + /// + /// An implicit comparison between the value of the property and the value of the constant. + /// + Implicit = 0, + + /// + /// The value of the property and the value of the constant must be equal. + /// + Equal = 1, + + /// + /// The value of the property and the value of the constant must not be equal. + /// + NotEqual = 2, + + /// + /// The value of the property must be less than the value of the constant. + /// + LessThan = 3, + + /// + /// The value of the property must be greater than the value of the constant. + /// + GreaterThan = 4, + + /// + /// The value of the property must be less than or equal to the value of the constant. + /// + LessThanOrEqual = 5, + + /// + /// The value of the property must be greater than or equal to the value of the constant. + /// + GreaterThanOrEqual = 6, + + /// + /// The value of the property must begin with the value of the constant. + /// + ValueStartsWith = 7, + + /// + /// The value of the property must end with the value of the constant. + /// + ValueEndsWith = 8, + + /// + /// The value of the property must contain the value of the constant. + /// + ValueContains = 9, + + /// + /// The value of the property must not contain the value of the constant. + /// + ValueNotContains = 10, + + /// + /// The value of the property must match the value of the constant, where '?' + /// matches any single character and '*' matches any sequence of characters. + /// + DosWildcards = 11, + + /// + /// The value of the property must contain a word that is the value of the constant. + /// + WordEqual = 12, + + /// + /// The value of the property must contain a word that begins with the value of the constant. + /// + WordStartsWith = 13, + + /// + /// The application is free to interpret this in any suitable way. + /// + ApplicationSpecific = 14 + } + + /// + /// Set of flags to be used with . + /// + public enum SearchConditionType + { + /// + /// Indicates that the values of the subterms are combined by "AND". + /// + And = 0, + + /// + /// Indicates that the values of the subterms are combined by "OR". + /// + Or = 1, + + /// + /// Indicates a "NOT" comparison of subterms. + /// + Not = 2, + + /// + /// Indicates that the node is a comparison between a property and a + /// constant value using a . + /// + Leaf = 3, + } + + /// + /// Used to describe the view mode. + /// + public enum FolderLogicalViewMode + { + /// + /// The view is not specified. + /// + Unspecified = -1, + + /// + /// This should have the same affect as Unspecified. + /// + None = 0, + + /// + /// The minimum valid enumeration value. Used for validation purposes only. + /// + First = 1, + + /// + /// Details view. + /// + Details = 1, + + /// + /// Tiles view. + /// + Tiles = 2, + + /// + /// Icons view. + /// + Icons = 3, + + /// + /// Windows 7 and later. List view. + /// + List = 4, + + /// + /// Windows 7 and later. Content view. + /// + Content = 5, + + /// + /// The maximum valid enumeration value. Used for validation purposes only. + /// + Last = 5 + } + + /// + /// The direction in which the items are sorted. + /// + public enum SortDirection + { + /// + /// A default value for sort direction, this value should not be used; + /// instead use Descending or Ascending. + /// + Default = 0, + + /// + /// The items are sorted in descending order. Whether the sort is alphabetical, numerical, + /// and so on, is determined by the data type of the column indicated in propkey. + /// + Descending = -1, + + /// + /// The items are sorted in ascending order. Whether the sort is alphabetical, numerical, + /// and so on, is determined by the data type of the column indicated in propkey. + /// + Ascending = 1, + } + + /// + /// Provides a set of flags to be used with IQueryParser::SetOption and + /// IQueryParser::GetOption to indicate individual options. + /// + public enum StructuredQuerySingleOption + { + /// + /// The value should be VT_LPWSTR and the path to a file containing a schema binary. + /// + Schema, + + /// + /// The value must be VT_EMPTY (the default) or a VT_UI4 that is an LCID. It is used + /// as the locale of contents (not keywords) in the query to be searched for, when no + /// other information is available. The default value is the current keyboard locale. + /// Retrieving the value always returns a VT_UI4. + /// + Locale, + + /// + /// This option is used to override the default word breaker used when identifying keywords + /// in queries. The default word breaker is chosen according to the language of the keywords + /// (cf. SQSO_LANGUAGE_KEYWORDS below). When setting this option, the value should be VT_EMPTY + /// for using the default word breaker, or a VT_UNKNOWN with an object supporting + /// the IWordBreaker interface. Retrieving the option always returns a VT_UNKNOWN with an object + /// supporting the IWordBreaker interface. + /// + WordBreaker, + + /// + /// The value should be VT_EMPTY or VT_BOOL with VARIANT_TRUE to allow natural query + /// syntax (the default) or VT_BOOL with VARIANT_FALSE to allow only advanced query syntax. + /// Retrieving the option always returns a VT_BOOL. + /// This option is now deprecated, use SQSO_SYNTAX. + /// + NaturalSyntax, + + /// + /// The value should be VT_BOOL with VARIANT_TRUE to generate query expressions + /// as if each word in the query had a star appended to it (unless followed by punctuation + /// other than a parenthesis), or VT_EMPTY or VT_BOOL with VARIANT_FALSE to + /// use the words as they are (the default). A word-wheeling application + /// will generally want to set this option to true. + /// Retrieving the option always returns a VT_BOOL. + /// + AutomaticWildcard, + + /// + /// Reserved. The value should be VT_EMPTY (the default) or VT_I4. + /// Retrieving the option always returns a VT_I4. + /// + TraceLevel, + + /// + /// The value must be a VT_UI4 that is a LANGID. It defaults to the default user UI language. + /// + LanguageKeywords, + + /// + /// The value must be a VT_UI4 that is a STRUCTURED_QUERY_SYNTAX value. + /// It defaults to SQS_NATURAL_QUERY_SYNTAX. + /// + Syntax, + + /// + /// The value must be a VT_BLOB that is a copy of a TIME_ZONE_INFORMATION structure. + /// It defaults to the current time zone. + /// + TimeZone, + + /// + /// This setting decides what connector should be assumed between conditions when none is specified. + /// The value must be a VT_UI4 that is a CONDITION_TYPE. Only CT_AND_CONDITION and CT_OR_CONDITION + /// are valid. It defaults to CT_AND_CONDITION. + /// + ImplicitConnector, + + /// + /// This setting decides whether there are special requirements on the case of connector keywords (such + /// as AND or OR). The value must be a VT_UI4 that is a CASE_REQUIREMENT value. + /// It defaults to CASE_REQUIREMENT_UPPER_IF_AQS. + /// + ConnectorCase, + + } + + /// + /// Provides a set of flags to be used with IQueryParser::SetMultiOption + /// to indicate individual options. + /// + public enum StructuredQueryMultipleOption + { + /// + /// The key should be property name P. The value should be a + /// VT_UNKNOWN with an IEnumVARIANT which has two values: a VT_BSTR that is another + /// property name Q and a VT_I4 that is a CONDITION_OPERATION cop. A predicate with + /// property name P, some operation and a value V will then be replaced by a predicate + /// with property name Q, operation cop and value V before further processing happens. + /// + VirtualProperty, + + /// + /// The key should be a value type name V. The value should be a + /// VT_LPWSTR with a property name P. A predicate with no property name and a value of type + /// V (or any subtype of V) will then use property P. + /// + DefaultProperty, + + /// + /// The key should be a value type name V. The value should be a + /// VT_UNKNOWN with a IConditionGenerator G. The GenerateForLeaf method of + /// G will then be applied to any predicate with value type V and if it returns a query + /// expression, that will be used. If it returns NULL, normal processing will be used + /// instead. + /// + GeneratorForType, + + /// + /// The key should be a property name P. The value should be a VT_VECTOR|VT_LPWSTR, + /// where each string is a property name. The count must be at least one. This "map" will be + /// added to those of the loaded schema and used during resolution. A second call with the + /// same key will replace the current map. If the value is VT_NULL, the map will be removed. + /// + MapProperty, + } + + /// + /// Used by IQueryParserManager::SetOption to set parsing options. + /// This can be used to specify schemas and localization options. + /// + public enum QueryParserManagerOption + { + /// + /// A VT_LPWSTR containing the name of the file that contains the schema binary. + /// The default value is StructuredQuerySchema.bin for the SystemIndex catalog + /// and StructuredQuerySchemaTrivial.bin for the trivial catalog. + /// + SchemaBinaryName = 0, + + /// + /// Either a VT_BOOL or a VT_LPWSTR. If the value is a VT_BOOL and is FALSE, + /// a pre-localized schema will not be used. If the value is a VT_BOOL and is TRUE, + /// IQueryParserManager will use the pre-localized schema binary in + /// "%ALLUSERSPROFILE%\Microsoft\Windows". If the value is a VT_LPWSTR, the value should + /// contain the full path of the folder in which the pre-localized schema binary can be found. + /// The default value is VT_BOOL with TRUE. + /// + PreLocalizedSchemaBinaryPath = 1, + + /// + /// A VT_LPWSTR containing the full path to the folder that contains the + /// unlocalized schema binary. The default value is "%SYSTEMROOT%\System32". + /// + UnlocalizedSchemaBinaryPath = 2, + + /// + /// A VT_LPWSTR containing the full path to the folder that contains the + /// localized schema binary that can be read and written to as needed. + /// The default value is "%LOCALAPPDATA%\Microsoft\Windows". + /// + LocalizedSchemaBinaryPath = 3, + + /// + /// A VT_BOOL. If TRUE, then the paths for pre-localized and localized binaries + /// have "\(LCID)" appended to them, where language code identifier (LCID) is + /// the decimal locale ID for the localized language. The default is TRUE. + /// + AppendLCIDToLocalizedPath = 4, + + /// + /// A VT_UNKNOWN with an object supporting ISchemaLocalizerSupport. + /// This object will be used instead of the default localizer support object. + /// + LocalizerSupport = 5 + } +} diff --git a/Shell/Common/ShellException.cs b/Shell/Common/ShellException.cs new file mode 100644 index 0000000..fe5da66 --- /dev/null +++ b/Shell/Common/ShellException.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + + /// + /// An exception thrown when an error occurs while dealing with ShellObjects. + /// + [Serializable] + public class ShellException : ExternalException + { + /// + /// Default constructor. + /// + public ShellException() { } + + /// + /// Initializes a new exception using an HResult + /// + /// HResult error + internal ShellException(HResult result) : this((int)result) { } + + /// + /// Initializes an excpetion with a custom message. + /// + /// Custom message + public ShellException(string message) : base(message) { } + + /// + /// Initializes an exception with custom message and inner exception. + /// + /// Custom message + /// The original exception that preceded this exception + public ShellException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes an exception with custom message and error code. + /// + /// Custom message + /// HResult error code + public ShellException(string message, int errorCode) : base(message, errorCode) { } + + /// + /// Initializes an exception with custom message and error code. + /// + /// + /// + internal ShellException(string message, HResult errorCode) : this(message, (int)errorCode) { } + + /// + /// Initializes an exception with custom message and inner exception. + /// + /// HRESULT of an operation + public ShellException(int errorCode) + : base(LocalizedMessages.ShellExceptionDefaultText, errorCode) + { + } + + /// + /// Initializes an exception from serialization info and a context. + /// + /// + /// + protected ShellException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + } +} \ No newline at end of file diff --git a/Shell/Common/ShellFile.cs b/Shell/Common/ShellFile.cs new file mode 100644 index 0000000..0a174f6 --- /dev/null +++ b/Shell/Common/ShellFile.cs @@ -0,0 +1,64 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.IO; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// A file in the Shell Namespace + /// + public class ShellFile : ShellObject + { + #region Internal Constructor + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] + internal ShellFile(string path) + { + // Get the absolute path + string absPath = ShellHelper.GetAbsolutePath(path); + + // Make sure this is valid + if (!File.Exists(absPath)) + { + throw new FileNotFoundException( + string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.FilePathNotExist, path)); + } + + ParsingName = absPath; + } + + internal ShellFile(IShellItem2 shellItem) + { + nativeShellItem = shellItem; + } + + #endregion + + #region Public Methods + /// + /// Constructs a new ShellFile object given a file path + /// + /// The file or folder path + /// ShellFile object created using given file path. + static public ShellFile FromFilePath(string path) + { + return new ShellFile(path); + } + + #endregion + + #region Public Properties + + /// + /// The path for this file + /// + virtual public string Path + { + get { return this.ParsingName; } + } + + #endregion + } +} diff --git a/Shell/Common/ShellFileSystemFolder.cs b/Shell/Common/ShellFileSystemFolder.cs new file mode 100644 index 0000000..7c5c45f --- /dev/null +++ b/Shell/Common/ShellFileSystemFolder.cs @@ -0,0 +1,75 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.IO; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// A folder in the Shell Namespace + /// + public class ShellFileSystemFolder : ShellFolder + { + #region Internal Constructor + + internal ShellFileSystemFolder() + { + // Empty + } + + internal ShellFileSystemFolder(IShellItem2 shellItem) + { + nativeShellItem = shellItem; + } + + #endregion + + #region Public Methods + /// + /// Constructs a new ShellFileSystemFolder object given a folder path + /// + /// The folder path + /// ShellFileSystemFolder created from the given folder path. + public static ShellFileSystemFolder FromFolderPath(string path) + { + // Get the absolute path + string absPath = ShellHelper.GetAbsolutePath(path); + + // Make sure this is valid + if (!Directory.Exists(absPath)) + { + throw new DirectoryNotFoundException( + string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.FilePathNotExist, path)); + } + + ShellFileSystemFolder folder = new ShellFileSystemFolder(); + try + { + folder.ParsingName = absPath; + return folder; + } + catch + { + folder.Dispose(); + throw; + } + + } + + #endregion + + #region Public Properties + + /// + /// The path for this Folder + /// + public virtual string Path + { + get { return this.ParsingName; } + } + + #endregion + + } +} \ No newline at end of file diff --git a/Shell/Common/ShellFolder.cs b/Shell/Common/ShellFolder.cs new file mode 100644 index 0000000..4632f74 --- /dev/null +++ b/Shell/Common/ShellFolder.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents the base class for all types of folders (filesystem and non filesystem) + /// + public abstract class ShellFolder : ShellContainer + { + // empty + } +} diff --git a/Shell/Common/ShellFolderItems.cs b/Shell/Common/ShellFolderItems.cs new file mode 100644 index 0000000..7b8ade7 --- /dev/null +++ b/Shell/Common/ShellFolderItems.cs @@ -0,0 +1,117 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + class ShellFolderItems : IEnumerator + { + #region Private Fields + + private IEnumIDList nativeEnumIdList; + private ShellObject currentItem; + ShellContainer nativeShellFolder; + + #endregion + + #region Internal Constructor + + internal ShellFolderItems(ShellContainer nativeShellFolder) + { + this.nativeShellFolder = nativeShellFolder; + + HResult hr = nativeShellFolder.NativeShellFolder.EnumObjects( + IntPtr.Zero, + ShellNativeMethods.ShellFolderEnumerationOptions.Folders | ShellNativeMethods.ShellFolderEnumerationOptions.NonFolders, + out nativeEnumIdList); + + + if (!CoreErrorHelper.Succeeded(hr)) + { + if (hr == HResult.Canceled) + { + throw new System.IO.FileNotFoundException(); + } + else + { + throw new ShellException(hr); + } + } + + + } + + #endregion + + #region IEnumerator Members + + public ShellObject Current + { + get + { + return currentItem; + } + } + + #endregion + + #region IDisposable Members + + public void Dispose() + { + if (nativeEnumIdList != null) + { + Marshal.ReleaseComObject(nativeEnumIdList); + nativeEnumIdList = null; + } + } + + #endregion + + #region IEnumerator Members + + object IEnumerator.Current + { + get { return currentItem; } + + } + + /// + /// + /// + /// + public bool MoveNext() + { + if (nativeEnumIdList == null) { return false; } + + IntPtr item; + uint numItemsReturned; + uint itemsRequested = 1; + HResult hr = nativeEnumIdList.Next(itemsRequested, out item, out numItemsReturned); + + if (numItemsReturned < itemsRequested || hr != HResult.Ok) { return false; } + + currentItem = ShellObjectFactory.Create(item, nativeShellFolder); + + return true; + } + + /// + /// + /// + public void Reset() + { + if (nativeEnumIdList != null) + { + nativeEnumIdList.Reset(); + } + } + + + #endregion + } +} diff --git a/Shell/Common/ShellHelper.cs b/Shell/Common/ShellHelper.cs new file mode 100644 index 0000000..11aca0a --- /dev/null +++ b/Shell/Common/ShellHelper.cs @@ -0,0 +1,91 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.IO; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// A helper class for Shell Objects + /// + internal static class ShellHelper + { + internal static string GetParsingName(IShellItem shellItem) + { + if (shellItem == null) { return null; } + + string path = null; + + IntPtr pszPath = IntPtr.Zero; + HResult hr = shellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.DesktopAbsoluteParsing, out pszPath); + + if (hr != HResult.Ok && hr != HResult.InvalidArguments) + { + throw new ShellException(LocalizedMessages.ShellHelperGetParsingNameFailed, hr); + } + + if (pszPath != IntPtr.Zero) + { + path = Marshal.PtrToStringAuto(pszPath); + Marshal.FreeCoTaskMem(pszPath); + pszPath = IntPtr.Zero; + } + + return path; + + } + + internal static string GetAbsolutePath(string path) + { + if (Uri.IsWellFormedUriString(path, UriKind.Absolute)) + { + return path; + } + return Path.GetFullPath((path)); + } + + internal static PropertyKey ItemTypePropertyKey = new PropertyKey(new Guid("28636AA6-953D-11D2-B5D6-00C04FD918D0"), 11); + + internal static string GetItemType(IShellItem2 shellItem) + { + if (shellItem != null) + { + string itemType = null; + HResult hr = shellItem.GetString(ref ItemTypePropertyKey, out itemType); + if (hr == HResult.Ok) { return itemType; } + } + + return null; + } + + internal static IntPtr PidlFromParsingName(string name) + { + IntPtr pidl; + + ShellNativeMethods.ShellFileGetAttributesOptions sfgao; + int retCode = ShellNativeMethods.SHParseDisplayName( + name, IntPtr.Zero, out pidl, (ShellNativeMethods.ShellFileGetAttributesOptions)0, + out sfgao); + + return (CoreErrorHelper.Succeeded(retCode) ? pidl : IntPtr.Zero); + } + + internal static IntPtr PidlFromShellItem(IShellItem nativeShellItem) + { + IntPtr unknown = Marshal.GetIUnknownForObject(nativeShellItem); + return PidlFromUnknown(unknown); + } + + internal static IntPtr PidlFromUnknown(IntPtr unknown) + { + IntPtr pidl; + int retCode = ShellNativeMethods.SHGetIDListFromObject(unknown, out pidl); + return (CoreErrorHelper.Succeeded(retCode) ? pidl : IntPtr.Zero); + } + + } +} diff --git a/Shell/Common/ShellItemArray.cs b/Shell/Common/ShellItemArray.cs new file mode 100644 index 0000000..f4ff3b8 --- /dev/null +++ b/Shell/Common/ShellItemArray.cs @@ -0,0 +1,70 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal class ShellItemArray : IShellItemArray + { + List shellItemsList = new List(); + + internal ShellItemArray(IShellItem[] shellItems) + { + shellItemsList.AddRange(shellItems); + } + + #region IShellItemArray Members + + public HResult BindToHandler(IntPtr pbc, ref Guid rbhid, ref Guid riid, out IntPtr ppvOut) + { + throw new NotSupportedException(); + } + + public HResult GetPropertyStore(int Flags, ref Guid riid, out IntPtr ppv) + { + throw new NotSupportedException(); + } + + public HResult GetPropertyDescriptionList(ref PropertyKey keyType, ref Guid riid, out IntPtr ppv) + { + throw new NotSupportedException(); + } + + public HResult GetAttributes(ShellNativeMethods.ShellItemAttributeOptions dwAttribFlags, ShellNativeMethods.ShellFileGetAttributesOptions sfgaoMask, out ShellNativeMethods.ShellFileGetAttributesOptions psfgaoAttribs) + { + throw new NotSupportedException(); + } + + public HResult GetCount(out uint pdwNumItems) + { + pdwNumItems = (uint)shellItemsList.Count; + return HResult.Ok; + } + + public HResult GetItemAt(uint dwIndex, out IShellItem ppsi) + { + int index = (int)dwIndex; + + if (index < shellItemsList.Count) + { + ppsi = shellItemsList[index]; + return HResult.Ok; + } + else + { + ppsi = null; + return HResult.Fail; + } + } + + public HResult EnumItems(out IntPtr ppenumShellItems) + { + throw new NotSupportedException(); + } + + #endregion + } +} diff --git a/Shell/Common/ShellLibrary.cs b/Shell/Common/ShellLibrary.cs new file mode 100644 index 0000000..ae2ccd1 --- /dev/null +++ b/Shell/Common/ShellLibrary.cs @@ -0,0 +1,901 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// A Shell Library in the Shell Namespace + /// + public sealed class ShellLibrary : ShellContainer, IList + { + #region Private Fields + + private INativeShellLibrary nativeShellLibrary; + private IKnownFolder knownFolder; + + private static Guid[] FolderTypesGuids = + { + new Guid(ShellKFIDGuid.GenericLibrary), + new Guid(ShellKFIDGuid.DocumentsLibrary), + new Guid(ShellKFIDGuid.MusicLibrary), + new Guid(ShellKFIDGuid.PicturesLibrary), + new Guid(ShellKFIDGuid.VideosLibrary) + }; + + #endregion + + #region Private Constructor + + private ShellLibrary() + { + CoreHelpers.ThrowIfNotWin7(); + } + + //Construct the ShellLibrary object from a native Shell Library + private ShellLibrary(INativeShellLibrary nativeShellLibrary) + : this() + { + this.nativeShellLibrary = nativeShellLibrary; + } + + /// + /// Creates a shell library in the Libraries Known Folder, + /// using the given IKnownFolder + /// + /// KnownFolder from which to create the new Shell Library + /// If true , opens the library in read-only mode. + private ShellLibrary(IKnownFolder sourceKnownFolder, bool isReadOnly) + : this() + { + Debug.Assert(sourceKnownFolder != null); + + // Keep a reference locally + knownFolder = sourceKnownFolder; + + nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass(); + + AccessModes flags = isReadOnly ? + AccessModes.Read : + AccessModes.ReadWrite; + + // Get the IShellItem2 + base.nativeShellItem = ((ShellObject)sourceKnownFolder).NativeShellItem2; + + Guid guid = sourceKnownFolder.FolderId; + + // Load the library from the IShellItem2 + try + { + nativeShellLibrary.LoadLibraryFromKnownFolder(ref guid, flags); + } + catch (InvalidCastException) + { + throw new ArgumentException(LocalizedMessages.ShellLibraryInvalidLibrary, "sourceKnownFolder"); + } + catch (NotImplementedException) + { + throw new ArgumentException(LocalizedMessages.ShellLibraryInvalidLibrary, "sourceKnownFolder"); + } + } + + #endregion + + #region Public Constructors + + /// + /// Creates a shell library in the Libraries Known Folder, + /// using the given shell library name. + /// + /// The name of this library + /// Allow overwriting an existing library; if one exists with the same name + public ShellLibrary(string libraryName, bool overwrite) + : this() + { + if (string.IsNullOrEmpty(libraryName)) + { + throw new ArgumentException(LocalizedMessages.ShellLibraryEmptyName, "libraryName"); + } + + this.Name = libraryName; + Guid guid = new Guid(ShellKFIDGuid.Libraries); + + ShellNativeMethods.LibrarySaveOptions flags = overwrite ? + ShellNativeMethods.LibrarySaveOptions.OverrideExisting : + ShellNativeMethods.LibrarySaveOptions.FailIfThere; + + nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass(); + nativeShellLibrary.SaveInKnownFolder(ref guid, libraryName, flags, out nativeShellItem); + } + + /// + /// Creates a shell library in a given Known Folder, + /// using the given shell library name. + /// + /// The name of this library + /// The known folder + /// Override an existing library with the same name + public ShellLibrary(string libraryName, IKnownFolder sourceKnownFolder, bool overwrite) + : this() + { + if (string.IsNullOrEmpty(libraryName)) + { + throw new ArgumentException(LocalizedMessages.ShellLibraryEmptyName, "libraryName"); + } + + knownFolder = sourceKnownFolder; + + this.Name = libraryName; + Guid guid = knownFolder.FolderId; + + ShellNativeMethods.LibrarySaveOptions flags = overwrite ? + ShellNativeMethods.LibrarySaveOptions.OverrideExisting : + ShellNativeMethods.LibrarySaveOptions.FailIfThere; + + nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass(); + nativeShellLibrary.SaveInKnownFolder(ref guid, libraryName, flags, out nativeShellItem); + } + + /// + /// Creates a shell library in a given local folder, + /// using the given shell library name. + /// + /// The name of this library + /// The path to the local folder + /// Override an existing library with the same name + public ShellLibrary(string libraryName, string folderPath, bool overwrite) + : this() + { + if (string.IsNullOrEmpty(libraryName)) + { + throw new ArgumentException(LocalizedMessages.ShellLibraryEmptyName, "libraryName"); + } + + if (!Directory.Exists(folderPath)) + { + throw new DirectoryNotFoundException(LocalizedMessages.ShellLibraryFolderNotFound); + } + + this.Name = libraryName; + + ShellNativeMethods.LibrarySaveOptions flags = overwrite ? + ShellNativeMethods.LibrarySaveOptions.OverrideExisting : + ShellNativeMethods.LibrarySaveOptions.FailIfThere; + + Guid guid = new Guid(ShellIIDGuid.IShellItem); + + IShellItem shellItemIn; + ShellNativeMethods.SHCreateItemFromParsingName(folderPath, IntPtr.Zero, ref guid, out shellItemIn); + + nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass(); + nativeShellLibrary.Save(shellItemIn, libraryName, flags, out nativeShellItem); + } + + #endregion + + #region Public Properties + + /// + /// The name of the library, every library must + /// have a name + /// + /// Will throw if no Icon is set + public override string Name + { + get + { + if (base.Name == null && NativeShellItem != null) + { + base.Name = System.IO.Path.GetFileNameWithoutExtension(ShellHelper.GetParsingName(NativeShellItem)); + } + + return base.Name; + } + } + + /// + /// The Resource Reference to the icon. + /// + public IconReference IconResourceId + { + get + { + string iconRef; + nativeShellLibrary.GetIcon(out iconRef); + return new IconReference(iconRef); + } + + set + { + nativeShellLibrary.SetIcon(value.ReferencePath); + nativeShellLibrary.Commit(); + } + } + + /// + /// One of predefined Library types + /// + /// Will throw if no Library Type is set + public LibraryFolderType LibraryType + { + get + { + Guid folderTypeGuid; + nativeShellLibrary.GetFolderType(out folderTypeGuid); + + return GetFolderTypefromGuid(folderTypeGuid); + } + + set + { + Guid guid = FolderTypesGuids[(int)value]; + nativeShellLibrary.SetFolderType(ref guid); + nativeShellLibrary.Commit(); + } + } + + /// + /// The Guid of the Library type + /// + /// Will throw if no Library Type is set + public Guid LibraryTypeId + { + get + { + Guid folderTypeGuid; + nativeShellLibrary.GetFolderType(out folderTypeGuid); + + return folderTypeGuid; + } + } + + private static LibraryFolderType GetFolderTypefromGuid(Guid folderTypeGuid) + { + for (int i = 0; i < FolderTypesGuids.Length; i++) + { + if (folderTypeGuid.Equals(FolderTypesGuids[i])) + { + return (LibraryFolderType)i; + } + } + throw new ArgumentOutOfRangeException("folderTypeGuid", LocalizedMessages.ShellLibraryInvalidFolderType); + } + + /// + /// By default, this folder is the first location + /// added to the library. The default save folder + /// is both the default folder where files can + /// be saved, and also where the library XML + /// file will be saved, if no other path is specified + /// + public string DefaultSaveFolder + { + get + { + Guid guid = new Guid(ShellIIDGuid.IShellItem); + + IShellItem saveFolderItem; + + nativeShellLibrary.GetDefaultSaveFolder( + ShellNativeMethods.DefaultSaveFolderType.Detect, + ref guid, + out saveFolderItem); + + return ShellHelper.GetParsingName(saveFolderItem); + } + set + { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value"); + } + + if (!Directory.Exists(value)) + { + throw new DirectoryNotFoundException(LocalizedMessages.ShellLibraryDefaultSaveFolderNotFound); + } + + string fullPath = new DirectoryInfo(value).FullName; + + Guid guid = new Guid(ShellIIDGuid.IShellItem); + IShellItem saveFolderItem; + + ShellNativeMethods.SHCreateItemFromParsingName(fullPath, IntPtr.Zero, ref guid, out saveFolderItem); + + nativeShellLibrary.SetDefaultSaveFolder( + ShellNativeMethods.DefaultSaveFolderType.Detect, + saveFolderItem); + + nativeShellLibrary.Commit(); + } + } + + /// + /// Whether the library will be pinned to the + /// Explorer Navigation Pane + /// + public bool IsPinnedToNavigationPane + { + get + { + ShellNativeMethods.LibraryOptions flags = ShellNativeMethods.LibraryOptions.PinnedToNavigationPane; + + nativeShellLibrary.GetOptions(out flags); + + return ( + (flags & ShellNativeMethods.LibraryOptions.PinnedToNavigationPane) == + ShellNativeMethods.LibraryOptions.PinnedToNavigationPane); + } + set + { + ShellNativeMethods.LibraryOptions flags = ShellNativeMethods.LibraryOptions.Default; + + if (value) + { + flags |= ShellNativeMethods.LibraryOptions.PinnedToNavigationPane; + } + else + { + flags &= ~ShellNativeMethods.LibraryOptions.PinnedToNavigationPane; + } + + nativeShellLibrary.SetOptions(ShellNativeMethods.LibraryOptions.PinnedToNavigationPane, flags); + nativeShellLibrary.Commit(); + } + } + + #endregion + + #region Public Methods + + /// + /// Close the library, and release its associated file system resources + /// + public void Close() + { + this.Dispose(); + } + + #endregion + + #region Internal Properties + + internal const string FileExtension = ".library-ms"; + + internal override IShellItem NativeShellItem + { + get { return NativeShellItem2; } + } + + internal override IShellItem2 NativeShellItem2 + { + get { return nativeShellItem; } + } + + #endregion + + #region Static Shell Library methods + + /// + /// Get a the known folder FOLDERID_Libraries + /// + public static IKnownFolder LibrariesKnownFolder + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return KnownFolderHelper.FromKnownFolderId(new Guid(ShellKFIDGuid.Libraries)); + } + } + + /// + /// Load the library using a number of options + /// + /// The name of the library + /// If true, loads the library in read-only mode. + /// A ShellLibrary Object + public static ShellLibrary Load(string libraryName, bool isReadOnly) + { + CoreHelpers.ThrowIfNotWin7(); + + IKnownFolder kf = KnownFolders.Libraries; + string librariesFolderPath = (kf != null) ? kf.Path : string.Empty; + + Guid guid = new Guid(ShellIIDGuid.IShellItem); + IShellItem nativeShellItem; + string shellItemPath = System.IO.Path.Combine(librariesFolderPath, libraryName + FileExtension); + int hr = ShellNativeMethods.SHCreateItemFromParsingName(shellItemPath, IntPtr.Zero, ref guid, out nativeShellItem); + + if (!CoreErrorHelper.Succeeded(hr)) + throw new ShellException(hr); + + INativeShellLibrary nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass(); + AccessModes flags = isReadOnly ? + AccessModes.Read : + AccessModes.ReadWrite; + nativeShellLibrary.LoadLibraryFromItem(nativeShellItem, flags); + + ShellLibrary library = new ShellLibrary(nativeShellLibrary); + try + { + library.nativeShellItem = (IShellItem2)nativeShellItem; + library.Name = libraryName; + + return library; + } + catch + { + library.Dispose(); + throw; + } + } + + /// + /// Load the library using a number of options + /// + /// The name of the library. + /// The path to the library. + /// If true, opens the library in read-only mode. + /// A ShellLibrary Object + public static ShellLibrary Load(string libraryName, string folderPath, bool isReadOnly) + { + CoreHelpers.ThrowIfNotWin7(); + + // Create the shell item path + string shellItemPath = System.IO.Path.Combine(folderPath, libraryName + FileExtension); + ShellFile item = ShellFile.FromFilePath(shellItemPath); + + IShellItem nativeShellItem = item.NativeShellItem; + INativeShellLibrary nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass(); + AccessModes flags = isReadOnly ? + AccessModes.Read : + AccessModes.ReadWrite; + nativeShellLibrary.LoadLibraryFromItem(nativeShellItem, flags); + + ShellLibrary library = new ShellLibrary(nativeShellLibrary); + try + { + library.nativeShellItem = (IShellItem2)nativeShellItem; + library.Name = libraryName; + + return library; + } + catch + { + library.Dispose(); + throw; + } + } + + /// + /// Load the library using a number of options + /// + /// IShellItem + /// read-only flag + /// A ShellLibrary Object + internal static ShellLibrary FromShellItem(IShellItem nativeShellItem, bool isReadOnly) + { + CoreHelpers.ThrowIfNotWin7(); + + INativeShellLibrary nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass(); + + AccessModes flags = isReadOnly ? + AccessModes.Read : + AccessModes.ReadWrite; + + nativeShellLibrary.LoadLibraryFromItem(nativeShellItem, flags); + + ShellLibrary library = new ShellLibrary(nativeShellLibrary); + library.nativeShellItem = (IShellItem2)nativeShellItem; + + return library; + } + + /// + /// Load the library using a number of options + /// + /// A known folder. + /// If true, opens the library in read-only mode. + /// A ShellLibrary Object + public static ShellLibrary Load(IKnownFolder sourceKnownFolder, bool isReadOnly) + { + CoreHelpers.ThrowIfNotWin7(); + return new ShellLibrary(sourceKnownFolder, isReadOnly); + } + + private static void ShowManageLibraryUI(ShellLibrary shellLibrary, IntPtr windowHandle, string title, string instruction, bool allowAllLocations) + { + int hr = 0; + + Thread staWorker = new Thread(() => + { + hr = ShellNativeMethods.SHShowManageLibraryUI( + shellLibrary.NativeShellItem, + windowHandle, + title, + instruction, + allowAllLocations ? + ShellNativeMethods.LibraryManageDialogOptions.NonIndexableLocationWarning : + ShellNativeMethods.LibraryManageDialogOptions.Default); + }); + + staWorker.SetApartmentState(ApartmentState.STA); + staWorker.Start(); + staWorker.Join(); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + + /// + /// Shows the library management dialog which enables users to mange the library folders and default save location. + /// + /// The name of the library + /// The path to the library. + /// The parent window,or IntPtr.Zero for no parent + /// A title for the library management dialog, or null to use the library name as the title + /// An optional help string to display for the library management dialog + /// If true, do not show warning dialogs about locations that cannot be indexed + /// If the library is already open in read-write mode, the dialog will not save the changes. + public static void ShowManageLibraryUI(string libraryName, string folderPath, IntPtr windowHandle, string title, string instruction, bool allowAllLocations) + { + // this method is not safe for MTA consumption and will blow + // Access Violations if called from an MTA thread so we wrap this + // call up into a Worker thread that performs all operations in a + // single threaded apartment + using (ShellLibrary shellLibrary = ShellLibrary.Load(libraryName, folderPath, true)) + { + ShowManageLibraryUI(shellLibrary, windowHandle, title, instruction, allowAllLocations); + } + } + + /// + /// Shows the library management dialog which enables users to mange the library folders and default save location. + /// + /// The name of the library + /// The parent window,or IntPtr.Zero for no parent + /// A title for the library management dialog, or null to use the library name as the title + /// An optional help string to display for the library management dialog + /// If true, do not show warning dialogs about locations that cannot be indexed + /// If the library is already open in read-write mode, the dialog will not save the changes. + public static void ShowManageLibraryUI(string libraryName, IntPtr windowHandle, string title, string instruction, bool allowAllLocations) + { + // this method is not safe for MTA consumption and will blow + // Access Violations if called from an MTA thread so we wrap this + // call up into a Worker thread that performs all operations in a + // single threaded apartment + using (ShellLibrary shellLibrary = ShellLibrary.Load(libraryName, true)) + { + ShowManageLibraryUI(shellLibrary, windowHandle, title, instruction, allowAllLocations); + } + } + + /// + /// Shows the library management dialog which enables users to mange the library folders and default save location. + /// + /// A known folder. + /// The parent window,or IntPtr.Zero for no parent + /// A title for the library management dialog, or null to use the library name as the title + /// An optional help string to display for the library management dialog + /// If true, do not show warning dialogs about locations that cannot be indexed + /// If the library is already open in read-write mode, the dialog will not save the changes. + public static void ShowManageLibraryUI(IKnownFolder sourceKnownFolder, IntPtr windowHandle, string title, string instruction, bool allowAllLocations) + { + // this method is not safe for MTA consumption and will blow + // Access Violations if called from an MTA thread so we wrap this + // call up into a Worker thread that performs all operations in a + // single threaded apartment + using (ShellLibrary shellLibrary = ShellLibrary.Load(sourceKnownFolder, true)) + { + ShowManageLibraryUI(shellLibrary, windowHandle, title, instruction, allowAllLocations); + } + } + + #endregion + + #region Collection Members + + /// + /// Add a new FileSystemFolder or SearchConnector + /// + /// The folder to add to the library. + public void Add(ShellFileSystemFolder item) + { + if (item == null) { throw new ArgumentNullException("item"); } + + nativeShellLibrary.AddFolder(item.NativeShellItem); + nativeShellLibrary.Commit(); + } + + /// + /// Add an existing folder to this library + /// + /// The path to the folder to be added to the library. + public void Add(string folderPath) + { + if (!Directory.Exists(folderPath)) + { + throw new DirectoryNotFoundException(LocalizedMessages.ShellLibraryFolderNotFound); + } + + Add(ShellFileSystemFolder.FromFolderPath(folderPath)); + } + + /// + /// Clear all items of this Library + /// + public void Clear() + { + List list = ItemsList; + foreach (ShellFileSystemFolder folder in list) + { + nativeShellLibrary.RemoveFolder(folder.NativeShellItem); + } + + nativeShellLibrary.Commit(); + } + + /// + /// Remove a folder or search connector + /// + /// The item to remove. + /// true if the item was removed. + public bool Remove(ShellFileSystemFolder item) + { + if (item == null) { throw new ArgumentNullException("item"); } + + try + { + nativeShellLibrary.RemoveFolder(item.NativeShellItem); + nativeShellLibrary.Commit(); + } + catch (COMException) + { + return false; + } + + return true; + } + + /// + /// Remove a folder or search connector + /// + /// The path of the item to remove. + /// true if the item was removed. + public bool Remove(string folderPath) + { + ShellFileSystemFolder item = ShellFileSystemFolder.FromFolderPath(folderPath); + return Remove(item); + } + + #endregion + + #region Disposable Pattern + + /// + /// Release resources + /// + /// Indicates that this was called from Dispose(), rather than from the finalizer. + protected override void Dispose(bool disposing) + { + if (nativeShellLibrary != null) + { + Marshal.ReleaseComObject(nativeShellLibrary); + nativeShellLibrary = null; + } + + base.Dispose(disposing); + } + + /// + /// Release resources + /// + ~ShellLibrary() + { + Dispose(false); + } + + #endregion + + #region Private Properties + + private List ItemsList + { + get { return GetFolders(); } + } + + private List GetFolders() + { + List list = new List(); + IShellItemArray itemArray; + + Guid shellItemArrayGuid = new Guid(ShellIIDGuid.IShellItemArray); + + HResult hr = nativeShellLibrary.GetFolders(ShellNativeMethods.LibraryFolderFilter.AllItems, ref shellItemArrayGuid, out itemArray); + + if (!CoreErrorHelper.Succeeded(hr)) { return list; } + + uint count; + itemArray.GetCount(out count); + + for (uint i = 0; i < count; ++i) + { + IShellItem shellItem; + itemArray.GetItemAt(i, out shellItem); + list.Add(new ShellFileSystemFolder(shellItem as IShellItem2)); + } + + if (itemArray != null) + { + Marshal.ReleaseComObject(itemArray); + itemArray = null; + } + + return list; + } + + #endregion + + #region IEnumerable Members + + /// + /// Retrieves the collection enumerator. + /// + /// The enumerator. + new public IEnumerator GetEnumerator() + { + return ItemsList.GetEnumerator(); + } + + #endregion + + #region IEnumerable Members + + /// + /// Retrieves the collection enumerator. + /// + /// The enumerator. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return ItemsList.GetEnumerator(); + } + + #endregion + + #region ICollection Members + + + /// + /// Determines if an item with the specified path exists in the collection. + /// + /// The path of the item. + /// true if the item exists in the collection. + public bool Contains(string fullPath) + { + if (string.IsNullOrEmpty(fullPath)) + { + throw new ArgumentNullException("fullPath"); + } + + return ItemsList.Any(folder => string.Equals(fullPath, folder.Path, StringComparison.OrdinalIgnoreCase)); + } + + /// + /// Determines if a folder exists in the collection. + /// + /// The folder. + /// true, if the folder exists in the collection. + public bool Contains(ShellFileSystemFolder item) + { + if (item == null) + { + throw new ArgumentNullException("item"); + } + + return ItemsList.Any(folder => string.Equals(item.Path, folder.Path, StringComparison.OrdinalIgnoreCase)); + } + + #endregion + + #region IList Members + + /// + /// Searches for the specified FileSystemFolder and returns the zero-based index of the + /// first occurrence within Library list. + /// + /// The item to search for. + /// The index of the item in the collection, or -1 if the item does not exist. + public int IndexOf(ShellFileSystemFolder item) + { + return ItemsList.IndexOf(item); + } + + /// + /// Inserts a FileSystemFolder at the specified index. + /// + /// The index to insert at. + /// The FileSystemFolder to insert. + void IList.Insert(int index, ShellFileSystemFolder item) + { + // Index related options are not supported by IShellLibrary doesn't support them. + throw new NotImplementedException(); + } + + /// + /// Removes an item at the specified index. + /// + /// The index to remove. + void IList.RemoveAt(int index) + { + // Index related options are not supported by IShellLibrary doesn't support them. + throw new NotImplementedException(); + } + + /// + /// Retrieves the folder at the specified index + /// + /// The index of the folder to retrieve. + /// A folder. + public ShellFileSystemFolder this[int index] + { + get { return ItemsList[index]; } + set + { + // Index related options are not supported by IShellLibrary + // doesn't support them. + throw new NotImplementedException(); + } + } + #endregion + + #region ICollection Members + + /// + /// Copies the collection to an array. + /// + /// The array to copy to. + /// The index in the array at which to start the copy. + void ICollection.CopyTo(ShellFileSystemFolder[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// The count of the items in the list. + /// + public int Count + { + get { return ItemsList.Count; } + } + + /// + /// Indicates whether this list is read-only or not. + /// + public bool IsReadOnly + { + get { return false; } + } + + #endregion + + /// + /// Indicates whether this feature is supported on the current platform. + /// + new public static bool IsPlatformSupported + { + get + { + // We need Windows 7 onwards ... + return CoreHelpers.RunningOnWin7; + } + } + } + +} diff --git a/Shell/Common/ShellLink.cs b/Shell/Common/ShellLink.cs new file mode 100644 index 0000000..de95815 --- /dev/null +++ b/Shell/Common/ShellLink.cs @@ -0,0 +1,143 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a link to existing FileSystem or Virtual item. + /// + public class ShellLink : ShellObject + { + /// + /// Path for this file e.g. c:\Windows\file.txt, + /// + private string _internalPath; + + #region Internal Constructors + + internal ShellLink(IShellItem2 shellItem) + { + nativeShellItem = shellItem; + } + + #endregion + + #region Public Properties + + /// + /// The path for this link + /// + virtual public string Path + { + get + { + if (_internalPath == null && NativeShellItem != null) + { + _internalPath = base.ParsingName; + } + return _internalPath; + } + protected set + { + this._internalPath = value; + } + } + + private string internalTargetLocation; + /// + /// Gets the location to which this link points to. + /// + public string TargetLocation + { + get + { + if (string.IsNullOrEmpty(internalTargetLocation) && NativeShellItem2 != null) + { + internalTargetLocation = this.Properties.System.Link.TargetParsingPath.Value; + } + return internalTargetLocation; + } + set + { + if (value == null) { return; } + + internalTargetLocation = value; + + if (NativeShellItem2 != null) + { + this.Properties.System.Link.TargetParsingPath.Value = internalTargetLocation; + } + } + } + + /// + /// Gets the ShellObject to which this link points to. + /// + public ShellObject TargetShellObject + { + get { return ShellObjectFactory.Create(TargetLocation); } + } + + /// + /// Gets or sets the link's title + /// + public string Title + { + get + { + if (NativeShellItem2 != null) { return this.Properties.System.Title.Value; } + return null; + } + set + { + if (value == null) + { + throw new ArgumentNullException("value"); + } + + if (NativeShellItem2 != null) + { + this.Properties.System.Title.Value = value; + } + } + } + + private string internalArguments; + /// + /// Gets the arguments associated with this link. + /// + public string Arguments + { + get + { + if (string.IsNullOrEmpty(internalArguments) && NativeShellItem2 != null) + { + internalArguments = this.Properties.System.Link.Arguments.Value; + } + + return internalArguments; + } + } + + private string internalComments; + /// + /// Gets the comments associated with this link. + /// + public string Comments + { + get + { + if (string.IsNullOrEmpty(internalComments) && NativeShellItem2 != null) + { + internalComments = this.Properties.System.Comment.Value; + } + + return internalComments; + } + } + + + #endregion + } +} diff --git a/Shell/Common/ShellNonFileSystemFolder.cs b/Shell/Common/ShellNonFileSystemFolder.cs new file mode 100644 index 0000000..dc608a1 --- /dev/null +++ b/Shell/Common/ShellNonFileSystemFolder.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a Non FileSystem folder (e.g. My Computer, Control Panel) + /// + public class ShellNonFileSystemFolder : ShellFolder + { + #region Internal Constructors + + internal ShellNonFileSystemFolder() + { + // Empty + } + + internal ShellNonFileSystemFolder(IShellItem2 shellItem) + { + nativeShellItem = shellItem; + } + + #endregion + + } +} diff --git a/Shell/Common/ShellNonFileSystemItem.cs b/Shell/Common/ShellNonFileSystemItem.cs new file mode 100644 index 0000000..b04f2b9 --- /dev/null +++ b/Shell/Common/ShellNonFileSystemItem.cs @@ -0,0 +1,15 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a non filesystem item (e.g. virtual items inside Control Panel) + /// + public class ShellNonFileSystemItem : ShellObject + { + internal ShellNonFileSystemItem(IShellItem2 shellItem) + { + nativeShellItem = shellItem; + } + } +} diff --git a/Shell/Common/ShellObject.cs b/Shell/Common/ShellObject.cs new file mode 100644 index 0000000..23aa4c4 --- /dev/null +++ b/Shell/Common/ShellObject.cs @@ -0,0 +1,532 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; +using System.Runtime.InteropServices.ComTypes; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// The base class for all Shell objects in Shell Namespace. + /// + abstract public class ShellObject : IDisposable, IEquatable + { + + #region Public Static Methods + + /// + /// Creates a ShellObject subclass given a parsing name. + /// For file system items, this method will only accept absolute paths. + /// + /// The parsing name of the object. + /// A newly constructed ShellObject object. + public static ShellObject FromParsingName(string parsingName) + { + return ShellObjectFactory.Create(parsingName); + } + + /// + /// Indicates whether this feature is supported on the current platform. + /// + public static bool IsPlatformSupported + { + get + { + // We need Windows Vista onwards ... + return CoreHelpers.RunningOnVista; + } + } + + #endregion + + #region Internal Fields + + /// + /// Internal member to keep track of the native IShellItem2 + /// + internal IShellItem2 nativeShellItem; + + #endregion + + #region Constructors + + internal ShellObject() + { + } + + internal ShellObject(IShellItem2 shellItem) + { + nativeShellItem = shellItem; + } + + #endregion + + #region Protected Fields + + /// + /// Parsing name for this Object e.g. c:\Windows\file.txt, + /// or ::{Some Guid} + /// + private string _internalParsingName; + + /// + /// A friendly name for this object that' suitable for display + /// + private string _internalName; + + /// + /// PID List (PIDL) for this object + /// + private IntPtr _internalPIDL = IntPtr.Zero; + + #endregion + + #region Internal Properties + + /// + /// Return the native ShellFolder object as newer IShellItem2 + /// + /// If the native object cannot be created. + /// The ErrorCode member will contain the external error code. + virtual internal IShellItem2 NativeShellItem2 + { + get + { + if (nativeShellItem == null && ParsingName != null) + { + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + int retCode = ShellNativeMethods.SHCreateItemFromParsingName(ParsingName, IntPtr.Zero, ref guid, out nativeShellItem); + + if (nativeShellItem == null || !CoreErrorHelper.Succeeded(retCode)) + { + throw new ShellException(LocalizedMessages.ShellObjectCreationFailed, Marshal.GetExceptionForHR(retCode)); + } + } + return nativeShellItem; + } + } + + /// + /// Return the native ShellFolder object + /// + virtual internal IShellItem NativeShellItem + { + get { return NativeShellItem2; } + } + + /// + /// Gets access to the native IPropertyStore (if one is already + /// created for this item and still valid. This is usually done by the + /// ShellPropertyWriter class. The reference will be set to null + /// when the writer has been closed/commited). + /// + internal IPropertyStore NativePropertyStore { get; set; } + + #endregion + + #region Public Methods + + /// + /// Updates the native shell item that maps to this shell object. This is necessary when the shell item + /// changes after the shell object has been created. Without this method call, the retrieval of properties will + /// return stale data. + /// + /// Bind context object + public void Update(IBindCtx bindContext) + { + HResult hr = HResult.Ok; + + if (NativeShellItem2 != null) + { + hr = NativeShellItem2.Update(bindContext); + } + + if (CoreErrorHelper.Failed(hr)) + { + throw new ShellException(hr); + } + } + + #endregion + + #region Public Properties + + private ShellProperties properties; + /// + /// Gets an object that allows the manipulation of ShellProperties for this shell item. + /// + public ShellProperties Properties + { + get + { + if (properties == null) + { + properties = new ShellProperties(this); + } + return properties; + } + } + + /// + /// Gets the parsing name for this ShellItem. + /// + virtual public string ParsingName + { + get + { + if (_internalParsingName == null && nativeShellItem != null) + { + _internalParsingName = ShellHelper.GetParsingName(nativeShellItem); + } + return _internalParsingName ?? string.Empty; + } + protected set + { + _internalParsingName = value; + } + } + + /// + /// Gets the normal display for this ShellItem. + /// + virtual public string Name + { + get + { + if (_internalName == null && NativeShellItem != null) + { + IntPtr pszString = IntPtr.Zero; + HResult hr = NativeShellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.Normal, out pszString); + if (hr == HResult.Ok && pszString != IntPtr.Zero) + { + _internalName = Marshal.PtrToStringAuto(pszString); + + // Free the string + Marshal.FreeCoTaskMem(pszString); + + } + } + return _internalName; + } + + protected set + { + this._internalName = value; + } + } + + /// + /// Gets the PID List (PIDL) for this ShellItem. + /// + internal virtual IntPtr PIDL + { + get + { + // Get teh PIDL for the ShellItem + if (_internalPIDL == IntPtr.Zero && NativeShellItem != null) + { + _internalPIDL = ShellHelper.PidlFromShellItem(NativeShellItem); + } + + return _internalPIDL; + } + set + { + this._internalPIDL = value; + } + } + + /// + /// Overrides object.ToString() + /// + /// A string representation of the object. + public override string ToString() + { + return this.Name; + } + + /// + /// Returns the display name of the ShellFolder object. DisplayNameType represents one of the + /// values that indicates how the name should look. + /// See for a list of possible values. + /// + /// A disaply name type. + /// A string. + public virtual string GetDisplayName(DisplayNameType displayNameType) + { + string returnValue = null; + + HResult hr = HResult.Ok; + + if (NativeShellItem2 != null) + { + hr = NativeShellItem2.GetDisplayName((ShellNativeMethods.ShellItemDesignNameOptions)displayNameType, out returnValue); + } + + if (hr != HResult.Ok) + { + throw new ShellException(LocalizedMessages.ShellObjectCannotGetDisplayName, hr); + } + + return returnValue; + } + + /// + /// Gets a value that determines if this ShellObject is a link or shortcut. + /// + public bool IsLink + { + get + { + try + { + ShellNativeMethods.ShellFileGetAttributesOptions sfgao; + NativeShellItem.GetAttributes(ShellNativeMethods.ShellFileGetAttributesOptions.Link, out sfgao); + return (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.Link) != 0; + } + catch (FileNotFoundException) + { + return false; + } + catch (NullReferenceException) + { + // NativeShellItem is null + return false; + } + } + } + + /// + /// Gets a value that determines if this ShellObject is a file system object. + /// + public bool IsFileSystemObject + { + get + { + try + { + ShellNativeMethods.ShellFileGetAttributesOptions sfgao; + NativeShellItem.GetAttributes(ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem, out sfgao); + return (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem) != 0; + } + catch (FileNotFoundException) + { + return false; + } + catch (NullReferenceException) + { + // NativeShellItem is null + return false; + } + } + } + + private ShellThumbnail thumbnail; + /// + /// Gets the thumbnail of the ShellObject. + /// + public ShellThumbnail Thumbnail + { + get + { + if (thumbnail == null) { thumbnail = new ShellThumbnail(this); } + return thumbnail; + } + } + + private ShellObject parentShellObject; + /// + /// Gets the parent ShellObject. + /// Returns null if the object has no parent, i.e. if this object is the Desktop folder. + /// + public ShellObject Parent + { + get + { + if (parentShellObject == null && NativeShellItem2 != null) + { + IShellItem parentShellItem; + HResult hr = NativeShellItem2.GetParent(out parentShellItem); + + if (hr == HResult.Ok && parentShellItem != null) + { + parentShellObject = ShellObjectFactory.Create(parentShellItem); + } + else if (hr == HResult.NoObject) + { + // Should return null if the parent is desktop + return null; + } + else + { + throw new ShellException(hr); + } + } + + return parentShellObject; + } + } + + + #endregion + + #region IDisposable Members + + /// + /// Release the native and managed objects + /// + /// Indicates that this is being called from Dispose(), rather than the finalizer. + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + _internalName = null; + _internalParsingName = null; + properties = null; + thumbnail = null; + parentShellObject = null; + } + + if (properties != null) + { + properties.Dispose(); + } + + if (_internalPIDL != IntPtr.Zero) + { + ShellNativeMethods.ILFree(_internalPIDL); + _internalPIDL = IntPtr.Zero; + } + + if (nativeShellItem != null) + { + Marshal.ReleaseComObject(nativeShellItem); + nativeShellItem = null; + } + + if (NativePropertyStore != null) + { + Marshal.ReleaseComObject(NativePropertyStore); + NativePropertyStore = null; + } + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Implement the finalizer. + /// + ~ShellObject() + { + Dispose(false); + } + + #endregion + + #region equality and hashing + + /// + /// Returns the hash code of the object. + /// + /// + public override int GetHashCode() + { + if (!hashValue.HasValue) + { + uint size = ShellNativeMethods.ILGetSize(PIDL); + if (size != 0) + { + byte[] pidlData = new byte[size]; + Marshal.Copy(PIDL, pidlData, 0, (int)size); + byte[] hashData = ShellObject.hashProvider.ComputeHash(pidlData); + hashValue = BitConverter.ToInt32(hashData, 0); + } + else + { + hashValue = 0; + } + + } + return hashValue.Value; + } + private static MD5CryptoServiceProvider hashProvider = new MD5CryptoServiceProvider(); + private int? hashValue; + + /// + /// Determines if two ShellObjects are identical. + /// + /// The ShellObject to comare this one to. + /// True if the ShellObjects are equal, false otherwise. + public bool Equals(ShellObject other) + { + bool areEqual = false; + + if (other != null) + { + IShellItem ifirst = this.NativeShellItem; + IShellItem isecond = other.NativeShellItem; + if (ifirst != null && isecond != null) + { + int result = 0; + HResult hr = ifirst.Compare( + isecond, SICHINTF.SICHINT_ALLFIELDS, out result); + + areEqual = (hr == HResult.Ok) && (result == 0); + } + } + + return areEqual; + } + + /// + /// Returns whether this object is equal to another. + /// + /// The object to compare against. + /// Equality result. + public override bool Equals(object obj) + { + return this.Equals(obj as ShellObject); + } + + /// + /// Implements the == (equality) operator. + /// + /// First object to compare. + /// Second object to compare. + /// True if leftShellObject equals rightShellObject; false otherwise. + public static bool operator ==(ShellObject leftShellObject, ShellObject rightShellObject) + { + if ((object)leftShellObject == null) + { + return ((object)rightShellObject == null); + } + return leftShellObject.Equals(rightShellObject); + } + + /// + /// Implements the != (inequality) operator. + /// + /// First object to compare. + /// Second object to compare. + /// True if leftShellObject does not equal leftShellObject; false otherwise. + public static bool operator !=(ShellObject leftShellObject, ShellObject rightShellObject) + { + return !(leftShellObject == rightShellObject); + } + + + #endregion + } +} diff --git a/Shell/Common/ShellObjectCollection.cs b/Shell/Common/ShellObjectCollection.cs new file mode 100644 index 0000000..1c1d85d --- /dev/null +++ b/Shell/Common/ShellObjectCollection.cs @@ -0,0 +1,396 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// An ennumerable list of ShellObjects + /// + public class ShellObjectCollection : IEnumerable, IDisposable, IList + { + private List content = new List(); + + bool readOnly; + bool isDisposed; + + #region construction/disposal/finialization + /// + /// Creates a ShellObject collection from an IShellItemArray + /// + /// IShellItemArray pointer + /// Indicates whether the collection shouldbe read-only or not + internal ShellObjectCollection(IShellItemArray iArray, bool readOnly) + { + this.readOnly = readOnly; + + if (iArray != null) + { + try + { + uint itemCount = 0; + iArray.GetCount(out itemCount); + content.Capacity = (int)itemCount; + for (uint index = 0; index < itemCount; index++) + { + IShellItem iShellItem = null; + iArray.GetItemAt(index, out iShellItem); + content.Add(ShellObjectFactory.Create(iShellItem)); + } + } + finally + { + Marshal.ReleaseComObject(iArray); + } + } + } + + /// + /// Creates a ShellObjectCollection from an IDataObject passed during Drop operation. + /// + /// An object that implements the IDataObject COM interface. + /// ShellObjectCollection created from the given IDataObject + public static ShellObjectCollection FromDataObject(System.Runtime.InteropServices.ComTypes.IDataObject dataObject) + { + IShellItemArray shellItemArray; + Guid iid = new Guid(ShellIIDGuid.IShellItemArray); + ShellNativeMethods.SHCreateShellItemArrayFromDataObject(dataObject, ref iid, out shellItemArray); + return new ShellObjectCollection(shellItemArray, true); + } + + /// + /// Constructs an empty ShellObjectCollection + /// + public ShellObjectCollection() + { + // Left empty + } + + /// + /// Finalizer + /// + ~ShellObjectCollection() + { + Dispose(false); + } + + /// + /// Standard Dispose pattern + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Standard Dispose patterns + /// + /// Indicates that this is being called from Dispose(), rather than the finalizer. + protected virtual void Dispose(bool disposing) + { + if (isDisposed == false) + { + if (disposing) + { + foreach (ShellObject shellObject in content) + { + shellObject.Dispose(); + } + + content.Clear(); + } + + isDisposed = true; + } + } + #endregion + + #region implementation + + /// + /// Item count + /// + public int Count { get { return content.Count; } } + + /// + /// Collection enumeration + /// + /// + public System.Collections.IEnumerator GetEnumerator() + { + foreach (ShellObject obj in content) + { + yield return obj; + } + } + + /// + /// Builds the data for the CFSTR_SHELLIDLIST Drag and Clipboard data format from the + /// ShellObjects in the collection. + /// + /// A memory stream containing the drag/drop data. + public MemoryStream BuildShellIDList() + { + if (content.Count == 0) + { + throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionEmptyCollection); + } + + + MemoryStream mstream = new MemoryStream(); + try + { + BinaryWriter bwriter = new BinaryWriter(mstream); + + + // number of IDLs to be written (shell objects + parent folder) + uint itemCount = (uint)(content.Count + 1); + + // grab the object IDLs + IntPtr[] idls = new IntPtr[itemCount]; + + for (int index = 0; index < itemCount; index++) + { + if (index == 0) + { + // Because the ShellObjects passed in may be from anywhere, the + // parent folder reference must be the desktop. + idls[index] = ((ShellObject)KnownFolders.Desktop).PIDL; + } + else + { + idls[index] = content[index - 1].PIDL; + } + } + + // calculate offset array (folder IDL + item IDLs) + uint[] offsets = new uint[itemCount + 1]; + for (int index = 0; index < itemCount; index++) + { + if (index == 0) + { + // first offset equals size of CIDA header data + offsets[0] = (uint)(sizeof(uint) * (offsets.Length + 1)); + } + else + { + offsets[index] = offsets[index - 1] + ShellNativeMethods.ILGetSize(idls[index - 1]); + } + } + + // Fill out the CIDA header + // + // typedef struct _IDA { + // UINT cidl; // number of relative IDList + // UINT aoffset[1]; // [0]: folder IDList, [1]-[cidl]: item IDList + // } CIDA, * LPIDA; + // + bwriter.Write(content.Count); + foreach (uint offset in offsets) + { + bwriter.Write(offset); + } + + // copy idls + foreach (IntPtr idl in idls) + { + byte[] data = new byte[ShellNativeMethods.ILGetSize(idl)]; + Marshal.Copy(idl, data, 0, data.Length); + bwriter.Write(data, 0, data.Length); + } + } + catch + { + mstream.Dispose(); + throw; + } + // return CIDA stream + return mstream; + } + #endregion + + #region IList Members + + /// + /// Returns the index of a particualr shell object in the collection + /// + /// The item to search for. + /// The index of the item found, or -1 if not found. + public int IndexOf(ShellObject item) + { + return content.IndexOf(item); + } + + /// + /// Inserts a new shell object into the collection. + /// + /// The index at which to insert. + /// The item to insert. + public void Insert(int index, ShellObject item) + { + if (readOnly) + { + throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionInsertReadOnly); + } + + content.Insert(index, item); + } + + /// + /// Removes the specified ShellObject from the collection + /// + /// The index to remove at. + public void RemoveAt(int index) + { + if (readOnly) + { + throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionRemoveReadOnly); + } + + content.RemoveAt(index); + } + + /// + /// The collection indexer + /// + /// The index of the item to retrieve. + /// The ShellObject at the specified index + public ShellObject this[int index] + { + get + { + return content[index]; + } + set + { + if (readOnly) + { + throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionInsertReadOnly); + } + + content[index] = value; + } + } + + #endregion + + #region ICollection Members + + /// + /// Adds a ShellObject to the collection, + /// + /// The ShellObject to add. + public void Add(ShellObject item) + { + if (readOnly) + { + throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionInsertReadOnly); + } + + content.Add(item); + } + + /// + /// Clears the collection of ShellObjects. + /// + public void Clear() + { + if (readOnly) + { + throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionRemoveReadOnly); + } + + content.Clear(); + } + + /// + /// Determines if the collection contains a particular ShellObject. + /// + /// The ShellObject. + /// true, if the ShellObject is in the list, false otherwise. + public bool Contains(ShellObject item) + { + return content.Contains(item); + } + + /// + /// Copies the ShellObjects in the collection to a ShellObject array. + /// + /// The destination to copy to. + /// The index into the array at which copying will commence. + public void CopyTo(ShellObject[] array, int arrayIndex) + { + if (array == null) { throw new ArgumentNullException("array"); } + if (array.Length < arrayIndex + content.Count) + { + throw new ArgumentException(LocalizedMessages.ShellObjectCollectionArrayTooSmall, "array"); + } + + for (int index = 0; index < content.Count; index++) + { + array[index + arrayIndex] = content[index]; + } + } + + /// + /// Retrieves the number of ShellObjects in the collection + /// + int ICollection.Count + { + get + { + return content.Count; + } + } + + /// + /// If true, the contents of the collection are immutable. + /// + public bool IsReadOnly + { + get + { + return readOnly; + } + } + + /// + /// Removes a particular ShellObject from the list. + /// + /// The ShellObject to remove. + /// True if the item could be removed, false otherwise. + public bool Remove(ShellObject item) + { + if (readOnly) + { + throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionRemoveReadOnly); + } + + return content.Remove(item); + } + + #endregion + + #region IEnumerable Members + + /// + /// Allows for enumeration through the list of ShellObjects in the collection. + /// + /// The IEnumerator interface to use for enumeration. + IEnumerator IEnumerable.GetEnumerator() + { + foreach (ShellObject obj in content) + { + yield return obj; + } + } + + #endregion + } +} diff --git a/Shell/Common/ShellObjectContainer.cs b/Shell/Common/ShellObjectContainer.cs new file mode 100644 index 0000000..8a42f21 --- /dev/null +++ b/Shell/Common/ShellObjectContainer.cs @@ -0,0 +1,120 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents the base class for all types of Shell "containers". Any class deriving from this class + /// can contain other ShellObjects (e.g. ShellFolder, FileSystemKnownFolder, ShellLibrary, etc) + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "This will complicate the class hierarchy and naming convention used in the Shell area")] + public abstract class ShellContainer : ShellObject, IEnumerable, IDisposable + { + + #region Private Fields + + private IShellFolder desktopFolderEnumeration; + private IShellFolder nativeShellFolder; + + #endregion + + #region Internal Properties + + internal IShellFolder NativeShellFolder + { + get + { + if (nativeShellFolder == null) + { + Guid guid = new Guid(ShellIIDGuid.IShellFolder); + Guid handler = new Guid(ShellBHIDGuid.ShellFolderObject); + + HResult hr = NativeShellItem.BindToHandler( + IntPtr.Zero, ref handler, ref guid, out nativeShellFolder); + + if (CoreErrorHelper.Failed(hr)) + { + string str = ShellHelper.GetParsingName(NativeShellItem); + if (str != null && str != Environment.GetFolderPath(Environment.SpecialFolder.Desktop)) + { + throw new ShellException(hr); + } + } + } + + return nativeShellFolder; + } + } + + #endregion + + #region Internal Constructor + + internal ShellContainer() { } + + internal ShellContainer(IShellItem2 shellItem) : base(shellItem) { } + + #endregion + + #region Disposable Pattern + + /// + /// Release resources + /// + /// True indicates that this is being called from Dispose(), rather than the finalizer. + protected override void Dispose(bool disposing) + { + if (nativeShellFolder != null) + { + Marshal.ReleaseComObject(nativeShellFolder); + nativeShellFolder = null; + } + + if (desktopFolderEnumeration != null) + { + Marshal.ReleaseComObject(desktopFolderEnumeration); + desktopFolderEnumeration = null; + } + + base.Dispose(disposing); + } + + #endregion + + #region IEnumerable Members + + /// + /// Enumerates through contents of the ShellObjectContainer + /// + /// Enumerated contents + public IEnumerator GetEnumerator() + { + if (NativeShellFolder == null) + { + if (desktopFolderEnumeration == null) + { + ShellNativeMethods.SHGetDesktopFolder(out desktopFolderEnumeration); + } + + nativeShellFolder = desktopFolderEnumeration; + } + + return new ShellFolderItems(this); + } + + #endregion + + #region IEnumerable Members + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return new ShellFolderItems(this); + } + + #endregion + } +} diff --git a/Shell/Common/ShellObjectFactory.cs b/Shell/Common/ShellObjectFactory.cs new file mode 100644 index 0000000..73c5147 --- /dev/null +++ b/Shell/Common/ShellObjectFactory.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; +using System.Linq; +using System.Threading; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal static class ShellObjectFactory + { + /// + /// Creates a ShellObject given a native IShellItem interface + /// + /// + /// A newly constructed ShellObject object + internal static ShellObject Create(IShellItem nativeShellItem) + { + // Sanity check + Debug.Assert(nativeShellItem != null, "nativeShellItem should not be null"); + + // Need to make sure we're running on Vista or higher + if (!CoreHelpers.RunningOnVista) + { + throw new PlatformNotSupportedException(LocalizedMessages.ShellObjectFactoryPlatformNotSupported); + } + + // A lot of APIs need IShellItem2, so just keep a copy of it here + IShellItem2 nativeShellItem2 = nativeShellItem as IShellItem2; + + // Get the System.ItemType property + string itemType = ShellHelper.GetItemType(nativeShellItem2); + + if (!string.IsNullOrEmpty(itemType)) { itemType = itemType.ToUpperInvariant(); } + + // Get some IShellItem attributes + ShellNativeMethods.ShellFileGetAttributesOptions sfgao; + nativeShellItem2.GetAttributes(ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem | ShellNativeMethods.ShellFileGetAttributesOptions.Folder, out sfgao); + + // Is this item a FileSystem item? + bool isFileSystem = (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem) != 0; + + // Is this item a Folder? + bool isFolder = (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.Folder) != 0; + + // Shell Library + ShellLibrary shellLibrary = null; + + // Create the right type of ShellObject based on the above information + + // 1. First check if this is a Shell Link + if (itemType == ".lnk") + { + return new ShellLink(nativeShellItem2); + } + // 2. Check if this is a container or a single item (entity) + else if (isFolder) + { + // 3. If this is a folder, check for types: Shell Library, Shell Folder or Search Container + if (itemType == ".library-ms" && (shellLibrary = ShellLibrary.FromShellItem(nativeShellItem2, true)) != null) + { + return shellLibrary; // we already created this above while checking for Library + } + else if (itemType == ".searchconnector-ms") + { + return new ShellSearchConnector(nativeShellItem2); + } + else if (itemType == ".search-ms") + { + return new ShellSavedSearchCollection(nativeShellItem2); + } + + // 4. It's a ShellFolder + if (isFileSystem) + { + // 5. Is it a (File-System / Non-Virtual) Known Folder + if (!IsVirtualKnownFolder(nativeShellItem2)) + { //needs to check if it is a known folder and not virtual + FileSystemKnownFolder kf = new FileSystemKnownFolder(nativeShellItem2); + return kf; + } + + return new ShellFileSystemFolder(nativeShellItem2); + } + + // 5. Is it a (Non File-System / Virtual) Known Folder + if (IsVirtualKnownFolder(nativeShellItem2)) + { //needs to check if known folder is virtual + NonFileSystemKnownFolder kf = new NonFileSystemKnownFolder(nativeShellItem2); + return kf; + } + + return new ShellNonFileSystemFolder(nativeShellItem2); + } + + // 6. If this is an entity (single item), check if its filesystem or not + if (isFileSystem) { return new ShellFile(nativeShellItem2); } + + return new ShellNonFileSystemItem(nativeShellItem2); + } + + // This is a work around for the STA thread bug. This will execute the call on a non-sta thread, then return the result + private static bool IsVirtualKnownFolder(IShellItem2 nativeShellItem2) + { + IntPtr pidl = IntPtr.Zero; + try + { + IKnownFolderNative nativeFolder = null; + KnownFoldersSafeNativeMethods.NativeFolderDefinition definition = new KnownFoldersSafeNativeMethods.NativeFolderDefinition(); + + // We found a bug where the enumeration of shell folders was + // not reliable when called from a STA thread - it would return + // different results the first time vs the other times. + // + // This is a work around. We call FindFolderFromIDList on a + // worker MTA thread instead of the main STA thread. + // + // Ultimately, it would be a very good idea to replace the 'getting shell object' logic + // to get a list of pidl's in 1 step, then look up their information in a 2nd, rather than + // looking them up as we get them. This would replace the need for the work around. + object padlock = new object(); + lock (padlock) + { + IntPtr unknown = Marshal.GetIUnknownForObject(nativeShellItem2); + + ThreadPool.QueueUserWorkItem(obj => + { + lock (padlock) + { + pidl = ShellHelper.PidlFromUnknown(unknown); + + new KnownFolderManagerClass().FindFolderFromIDList(pidl, out nativeFolder); + + if (nativeFolder != null) + { + nativeFolder.GetFolderDefinition(out definition); + } + + Monitor.Pulse(padlock); + } + }); + + Monitor.Wait(padlock); + } + + return nativeFolder != null && definition.category == FolderCategory.Virtual; + } + finally + { + ShellNativeMethods.ILFree(pidl); + } + } + + /// + /// Creates a ShellObject given a parsing name + /// + /// + /// A newly constructed ShellObject object + internal static ShellObject Create(string parsingName) + { + if (string.IsNullOrEmpty(parsingName)) + { + throw new ArgumentNullException("parsingName"); + } + + // Create a native shellitem from our path + IShellItem2 nativeShellItem; + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + int retCode = ShellNativeMethods.SHCreateItemFromParsingName(parsingName, IntPtr.Zero, ref guid, out nativeShellItem); + + if (!CoreErrorHelper.Succeeded(retCode)) + { + throw new ShellException(LocalizedMessages.ShellObjectFactoryUnableToCreateItem, Marshal.GetExceptionForHR(retCode)); + } + return ShellObjectFactory.Create(nativeShellItem); + } + + /// + /// Constructs a new Shell object from IDList pointer + /// + /// + /// + internal static ShellObject Create(IntPtr idListPtr) + { + // Throw exception if not running on Win7 or newer. + CoreHelpers.ThrowIfNotVista(); + + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + + IShellItem2 nativeShellItem; + int retCode = ShellNativeMethods.SHCreateItemFromIDList(idListPtr, ref guid, out nativeShellItem); + + if (!CoreErrorHelper.Succeeded(retCode)) { return null; } + return ShellObjectFactory.Create(nativeShellItem); + } + + /// + /// Constructs a new Shell object from IDList pointer + /// + /// + /// + /// + internal static ShellObject Create(IntPtr idListPtr, ShellContainer parent) + { + IShellItem nativeShellItem; + + int retCode = ShellNativeMethods.SHCreateShellItem( + IntPtr.Zero, + parent.NativeShellFolder, + idListPtr, out nativeShellItem); + + if (!CoreErrorHelper.Succeeded(retCode)) { return null; } + + return ShellObjectFactory.Create(nativeShellItem); + } + } +} diff --git a/Shell/Common/ShellSavedSearchCollection.cs b/Shell/Common/ShellSavedSearchCollection.cs new file mode 100644 index 0000000..8cb1d87 --- /dev/null +++ b/Shell/Common/ShellSavedSearchCollection.cs @@ -0,0 +1,18 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a saved search + /// + public class ShellSavedSearchCollection : ShellSearchCollection + { + internal ShellSavedSearchCollection(IShellItem2 shellItem) + : base(shellItem) + { + CoreHelpers.ThrowIfNotVista(); + } + } +} diff --git a/Shell/Common/ShellSearchCollection.cs b/Shell/Common/ShellSearchCollection.cs new file mode 100644 index 0000000..bca3f2e --- /dev/null +++ b/Shell/Common/ShellSearchCollection.cs @@ -0,0 +1,16 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents the base class for all search-related classes. + /// + public class ShellSearchCollection : ShellContainer + { + internal ShellSearchCollection() { } + + internal ShellSearchCollection(IShellItem2 shellItem) : base(shellItem) { } + } +} diff --git a/Shell/Common/ShellSearchConnector.cs b/Shell/Common/ShellSearchConnector.cs new file mode 100644 index 0000000..afdb059 --- /dev/null +++ b/Shell/Common/ShellSearchConnector.cs @@ -0,0 +1,40 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// A Serch Connector folder in the Shell Namespace + /// + public sealed class ShellSearchConnector : ShellSearchCollection + { + + #region Internal Constructor + + internal ShellSearchConnector() + { + CoreHelpers.ThrowIfNotWin7(); + } + + internal ShellSearchConnector(IShellItem2 shellItem) + : this() + { + nativeShellItem = shellItem; + } + + #endregion + + /// + /// Indicates whether this feature is supported on the current platform. + /// + new public static bool IsPlatformSupported + { + get + { + // We need Windows 7 onwards ... + return CoreHelpers.RunningOnWin7; + } + } + } +} diff --git a/Shell/Common/ShellSearchFolder.cs b/Shell/Common/ShellSearchFolder.cs new file mode 100644 index 0000000..75b2816 --- /dev/null +++ b/Shell/Common/ShellSearchFolder.cs @@ -0,0 +1,266 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; +using System.Linq; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Create and modify search folders. + /// + public class ShellSearchFolder : ShellSearchCollection + { + /// + /// Create a simple search folder. Once the appropriate parameters are set, + /// the search folder can be enumerated to get the search results. + /// + /// Specific condition on which to perform the search (property and expected value) + /// List of folders/paths to perform the search on. These locations need to be indexed by the system. + public ShellSearchFolder(SearchCondition searchCondition, params ShellContainer[] searchScopePath) + { + CoreHelpers.ThrowIfNotVista(); + + NativeSearchFolderItemFactory = (ISearchFolderItemFactory)new SearchFolderItemFactoryCoClass(); + + this.SearchCondition = searchCondition; + + if (searchScopePath != null && searchScopePath.Length > 0 && searchScopePath[0] != null) + { + this.SearchScopePaths = searchScopePath.Select(cont => cont.ParsingName); + } + } + + /// + /// Create a simple search folder. Once the appropiate parameters are set, + /// the search folder can be enumerated to get the search results. + /// + /// Specific condition on which to perform the search (property and expected value) + /// List of folders/paths to perform the search on. These locations need to be indexed by the system. + public ShellSearchFolder(SearchCondition searchCondition, params string[] searchScopePath) + { + CoreHelpers.ThrowIfNotVista(); + + NativeSearchFolderItemFactory = (ISearchFolderItemFactory)new SearchFolderItemFactoryCoClass(); + + if (searchScopePath != null && searchScopePath.Length > 0 && searchScopePath[0] != null) + { + this.SearchScopePaths = searchScopePath; + } + + this.SearchCondition = searchCondition; + } + + internal ISearchFolderItemFactory NativeSearchFolderItemFactory { get; set; } + + private SearchCondition searchCondition; + /// + /// Gets the of the search. + /// When this property is not set, the resulting search will have no filters applied. + /// + public SearchCondition SearchCondition + { + get { return searchCondition; } + private set + { + searchCondition = value; + + NativeSearchFolderItemFactory.SetCondition(searchCondition.NativeSearchCondition); + } + } + + private string[] searchScopePaths; + /// + /// Gets the search scope, as specified using an array of locations to search. + /// The search will include this location and all its subcontainers. The default is FOLDERID_Profile + /// + public IEnumerable SearchScopePaths + { + get + { + foreach (var scopePath in searchScopePaths) + { + yield return scopePath; + } + } + private set + { + searchScopePaths = value.ToArray(); + List shellItems = new List(searchScopePaths.Length); + + Guid shellItemGuid = new Guid(ShellIIDGuid.IShellItem); + Guid shellItemArrayGuid = new Guid(ShellIIDGuid.IShellItemArray); + + // Create IShellItem for all the scopes we were given + foreach (string path in searchScopePaths) + { + IShellItem scopeShellItem; + + int hr = ShellNativeMethods.SHCreateItemFromParsingName(path, IntPtr.Zero, ref shellItemGuid, out scopeShellItem); + + if (CoreErrorHelper.Succeeded(hr)) { shellItems.Add(scopeShellItem); } + } + + // Create a new IShellItemArray + IShellItemArray scopeShellItemArray = new ShellItemArray(shellItems.ToArray()); + + // Set the scope on the native ISearchFolderItemFactory + HResult hResult = NativeSearchFolderItemFactory.SetScope(scopeShellItemArray); + + if (!CoreErrorHelper.Succeeded((int)hResult)) { throw new ShellException((int)hResult); } + } + } + + internal override IShellItem NativeShellItem + { + get + { + Guid guid = new Guid(ShellIIDGuid.IShellItem); + + if (NativeSearchFolderItemFactory == null) { return null; } + + IShellItem shellItem; + int hr = NativeSearchFolderItemFactory.GetShellItem(ref guid, out shellItem); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + + return shellItem; + } + } + + + /// + /// Creates a list of stack keys, as specified. If this method is not called, + /// by default the folder will not be stacked. + /// + /// Array of canonical names for properties on which the folder is stacked. + /// If one of the given canonical names is invalid. + public void SetStacks(params string[] canonicalNames) + { + if (canonicalNames == null) { throw new ArgumentNullException("canonicalNames"); } + List propertyKeyList = new List(); + + foreach (string prop in canonicalNames) + { + // Get the PropertyKey using the canonicalName passed in + PropertyKey propKey; + int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(prop, out propKey); + + if (!CoreErrorHelper.Succeeded(result)) + { + throw new ArgumentException(LocalizedMessages.ShellInvalidCanonicalName, "canonicalNames", Marshal.GetExceptionForHR(result)); + } + + propertyKeyList.Add(propKey); + } + + if (propertyKeyList.Count > 0) + { + SetStacks(propertyKeyList.ToArray()); + } + } + + /// + /// Creates a list of stack keys, as specified. If this method is not called, + /// by default the folder will not be stacked. + /// + /// Array of property keys on which the folder is stacked. + public void SetStacks(params PropertyKey[] propertyKeys) + { + if (propertyKeys != null && propertyKeys.Length > 0) + { + NativeSearchFolderItemFactory.SetStacks((uint)propertyKeys.Length, propertyKeys); + } + } + + /// + /// Sets the search folder display name. + /// + public void SetDisplayName(string displayName) + { + HResult hr = NativeSearchFolderItemFactory.SetDisplayName(displayName); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + + + + /// + /// Sets the search folder icon size. + /// The default settings are based on the FolderTypeID which is set by the + /// SearchFolder::SetFolderTypeID method. + /// + public void SetIconSize(int value) + { + HResult hr = NativeSearchFolderItemFactory.SetIconSize(value); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + + /// + /// Sets a search folder type ID, as specified. + /// + public void SetFolderTypeID(Guid value) + { + HResult hr = NativeSearchFolderItemFactory.SetFolderTypeID(value); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + + /// + /// Sets folder logical view mode. The default settings are based on the FolderTypeID which is set + /// by the SearchFolder::SetFolderTypeID method. + /// + /// The logical view mode to set. + public void SetFolderLogicalViewMode(FolderLogicalViewMode mode) + { + HResult hr = NativeSearchFolderItemFactory.SetFolderLogicalViewMode(mode); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + + /// + /// Creates a new column list whose columns are all visible, + /// given an array of PropertyKey structures. The default is based on FolderTypeID. + /// + /// This property may not work correctly with the ExplorerBrowser control. + public void SetVisibleColumns(PropertyKey[] value) + { + HResult hr = NativeSearchFolderItemFactory.SetVisibleColumns(value == null ? 0 : (uint)value.Length, value); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(LocalizedMessages.ShellSearchFolderUnableToSetVisibleColumns, Marshal.GetExceptionForHR((int)hr)); + } + } + + /// + /// Creates a list of sort column directions, as specified. + /// + /// This property may not work correctly with the ExplorerBrowser control. + public void SortColumns(SortColumn[] value) + { + HResult hr = NativeSearchFolderItemFactory.SetSortColumns(value == null ? 0 : (uint)value.Length, value); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(LocalizedMessages.ShellSearchFolderUnableToSetSortColumns, Marshal.GetExceptionForHR((int)hr)); + } + } + + /// + /// Sets a group column, as specified. If no group column is specified, no grouping occurs. + /// + /// This property may not work correctly with the ExplorerBrowser control. + public void SetGroupColumn(PropertyKey propertyKey) + { + HResult hr = NativeSearchFolderItemFactory.SetGroupColumn(ref propertyKey); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + } +} diff --git a/Shell/Common/ShellThumbnail.cs b/Shell/Common/ShellThumbnail.cs new file mode 100644 index 0000000..f16409d --- /dev/null +++ b/Shell/Common/ShellThumbnail.cs @@ -0,0 +1,357 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Windows.Interop; +using System.Windows.Media.Imaging; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a thumbnail or an icon for a ShellObject. + /// + public class ShellThumbnail + { + #region Private members + + /// + /// Native shellItem + /// + private IShellItem shellItemNative; + + /// + /// Internal member to keep track of the current size + /// + private System.Windows.Size currentSize = new System.Windows.Size(256, 256); + + #endregion + + #region Constructors + + /// + /// Internal constructor that takes in a parent ShellObject. + /// + /// + internal ShellThumbnail(ShellObject shellObject) + { + if (shellObject == null || shellObject.NativeShellItem == null) + { + throw new ArgumentNullException("shellObject"); + } + + shellItemNative = shellObject.NativeShellItem; + } + + #endregion + + #region Public properties + + /// + /// Gets or sets the default size of the thumbnail or icon. The default is 32x32 pixels for icons and + /// 256x256 pixels for thumbnails. + /// + /// If the size specified is larger than the maximum size of 1024x1024 for thumbnails and 256x256 for icons, + /// an is thrown. + /// + public System.Windows.Size CurrentSize + { + get { return currentSize; } + set + { + // Check for 0; negative number check not required as System.Windows.Size only allows positive numbers. + if (value.Height == 0 || value.Width == 0) + { + throw new System.ArgumentOutOfRangeException("value", LocalizedMessages.ShellThumbnailSizeCannotBe0); + } + + System.Windows.Size size = (FormatOption == ShellThumbnailFormatOption.IconOnly) ? + DefaultIconSize.Maximum : DefaultThumbnailSize.Maximum; + + if (value.Height > size.Height || value.Width > size.Width) + { + throw new System.ArgumentOutOfRangeException("value", + string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.ShellThumbnailCurrentSizeRange, size.ToString())); + } + + currentSize = value; + } + } + + /// + /// Gets the thumbnail or icon image in format. + /// Null is returned if the ShellObject does not have a thumbnail or icon image. + /// + public Bitmap Bitmap { get { return GetBitmap(CurrentSize); } } + + /// + /// Gets the thumbnail or icon image in format. + /// Null is returned if the ShellObject does not have a thumbnail or icon image. + /// + public BitmapSource BitmapSource { get { return GetBitmapSource(CurrentSize); } } + + /// + /// Gets the thumbnail or icon image in format. + /// Null is returned if the ShellObject does not have a thumbnail or icon image. + /// + public Icon Icon { get { return Icon.FromHandle(Bitmap.GetHicon()); } } + + /// + /// Gets the thumbnail or icon in small size and format. + /// + public Bitmap SmallBitmap + { + get + { + return GetBitmap(DefaultIconSize.Small, DefaultThumbnailSize.Small); + } + } + + /// + /// Gets the thumbnail or icon in small size and format. + /// + public BitmapSource SmallBitmapSource + { + get + { + return GetBitmapSource(DefaultIconSize.Small, DefaultThumbnailSize.Small); + } + } + + /// + /// Gets the thumbnail or icon in small size and format. + /// + public Icon SmallIcon { get { return Icon.FromHandle(SmallBitmap.GetHicon()); } } + + /// + /// Gets the thumbnail or icon in Medium size and format. + /// + public Bitmap MediumBitmap + { + get + { + return GetBitmap(DefaultIconSize.Medium, DefaultThumbnailSize.Medium); + } + } + + /// + /// Gets the thumbnail or icon in medium size and format. + /// + public BitmapSource MediumBitmapSource + { + get + { + return GetBitmapSource(DefaultIconSize.Medium, DefaultThumbnailSize.Medium); + } + } + + /// + /// Gets the thumbnail or icon in Medium size and format. + /// + public Icon MediumIcon { get { return Icon.FromHandle(MediumBitmap.GetHicon()); } } + + /// + /// Gets the thumbnail or icon in large size and format. + /// + public Bitmap LargeBitmap + { + get + { + return GetBitmap(DefaultIconSize.Large, DefaultThumbnailSize.Large); + } + } + + /// + /// Gets the thumbnail or icon in large size and format. + /// + public BitmapSource LargeBitmapSource + { + get + { + return GetBitmapSource(DefaultIconSize.Large, DefaultThumbnailSize.Large); + } + } + + /// + /// Gets the thumbnail or icon in Large size and format. + /// + public Icon LargeIcon { get { return Icon.FromHandle(LargeBitmap.GetHicon()); } } + + /// + /// Gets the thumbnail or icon in extra large size and format. + /// + public Bitmap ExtraLargeBitmap + { + get + { + return GetBitmap(DefaultIconSize.ExtraLarge, DefaultThumbnailSize.ExtraLarge); + } + } + + /// + /// Gets the thumbnail or icon in Extra Large size and format. + /// + public BitmapSource ExtraLargeBitmapSource + { + get + { + return GetBitmapSource(DefaultIconSize.ExtraLarge, DefaultThumbnailSize.ExtraLarge); + } + } + + /// + /// Gets the thumbnail or icon in Extra Large size and format. + /// + public Icon ExtraLargeIcon { get { return Icon.FromHandle(ExtraLargeBitmap.GetHicon()); } } + + /// + /// Gets or sets a value that determines if the current retrieval option is cache or extract, cache only, or from memory only. + /// The default is cache or extract. + /// + public ShellThumbnailRetrievalOption RetrievalOption { get; set; } + + private ShellThumbnailFormatOption formatOption = ShellThumbnailFormatOption.Default; + /// + /// Gets or sets a value that determines if the current format option is thumbnail or icon, thumbnail only, or icon only. + /// The default is thumbnail or icon. + /// + public ShellThumbnailFormatOption FormatOption + { + get { return formatOption; } + set + { + formatOption = value; + + // Do a similar check as we did in CurrentSize property setter, + // If our mode is IconOnly, then our max is defined by DefaultIconSize.Maximum. We should make sure + // our CurrentSize is within this max range + if (FormatOption == ShellThumbnailFormatOption.IconOnly + && (CurrentSize.Height > DefaultIconSize.Maximum.Height || CurrentSize.Width > DefaultIconSize.Maximum.Width)) + { + CurrentSize = DefaultIconSize.Maximum; + } + } + + } + + /// + /// Gets or sets a value that determines if the user can manually stretch the returned image. + /// The default value is false. + /// + /// + /// For example, if the caller passes in 80x80 a 96x96 thumbnail could be returned. + /// This could be used as a performance optimization if the caller will need to stretch + /// the image themselves anyway. Note that the Shell implementation performs a GDI stretch blit. + /// If the caller wants a higher quality image stretch, they should pass this flag and do it themselves. + /// + public bool AllowBiggerSize { get; set; } + + #endregion + + #region Private Methods + + private ShellNativeMethods.SIIGBF CalculateFlags() + { + ShellNativeMethods.SIIGBF flags = 0x0000; + + if (AllowBiggerSize) + { + flags |= ShellNativeMethods.SIIGBF.BiggerSizeOk; + } + + if (RetrievalOption == ShellThumbnailRetrievalOption.CacheOnly) + { + flags |= ShellNativeMethods.SIIGBF.InCacheOnly; + } + else if (RetrievalOption == ShellThumbnailRetrievalOption.MemoryOnly) + { + flags |= ShellNativeMethods.SIIGBF.MemoryOnly; + } + + if (FormatOption == ShellThumbnailFormatOption.IconOnly) + { + flags |= ShellNativeMethods.SIIGBF.IconOnly; + } + else if (FormatOption == ShellThumbnailFormatOption.ThumbnailOnly) + { + flags |= ShellNativeMethods.SIIGBF.ThumbnailOnly; + } + + return flags; + } + + private IntPtr GetHBitmap(System.Windows.Size size) + { + IntPtr hbitmap = IntPtr.Zero; + + // Create a size structure to pass to the native method + CoreNativeMethods.Size nativeSIZE = new CoreNativeMethods.Size(); + nativeSIZE.Width = Convert.ToInt32(size.Width); + nativeSIZE.Height = Convert.ToInt32(size.Height); + + // Use IShellItemImageFactory to get an icon + // Options passed in: Resize to fit + HResult hr = ((IShellItemImageFactory)shellItemNative).GetImage(nativeSIZE, CalculateFlags(), out hbitmap); + + if (hr == HResult.Ok) { return hbitmap; } + else if ((uint)hr == 0x8004B200 && FormatOption == ShellThumbnailFormatOption.ThumbnailOnly) + { + // Thumbnail was requested, but this ShellItem doesn't have a thumbnail. + throw new InvalidOperationException(LocalizedMessages.ShellThumbnailDoesNotHaveThumbnail, Marshal.GetExceptionForHR((int)hr)); + } + else if ((uint)hr == 0x80040154) // REGDB_E_CLASSNOTREG + { + throw new NotSupportedException(LocalizedMessages.ShellThumbnailNoHandler, Marshal.GetExceptionForHR((int)hr)); + } + + throw new ShellException(hr); + } + + private Bitmap GetBitmap(System.Windows.Size iconOnlySize, System.Windows.Size thumbnailSize) + { + return GetBitmap(FormatOption == ShellThumbnailFormatOption.IconOnly ? iconOnlySize : thumbnailSize); + } + + private Bitmap GetBitmap(System.Windows.Size size) + { + IntPtr hBitmap = GetHBitmap(size); + + // return a System.Drawing.Bitmap from the hBitmap + Bitmap returnValue = Bitmap.FromHbitmap(hBitmap); + + // delete HBitmap to avoid memory leaks + ShellNativeMethods.DeleteObject(hBitmap); + + return returnValue; + } + + private BitmapSource GetBitmapSource(System.Windows.Size iconOnlySize, System.Windows.Size thumbnailSize) + { + return GetBitmapSource(FormatOption == ShellThumbnailFormatOption.IconOnly ? iconOnlySize : thumbnailSize); + } + + private BitmapSource GetBitmapSource(System.Windows.Size size) + { + IntPtr hBitmap = GetHBitmap(size); + + // return a System.Media.Imaging.BitmapSource + // Use interop to create a BitmapSource from hBitmap. + BitmapSource returnValue = Imaging.CreateBitmapSourceFromHBitmap( + hBitmap, + IntPtr.Zero, + System.Windows.Int32Rect.Empty, + BitmapSizeOptions.FromEmptyOptions()); + + // delete HBitmap to avoid memory leaks + ShellNativeMethods.DeleteObject(hBitmap); + + return returnValue; + } + + #endregion + + } +} \ No newline at end of file diff --git a/Shell/Common/ShellThumbnailEnums.cs b/Shell/Common/ShellThumbnailEnums.cs new file mode 100644 index 0000000..e0abd36 --- /dev/null +++ b/Shell/Common/ShellThumbnailEnums.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents the different retrieval options for the thumbnail or icon, + /// such as extracting the thumbnail or icon from a file, + /// from the cache only, or from memory only. + /// + public enum ShellThumbnailRetrievalOption + { + /// + /// The default behavior loads a thumbnail. If there is no thumbnail for the current ShellItem, + /// the icon is retrieved. The thumbnail or icon is extracted if it is not currently cached. + /// + Default, + + /// + /// The CacheOnly behavior returns a cached thumbnail if it is available. Allows access to the disk, + /// but only to retrieve a cached item. If no cached thumbnail is available, a cached per-instance icon is returned but + /// a thumbnail or icon is not extracted. + /// + CacheOnly = ShellNativeMethods.SIIGBF.InCacheOnly, + + /// + /// The MemoryOnly behavior returns the item only if it is in memory. The disk is not accessed even if the item is cached. + /// Note that this only returns an already-cached icon and can fall back to a per-class icon if + /// an item has a per-instance icon that has not been cached yet. Retrieving a thumbnail, + /// even if it is cached, always requires the disk to be accessed, so this method should not be + /// called from the user interface (UI) thread without passing ShellThumbnailCacheOptions.MemoryOnly. + /// + MemoryOnly = ShellNativeMethods.SIIGBF.MemoryOnly, + } + + /// + /// Represents the format options for the thumbnails and icons. + /// + public enum ShellThumbnailFormatOption + { + /// + /// The default behavior loads a thumbnail. An HBITMAP for the icon of the item is retrieved if there is no thumbnail for the current Shell Item. + /// + Default, + + /// + /// The ThumbnailOnly behavior returns only the thumbnails, never the icon. Note that not all items have thumbnails + /// so ShellThumbnailFormatOption.ThumbnailOnly can fail in these cases. + /// + ThumbnailOnly = ShellNativeMethods.SIIGBF.ThumbnailOnly, + + /// + /// The IconOnly behavior returns only the icon, never the thumbnail. + /// + IconOnly = ShellNativeMethods.SIIGBF.IconOnly, + } +} diff --git a/Shell/Common/SortColumn.cs b/Shell/Common/SortColumn.cs new file mode 100644 index 0000000..0a6da21 --- /dev/null +++ b/Shell/Common/SortColumn.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Stores information about how to sort a column that is displayed in the folder view. + /// + [StructLayout(LayoutKind.Sequential)] + public struct SortColumn + { + + /// + /// Creates a sort column with the specified direction for the given property. + /// + /// Property key for the property that the user will sort. + /// The direction in which the items are sorted. + public SortColumn(PropertyKey propertyKey, SortDirection direction) + : this() + { + this.propertyKey = propertyKey; + this.direction = direction; + } + + /// + /// The ID of the column by which the user will sort. A PropertyKey structure. + /// For example, for the "Name" column, the property key is PKEY_ItemNameDisplay or + /// . + /// + public PropertyKey PropertyKey { get { return propertyKey; } set { propertyKey = value; } } + private PropertyKey propertyKey; + + /// + /// The direction in which the items are sorted. + /// + public SortDirection Direction { get { return direction; } set { direction = value; } } + private SortDirection direction; + + + /// + /// Implements the == (equality) operator. + /// + /// First object to compare. + /// Second object to compare. + /// True if col1 equals col2; false otherwise. + public static bool operator ==(SortColumn col1, SortColumn col2) + { + return (col1.direction == col2.direction) && + (col1.propertyKey == col2.propertyKey); + } + + /// + /// Implements the != (unequality) operator. + /// + /// First object to compare. + /// Second object to compare. + /// True if col1 does not equals col1; false otherwise. + public static bool operator !=(SortColumn col1, SortColumn col2) + { + return !(col1 == col2); + } + + /// + /// Determines if this object is equal to another. + /// + /// The object to compare + /// Returns true if the objects are equal; false otherwise. + public override bool Equals(object obj) + { + if (obj == null || obj.GetType() != typeof(SortColumn)) { return false; } + return (this == (SortColumn)obj); + } + + /// + /// Generates a nearly unique hashcode for this structure. + /// + /// A hash code. + public override int GetHashCode() + { + int hash = this.direction.GetHashCode(); + hash = hash * 31 + this.propertyKey.GetHashCode(); + return hash; + } + + } + +} diff --git a/Shell/CommonFileDialogs/CommonFileDialog.cs b/Shell/CommonFileDialogs/CommonFileDialog.cs new file mode 100644 index 0000000..149f924 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialog.cs @@ -0,0 +1,1349 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Interop; +using System.Windows.Markup; +using Microsoft.WindowsAPICodePack.Controls; +using Microsoft.WindowsAPICodePack.Dialogs.Controls; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; +using System.Collections.Generic; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Defines the abstract base class for the common file dialogs. + /// + [ContentProperty("Controls")] + public abstract class CommonFileDialog : IDialogControlHost, IDisposable + { + /// + /// The collection of names selected by the user. + /// + protected IEnumerable FileNameCollection + { + get + { + foreach (string name in filenames) + { + yield return name; + } + } + } + private Collection filenames; + internal readonly Collection items; + internal DialogShowState showState = DialogShowState.PreShow; + + private IFileDialog nativeDialog; + private IFileDialogCustomize customize; + private NativeDialogEventSink nativeEventSink; + private bool? canceled; + private bool resetSelections; + private IntPtr parentWindow = IntPtr.Zero; + + private bool filterSet; // filters can only be set once + + #region Constructors + + /// + /// Creates a new instance of this class. + /// + protected CommonFileDialog() + { + if (!CoreHelpers.RunningOnVista) + { + throw new PlatformNotSupportedException(LocalizedMessages.CommonFileDialogRequiresVista); + } + + filenames = new Collection(); + filters = new CommonFileDialogFilterCollection(); + items = new Collection(); + controls = new CommonFileDialogControlCollection(this); + } + + /// + /// Creates a new instance of this class with the specified title. + /// + /// The title to display in the dialog. + protected CommonFileDialog(string title) + : this() + { + this.title = title; + } + + #endregion + + // Template method to allow derived dialog to create actual + // specific COM coclass (e.g. FileOpenDialog or FileSaveDialog). + internal abstract void InitializeNativeFileDialog(); + internal abstract IFileDialog GetNativeFileDialog(); + internal abstract void PopulateWithFileNames(Collection names); + internal abstract void PopulateWithIShellItems(Collection shellItems); + internal abstract void CleanUpNativeFileDialog(); + internal abstract ShellNativeMethods.FileOpenOptions GetDerivedOptionFlags(ShellNativeMethods.FileOpenOptions flags); + + #region Public API + + // Events. + /// + /// Raised just before the dialog is about to return with a result. Occurs when the user clicks on the Open + /// or Save button on a file dialog box. + /// + public event CancelEventHandler FileOk; + /// + /// Raised just before the user navigates to a new folder. + /// + public event EventHandler FolderChanging; + /// + /// Raised when the user navigates to a new folder. + /// + public event EventHandler FolderChanged; + /// + /// Raised when the user changes the selection in the dialog's view. + /// + public event EventHandler SelectionChanged; + /// + /// Raised when the dialog is opened to notify the application of the initial chosen filetype. + /// + public event EventHandler FileTypeChanged; + /// + /// Raised when the dialog is opening. + /// + public event EventHandler DialogOpening; + + private CommonFileDialogControlCollection controls; + /// + /// Gets the collection of controls for the dialog. + /// + public CommonFileDialogControlCollection Controls + { + get { return controls; } + } + + private CommonFileDialogFilterCollection filters; + /// + /// Gets the filters used by the dialog. + /// + public CommonFileDialogFilterCollection Filters + { + get { return filters; } + } + + private string title; + /// + /// Gets or sets the dialog title. + /// + /// A object. + public string Title + { + get { return title; } + set + { + title = value; + if (NativeDialogShowing) { nativeDialog.SetTitle(value); } + } + } + + // This is the first of many properties that are backed by the FOS_* + // bitflag options set with IFileDialog.SetOptions(). + // SetOptions() fails + // if called while dialog is showing (e.g. from a callback). + private bool ensureFileExists; + /// + /// Gets or sets a value that determines whether the file must exist beforehand. + /// + /// A value. true if the file must exist. + /// This property cannot be set when the dialog is visible. + public bool EnsureFileExists + { + get { return ensureFileExists; } + set + { + ThrowIfDialogShowing(LocalizedMessages.EnsureFileExistsCannotBeChanged); + ensureFileExists = value; + } + } + + private bool ensurePathExists; + /// + /// Gets or sets a value that specifies whether the returned file must be in an existing folder. + /// + /// A value. true if the file must exist. + /// This property cannot be set when the dialog is visible. + public bool EnsurePathExists + { + get { return ensurePathExists; } + set + { + ThrowIfDialogShowing(LocalizedMessages.EnsurePathExistsCannotBeChanged); + ensurePathExists = value; + } + } + + private bool ensureValidNames; + /// Gets or sets a value that determines whether to validate file names. + /// + ///A value. true to check for situations that would prevent an application from opening the selected file, such as sharing violations or access denied errors. + /// This property cannot be set when the dialog is visible. + /// + public bool EnsureValidNames + { + get { return ensureValidNames; } + set + { + ThrowIfDialogShowing(LocalizedMessages.EnsureValidNamesCannotBeChanged); + ensureValidNames = value; + } + } + + private bool ensureReadOnly; + /// + /// Gets or sets a value that determines whether read-only items are returned. + /// Default value for CommonOpenFileDialog is true (allow read-only files) and + /// CommonSaveFileDialog is false (don't allow read-only files). + /// + /// A value. true includes read-only items. + /// This property cannot be set when the dialog is visible. + public bool EnsureReadOnly + { + get { return ensureReadOnly; } + set + { + ThrowIfDialogShowing(LocalizedMessages.EnsureReadonlyCannotBeChanged); + ensureReadOnly = value; + } + } + + private bool restoreDirectory; + /// + /// Gets or sets a value that determines the restore directory. + /// + /// + /// This property cannot be set when the dialog is visible. + public bool RestoreDirectory + { + get { return restoreDirectory; } + set + { + ThrowIfDialogShowing(LocalizedMessages.RestoreDirectoryCannotBeChanged); + restoreDirectory = value; + } + } + + private bool showPlacesList = true; + /// + /// Gets or sets a value that controls whether + /// to show or hide the list of pinned places that + /// the user can choose. + /// + /// A value. true if the list is visible; otherwise false. + /// This property cannot be set when the dialog is visible. + public bool ShowPlacesList + { + + get { return showPlacesList; } + set + { + ThrowIfDialogShowing(LocalizedMessages.ShowPlacesListCannotBeChanged); + showPlacesList = value; + } + } + + private bool addToMruList = true; + /// + /// Gets or sets a value that controls whether to show or hide the list of places where the user has recently opened or saved items. + /// + /// A value. + /// This property cannot be set when the dialog is visible. + public bool AddToMostRecentlyUsedList + { + get { return addToMruList; } + set + { + ThrowIfDialogShowing(LocalizedMessages.AddToMostRecentlyUsedListCannotBeChanged); + addToMruList = value; + } + } + + private bool showHiddenItems; + /// + /// Gets or sets a value that controls whether to show hidden items. + /// + /// A value.true to show the items; otherwise false. + /// This property cannot be set when the dialog is visible. + public bool ShowHiddenItems + { + get { return showHiddenItems; } + set + { + ThrowIfDialogShowing(LocalizedMessages.ShowHiddenItemsCannotBeChanged); + showHiddenItems = value; + } + } + private bool allowPropertyEditing; + /// + /// Gets or sets a value that controls whether + /// properties can be edited. + /// + /// A value. + public bool AllowPropertyEditing + { + get { return allowPropertyEditing; } + set { allowPropertyEditing = value; } + } + + private bool navigateToShortcut = true; + /// + /// Gets or sets a value that controls whether shortcuts should be treated as their target items, allowing an application to open a .lnk file. + /// + /// A value. true indicates that shortcuts should be treated as their targets. + /// This property cannot be set when the dialog is visible. + public bool NavigateToShortcut + { + get { return navigateToShortcut; } + set + { + ThrowIfDialogShowing(LocalizedMessages.NavigateToShortcutCannotBeChanged); + navigateToShortcut = value; + } + } + + /// + /// Gets or sets the default file extension to be added to file names. If the value is null + /// or string.Empty, the extension is not added to the file names. + /// + public string DefaultExtension { get; set; } + + /// + /// Gets the index for the currently selected file type. + /// + public int SelectedFileTypeIndex + { + get + { + uint fileType; + + if (nativeDialog != null) + { + nativeDialog.GetFileTypeIndex(out fileType); + return (int)fileType; + } + + return -1; + } + } + + /// + /// Tries to set the File(s) Type Combo to match the value in + /// 'DefaultExtension'. Only doing this if 'this' is a Save dialog + /// as it makes no sense to do this if only Opening a file. + /// + /// + /// The native/IFileDialog instance. + /// + private void SyncFileTypeComboToDefaultExtension(IFileDialog dialog) + { + // make sure it's a Save dialog and that there is a default + // extension to sync to. + if (!(this is CommonSaveFileDialog) || DefaultExtension == null || + filters.Count <= 0) + { + return; + } + + CommonFileDialogFilter filter = null; + + for (uint filtersCounter = 0; filtersCounter < filters.Count; filtersCounter++) + { + filter = (CommonFileDialogFilter)filters[(int)filtersCounter]; + + if (filter.Extensions.Contains(DefaultExtension)) + { + // set the docType combo to match this + // extension. property is a 1-based index. + dialog.SetFileTypeIndex(filtersCounter + 1); + + // we're done, exit for + break; + } + } + + } + + /// + /// Gets the selected filename. + /// + /// A object. + /// This property cannot be used when multiple files are selected. + public string FileName + { + get + { + CheckFileNamesAvailable(); + + if (filenames.Count > 1) + { + throw new InvalidOperationException(LocalizedMessages.CommonFileDialogMultipleFiles); + } + + string returnFilename = filenames[0]; + + // "If extension is a null reference (Nothing in Visual + // Basic), the returned string contains the specified + // path with its extension removed." Since we do not want + // to remove any existing extension, make sure the + // DefaultExtension property is NOT null. + + // if we should, and there is one to set... + if (!string.IsNullOrEmpty(DefaultExtension)) + { + returnFilename = System.IO.Path.ChangeExtension(returnFilename, DefaultExtension); + } + + return returnFilename; + } + } + + /// + /// Gets the selected item as a ShellObject. + /// + /// A object. + /// This property cannot be used when multiple files + /// are selected. + public ShellObject FileAsShellObject + { + get + { + CheckFileItemsAvailable(); + + if (items.Count > 1) + { + throw new InvalidOperationException(LocalizedMessages.CommonFileDialogMultipleItems); + } + + if (items.Count == 0) { return null; } + + return ShellObjectFactory.Create(items[0]); + } + } + + /// + /// Adds a location, such as a folder, library, search connector, or known folder, to the list of + /// places available for a user to open or save items. This method actually adds an item + /// to the Favorite Links or Places section of the Open/Save dialog. + /// + /// The item to add to the places list. + /// One of the enumeration values that indicates placement of the item in the list. + public void AddPlace(ShellContainer place, FileDialogAddPlaceLocation location) + { + if (place == null) + { + throw new ArgumentNullException("place"); + } + + // Get our native dialog + if (nativeDialog == null) + { + InitializeNativeFileDialog(); + nativeDialog = GetNativeFileDialog(); + } + + // Add the shellitem to the places list + if (nativeDialog != null) + { + nativeDialog.AddPlace(place.NativeShellItem, (ShellNativeMethods.FileDialogAddPlacement)location); + } + } + + /// + /// Adds a location (folder, library, search connector, known folder) to the list of + /// places available for the user to open or save items. This method actually adds an item + /// to the Favorite Links or Places section of the Open/Save dialog. Overload method + /// takes in a string for the path. + /// + /// The item to add to the places list. + /// One of the enumeration values that indicates placement of the item in the list. + public void AddPlace(string path, FileDialogAddPlaceLocation location) + { + if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } + + // Get our native dialog + if (nativeDialog == null) + { + InitializeNativeFileDialog(); + nativeDialog = GetNativeFileDialog(); + } + + // Create a native shellitem from our path + IShellItem2 nativeShellItem; + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + int retCode = ShellNativeMethods.SHCreateItemFromParsingName(path, IntPtr.Zero, ref guid, out nativeShellItem); + + if (!CoreErrorHelper.Succeeded(retCode)) + { + throw new CommonControlException(LocalizedMessages.CommonFileDialogCannotCreateShellItem, Marshal.GetExceptionForHR(retCode)); + } + + // Add the shellitem to the places list + if (nativeDialog != null) + { + nativeDialog.AddPlace(nativeShellItem, (ShellNativeMethods.FileDialogAddPlacement)location); + } + } + + // Null = use default directory. + private string initialDirectory; + /// + /// Gets or sets the initial directory displayed when the dialog is shown. + /// A null or empty string indicates that the dialog is using the default directory. + /// + /// A object. + public string InitialDirectory + { + get { return initialDirectory; } + set { initialDirectory = value; } + } + + private ShellContainer initialDirectoryShellContainer; + /// + /// Gets or sets a location that is always selected when the dialog is opened, + /// regardless of previous user action. A null value implies that the dialog is using + /// the default location. + /// + public ShellContainer InitialDirectoryShellContainer + { + get { return initialDirectoryShellContainer; } + set { initialDirectoryShellContainer = value; } + } + + private string defaultDirectory; + /// + /// Sets the folder and path used as a default if there is not a recently used folder value available. + /// + public string DefaultDirectory + { + get { return defaultDirectory; } + set { defaultDirectory = value; } + } + + private ShellContainer defaultDirectoryShellContainer; + /// + /// Sets the location (ShellContainer + /// used as a default if there is not a recently used folder value available. + /// + public ShellContainer DefaultDirectoryShellContainer + { + get { return defaultDirectoryShellContainer; } + set { defaultDirectoryShellContainer = value; } + } + + // Null = use default identifier. + private Guid cookieIdentifier; + /// + /// Gets or sets a value that enables a calling application + /// to associate a GUID with a dialog's persisted state. + /// + public Guid CookieIdentifier + { + get { return cookieIdentifier; } + set { cookieIdentifier = value; } + } + + /// + /// Displays the dialog. + /// + /// Window handle of any top-level window that will own the modal dialog box. + /// A object. + public CommonFileDialogResult ShowDialog(IntPtr ownerWindowHandle) + { + if (ownerWindowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "ownerWindowHandle"); + } + + // Set the parent / owner window + parentWindow = ownerWindowHandle; + + // Show the modal dialog + return ShowDialog(); + } + + /// + /// Displays the dialog. + /// + /// Top-level WPF window that will own the modal dialog box. + /// A object. + public CommonFileDialogResult ShowDialog(Window window) + { + if (window == null) + { + throw new ArgumentNullException("window"); + } + + // Set the parent / owner window + parentWindow = (new WindowInteropHelper(window)).Handle; + + // Show the modal dialog + return ShowDialog(); + } + + /// + /// Displays the dialog. + /// + /// A object. + public CommonFileDialogResult ShowDialog() + { + CommonFileDialogResult result; + + // Fetch derived native dialog (i.e. Save or Open). + InitializeNativeFileDialog(); + nativeDialog = GetNativeFileDialog(); + + // Apply outer properties to native dialog instance. + ApplyNativeSettings(nativeDialog); + InitializeEventSink(nativeDialog); + + // Clear user data if Reset has been called + // since the last show. + if (resetSelections) + { + resetSelections = false; + } + + // Show dialog. + showState = DialogShowState.Showing; + int hresult = nativeDialog.Show(parentWindow); + showState = DialogShowState.Closed; + + // Create return information. + if (CoreErrorHelper.Matches(hresult, (int)HResult.Win32ErrorCanceled)) + { + canceled = true; + result = CommonFileDialogResult.Cancel; + filenames.Clear(); + } + else + { + canceled = false; + result = CommonFileDialogResult.Ok; + + // Populate filenames if user didn't cancel. + PopulateWithFileNames(filenames); + + // Populate the actual IShellItems + PopulateWithIShellItems(items); + } + + return result; + } + /// + /// Removes the current selection. + /// + public void ResetUserSelections() + { + resetSelections = true; + } + + /// + /// Default file name. + /// + public string DefaultFileName { get; set; } + + #endregion + + #region Configuration + + private void InitializeEventSink(IFileDialog nativeDlg) + { + // Check if we even need to have a sink. + if (FileOk != null + || FolderChanging != null + || FolderChanged != null + || SelectionChanged != null + || FileTypeChanged != null + || DialogOpening != null + || (controls != null && controls.Count > 0)) + { + uint cookie; + nativeEventSink = new NativeDialogEventSink(this); + nativeDlg.Advise(nativeEventSink, out cookie); + nativeEventSink.Cookie = cookie; + } + } + + private void ApplyNativeSettings(IFileDialog dialog) + { + Debug.Assert(dialog != null, "No dialog instance to configure"); + + if (parentWindow == IntPtr.Zero) + { + if (System.Windows.Application.Current != null && System.Windows.Application.Current.MainWindow != null) + { + parentWindow = (new WindowInteropHelper(System.Windows.Application.Current.MainWindow)).Handle; + } + else if (System.Windows.Forms.Application.OpenForms.Count > 0) + { + parentWindow = System.Windows.Forms.Application.OpenForms[0].Handle; + } + } + + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + + // Apply option bitflags. + dialog.SetOptions(CalculateNativeDialogOptionFlags()); + + // Other property sets. + if (title != null) { dialog.SetTitle(title); } + + if (initialDirectoryShellContainer != null) + { + dialog.SetFolder(((ShellObject)initialDirectoryShellContainer).NativeShellItem); + } + + if (defaultDirectoryShellContainer != null) + { + dialog.SetDefaultFolder(((ShellObject)defaultDirectoryShellContainer).NativeShellItem); + } + + if (!string.IsNullOrEmpty(initialDirectory)) + { + // Create a native shellitem from our path + IShellItem2 initialDirectoryShellItem; + ShellNativeMethods.SHCreateItemFromParsingName(initialDirectory, IntPtr.Zero, ref guid, out initialDirectoryShellItem); + + // If we get a real shell item back, + // then use that as the initial folder - otherwise, + // we'll allow the dialog to revert to the default folder. + // (OR should we fail loudly?) + if (initialDirectoryShellItem != null) + dialog.SetFolder(initialDirectoryShellItem); + } + + if (!string.IsNullOrEmpty(defaultDirectory)) + { + // Create a native shellitem from our path + IShellItem2 defaultDirectoryShellItem; + ShellNativeMethods.SHCreateItemFromParsingName(defaultDirectory, IntPtr.Zero, ref guid, out defaultDirectoryShellItem); + + // If we get a real shell item back, + // then use that as the initial folder - otherwise, + // we'll allow the dialog to revert to the default folder. + // (OR should we fail loudly?) + if (defaultDirectoryShellItem != null) + { + dialog.SetDefaultFolder(defaultDirectoryShellItem); + } + } + + // Apply file type filters, if available. + if (filters.Count > 0 && !filterSet) + { + dialog.SetFileTypes( + (uint)filters.Count, + filters.GetAllFilterSpecs()); + + filterSet = true; + + SyncFileTypeComboToDefaultExtension(dialog); + } + + if (cookieIdentifier != Guid.Empty) + { + dialog.SetClientGuid(ref cookieIdentifier); + } + + // Set the default extension + if (!string.IsNullOrEmpty(DefaultExtension)) + { + dialog.SetDefaultExtension(DefaultExtension); + } + + // Set the default filename + dialog.SetFileName(DefaultFileName); + } + + private ShellNativeMethods.FileOpenOptions CalculateNativeDialogOptionFlags() + { + // We start with only a few flags set by default, + // then go from there based on the current state + // of the managed dialog's property values. + ShellNativeMethods.FileOpenOptions flags = ShellNativeMethods.FileOpenOptions.NoTestFileCreate; + + // Call to derived (concrete) dialog to + // set dialog-specific flags. + flags = GetDerivedOptionFlags(flags); + + // Apply other optional flags. + if (ensureFileExists) + { + flags |= ShellNativeMethods.FileOpenOptions.FileMustExist; + } + if (ensurePathExists) + { + flags |= ShellNativeMethods.FileOpenOptions.PathMustExist; + } + if (!ensureValidNames) + { + flags |= ShellNativeMethods.FileOpenOptions.NoValidate; + } + if (!EnsureReadOnly) + { + flags |= ShellNativeMethods.FileOpenOptions.NoReadOnlyReturn; + } + if (restoreDirectory) + { + flags |= ShellNativeMethods.FileOpenOptions.NoChangeDirectory; + } + if (!showPlacesList) + { + flags |= ShellNativeMethods.FileOpenOptions.HidePinnedPlaces; + } + if (!addToMruList) + { + flags |= ShellNativeMethods.FileOpenOptions.DontAddToRecent; + } + if (showHiddenItems) + { + flags |= ShellNativeMethods.FileOpenOptions.ForceShowHidden; + } + if (!navigateToShortcut) + { + flags |= ShellNativeMethods.FileOpenOptions.NoDereferenceLinks; + } + return flags; + } + + #endregion + + #region IDialogControlHost Members + + private static void GenerateNotImplementedException() + { + throw new NotImplementedException(LocalizedMessages.NotImplementedException); + } + + /// + /// Returns if change to the colleciton is allowed. + /// + /// true if collection change is allowed. + public virtual bool IsCollectionChangeAllowed() + { + return true; + } + + /// + /// Applies changes to the collection. + /// + public virtual void ApplyCollectionChanged() + { + // Query IFileDialogCustomize interface before adding controls + GetCustomizedFileDialog(); + // Populate all the custom controls and add them to the dialog + foreach (CommonFileDialogControl control in controls) + { + if (!control.IsAdded) + { + control.HostingDialog = this; + control.Attach(customize); + control.IsAdded = true; + } + } + + } + + /// + /// Determines if changes to a specific property are allowed. + /// + /// The name of the property. + /// The control propertyName applies to. + /// true if the property change is allowed. + public virtual bool IsControlPropertyChangeAllowed(string propertyName, DialogControl control) + { + CommonFileDialog.GenerateNotImplementedException(); + return false; + } + + /// + /// Called when a control currently in the collection + /// has a property changed. + /// + /// The name of the property changed. + /// The control whose property has changed. + public virtual void ApplyControlPropertyChange(string propertyName, DialogControl control) + { + if (control == null) + { + throw new ArgumentNullException("control"); + } + + CommonFileDialogControl dialogControl = null; + if (propertyName == "Text") + { + CommonFileDialogTextBox textBox = control as CommonFileDialogTextBox; + + if (textBox != null) + { + customize.SetEditBoxText(control.Id, textBox.Text); + } + else + { + customize.SetControlLabel(control.Id, textBox.Text); + } + } + else if (propertyName == "Visible" && (dialogControl = control as CommonFileDialogControl) != null) + { + ShellNativeMethods.ControlState state; + customize.GetControlState(control.Id, out state); + + if (dialogControl.Visible == true) + { + state |= ShellNativeMethods.ControlState.Visible; + } + else if (dialogControl.Visible == false) + { + state &= ~ShellNativeMethods.ControlState.Visible; + } + + customize.SetControlState(control.Id, state); + } + else if (propertyName == "Enabled" && dialogControl != null) + { + ShellNativeMethods.ControlState state; + customize.GetControlState(control.Id, out state); + + if (dialogControl.Enabled == true) + { + state |= ShellNativeMethods.ControlState.Enable; + } + else if (dialogControl.Enabled == false) + { + state &= ~ShellNativeMethods.ControlState.Enable; + } + + customize.SetControlState(control.Id, state); + } + else if (propertyName == "SelectedIndex") + { + CommonFileDialogRadioButtonList list; + CommonFileDialogComboBox box; + + if ((list = control as CommonFileDialogRadioButtonList) != null) + { + customize.SetSelectedControlItem(list.Id, list.SelectedIndex); + } + else if ((box = control as CommonFileDialogComboBox) != null) + { + customize.SetSelectedControlItem(box.Id, box.SelectedIndex); + } + } + else if (propertyName == "IsChecked") + { + CommonFileDialogCheckBox checkBox = control as CommonFileDialogCheckBox; + if (checkBox != null) + { + customize.SetCheckButtonState(checkBox.Id, checkBox.IsChecked); + } + } + } + + #endregion + + #region Helpers + + /// + /// Ensures that the user has selected one or more files. + /// + /// + /// The dialog has not been dismissed yet or the dialog was cancelled. + /// + protected void CheckFileNamesAvailable() + { + if (showState != DialogShowState.Closed) + { + throw new InvalidOperationException(LocalizedMessages.CommonFileDialogNotClosed); + } + + if (canceled.GetValueOrDefault()) + { + throw new InvalidOperationException(LocalizedMessages.CommonFileDialogCanceled); + } + + Debug.Assert(filenames.Count != 0, + "FileNames empty - shouldn't happen unless dialog canceled or not yet shown."); + } + + /// + /// Ensures that the user has selected one or more files. + /// + /// + /// The dialog has not been dismissed yet or the dialog was cancelled. + /// + protected void CheckFileItemsAvailable() + { + if (showState != DialogShowState.Closed) + { + throw new InvalidOperationException(LocalizedMessages.CommonFileDialogNotClosed); + } + + if (canceled.GetValueOrDefault()) + { + throw new InvalidOperationException(LocalizedMessages.CommonFileDialogCanceled); + } + + Debug.Assert(items.Count != 0, + "Items list empty - shouldn't happen unless dialog canceled or not yet shown."); + } + + private bool NativeDialogShowing + { + get + { + return (nativeDialog != null) + && (showState == DialogShowState.Showing || showState == DialogShowState.Closing); + } + } + + internal static string GetFileNameFromShellItem(IShellItem item) + { + string filename = null; + IntPtr pszString = IntPtr.Zero; + HResult hr = item.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.DesktopAbsoluteParsing, out pszString); + if (hr == HResult.Ok && pszString != IntPtr.Zero) + { + filename = Marshal.PtrToStringAuto(pszString); + Marshal.FreeCoTaskMem(pszString); + } + return filename; + } + + internal static IShellItem GetShellItemAt(IShellItemArray array, int i) + { + IShellItem result; + uint index = (uint)i; + array.GetItemAt(index, out result); + return result; + } + + /// + /// Throws an exception when the dialog is showing preventing + /// a requested change to a property or the visible set of controls. + /// + /// The message to include in the exception. + /// The dialog is in an + /// invalid state to perform the requested operation. + protected void ThrowIfDialogShowing(string message) + { + if (NativeDialogShowing) + { + throw new InvalidOperationException(message); + } + } + /// + /// Get the IFileDialogCustomize interface, preparing to add controls. + /// + private void GetCustomizedFileDialog() + { + if (customize == null) + { + if (nativeDialog == null) + { + InitializeNativeFileDialog(); + nativeDialog = GetNativeFileDialog(); + } + customize = (IFileDialogCustomize)nativeDialog; + } + } + #endregion + + #region CheckChanged handling members + /// + /// Raises the event just before the dialog is about to return with a result. + /// + /// The event data. + protected virtual void OnFileOk(CancelEventArgs e) + { + CancelEventHandler handler = FileOk; + if (handler != null) + { + handler(this, e); + } + } + /// + /// Raises the to stop navigation to a particular location. + /// + /// Cancelable event arguments. + protected virtual void OnFolderChanging(CommonFileDialogFolderChangeEventArgs e) + { + EventHandler handler = FolderChanging; + if (handler != null) + { + handler(this, e); + } + } + /// + /// Raises the event when the user navigates to a new folder. + /// + /// The event data. + protected virtual void OnFolderChanged(EventArgs e) + { + EventHandler handler = FolderChanged; + if (handler != null) + { + handler(this, e); + } + } + /// + /// Raises the event when the user changes the selection in the dialog's view. + /// + /// The event data. + protected virtual void OnSelectionChanged(EventArgs e) + { + EventHandler handler = SelectionChanged; + if (handler != null) + { + handler(this, e); + } + } + /// + /// Raises the event when the dialog is opened to notify the + /// application of the initial chosen filetype. + /// + /// The event data. + protected virtual void OnFileTypeChanged(EventArgs e) + { + EventHandler handler = FileTypeChanged; + if (handler != null) + { + handler(this, e); + } + } + /// + /// Raises the event when the dialog is opened. + /// + /// The event data. + protected virtual void OnOpening(EventArgs e) + { + EventHandler handler = DialogOpening; + if (handler != null) + { + handler(this, e); + } + } + + #endregion + + #region NativeDialogEventSink Nested Class + + private class NativeDialogEventSink : IFileDialogEvents, IFileDialogControlEvents + { + private CommonFileDialog parent; + private bool firstFolderChanged = true; + + public NativeDialogEventSink(CommonFileDialog commonDialog) + { + this.parent = commonDialog; + } + + public uint Cookie { get; set; } + + public HResult OnFileOk(IFileDialog pfd) + { + CancelEventArgs args = new CancelEventArgs(); + parent.OnFileOk(args); + + if (!args.Cancel) + { + // Make sure all custom properties are sync'ed + if (parent.Controls != null) + { + foreach (CommonFileDialogControl control in parent.Controls) + { + CommonFileDialogTextBox textBox; + CommonFileDialogGroupBox groupBox; ; + + if ((textBox = control as CommonFileDialogTextBox) != null) + { + textBox.SyncValue(); + textBox.Closed = true; + } + // Also check subcontrols + else if ((groupBox = control as CommonFileDialogGroupBox) != null) + { + foreach (CommonFileDialogControl subcontrol in groupBox.Items) + { + CommonFileDialogTextBox textbox = subcontrol as CommonFileDialogTextBox; + if (textbox != null) + { + textbox.SyncValue(); + textbox.Closed = true; + } + } + } + } + } + } + + return (args.Cancel ? HResult.False : HResult.Ok); + } + + public HResult OnFolderChanging(IFileDialog pfd, IShellItem psiFolder) + { + CommonFileDialogFolderChangeEventArgs args = new CommonFileDialogFolderChangeEventArgs( + CommonFileDialog.GetFileNameFromShellItem(psiFolder)); + + if (!firstFolderChanged) { parent.OnFolderChanging(args); } + + return (args.Cancel ? HResult.False : HResult.Ok); + } + + public void OnFolderChange(IFileDialog pfd) + { + if (firstFolderChanged) + { + firstFolderChanged = false; + parent.OnOpening(EventArgs.Empty); + } + else + { + parent.OnFolderChanged(EventArgs.Empty); + } + } + + public void OnSelectionChange(IFileDialog pfd) + { + parent.OnSelectionChanged(EventArgs.Empty); + } + + public void OnShareViolation( + IFileDialog pfd, + IShellItem psi, + out ShellNativeMethods.FileDialogEventShareViolationResponse pResponse) + { + // Do nothing: we will ignore share violations, + // and don't register + // for them, so this method should never be called. + pResponse = ShellNativeMethods.FileDialogEventShareViolationResponse.Accept; + } + + public void OnTypeChange(IFileDialog pfd) + { + parent.OnFileTypeChanged(EventArgs.Empty); + } + + public void OnOverwrite(IFileDialog pfd, IShellItem psi, out ShellNativeMethods.FileDialogEventOverwriteResponse pResponse) + { + // Don't accept or reject the dialog, keep default settings + pResponse = ShellNativeMethods.FileDialogEventOverwriteResponse.Default; + } + + public void OnItemSelected(IFileDialogCustomize pfdc, int dwIDCtl, int dwIDItem) + { + // Find control + DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl); + + ICommonFileDialogIndexedControls controlInterface; + CommonFileDialogMenu menu; + + // Process ComboBox and/or RadioButtonList + if ((controlInterface = control as ICommonFileDialogIndexedControls) != null) + { + // Update selected item and raise SelectedIndexChanged event + controlInterface.SelectedIndex = dwIDItem; + controlInterface.RaiseSelectedIndexChangedEvent(); + } + // Process Menu + else if ((menu = control as CommonFileDialogMenu) != null) + { + // Find the menu item that was clicked and invoke it's click event + foreach (CommonFileDialogMenuItem item in menu.Items) + { + if (item.Id == dwIDItem) + { + item.RaiseClickEvent(); + break; + } + } + } + } + + public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl) + { + // Find control + DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl); + CommonFileDialogButton button = control as CommonFileDialogButton; + // Call corresponding event + if (button != null) + { + button.RaiseClickEvent(); + } + } + + public void OnCheckButtonToggled(IFileDialogCustomize pfdc, int dwIDCtl, bool bChecked) + { + // Find control + DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl); + + CommonFileDialogCheckBox box = control as CommonFileDialogCheckBox; + // Update control and call corresponding event + if (box != null) + { + box.IsChecked = bChecked; + box.RaiseCheckedChangedEvent(); + } + } + + public void OnControlActivating(IFileDialogCustomize pfdc, int dwIDCtl) + { + } + } + + #endregion + + #region IDisposable Members + + /// + /// Releases the unmanaged resources used by the CommonFileDialog class and optionally + /// releases the managed resources. + /// + /// true to release both managed and unmanaged resources; + /// false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + CleanUpNativeFileDialog(); + } + } + + /// + /// Releases the resources used by the current instance of the CommonFileDialog class. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + #endregion + + /// + /// Indicates whether this feature is supported on the current platform. + /// + public static bool IsPlatformSupported + { + get + { + // We need Windows Vista onwards ... + return CoreHelpers.RunningOnVista; + } + } + } + + +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogButton.cs b/Shell/CommonFileDialogs/CommonFileDialogButton.cs new file mode 100644 index 0000000..879352a --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogButton.cs @@ -0,0 +1,59 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Creates the push button controls used by the Common File Dialog. + /// + public class CommonFileDialogButton : CommonFileDialogProminentControl + { + /// + /// Initializes a new instance of this class. + /// + public CommonFileDialogButton() : base(string.Empty) { } + + /// + /// Initializes a new instance of this class with the text only. + /// + /// The text to display for this control. + public CommonFileDialogButton(string text) : base(text) { } + + /// + /// Initializes a new instance of this class with the specified name and text. + /// + /// The name of this control. + /// The text to display for this control. + public CommonFileDialogButton(string name, string text) : base(name, text) { } + + /// + /// Attach the PushButton control to the dialog object + /// + /// Target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialogButton.Attach: dialog parameter can not be null"); + + // Add a push button control + dialog.AddPushButton(this.Id, this.Text); + + // Make this control prominent if needed + if (IsProminent) { dialog.MakeProminent(this.Id); } + + // Sync unmanaged properties with managed properties + SyncUnmanagedProperties(); + } + + /// + /// Occurs when the user clicks the control. This event is routed from COM via the event sink. + /// + public event EventHandler Click = delegate { }; + internal void RaiseClickEvent() + { + // Make sure that this control is enabled and has a specified delegate + if (Enabled) { this.Click(this, EventArgs.Empty); } + } + } +} \ No newline at end of file diff --git a/Shell/CommonFileDialogs/CommonFileDialogCheckBox.cs b/Shell/CommonFileDialogs/CommonFileDialogCheckBox.cs new file mode 100644 index 0000000..199d2f7 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogCheckBox.cs @@ -0,0 +1,106 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Creates the check button controls used by the Common File Dialog. + /// + public class CommonFileDialogCheckBox : CommonFileDialogProminentControl + { + private bool isChecked; + /// + /// Gets or sets the state of the check box. + /// + public bool IsChecked + { + get { return isChecked; } + set + { + // Check if property has changed + if (isChecked != value) + { + isChecked = value; + ApplyPropertyChange("IsChecked"); + } + } + } + + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogCheckBox() { } + + /// + /// Creates a new instance of this class with the specified text. + /// + /// The text to display for this control. + public CommonFileDialogCheckBox(string text) : base(text) { } + + /// + /// Creates a new instance of this class with the specified name and text. + /// + /// The name of this control. + /// The text to display for this control. + public CommonFileDialogCheckBox(string name, string text) : base(name, text) { } + + /// + /// Creates a new instance of this class with the specified text and check state. + /// + /// The text to display for this control. + /// The check state of this control. + public CommonFileDialogCheckBox(string text, bool isChecked) + : base(text) + { + this.isChecked = isChecked; + } + + /// + /// Creates a new instance of this class with the specified name, text and check state. + /// + /// The name of this control. + /// The text to display for this control. + /// The check state of this control. + public CommonFileDialogCheckBox(string name, string text, bool isChecked) + : base(name, text) + { + this.isChecked = isChecked; + } + + /// + /// Occurs when the user changes the check state. + /// + public event EventHandler CheckedChanged = delegate { }; + internal void RaiseCheckedChangedEvent() + { + // Make sure that this control is enabled and has a specified delegate + if (Enabled) + { + this.CheckedChanged(this, EventArgs.Empty); + } + } + + /// + /// Attach the CheckButton control to the dialog object. + /// + /// the target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialogCheckBox.Attach: dialog parameter can not be null"); + + // Add a check button control + dialog.AddCheckButton(this.Id, this.Text, this.isChecked); + + // Make this control prominent if needed + if (IsProminent) { dialog.MakeProminent(this.Id); } + + // Make sure this property is set + ApplyPropertyChange("IsChecked"); + + // Sync unmanaged properties with managed properties + SyncUnmanagedProperties(); + } + } +} \ No newline at end of file diff --git a/Shell/CommonFileDialogs/CommonFileDialogComboBox.cs b/Shell/CommonFileDialogs/CommonFileDialogComboBox.cs new file mode 100644 index 0000000..cebe120 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogComboBox.cs @@ -0,0 +1,174 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Windows.Markup; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Creates the ComboBox controls in the Common File Dialog. + /// + [ContentProperty("Items")] + public class CommonFileDialogComboBox : CommonFileDialogProminentControl, ICommonFileDialogIndexedControls + { + private readonly Collection items = new Collection(); + /// + /// Gets the collection of CommonFileDialogComboBoxItem objects. + /// + public Collection Items + { + get { return items; } + } + + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogComboBox() + { + } + + /// + /// Creates a new instance of this class with the specified name. + /// + /// Text to display for this control + public CommonFileDialogComboBox(string name) + : base(name, string.Empty) + { + } + + #region ICommonFileDialogIndexedControls Members + + private int selectedIndex = -1; + /// + /// Gets or sets the current index of the selected item. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] + public int SelectedIndex + { + get { return selectedIndex; } + set + { + // Don't update property if it hasn't changed + if (selectedIndex == value) + return; + + if (HostingDialog == null) + { + selectedIndex = value; + return; + } + + // Only update this property if it has a valid value + if (value >= 0 && value < items.Count) + { + selectedIndex = value; + ApplyPropertyChange("SelectedIndex"); + } + else + { + throw new IndexOutOfRangeException(LocalizedMessages.ComboBoxIndexOutsideBounds); + } + } + } + + /// + /// Occurs when the SelectedIndex is changed. + /// + /// + /// + /// By initializing the SelectedIndexChanged event with an empty + /// delegate, it is not necessary to check + /// if the SelectedIndexChanged is not null. + /// + /// + public event EventHandler SelectedIndexChanged = delegate { }; + + /// + /// Raises the SelectedIndexChanged event if this control is + /// enabled. + /// + /// Because this method is defined in an interface, we can either + /// have it as public, or make it private and explicitly implement (like below). + /// Making it public doesn't really help as its only internal (but can't have this + /// internal because of the interface) + /// + void ICommonFileDialogIndexedControls.RaiseSelectedIndexChangedEvent() + { + // Make sure that this control is enabled and has a specified delegate + if (Enabled) + SelectedIndexChanged(this, EventArgs.Empty); + } + + #endregion + + /// + /// Attach the ComboBox control to the dialog object + /// + /// The target dialog + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); + + // Add the combo box control + dialog.AddComboBox(this.Id); + + // Add the combo box items + for (int index = 0; index < items.Count; index++) + dialog.AddControlItem(this.Id, index, items[index].Text); + + // Set the currently selected item + if (selectedIndex >= 0 && selectedIndex < items.Count) + { + dialog.SetSelectedControlItem(this.Id, this.selectedIndex); + } + else if (selectedIndex != -1) + { + throw new IndexOutOfRangeException(LocalizedMessages.ComboBoxIndexOutsideBounds); + } + + // Make this control prominent if needed + if (IsProminent) + dialog.MakeProminent(this.Id); + + // Sync additional properties + SyncUnmanagedProperties(); + } + + } + + /// + /// Creates a ComboBoxItem for the Common File Dialog. + /// + public class CommonFileDialogComboBoxItem + { + private string text = string.Empty; + /// + /// Gets or sets the string that is displayed for this item. + /// + public string Text + { + get { return text; } + set { text = value; } + } + + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogComboBoxItem() + { + } + + /// + /// Creates a new instance of this class with the specified text. + /// + /// The text to use for the combo box item. + public CommonFileDialogComboBoxItem(string text) + { + this.text = text; + } + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogControl.cs b/Shell/CommonFileDialogs/CommonFileDialogControl.cs new file mode 100644 index 0000000..fe2a204 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogControl.cs @@ -0,0 +1,116 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Defines an abstract class that supports shared functionality for the + /// common file dialog controls. + /// + public abstract class CommonFileDialogControl : DialogControl + { + /// + /// Holds the text that is displayed for this control. + /// + private string textValue; + + /// + /// Gets or sets the text string that is displayed on the control. + /// + public virtual string Text + { + get { return textValue; } + set + { + // Don't update this property if it hasn't changed + if (value != textValue) + { + textValue = value; + ApplyPropertyChange("Text"); + } + } + } + + private bool enabled = true; + /// + /// Gets or sets a value that determines if this control is enabled. + /// + public bool Enabled + { + get { return enabled; } + set + { + // Don't update this property if it hasn't changed + if (value == enabled) { return; } + + enabled = value; + ApplyPropertyChange("Enabled"); + } + } + + private bool visible = true; + /// + /// Gets or sets a boolean value that indicates whether + /// this control is visible. + /// + public bool Visible + { + get { return visible; } + set + { + // Don't update this property if it hasn't changed + if (value == visible) { return; } + + visible = value; + ApplyPropertyChange("Visible"); + } + } + + private bool isAdded; + /// + /// Has this control been added to the dialog + /// + internal bool IsAdded + { + get { return isAdded; } + set { isAdded = value; } + } + + /// + /// Creates a new instance of this class. + /// + protected CommonFileDialogControl() { } + + /// + /// Creates a new instance of this class with the text. + /// + /// The text of the common file dialog control. + protected CommonFileDialogControl(string text) + : base() + { + this.textValue = text; + } + + /// + /// Creates a new instance of this class with the specified name and text. + /// + /// The name of the common file dialog control. + /// The text of the common file dialog control. + protected CommonFileDialogControl(string name, string text) + : base(name) + { + this.textValue = text; + } + + /// + /// Attach the custom control itself to the specified dialog + /// + /// the target dialog + internal abstract void Attach(IFileDialogCustomize dialog); + + internal virtual void SyncUnmanagedProperties() + { + ApplyPropertyChange("Enabled"); + ApplyPropertyChange("Visible"); + } + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs b/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs new file mode 100644 index 0000000..96dc6b4 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs @@ -0,0 +1,168 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Provides a strongly typed collection for dialog controls. + /// + /// DialogControl + public sealed class CommonFileDialogControlCollection : Collection where T : DialogControl + { + private IDialogControlHost hostingDialog; + + internal CommonFileDialogControlCollection(IDialogControlHost host) + { + hostingDialog = host; + } + + /// + /// Inserts an dialog control at the specified index. + /// + /// The location to insert the control. + /// The item to insert. + /// A control with + /// the same name already exists in this collection -or- + /// the control is being hosted by another dialog -or- the associated dialog is + /// showing and cannot be modified. + protected override void InsertItem(int index, T control) + { + // Check for duplicates, lack of host, + // and during-show adds. + if (Items.Contains(control)) + { + throw new InvalidOperationException( + LocalizedMessages.DialogControlCollectionMoreThanOneControl); + } + if (control.HostingDialog != null) + { + throw new InvalidOperationException( + LocalizedMessages.DialogControlCollectionRemoveControlFirst); + } + if (!hostingDialog.IsCollectionChangeAllowed()) + { + throw new InvalidOperationException( + LocalizedMessages.DialogControlCollectionModifyingControls); + } + if (control is CommonFileDialogMenuItem) + { + throw new InvalidOperationException( + LocalizedMessages.DialogControlCollectionMenuItemControlsCannotBeAdded); + } + + // Reparent, add control. + control.HostingDialog = hostingDialog; + base.InsertItem(index, control); + + // Notify that we've added a control. + hostingDialog.ApplyCollectionChanged(); + } + + /// + /// Removes the control at the specified index. + /// + /// The location of the control to remove. + /// + /// The associated dialog is + /// showing and cannot be modified. + protected override void RemoveItem(int index) + { + throw new NotSupportedException(LocalizedMessages.DialogControlCollectionCannotRemoveControls); + } + + /// + /// Defines the indexer that supports accessing controls by name. + /// + /// + /// Control names are case sensitive. + /// This indexer is useful when the dialog is created in XAML + /// rather than constructed in code. + /// + /// The name cannot be null or a zero-length string. + /// If there is more than one control with the same name, only the first control will be returned. + public T this[string name] + { + get + { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException(LocalizedMessages.DialogControlCollectionEmptyName, "name"); + } + + foreach (T control in base.Items) + { + CommonFileDialogGroupBox groupBox; + // NOTE: we don't ToLower() the strings - casing effects + // hash codes, so we are case-sensitive. + if (control.Name == name) + { + return control; + } + else if ((groupBox = control as CommonFileDialogGroupBox) != null) + { + foreach (T subControl in groupBox.Items) + { + if (subControl.Name == name) { return subControl; } + } + } + } + return null; + } + } + + /// + /// Recursively searches for the control who's id matches the value + /// passed in the parameter. + /// + /// + /// An integer containing the identifier of the + /// control being searched for. + /// + /// A DialogControl who's id matches the value of the + /// parameter. + /// + internal DialogControl GetControlbyId(int id) + { + return GetSubControlbyId(Items.Cast(), id); + } + + /// + /// Recursively searches for a given control id in the + /// collection passed via the parameter. + /// + /// + /// A Collection<CommonFileDialogControl> + /// An int containing the identifier of the control + /// being searched for. + /// + /// A DialogControl who's Id matches the value of the + /// parameter. + /// + internal DialogControl GetSubControlbyId(IEnumerable controlCollection, int id) + { + // if ctrlColl is null, it will throw in the foreach. + if (controlCollection == null) { return null; } + + foreach (DialogControl control in controlCollection) + { + if (control.Id == id) { return control; } + + // Search GroupBox child items + CommonFileDialogGroupBox groupBox = control as CommonFileDialogGroupBox; + if (groupBox != null) + { + var temp = GetSubControlbyId(groupBox.Items, id); + if (temp != null) { return temp; } + } + } + + return null; + } + + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogFilter.cs b/Shell/CommonFileDialogs/CommonFileDialogFilter.cs new file mode 100644 index 0000000..5d1879c --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogFilter.cs @@ -0,0 +1,167 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Stores the file extensions used when filtering files in File Open and File Save dialogs. + /// + public class CommonFileDialogFilter + { + // We'll keep a parsed list of separate + // extensions and rebuild as needed. + + private Collection extensions; + private string rawDisplayName; + + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogFilter() + { + extensions = new Collection(); + } + + /// + /// Creates a new instance of this class with the specified display name and + /// file extension list. + /// + /// The name of this filter. + /// The list of extensions in + /// this filter. See remarks. + /// The can use a semicolon(";") + /// or comma (",") to separate extensions. Extensions can be prefaced + /// with a period (".") or with the file wild card specifier "*.". + /// + /// The cannot be null or a + /// zero-length string. + /// + public CommonFileDialogFilter(string rawDisplayName, string extensionList) + : this() + { + if (string.IsNullOrEmpty(extensionList)) + { + throw new ArgumentNullException("extensionList"); + } + + this.rawDisplayName = rawDisplayName; + + // Parse string and create extension strings. + // Format: "bat,cmd", or "bat;cmd", or "*.bat;*.cmd" + // Can support leading "." or "*." - these will be stripped. + string[] rawExtensions = extensionList.Split(',', ';'); + foreach (string extension in rawExtensions) + { + extensions.Add(CommonFileDialogFilter.NormalizeExtension(extension)); + } + } + /// + /// Gets or sets the display name for this filter. + /// + /// + /// The value for this property cannot be set to null or a + /// zero-length string. + /// + public string DisplayName + { + get + { + if (showExtensions) + { + return string.Format(System.Globalization.CultureInfo.InvariantCulture, + "{0} ({1})", + rawDisplayName, + CommonFileDialogFilter.GetDisplayExtensionList(extensions)); + } + + return rawDisplayName; + } + + set + { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value"); + } + rawDisplayName = value; + } + } + + /// + /// Gets a collection of the individual extensions + /// described by this filter. + /// + public Collection Extensions + { + get { return extensions; } + } + + private bool showExtensions = true; + /// + /// Gets or sets a value that controls whether the extensions are displayed. + /// + public bool ShowExtensions + { + get { return showExtensions; } + set { showExtensions = value; } + } + + private static string NormalizeExtension(string rawExtension) + { + rawExtension = rawExtension.Trim(); + rawExtension = rawExtension.Replace("*.", null); + rawExtension = rawExtension.Replace(".", null); + return rawExtension; + } + + private static string GetDisplayExtensionList(Collection extensions) + { + StringBuilder extensionList = new StringBuilder(); + foreach (string extension in extensions) + { + if (extensionList.Length > 0) { extensionList.Append(", "); } + extensionList.Append("*."); + extensionList.Append(extension); + } + + return extensionList.ToString(); + } + + /// + /// Internal helper that generates a single filter + /// specification for this filter, used by the COM API. + /// + /// Filter specification for this filter + /// + internal ShellNativeMethods.FilterSpec GetFilterSpec() + { + StringBuilder filterList = new StringBuilder(); + foreach (string extension in extensions) + { + if (filterList.Length > 0) { filterList.Append(";"); } + + filterList.Append("*."); + filterList.Append(extension); + + } + return new ShellNativeMethods.FilterSpec(DisplayName, filterList.ToString()); + } + + /// + /// Returns a string representation for this filter that includes + /// the display name and the list of extensions. + /// + /// A . + public override string ToString() + { + return string.Format(System.Globalization.CultureInfo.InvariantCulture, + "{0} ({1})", + rawDisplayName, + CommonFileDialogFilter.GetDisplayExtensionList(extensions)); + } + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogFilterCollection.cs b/Shell/CommonFileDialogs/CommonFileDialogFilterCollection.cs new file mode 100644 index 0000000..49ee6a2 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogFilterCollection.cs @@ -0,0 +1,29 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Collections.ObjectModel; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Provides a strongly typed collection for file dialog filters. + /// + public class CommonFileDialogFilterCollection : Collection + { + // Make the default constructor internal so users can't instantiate this + // collection by themselves. + internal CommonFileDialogFilterCollection() { } + + internal ShellNativeMethods.FilterSpec[] GetAllFilterSpecs() + { + ShellNativeMethods.FilterSpec[] filterSpecs = new ShellNativeMethods.FilterSpec[this.Count]; + + for (int i = 0; i < this.Count; i++) + { + filterSpecs[i] = this[i].GetFilterSpec(); + } + + return filterSpecs; + } + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogFolderChangeEventArgs.cs b/Shell/CommonFileDialogs/CommonFileDialogFolderChangeEventArgs.cs new file mode 100644 index 0000000..e794c86 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogFolderChangeEventArgs.cs @@ -0,0 +1,28 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.ComponentModel; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Creates the event data associated with event. + /// + /// + public class CommonFileDialogFolderChangeEventArgs : CancelEventArgs + { + /// + /// Creates a new instance of this class. + /// + /// The name of the folder. + public CommonFileDialogFolderChangeEventArgs(string folder) + { + Folder = folder; + } + + /// + /// Gets or sets the name of the folder. + /// + public string Folder { get; set; } + + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogGroupBox.cs b/Shell/CommonFileDialogs/CommonFileDialogGroupBox.cs new file mode 100644 index 0000000..cb0b49d --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogGroupBox.cs @@ -0,0 +1,93 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Windows.Markup; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Represents a group box control for the Common File Dialog. + /// note + [ContentProperty("Items")] + public class CommonFileDialogGroupBox : CommonFileDialogProminentControl + { + private Collection items; + /// + /// Gets the collection of controls for this group box. + /// + public Collection Items + { + get { return items; } + } + + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogGroupBox() + : base(string.Empty) + { + Initialize(); + } + + /// + /// Create a new instance of this class with the specified text. + /// + /// The text to display for this control. + public CommonFileDialogGroupBox(string text) + : base(text) + { + Initialize(); + } + + /// + /// Creates a new instance of this class with the specified name and text. + /// + /// The name of this control. + /// The text to display for this control. + public CommonFileDialogGroupBox(string name, string text) + : base(name, text) + { + Initialize(); + } + + /// + /// Initializes the item collection for this class. + /// + private void Initialize() + { + items = new Collection(); + } + + /// + /// Attach the GroupBox control to the dialog object + /// + /// Target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialogGroupBox.Attach: dialog parameter can not be null"); + + // Start a visual group + dialog.StartVisualGroup(this.Id, this.Text); + + // Add child controls + foreach (CommonFileDialogControl item in this.items) + { + item.HostingDialog = HostingDialog; + item.Attach(dialog); + } + + // End visual group + dialog.EndVisualGroup(); + + // Make this control prominent if needed + if (IsProminent) + dialog.MakeProminent(this.Id); + + // Sync unmanaged properties with managed properties + SyncUnmanagedProperties(); + } + + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogLabel.cs b/Shell/CommonFileDialogs/CommonFileDialogLabel.cs new file mode 100644 index 0000000..373a5c4 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogLabel.cs @@ -0,0 +1,45 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Diagnostics; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Defines the label controls in the Common File Dialog. + /// + public class CommonFileDialogLabel : CommonFileDialogControl + { + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogLabel() { } + + /// + /// Creates a new instance of this class with the specified text. + /// + /// The text to display for this control. + public CommonFileDialogLabel(string text) : base(text) { } + + /// + /// Creates a new instance of this class with the specified name and text. + /// + /// The name of this control. + /// The text to display for this control. + public CommonFileDialogLabel(string name, string text) : base(name, text) { } + + /// + /// Attach this control to the dialog object + /// + /// Target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialog.Attach: dialog parameter can not be null"); + + // Add a text control + dialog.AddText(this.Id, this.Text); + + // Sync unmanaged properties with managed properties + SyncUnmanagedProperties(); + } + } +} \ No newline at end of file diff --git a/Shell/CommonFileDialogs/CommonFileDialogMenu.cs b/Shell/CommonFileDialogs/CommonFileDialogMenu.cs new file mode 100644 index 0000000..3fa81e2 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogMenu.cs @@ -0,0 +1,102 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Windows.Markup; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Defines the menu controls for the Common File Dialog. + /// + [ContentProperty("Items")] + public class CommonFileDialogMenu : CommonFileDialogProminentControl + { + private Collection items = new Collection(); + /// + /// Gets the collection of CommonFileDialogMenuItem objects. + /// + public Collection Items + { + get { return items; } + } + + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogMenu() : base() { } + + /// + /// Creates a new instance of this class with the specified text. + /// + /// The text to display for this control. + public CommonFileDialogMenu(string text) : base(text) { } + + /// + /// Creates a new instance of this class with the specified name and text. + /// + /// The name of this control. + /// The text to display for this control. + public CommonFileDialogMenu(string name, string text) : base(name, text) { } + + /// + /// Attach the Menu control to the dialog object. + /// + /// the target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialogMenu.Attach: dialog parameter can not be null"); + + // Add the menu control + dialog.AddMenu(this.Id, this.Text); + + // Add the menu items + foreach (CommonFileDialogMenuItem item in this.items) + dialog.AddControlItem(this.Id, item.Id, item.Text); + + // Make prominent as needed + if (IsProminent) + dialog.MakeProminent(this.Id); + + // Sync unmanaged properties with managed properties + SyncUnmanagedProperties(); + } + } + + /// + /// Creates the CommonFileDialogMenuItem items for the Common File Dialog. + /// + public class CommonFileDialogMenuItem : CommonFileDialogControl + { + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogMenuItem() : base(string.Empty) { } + + /// + /// Creates a new instance of this class with the specified text. + /// + /// The text to display for this control. + public CommonFileDialogMenuItem(string text) : base(text) { } + + /// + /// Occurs when a user clicks a menu item. + /// + public event EventHandler Click = delegate { }; + internal void RaiseClickEvent() + { + // Make sure that this control is enabled and has a specified delegate + if (Enabled) { Click(this, EventArgs.Empty); } + } + + /// + /// Attach this control to the dialog object + /// + /// Target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + // Items are added via the menu itself + } + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogProminentControl.cs b/Shell/CommonFileDialogs/CommonFileDialogProminentControl.cs new file mode 100644 index 0000000..efdd975 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogProminentControl.cs @@ -0,0 +1,47 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Windows.Markup; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Defines the properties and constructors for all prominent controls in the Common File Dialog. + /// + [ContentProperty("Items")] + public abstract class CommonFileDialogProminentControl : CommonFileDialogControl + { + private bool isProminent; + + /// + /// Gets or sets the prominent value of this control. + /// + /// Only one control can be specified as prominent. If more than one control is specified prominent, + /// then an 'E_UNEXPECTED' exception will be thrown when these controls are added to the dialog. + /// A group box control can only be specified as prominent if it contains one control and that control is of type 'CommonFileDialogProminentControl'. + /// + public bool IsProminent + { + get { return isProminent; } + set { isProminent = value; } + } + + + /// + /// Creates a new instance of this class. + /// + protected CommonFileDialogProminentControl() { } + + /// + /// Creates a new instance of this class with the specified text. + /// + /// The text to display for this control. + protected CommonFileDialogProminentControl(string text) : base(text) { } + + /// + /// Creates a new instance of this class with the specified name and text. + /// + /// The name of this control. + /// The text to display for this control. + protected CommonFileDialogProminentControl(string name, string text) : base(name, text) { } + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogRadioButtonList.cs b/Shell/CommonFileDialogs/CommonFileDialogRadioButtonList.cs new file mode 100644 index 0000000..0dd4439 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogRadioButtonList.cs @@ -0,0 +1,153 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Windows.Markup; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Represents a radio button list for the Common File Dialog. + /// + [ContentProperty("Items")] + public class CommonFileDialogRadioButtonList : CommonFileDialogControl, ICommonFileDialogIndexedControls + { + private Collection items = new Collection(); + /// + /// Gets the collection of CommonFileDialogRadioButtonListItem objects + /// + public Collection Items + { + get { return items; } + } + + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogRadioButtonList() { } + + /// + /// Creates a new instance of this class with the specified name. + /// + /// The name of this control. + public CommonFileDialogRadioButtonList(string name) : base(name, string.Empty) { } + + #region ICommonFileDialogIndexedControls Members + + private int selectedIndex = -1; + /// + /// Gets or sets the current index of the selected item. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] + public int SelectedIndex + { + get { return selectedIndex; } + set + { + // Don't update this property if it hasn't changed + if (selectedIndex == value) { return; } + + // If the native dialog has not been created yet + if (HostingDialog == null) + { + selectedIndex = value; + } + else if (value >= 0 && value < items.Count) + { + selectedIndex = value; + ApplyPropertyChange("SelectedIndex"); + } + else + { + throw new IndexOutOfRangeException(LocalizedMessages.RadioButtonListIndexOutOfBounds); + } + } + } + + /// + /// Occurs when the user changes the SelectedIndex. + /// + /// + /// + /// By initializing the SelectedIndexChanged event with an empty + /// delegate, we can skip the test to determine + /// if the SelectedIndexChanged is null. + /// test. + /// + public event EventHandler SelectedIndexChanged = delegate { }; + + /// + /// Occurs when the user changes the SelectedIndex. + /// + /// Because this method is defined in an interface, we can either + /// have it as public, or make it private and explicitly implement (like below). + /// Making it public doesn't really help as its only internal (but can't have this + /// internal because of the interface) + /// + void ICommonFileDialogIndexedControls.RaiseSelectedIndexChangedEvent() + { + // Make sure that this control is enabled and has a specified delegate + if (Enabled) { SelectedIndexChanged(this, EventArgs.Empty); } + } + + #endregion + + /// + /// Attach the RadioButtonList control to the dialog object + /// + /// The target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialogRadioButtonList.Attach: dialog parameter can not be null"); + + // Add the radio button list control + dialog.AddRadioButtonList(this.Id); + + // Add the radio button list items + for (int index = 0; index < items.Count; index++) + { + dialog.AddControlItem(this.Id, index, items[index].Text); + } + + // Set the currently selected item + if (selectedIndex >= 0 && selectedIndex < items.Count) + { + dialog.SetSelectedControlItem(this.Id, this.selectedIndex); + } + else if (selectedIndex != -1) + { + throw new IndexOutOfRangeException(LocalizedMessages.RadioButtonListIndexOutOfBounds); + } + + // Sync unmanaged properties with managed properties + SyncUnmanagedProperties(); + } + } + + /// + /// Represents a list item for the CommonFileDialogRadioButtonList object. + /// + public class CommonFileDialogRadioButtonListItem + { + /// + /// Gets or sets the string that will be displayed for this list item. + /// + public string Text { get; set; } + + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogRadioButtonListItem() : this(string.Empty) { } + + /// + /// Creates a new instance of this class with the specified text. + /// + /// The string that you want to display for this list item. + public CommonFileDialogRadioButtonListItem(string text) + { + Text = text; + } + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogResult.cs b/Shell/CommonFileDialogs/CommonFileDialogResult.cs new file mode 100644 index 0000000..b026dcd --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogResult.cs @@ -0,0 +1,25 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Specifies identifiers to indicate the return value of a CommonFileDialog dialog. + /// + public enum CommonFileDialogResult + { + /// + /// Default value for enumeration, a dialog box should never return this value. + /// + None = 0, + + /// + /// The dialog box return value is OK (usually sent from a button labeled OK or Save). + /// + Ok = 1, + + /// + /// The dialog box return value is Cancel (usually sent from a button labeled Cancel). + /// + Cancel = 2, + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogSeperator.cs b/Shell/CommonFileDialogs/CommonFileDialogSeperator.cs new file mode 100644 index 0000000..c2d1d11 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogSeperator.cs @@ -0,0 +1,27 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Diagnostics; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Defines the class for the simplest separator controls. + /// + public class CommonFileDialogSeparator : CommonFileDialogControl + { + /// + /// Attach the Separator control to the dialog object + /// + /// Target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialogSeparator.Attach: dialog parameter can not be null"); + + // Add a separator + dialog.AddSeparator(this.Id); + + // Sync unmanaged properties with managed properties + SyncUnmanagedProperties(); + } + } +} \ No newline at end of file diff --git a/Shell/CommonFileDialogs/CommonFileDialogStandardFilters.cs b/Shell/CommonFileDialogs/CommonFileDialogStandardFilters.cs new file mode 100644 index 0000000..4f24ccb --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogStandardFilters.cs @@ -0,0 +1,62 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Defines the class of commonly used file filters. + /// + public static class CommonFileDialogStandardFilters + { + private static CommonFileDialogFilter textFilesFilter; + /// + /// Gets a value that specifies the filter for *.txt files. + /// + public static CommonFileDialogFilter TextFiles + { + get + { + if (textFilesFilter == null) + { + textFilesFilter = new CommonFileDialogFilter(LocalizedMessages.CommonFiltersText, "*.txt"); + } + return textFilesFilter; + } + } + + private static CommonFileDialogFilter pictureFilesFilter; + /// + /// Gets a value that specifies the filter for picture files. + /// + public static CommonFileDialogFilter PictureFiles + { + get + { + if (pictureFilesFilter == null) + { + pictureFilesFilter = new CommonFileDialogFilter(LocalizedMessages.CommonFiltersPicture, + "*.bmp, *.jpg, *.jpeg, *.png, *.ico"); + } + return pictureFilesFilter; + } + + } + private static CommonFileDialogFilter officeFilesFilter; + /// + /// Gets a value that specifies the filter for Microsoft Office files. + /// + public static CommonFileDialogFilter OfficeFiles + { + get + { + if (officeFilesFilter == null) + { + officeFilesFilter = new CommonFileDialogFilter(LocalizedMessages.CommonFiltersOffice, + "*.doc, *.docx, *.xls, *.xlsx, *.ppt, *.pptx"); + } + return officeFilesFilter; + } + } + } +} diff --git a/Shell/CommonFileDialogs/CommonFileDialogTextBox.cs b/Shell/CommonFileDialogs/CommonFileDialogTextBox.cs new file mode 100644 index 0000000..106c4f1 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonFileDialogTextBox.cs @@ -0,0 +1,101 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Defines the text box controls in the Common File Dialog. + /// + public class CommonFileDialogTextBox : CommonFileDialogControl + { + /// + /// Creates a new instance of this class. + /// + public CommonFileDialogTextBox() : base(string.Empty) { } + + /// + /// Creates a new instance of this class with the specified text. + /// + /// The text to display for this control. + public CommonFileDialogTextBox(string text) : base(text) { } + + /// + /// Creates a new instance of this class with the specified name and text. + /// + /// The name of this control. + /// The text to display for this control. + public CommonFileDialogTextBox(string name, string text) : base(name, text) { } + + internal bool Closed { get; set; } + + /// + /// Gets or sets a value for the text string contained in the CommonFileDialogTextBox. + /// + public override string Text + { + get + { + if (!Closed) + { + SyncValue(); + } + + return base.Text; + } + + set + { + if (customizedDialog != null) + { + customizedDialog.SetEditBoxText(this.Id, value); + } + + base.Text = value; + } + } + + /// + /// Holds an instance of the customized (/native) dialog and should + /// be null until after the Attach() call is made. + /// + private IFileDialogCustomize customizedDialog; + + /// + /// Attach the TextBox control to the dialog object + /// + /// Target dialog + internal override void Attach(IFileDialogCustomize dialog) + { + Debug.Assert(dialog != null, "CommonFileDialogTextBox.Attach: dialog parameter can not be null"); + + // Add a text entry control + dialog.AddEditBox(this.Id, this.Text); + + // Set to local instance in order to gate access to same. + customizedDialog = dialog; + + // Sync unmanaged properties with managed properties + SyncUnmanagedProperties(); + + Closed = false; + } + + internal void SyncValue() + { + // Make sure that the local native dialog instance is NOT + // null. If it's null, just return the "textValue" var, + // otherwise, use the native call to get the text value, + // setting the textValue member variable then return it. + + if (customizedDialog != null) + { + string textValue; + customizedDialog.GetEditBoxText(this.Id, out textValue); + + base.Text = textValue; + } + } + } +} diff --git a/Shell/CommonFileDialogs/CommonOpenFileDialog.cs b/Shell/CommonFileDialogs/CommonOpenFileDialog.cs new file mode 100644 index 0000000..bd4ee21 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonOpenFileDialog.cs @@ -0,0 +1,193 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Creates a Vista or Windows 7 Common File Dialog, allowing the user to select one or more files. + /// + /// + public sealed class CommonOpenFileDialog : CommonFileDialog + { + private NativeFileOpenDialog openDialogCoClass; + + /// + /// Creates a new instance of this class. + /// + public CommonOpenFileDialog() + : base() + { + // For Open file dialog, allow read only files. + base.EnsureReadOnly = true; + } + + /// + /// Creates a new instance of this class with the specified name. + /// + /// The name of this dialog. + public CommonOpenFileDialog(string name) + : base(name) + { + // For Open file dialog, allow read only files. + base.EnsureReadOnly = true; + } + + #region Public API specific to Open + + /// + /// Gets a collection of the selected file names. + /// + /// This property should only be used when the + /// + /// property is true. + public IEnumerable FileNames + { + get + { + CheckFileNamesAvailable(); + return base.FileNameCollection; + } + } + + /// + /// Gets a collection of the selected items as ShellObject objects. + /// + /// This property should only be used when the + /// + /// property is true. + public ICollection FilesAsShellObject + { + get + { + // Check if we have selected files from the user. + CheckFileItemsAvailable(); + + // temp collection to hold our shellobjects + ICollection resultItems = new Collection(); + + // Loop through our existing list of filenames, and try to create a concrete type of + // ShellObject (e.g. ShellLibrary, FileSystemFolder, ShellFile, etc) + foreach (IShellItem si in items) + { + resultItems.Add(ShellObjectFactory.Create(si)); + } + + return resultItems; + } + } + + + private bool multiselect; + /// + /// Gets or sets a value that determines whether the user can select more than one file. + /// + public bool Multiselect + { + get { return multiselect; } + set { multiselect = value; } + } + + private bool isFolderPicker; + /// + /// Gets or sets a value that determines whether the user can select folders or files. + /// Default value is false. + /// + public bool IsFolderPicker + { + get { return isFolderPicker; } + set { isFolderPicker = value; } + } + + private bool allowNonFileSystem; + /// + /// Gets or sets a value that determines whether the user can select non-filesystem items, + /// such as Library, Search Connectors, or Known Folders. + /// + public bool AllowNonFileSystemItems + { + get { return allowNonFileSystem; } + set { allowNonFileSystem = value; } + } + #endregion + + internal override IFileDialog GetNativeFileDialog() + { + Debug.Assert(openDialogCoClass != null, "Must call Initialize() before fetching dialog interface"); + + return (IFileDialog)openDialogCoClass; + } + + internal override void InitializeNativeFileDialog() + { + if (openDialogCoClass == null) + { + openDialogCoClass = new NativeFileOpenDialog(); + } + } + + internal override void CleanUpNativeFileDialog() + { + if (openDialogCoClass != null) + { + Marshal.ReleaseComObject(openDialogCoClass); + } + } + + internal override void PopulateWithFileNames(Collection names) + { + IShellItemArray resultsArray; + uint count; + + openDialogCoClass.GetResults(out resultsArray); + resultsArray.GetCount(out count); + names.Clear(); + for (int i = 0; i < count; i++) + { + names.Add(GetFileNameFromShellItem(GetShellItemAt(resultsArray, i))); + } + } + + internal override void PopulateWithIShellItems(Collection items) + { + IShellItemArray resultsArray; + uint count; + + openDialogCoClass.GetResults(out resultsArray); + resultsArray.GetCount(out count); + items.Clear(); + for (int i = 0; i < count; i++) + { + items.Add(GetShellItemAt(resultsArray, i)); + } + } + + internal override ShellNativeMethods.FileOpenOptions GetDerivedOptionFlags(ShellNativeMethods.FileOpenOptions flags) + { + if (multiselect) + { + flags |= ShellNativeMethods.FileOpenOptions.AllowMultiSelect; + } + if (isFolderPicker) + { + flags |= ShellNativeMethods.FileOpenOptions.PickFolders; + } + + if (!allowNonFileSystem) + { + flags |= ShellNativeMethods.FileOpenOptions.ForceFilesystem; + } + else if (allowNonFileSystem) + { + flags |= ShellNativeMethods.FileOpenOptions.AllNonStorageItems; + } + + return flags; + } + } +} diff --git a/Shell/CommonFileDialogs/CommonSaveFileDialog.cs b/Shell/CommonFileDialogs/CommonSaveFileDialog.cs new file mode 100644 index 0000000..54d0ca6 --- /dev/null +++ b/Shell/CommonFileDialogs/CommonSaveFileDialog.cs @@ -0,0 +1,305 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; +using System.Text; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + /// + /// Creates a Vista or Windows 7 Common File Dialog, allowing the user to select the filename and location for a saved file. + /// + /// + /// to save a file. Associated enumeration: . + /// + public sealed class CommonSaveFileDialog : CommonFileDialog + { + private NativeFileSaveDialog saveDialogCoClass; + + /// + /// Creates a new instance of this class. + /// + public CommonSaveFileDialog() { } + /// + /// Creates a new instance of this class with the specified name. + /// + /// The name of this dialog. + public CommonSaveFileDialog(string name) : base(name) { } + + #region Public API specific to Save + + private bool overwritePrompt = true; + /// + /// Gets or sets a value that controls whether to prompt before + /// overwriting an existing file of the same name. Default value is true. + /// + /// + /// This property cannot be changed when the dialog is showing. + /// + public bool OverwritePrompt + { + get { return overwritePrompt; } + set + { + ThrowIfDialogShowing(LocalizedMessages.OverwritePromptCannotBeChanged); + overwritePrompt = value; + } + } + + private bool createPrompt; + /// + /// Gets or sets a value that controls whether to prompt for creation if the item returned in the save dialog does not exist. + /// + /// Note that this does not actually create the item. + /// + /// This property cannot be changed when the dialog is showing. + /// + public bool CreatePrompt + { + get { return createPrompt; } + set + { + ThrowIfDialogShowing(LocalizedMessages.CreatePromptCannotBeChanged); + createPrompt = value; + } + } + + private bool isExpandedMode; + /// + /// Gets or sets a value that controls whether to the save dialog + /// displays in expanded mode. + /// + /// Expanded mode controls whether the dialog + /// shows folders for browsing or hides them. + /// + /// This property cannot be changed when the dialog is showing. + /// + public bool IsExpandedMode + { + get { return isExpandedMode; } + set + { + ThrowIfDialogShowing(LocalizedMessages.IsExpandedModeCannotBeChanged); + isExpandedMode = value; + } + } + + private bool alwaysAppendDefaultExtension; + /// + /// Gets or sets a value that controls whether the + /// returned file name has a file extension that matches the + /// currently selected file type. If necessary, the dialog appends the correct + /// file extension. + /// + /// + /// This property cannot be changed when the dialog is showing. + /// + public bool AlwaysAppendDefaultExtension + { + get { return alwaysAppendDefaultExtension; } + set + { + ThrowIfDialogShowing(LocalizedMessages.AlwaysAppendDefaultExtensionCannotBeChanged); + alwaysAppendDefaultExtension = value; + } + } + + /// + /// Sets an item to appear as the initial entry in a Save As dialog. + /// + /// The initial entry to be set in the dialog. + /// The name of the item is displayed in the file name edit box, + /// and the containing folder is opened in the view. This would generally be + /// used when the application is saving an item that already exists. + public void SetSaveAsItem(ShellObject item) + { + if (item == null) + { + throw new ArgumentNullException("item"); + } + + InitializeNativeFileDialog(); + IFileSaveDialog nativeDialog = GetNativeFileDialog() as IFileSaveDialog; + + // Get the native IShellItem from ShellObject + if (nativeDialog != null) + { + nativeDialog.SetSaveAsItem(item.NativeShellItem); + } + } + + /// + /// Specifies which properties will be collected in the save dialog. + /// + /// True to show default properties for the currently selected + /// filetype in addition to the properties specified by propertyList. False to show only properties + /// specified by pList. + /// List of properties to collect. This parameter can be null. + /// + /// + /// SetCollectedPropertyKeys can be called at any time before the dialog is displayed or while it + /// is visible. If different properties are to be collected depending on the chosen filetype, + /// then SetCollectedProperties can be called in response to CommonFileDialog::FileTypeChanged event. + /// Note: By default, no properties are collected in the save dialog. + /// + public void SetCollectedPropertyKeys(bool appendDefault, params PropertyKey[] propertyList) + { + // Loop through all our property keys and create a semicolon-delimited property list string. + // The string we pass to PSGetPropertyDescriptionListFromString must + // start with "prop:", followed a list of canonical names for each + // property that is to collected. + if (propertyList != null && propertyList.Length > 0 && propertyList[0] != null) + { + StringBuilder sb = new StringBuilder("prop:"); + foreach (PropertyKey key in propertyList) + { + string canonicalName = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(key).CanonicalName; + if (!string.IsNullOrEmpty(canonicalName)) { sb.AppendFormat("{0};", canonicalName); } + } + + Guid guid = new Guid(ShellIIDGuid.IPropertyDescriptionList); + IPropertyDescriptionList propertyDescriptionList = null; + + try + { + int hr = PropertySystemNativeMethods.PSGetPropertyDescriptionListFromString( + sb.ToString(), + ref guid, + out propertyDescriptionList); + + // If we get a IPropertyDescriptionList, setit on the native dialog. + if (CoreErrorHelper.Succeeded(hr)) + { + InitializeNativeFileDialog(); + IFileSaveDialog nativeDialog = GetNativeFileDialog() as IFileSaveDialog; + + if (nativeDialog != null) + { + hr = nativeDialog.SetCollectedProperties(propertyDescriptionList, appendDefault); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + } + } + } + finally + { + if (propertyDescriptionList != null) + { + Marshal.ReleaseComObject(propertyDescriptionList); + } + } + } + } + + /// + /// Retrieves the set of property values for a saved item or an item in the process of being saved. + /// + /// Collection of property values collected from the save dialog + /// This property can be called while the dialog is showing to retrieve the current + /// set of values in the metadata collection pane. It can also be called after the dialog + /// has closed, to retrieve the final set of values. The call to this method will fail + /// unless property collection has been turned on with a call to SetCollectedPropertyKeys method. + /// + public ShellPropertyCollection CollectedProperties + { + get + { + InitializeNativeFileDialog(); + IFileSaveDialog nativeDialog = GetNativeFileDialog() as IFileSaveDialog; + + if (nativeDialog != null) + { + IPropertyStore propertyStore; + HResult hr = nativeDialog.GetProperties(out propertyStore); + + if (propertyStore != null && CoreErrorHelper.Succeeded(hr)) + { + return new ShellPropertyCollection(propertyStore); + } + } + + return null; + } + } + + #endregion + + internal override void InitializeNativeFileDialog() + { + if (saveDialogCoClass == null) + { + saveDialogCoClass = new NativeFileSaveDialog(); + } + } + + internal override IFileDialog GetNativeFileDialog() + { + Debug.Assert(saveDialogCoClass != null, "Must call Initialize() before fetching dialog interface"); + return (IFileDialog)saveDialogCoClass; + } + + internal override void PopulateWithFileNames( + System.Collections.ObjectModel.Collection names) + { + IShellItem item; + saveDialogCoClass.GetResult(out item); + + if (item == null) + { + throw new InvalidOperationException(LocalizedMessages.SaveFileNullItem); + } + names.Clear(); + names.Add(GetFileNameFromShellItem(item)); + } + + internal override void PopulateWithIShellItems(System.Collections.ObjectModel.Collection items) + { + IShellItem item; + saveDialogCoClass.GetResult(out item); + + if (item == null) + { + throw new InvalidOperationException(LocalizedMessages.SaveFileNullItem); + } + items.Clear(); + items.Add(item); + } + + internal override void CleanUpNativeFileDialog() + { + if (saveDialogCoClass != null) + { + Marshal.ReleaseComObject(saveDialogCoClass); + } + } + + internal override ShellNativeMethods.FileOpenOptions GetDerivedOptionFlags(ShellNativeMethods.FileOpenOptions flags) + { + if (overwritePrompt) + { + flags |= ShellNativeMethods.FileOpenOptions.OverwritePrompt; + } + if (createPrompt) + { + flags |= ShellNativeMethods.FileOpenOptions.CreatePrompt; + } + if (!isExpandedMode) + { + flags |= ShellNativeMethods.FileOpenOptions.DefaultNoMiniMode; + } + if (alwaysAppendDefaultExtension) + { + flags |= ShellNativeMethods.FileOpenOptions.StrictFileTypes; + } + return flags; + } + } +} diff --git a/Shell/CommonFileDialogs/ICommonFileDialogIndexedControls.cs b/Shell/CommonFileDialogs/ICommonFileDialogIndexedControls.cs new file mode 100644 index 0000000..75d29c1 --- /dev/null +++ b/Shell/CommonFileDialogs/ICommonFileDialogIndexedControls.cs @@ -0,0 +1,23 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Dialogs.Controls +{ + /// + /// Specifies a property, event and method that indexed controls need + /// to implement. + /// + /// + /// + /// not sure where else to put this, so leaving here for now. + /// + interface ICommonFileDialogIndexedControls + { + int SelectedIndex { get; set; } + + event EventHandler SelectedIndexChanged; + + void RaiseSelectedIndexChangedEvent(); + } +} \ No newline at end of file diff --git a/Shell/Controls/CommandLinkWPF.xaml b/Shell/Controls/CommandLinkWPF.xaml new file mode 100644 index 0000000..34a7de5 --- /dev/null +++ b/Shell/Controls/CommandLinkWPF.xaml @@ -0,0 +1,171 @@ + + + + + + + + diff --git a/Shell/Controls/CommandLinkWPF.xaml.cs b/Shell/Controls/CommandLinkWPF.xaml.cs new file mode 100644 index 0000000..5946484 --- /dev/null +++ b/Shell/Controls/CommandLinkWPF.xaml.cs @@ -0,0 +1,132 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.ComponentModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation +{ + /// + /// Implements a CommandLink button that can be used in WPF user interfaces. + /// + public partial class CommandLink : UserControl, INotifyPropertyChanged + { + /// + /// Creates a new instance of this class. + /// + public CommandLink() + { + // Throw PlatformNotSupportedException if the user is not running Vista or beyond + CoreHelpers.ThrowIfNotVista(); + + this.DataContext = this; + InitializeComponent(); + this.button.Click += new RoutedEventHandler(button_Click); + } + + void button_Click(object sender, RoutedEventArgs e) + { + e.Source = this; + if (Click != null) + { + Click(sender, e); + } + } + + /// + /// Routed UI command to use for this button + /// + public RoutedUICommand Command { get; set; } + + /// + /// Occurs when the control is clicked. + /// + public event RoutedEventHandler Click; + + private string link; + + /// + /// Specifies the main instruction text + /// + public string Link + { + get { return link; } + set + { + link = value; + + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs("Link")); + } + } + } + private string note; + + /// + /// Specifies the supporting note text + /// + public string Note + { + get { return note; } + set + { + note = value; + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs("Note")); + } + } + } + private ImageSource icon; + + /// + /// Icon to set for the command link button + /// + public ImageSource Icon + { + get { return icon; } + set + { + icon = value; + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs("Icon")); + } + } + } + + /// + /// Indicates if the button is in a checked state + /// + public bool? IsCheck + { + get { return button.IsChecked; } + set { button.IsChecked = value; } + } + + + #region INotifyPropertyChanged Members + + /// + /// Occurs when a property value changes. + /// + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + + /// + /// Indicates whether this feature is supported on the current platform. + /// + public static bool IsPlatformSupported + { + get + { + return CoreHelpers.RunningOnVista; + } + } + } +} \ No newline at end of file diff --git a/Shell/Controls/CommandLinkWinforms.cs b/Shell/Controls/CommandLinkWinforms.cs new file mode 100644 index 0000000..a2fe9b7 --- /dev/null +++ b/Shell/Controls/CommandLinkWinforms.cs @@ -0,0 +1,152 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.ComponentModel; +using System.Text; +using System.Windows.Forms; +using Microsoft.WindowsAPICodePack.Shell; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Controls.WindowsForms +{ + /// + /// Implements a CommandLink button that can be used in + /// WinForms user interfaces. + /// + public class CommandLink : Button + { + /// + /// Gets a System.Windows.Forms.CreateParams on the base class when + /// creating a window. + /// + protected override CreateParams CreateParams + { + + get + { + // Add BS_COMMANDLINK style before control creation. + CreateParams cp = base.CreateParams; + + cp.Style = AddCommandLinkStyle(cp.Style); + + return cp; + } + } + + // Let Windows handle the rendering. + /// + /// Creates a new instance of this class. + /// + public CommandLink() + { + CoreHelpers.ThrowIfNotVista(); + + FlatStyle = FlatStyle.System; + } + + // Add Design-Time Support. + + /// + /// Increase default width. + /// + protected override System.Drawing.Size DefaultSize + { + get { return new System.Drawing.Size(180, 60); } + } + + /// + /// Specifies the supporting note text + /// + [Category("Appearance")] + [Description("Specifies the supporting note text.")] + [BrowsableAttribute(true)] + [DefaultValue("(Note Text)")] + public string NoteText + { + get { return (GetNote(this)); } + set + { + SetNote(this, value); + } + } + + /// + /// Enable shield icon to be set at design-time. + /// + [Category("Appearance")] + [Description("Indicates whether the button should be decorated with the security shield icon (Windows Vista only).")] + [BrowsableAttribute(true)] + [DefaultValue(false)] + public bool UseElevationIcon + { + get { return (useElevationIcon); } + set + { + useElevationIcon = value; + SetShieldIcon(this, this.useElevationIcon); + } + } + private bool useElevationIcon; + + + #region Interop helpers + + private static int AddCommandLinkStyle(int style) + { + // Only add BS_COMMANDLINK style on Windows Vista or above. + // Otherwise, button creation will fail. + if (CoreHelpers.RunningOnVista) + { + style |= ShellNativeMethods.CommandLink; + } + + return style; + } + + private static string GetNote(System.Windows.Forms.Button Button) + { + IntPtr retVal = CoreNativeMethods.SendMessage( + Button.Handle, + ShellNativeMethods.GetNoteLength, + IntPtr.Zero, + IntPtr.Zero); + + // Add 1 for null terminator, to get the entire string back. + int len = ((int)retVal) + 1; + StringBuilder strBld = new StringBuilder(len); + + retVal = CoreNativeMethods.SendMessage(Button.Handle, ShellNativeMethods.GetNote, ref len, strBld); + return strBld.ToString(); + } + + private static void SetNote(System.Windows.Forms.Button button, string text) + { + // This call will be ignored on versions earlier than Windows Vista. + CoreNativeMethods.SendMessage(button.Handle, ShellNativeMethods.SetNote, 0, text); + } + + static internal void SetShieldIcon(System.Windows.Forms.Button Button, bool Show) + { + IntPtr fRequired = new IntPtr(Show ? 1 : 0); + CoreNativeMethods.SendMessage( + Button.Handle, + ShellNativeMethods.SetShield, + IntPtr.Zero, + fRequired); + } + + #endregion + + /// + /// Indicates whether this feature is supported on the current platform. + /// + public static bool IsPlatformSupported + { + get + { + // We need Windows Vista onwards ... + return CoreHelpers.RunningOnVista; + } + } + } +} diff --git a/Shell/CustomDictionary.xml b/Shell/CustomDictionary.xml new file mode 100644 index 0000000..dcdeb48 --- /dev/null +++ b/Shell/CustomDictionary.xml @@ -0,0 +1,58 @@ + + + + + Redirectable + Relaunch + Transcoded + Unlocalized + Cc + Blu + Multiselect + Precreate + Roamable + Svcd + Vcd + Csc + Oem + Unshare + Param + + + + + API + + TTYTDD + SFGAO + DOP + DRM + DTV + DVDID + EXIF + EXIFS + FRN + GPS + ID + ISO + LCID + MCDI + MIME + SAP + ATSC + CDR + CDRW + DOS + HDDVD + HDDVDR + HDDVDRAM + HDDVDROM + ROM + Csc + + + + Wildcards + Showplaces + + \ No newline at end of file diff --git a/Shell/Design/ShellObjects.cd b/Shell/Design/ShellObjects.cd new file mode 100644 index 0000000..ae8f19c --- /dev/null +++ b/Shell/Design/ShellObjects.cd @@ -0,0 +1,130 @@ + + + + + + AAoAAAgAAGAACQANgAJASAYAQABAAIAAAAAAAAAiAiQ= + Common\ShellObject.cs + + + + + + + AGIAoEAQACAAABBRCIAARCQCAAIABAAMCAEEAAPQKAQ= + Common\ShellLibrary.cs + + + + + + + BAAAABAAACAgAAoAAkSCIIAAQARAAAAIAoAEIAAACAA= + KnownFolders\FileSystemKnownFolder.cs + + + + + + + ACAAAAIAAKAAABAAAAAABAAAAAAAAIAAAAAAAAAAAAA= + Common\ShellObjectContainer.cs + + + + + + + AAQAAACAAAAAAEKAAIAAAIAABAAgESAAIAACAAQAAAA= + Common\ShellLink.cs + + + + + + BAAAABAAACAgAAoAAkSCIIAAQARAAAAIAoAEIAAACAA= + KnownFolders\NonFileSystemKnownFolder.cs + + + + + + + AAAAAAgAAAAAAAIAAAAAAAAABAAAAAAAAAABAAAAAAA= + Common\ShellFile.cs + + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Common\ShellFolder.cs + ShellFolder.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Common\ShellObjectNode.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Common\ShellNonFileSystemItem.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Common\ShellSearchCollection.cs + + + + + + AAAAAAAAAAAAAAIAIAAAAAAABAAAAAAAAAAAAAAAAAA= + Common\ShellFileSystemFolder.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Common\ShellNonFileSystemFolder.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Common\ShellSavedSearchCollection.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Common\ShellSearchConnector.cs + + + + + + AAQAEBAAAAAQAAABBEAAAQAIAIAAAAAAAJBAAgAAAAA= + Common\ShellSearchFolder.cs + + + + + + BAAAABAAAAAgAAoAAkCAIIAAQARAAAAIAoAEIAAACAA= + KnownFolders\IKnownFolder.cs + + + + \ No newline at end of file diff --git a/Shell/Design/ShellThumbnailClassDiagram.cd b/Shell/Design/ShellThumbnailClassDiagram.cd new file mode 100644 index 0000000..b60a69a --- /dev/null +++ b/Shell/Design/ShellThumbnailClassDiagram.cd @@ -0,0 +1,39 @@ + + + + + + QAABAABAAAAAAASAABkIABggAQAACgABgBIQAAEAAEI= + Common\ShellThumbnail.cs + + + + + + gAAAAAAAAAAAAAAQAAAAAABgAAAAAAAAAAAAAAAEAAA= + Common\DefaultShellImageSizes.cs + + + + + + gAAAAAAAAAAAAAAQAAAAAABgAAAAAAAAAAAAAAAEAAA= + Common\DefaultShellImageSizes.cs + + + + + + AAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAIAAAAAA= + Common\ShellThumbnailEnums.cs + + + + + + BAAAAAAAAAAAAAAAACAAIAAAAAAAAAAAAAAAAAAAAAA= + Common\ShellThumbnailEnums.cs + + + + \ No newline at end of file diff --git a/Shell/DesktopWindowManager/DesktopWindowManagerNativeMethods.cs b/Shell/DesktopWindowManager/DesktopWindowManagerNativeMethods.cs new file mode 100644 index 0000000..974c144 --- /dev/null +++ b/Shell/DesktopWindowManager/DesktopWindowManagerNativeMethods.cs @@ -0,0 +1,65 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using System.Security; +using Microsoft.WindowsAPICodePack.Shell.Interop; +using Microsoft.WindowsAPICodePack.Shell; + +namespace MS.WindowsAPICodePack.Internal +{ + internal static class DWMMessages + { + internal const int WM_DWMCOMPOSITIONCHANGED = 0x031E; + internal const int WM_DWMNCRENDERINGCHANGED = 0x031F; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct Margins + { + public int LeftWidth; // width of left border that retains its size + public int RightWidth; // width of right border that retains its size + public int TopHeight; // height of top border that retains its size + public int BottomHeight; // height of bottom border that retains its size + + public Margins(bool fullWindow) + { + LeftWidth = RightWidth = TopHeight = BottomHeight = (fullWindow ? -1 : 0); + } + }; + + internal enum CompositionEnable + { + Disable = 0, + Enable = 1 + } + + /// + /// Internal class that contains interop declarations for + /// functions that are not benign and are performance critical. + /// + [SuppressUnmanagedCodeSecurity] + internal static class DesktopWindowManagerNativeMethods + { + [DllImport("DwmApi.dll")] + internal static extern int DwmExtendFrameIntoClientArea( + IntPtr hwnd, + ref Margins m); + + [DllImport("DwmApi.dll", PreserveSig = false)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool DwmIsCompositionEnabled(); + + [DllImport("DwmApi.dll")] + internal static extern int DwmEnableComposition( + CompositionEnable compositionAction); + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool GetWindowRect(IntPtr hwnd, [Out] out NativeRect rect); + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool GetClientRect(IntPtr hwnd, [Out] out NativeRect rect); + } +} diff --git a/Shell/DesktopWindowManager/GlassEvents.cs b/Shell/DesktopWindowManager/GlassEvents.cs new file mode 100644 index 0000000..d21351a --- /dev/null +++ b/Shell/DesktopWindowManager/GlassEvents.cs @@ -0,0 +1,22 @@ +using System; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Event argument for The GlassAvailabilityChanged event + /// + public class AeroGlassCompositionChangedEventArgs : EventArgs + { + internal AeroGlassCompositionChangedEventArgs(bool avialbility) + { + GlassAvailable = avialbility; + } + + /// + /// The new GlassAvailable state + /// + public bool GlassAvailable { get; private set; } + + } + +} diff --git a/Shell/DesktopWindowManager/GlassForm.cs b/Shell/DesktopWindowManager/GlassForm.cs new file mode 100644 index 0000000..b850b08 --- /dev/null +++ b/Shell/DesktopWindowManager/GlassForm.cs @@ -0,0 +1,144 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using MS.WindowsAPICodePack.Internal; + + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Windows Glass Form + /// Inherit from this form to be able to enable glass on Windows Form + /// + public class GlassForm : Form + { + #region properties + + /// + /// Get determines if AeroGlass is enabled on the desktop. Set enables/disables AreoGlass on the desktop. + /// + public static bool AeroGlassCompositionEnabled + { + set + { + DesktopWindowManagerNativeMethods.DwmEnableComposition( + value ? CompositionEnable.Enable : CompositionEnable.Disable); + } + get + { + return DesktopWindowManagerNativeMethods.DwmIsCompositionEnabled(); + } + } + + #endregion + + #region events + + /// + /// Fires when the availability of Glass effect changes. + /// + public event EventHandler AeroGlassCompositionChanged; + + #endregion + + #region operations + + /// + /// Makes the background of current window transparent + /// + public void SetAeroGlassTransparency() + { + this.BackColor = Color.Transparent; + } + + /// + /// Excludes a Control from the AeroGlass frame. + /// + /// The control to exclude. + /// Many non-WPF rendered controls (i.e., the ExplorerBrowser control) will not + /// render properly on top of an AeroGlass frame. + public void ExcludeControlFromAeroGlass(Control control) + { + if (control == null) { throw new ArgumentNullException("control"); } + + if (AeroGlassCompositionEnabled) + { + Rectangle clientScreen = this.RectangleToScreen(this.ClientRectangle); + Rectangle controlScreen = control.RectangleToScreen(control.ClientRectangle); + + Margins margins = new Margins(); + margins.LeftWidth = controlScreen.Left - clientScreen.Left; + margins.RightWidth = clientScreen.Right - controlScreen.Right; + margins.TopHeight = controlScreen.Top - clientScreen.Top; + margins.BottomHeight = clientScreen.Bottom - controlScreen.Bottom; + + // Extend the Frame into client area + DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(Handle, ref margins); + } + } + + /// + /// Resets the AeroGlass exclusion area. + /// + public void ResetAeroGlass() + { + if (this.Handle != IntPtr.Zero) + { + Margins margins = new Margins(true); + DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(this.Handle, ref margins); + } + } + #endregion + + #region implementation + /// + /// Catches the DWM messages to this window and fires the appropriate event. + /// + /// + + protected override void WndProc(ref System.Windows.Forms.Message m) + { + if (m.Msg == DWMMessages.WM_DWMCOMPOSITIONCHANGED + || m.Msg == DWMMessages.WM_DWMNCRENDERINGCHANGED) + { + if (AeroGlassCompositionChanged != null) + { + AeroGlassCompositionChanged.Invoke(this, + new AeroGlassCompositionChangedEventArgs(AeroGlassCompositionEnabled)); + } + } + + base.WndProc(ref m); + } + + /// + /// Initializes the Form for AeroGlass + /// + /// The arguments for this event + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + ResetAeroGlass(); + } + + /// + /// Overide OnPaint to paint the background as black. + /// + /// PaintEventArgs + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + if (DesignMode == false) + { + if (AeroGlassCompositionEnabled && e != null) + { + // Paint the all the regions black to enable glass + e.Graphics.FillRectangle(Brushes.Black, this.ClientRectangle); + } + } + } + + #endregion + } +} diff --git a/Shell/DesktopWindowManager/GlassWindow.cs b/Shell/DesktopWindowManager/GlassWindow.cs new file mode 100644 index 0000000..894cea6 --- /dev/null +++ b/Shell/DesktopWindowManager/GlassWindow.cs @@ -0,0 +1,150 @@ +using System; +using System.Windows.Interop; +using System.Windows.Media; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Shell.Interop; +using System.Windows; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + + /// + /// WPF Glass Window + /// Inherit from this window class to enable glass on a WPF window + /// + public class GlassWindow : Window + { + #region properties + + /// + /// Get determines if AeroGlass is enabled on the desktop. Set enables/disables AreoGlass on the desktop. + /// + public static bool AeroGlassCompositionEnabled + { + set + { + DesktopWindowManagerNativeMethods.DwmEnableComposition( + value ? CompositionEnable.Enable : CompositionEnable.Disable); + } + get + { + return DesktopWindowManagerNativeMethods.DwmIsCompositionEnabled(); + } + } + + #endregion + + #region events + + /// + /// Fires when the availability of Glass effect changes. + /// + public event EventHandler AeroGlassCompositionChanged; + + #endregion + + #region operations + + /// + /// Makes the background of current window transparent from both Wpf and Windows Perspective + /// + public void SetAeroGlassTransparency() + { + // Set the Background to transparent from Win32 perpective + HwndSource.FromHwnd(windowHandle).CompositionTarget.BackgroundColor = System.Windows.Media.Colors.Transparent; + + // Set the Background to transparent from WPF perpective + this.Background = Brushes.Transparent; + } + + /// + /// Excludes a UI element from the AeroGlass frame. + /// + /// The element to exclude. + /// Many non-WPF rendered controls (i.e., the ExplorerBrowser control) will not + /// render properly on top of an AeroGlass frame. + public void ExcludeElementFromAeroGlass(FrameworkElement element) + { + if (AeroGlassCompositionEnabled && element != null) + { + // calculate total size of window nonclient area + HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource; + NativeRect windowRect; + NativeRect clientRect; + DesktopWindowManagerNativeMethods.GetWindowRect(hwndSource.Handle, out windowRect); + DesktopWindowManagerNativeMethods.GetClientRect(hwndSource.Handle, out clientRect); + Size nonClientSize = new Size( + (double)(windowRect.Right - windowRect.Left) - (double)(clientRect.Right - clientRect.Left), + (double)(windowRect.Bottom - windowRect.Top) - (double)(clientRect.Bottom - clientRect.Top)); + + // calculate size of element relative to nonclient area + GeneralTransform transform = element.TransformToAncestor(this); + Point topLeftFrame = transform.Transform(new Point(0, 0)); + Point bottomRightFrame = transform.Transform(new Point( + element.ActualWidth + nonClientSize.Width, + element.ActualHeight + nonClientSize.Height)); + + // Create a margin structure + Margins margins = new Margins(); + margins.LeftWidth = (int)topLeftFrame.X; + margins.RightWidth = (int)(this.ActualWidth - bottomRightFrame.X); + margins.TopHeight = (int)(topLeftFrame.Y); + margins.BottomHeight = (int)(this.ActualHeight - bottomRightFrame.Y); + + // Extend the Frame into client area + DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(windowHandle, ref margins); + } + } + + /// + /// Resets the AeroGlass exclusion area. + /// + public void ResetAeroGlass() + { + Margins margins = new Margins(true); + DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(windowHandle, ref margins); + } + + #endregion + + #region implementation + private IntPtr windowHandle; + + private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == DWMMessages.WM_DWMCOMPOSITIONCHANGED + || msg == DWMMessages.WM_DWMNCRENDERINGCHANGED) + { + if (AeroGlassCompositionChanged != null) + { + AeroGlassCompositionChanged.Invoke(this, + new AeroGlassCompositionChangedEventArgs(AeroGlassCompositionEnabled)); + } + + handled = true; + } + return IntPtr.Zero; + } + + /// + /// OnSourceInitialized + /// Override SourceInitialized to initialize windowHandle for this window. + /// A valid windowHandle is available only after the sourceInitialized is completed + /// + /// EventArgs + protected override void OnSourceInitialized(EventArgs e) + { + base.OnSourceInitialized(e); + WindowInteropHelper interopHelper = new WindowInteropHelper(this); + this.windowHandle = interopHelper.Handle; + + // add Window Proc hook to capture DWM messages + HwndSource source = HwndSource.FromHwnd(windowHandle); + source.AddHook(new HwndSourceHook(WndProc)); + + ResetAeroGlass(); + } + + #endregion + } +} diff --git a/Shell/ExplorerBrowser/CommonControlException.cs b/Shell/ExplorerBrowser/CommonControlException.cs new file mode 100644 index 0000000..c7eace1 --- /dev/null +++ b/Shell/ExplorerBrowser/CommonControlException.cs @@ -0,0 +1,61 @@ +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + /// + /// An exception thrown when an error occurs while dealing with Control objects. + /// + [Serializable] + public class CommonControlException : COMException + { + /// + /// Default constructor. + /// + public CommonControlException() { } + + /// + /// Initializes an excpetion with a custom message. + /// + /// + public CommonControlException(string message) : base(message) { } + + /// + /// Initializes an exception with custom message and inner exception. + /// + /// + /// + public CommonControlException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes an exception with custom message and error code. + /// + /// + /// + public CommonControlException(string message, int errorCode) : base(message, errorCode) { } + + /// + /// Initializes an exception with custom message and error code. + /// + /// + /// + internal CommonControlException(string message, HResult errorCode) : this(message, (int)errorCode) { } + + /// + /// Initializes an exception from serialization info and a context. + /// + /// + /// + protected CommonControlException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + } +} diff --git a/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml b/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml new file mode 100644 index 0000000..9d5cee9 --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml @@ -0,0 +1,8 @@ + + + + Explorer Browser Control + + diff --git a/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml.cs b/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml.cs new file mode 100644 index 0000000..24ff186 --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml.cs @@ -0,0 +1,987 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. +using System; +using System.Collections.ObjectModel; +using System.Threading; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms.Integration; +using System.Windows.Threading; +using Microsoft.WindowsAPICodePack.Shell; + + +namespace Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation +{ + /// + /// Interaction logic for ExplorerBrowser.xaml + /// + public partial class ExplorerBrowser : UserControl, IDisposable + { + /// + /// The underlying WinForms control + /// + public Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser ExplorerBrowserControl + { + get; + set; + } + + private ObservableCollection selectedItems; + private ObservableCollection items; + private ObservableCollection navigationLog; + private DispatcherTimer dtCLRUpdater = new DispatcherTimer(); + + private ShellObject initialNavigationTarget; + private ExplorerBrowserViewMode? initialViewMode; + + private AutoResetEvent itemsChanged = new AutoResetEvent(false); + private AutoResetEvent selectionChanged = new AutoResetEvent(false); + private int selectionChangeWaitCount; + + /// + /// Hosts the ExplorerBrowser WinForms wrapper in this control + /// + public ExplorerBrowser() + { + InitializeComponent(); + + // the ExplorerBrowser WinForms control + ExplorerBrowserControl = new Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser(); + + // back the dependency collection properties with instances + SelectedItems = selectedItems = new ObservableCollection(); + Items = items = new ObservableCollection(); + NavigationLog = navigationLog = new ObservableCollection(); + + // hook up events for collection synchronization + ExplorerBrowserControl.ItemsChanged += new EventHandler(ItemsChanged); + ExplorerBrowserControl.SelectionChanged += new EventHandler(SelectionChanged); + ExplorerBrowserControl.ViewEnumerationComplete += new EventHandler(ExplorerBrowserControl_ViewEnumerationComplete); + ExplorerBrowserControl.ViewSelectedItemChanged += new EventHandler(ExplorerBrowserControl_ViewSelectedItemChanged); + ExplorerBrowserControl.NavigationLog.NavigationLogChanged += new EventHandler(NavigationLogChanged); + + // host the control + WindowsFormsHost host = new WindowsFormsHost(); + try + { + host.Child = ExplorerBrowserControl; + this.root.Children.Clear(); + this.root.Children.Add(host); + } + catch + { + host.Dispose(); + throw; + } + + Loaded += new RoutedEventHandler(ExplorerBrowser_Loaded); + } + + void ExplorerBrowserControl_ViewSelectedItemChanged(object sender, EventArgs e) + { + } + + void ExplorerBrowserControl_ViewEnumerationComplete(object sender, EventArgs e) + { + itemsChanged.Set(); + selectionChanged.Set(); + } + + /// + /// To avoid the 'Dispatcher processing has been suspended' InvalidOperationException on Win7, + /// the ExplorerBorwser native control is initialized after this control is fully loaded. + /// + /// + /// + void ExplorerBrowser_Loaded(object sender, RoutedEventArgs e) + { + // setup timer to update dependency properties from CLR properties of WinForms ExplorerBrowser object + dtCLRUpdater.Tick += new EventHandler(UpdateDependencyPropertiesFromCLRPRoperties); + dtCLRUpdater.Interval = new TimeSpan(100 * 10000); // 100ms + dtCLRUpdater.Start(); + + if (initialNavigationTarget != null) + { + ExplorerBrowserControl.Navigate(initialNavigationTarget); + initialNavigationTarget = null; + } + + if (initialViewMode != null) + { + ExplorerBrowserControl.ContentOptions.ViewMode = (ExplorerBrowserViewMode)initialViewMode; + initialViewMode = null; + } + } + + /// + /// Map changes to the CLR flags to the dependency properties + /// + /// + /// + void UpdateDependencyPropertiesFromCLRPRoperties(object sender, EventArgs e) + { + AlignLeft = ExplorerBrowserControl.ContentOptions.AlignLeft; + AutoArrange = ExplorerBrowserControl.ContentOptions.AutoArrange; + CheckSelect = ExplorerBrowserControl.ContentOptions.CheckSelect; + ExtendedTiles = ExplorerBrowserControl.ContentOptions.ExtendedTiles; + FullRowSelect = ExplorerBrowserControl.ContentOptions.FullRowSelect; + HideFileNames = ExplorerBrowserControl.ContentOptions.HideFileNames; + NoBrowserViewState = ExplorerBrowserControl.ContentOptions.NoBrowserViewState; + NoColumnHeader = ExplorerBrowserControl.ContentOptions.NoColumnHeader; + NoHeaderInAllViews = ExplorerBrowserControl.ContentOptions.NoHeaderInAllViews; + NoIcons = ExplorerBrowserControl.ContentOptions.NoIcons; + NoSubfolders = ExplorerBrowserControl.ContentOptions.NoSubfolders; + SingleClickActivate = ExplorerBrowserControl.ContentOptions.SingleClickActivate; + SingleSelection = ExplorerBrowserControl.ContentOptions.SingleSelection; + ThumbnailSize = ExplorerBrowserControl.ContentOptions.ThumbnailSize; + ViewMode = ExplorerBrowserControl.ContentOptions.ViewMode; + AlwaysNavigate = ExplorerBrowserControl.NavigationOptions.AlwaysNavigate; + NavigateOnce = ExplorerBrowserControl.NavigationOptions.NavigateOnce; + AdvancedQueryPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.AdvancedQuery; + CommandsPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Commands; + CommandsOrganizePane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.CommandsOrganize; + CommandsViewPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.CommandsView; + DetailsPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Details; + NavigationPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Navigation; + PreviewPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Preview; + QueryPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Query; + NavigationLogIndex = ExplorerBrowserControl.NavigationLog.CurrentLocationIndex; + + if (itemsChanged.WaitOne(1, false)) + { + items.Clear(); + foreach (ShellObject obj in ExplorerBrowserControl.Items) + { + items.Add(obj); + } + } + + if (selectionChanged.WaitOne(1, false)) + { + selectionChangeWaitCount = 4; + } + else if (selectionChangeWaitCount > 0) + { + selectionChangeWaitCount--; + + if (selectionChangeWaitCount == 0) + { + selectedItems.Clear(); + foreach (ShellObject obj in ExplorerBrowserControl.SelectedItems) + { + selectedItems.Add(obj); + } + } + } + } + + /// + /// Synchronize NavigationLog collection to dependency collection + /// + /// + /// + void NavigationLogChanged(object sender, NavigationLogEventArgs args) + { + navigationLog.Clear(); + foreach (ShellObject obj in ExplorerBrowserControl.NavigationLog.Locations) + { + navigationLog.Add(obj); + } + } + + /// + /// Synchronize SelectedItems collection to dependency collection + /// + /// + /// + void SelectionChanged(object sender, EventArgs e) + { + selectionChanged.Set(); + } + + // Synchronize ItemsCollection to dependency collection + void ItemsChanged(object sender, EventArgs e) + { + itemsChanged.Set(); + } + + /// + /// The items in the ExplorerBrowser window + /// + public ObservableCollection Items + { + get + { + return (ObservableCollection)GetValue(ItemsProperty); + } + set + { + SetValue(ItemsPropertyKey, value); + } + } + + private static readonly DependencyPropertyKey ItemsPropertyKey = + DependencyProperty.RegisterReadOnly( + "Items", typeof(ObservableCollection), + typeof(ExplorerBrowser), + new PropertyMetadata(null)); + + /// + /// The items in the ExplorerBrowser window + /// + public static readonly DependencyProperty ItemsProperty = ItemsPropertyKey.DependencyProperty; + + /// + /// The selected items in the ExplorerBrowser window + /// + public ObservableCollection SelectedItems + { + get + { + return (ObservableCollection)GetValue(SelectedItemsProperty); + } + internal set + { + SetValue(SelectedItemsPropertyKey, value); + } + } + + private static readonly DependencyPropertyKey SelectedItemsPropertyKey = + DependencyProperty.RegisterReadOnly( + "SelectedItems", typeof(ObservableCollection), + typeof(ExplorerBrowser), + new PropertyMetadata(null)); + + /// + /// The selected items in the ExplorerBrowser window + /// + public ObservableCollection NavigationLog + { + get + { + return (ObservableCollection)GetValue(NavigationLogProperty); + } + internal set + { + SetValue(NavigationLogPropertyKey, value); + } + } + + private static readonly DependencyPropertyKey NavigationLogPropertyKey = + DependencyProperty.RegisterReadOnly( + "NavigationLog", typeof(ObservableCollection), + typeof(ExplorerBrowser), + new PropertyMetadata(null)); + + /// + /// The NavigationLog + /// + public static readonly DependencyProperty NavigationLogProperty = NavigationLogPropertyKey.DependencyProperty; + + /// + /// The selected items in the ExplorerBrowser window + /// + public static readonly DependencyProperty SelectedItemsProperty = SelectedItemsPropertyKey.DependencyProperty; + + + /// + /// The location the explorer browser is navigating to + /// + public ShellObject NavigationTarget + { + get + { + return (ShellObject)GetValue(NavigationTargetProperty); + } + set + { + SetValue(NavigationTargetProperty, value); + } + } + + /// + /// The DependencyProperty for the NavigationTarget property + /// + public static readonly DependencyProperty NavigationTargetProperty = + DependencyProperty.Register( + "NavigationTarget", typeof(ShellObject), + typeof(ExplorerBrowser), + new PropertyMetadata(null, navigationTargetChanged)); + + private static void navigationTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + + if (instance.ExplorerBrowserControl.explorerBrowserControl != null) + { + instance.ExplorerBrowserControl.Navigate((ShellObject)e.NewValue); + } + else + { + instance.initialNavigationTarget = (ShellObject)e.NewValue; + } + } + + /// + /// The view should be left-aligned. + /// + public bool AlignLeft + { + get { return (bool)GetValue(AlignLeftProperty); } + set { SetValue(AlignLeftProperty, value); } + } + + internal static DependencyProperty AlignLeftProperty = + DependencyProperty.Register( + "AlignLeft", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnAlignLeftChanged)); + + private static void OnAlignLeftChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + instance.ExplorerBrowserControl.ContentOptions.AlignLeft = (bool)e.NewValue; + } + + + /// + /// Automatically arrange the elements in the view. + /// + public bool AutoArrange + { + get { return (bool)GetValue(AutoArrangeProperty); } + set { SetValue(AutoArrangeProperty, value); } + } + + internal static DependencyProperty AutoArrangeProperty = + DependencyProperty.Register( + "AutoArrange", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnAutoArrangeChanged)); + + private static void OnAutoArrangeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + instance.ExplorerBrowserControl.ContentOptions.AutoArrange = (bool)e.NewValue; + } + + /// + /// Turns on check mode for the view + /// + public bool CheckSelect + { + get { return (bool)GetValue(CheckSelectProperty); } + set { SetValue(CheckSelectProperty, value); } + } + + internal static DependencyProperty CheckSelectProperty = + DependencyProperty.Register( + "CheckSelect", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnCheckSelectChanged)); + + private static void OnCheckSelectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.CheckSelect = (bool)e.NewValue; + } + } + + /// + /// When the view is in "tile view mode" the layout of a single item should be extended to the width of the view. + /// + public bool ExtendedTiles + { + get { return (bool)GetValue(ExtendedTilesProperty); } + set { SetValue(ExtendedTilesProperty, value); } + } + + internal static DependencyProperty ExtendedTilesProperty = + DependencyProperty.Register( + "ExtendedTiles", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnExtendedTilesChanged)); + + private static void OnExtendedTilesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + instance.ExplorerBrowserControl.ContentOptions.ExtendedTiles = (bool)e.NewValue; + } + + /// + /// When an item is selected, the item and all its sub-items are highlighted. + /// + public bool FullRowSelect + { + get { return (bool)GetValue(FullRowSelectProperty); } + set { SetValue(FullRowSelectProperty, value); } + } + + internal static DependencyProperty FullRowSelectProperty = + DependencyProperty.Register( + "FullRowSelect", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnFullRowSelectChanged)); + + private static void OnFullRowSelectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.FullRowSelect = (bool)e.NewValue; + } + } + + /// + /// The view should not display file names + /// + public bool HideFileNames + { + get { return (bool)GetValue(HideFileNamesProperty); } + set { SetValue(HideFileNamesProperty, value); } + } + + internal static DependencyProperty HideFileNamesProperty = + DependencyProperty.Register( + "HideFileNames", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnHideFileNamesChanged)); + + private static void OnHideFileNamesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.HideFileNames = (bool)e.NewValue; + } + } + + /// + /// The view should not save view state in the browser. + /// + public bool NoBrowserViewState + { + get { return (bool)GetValue(NoBrowserViewStateProperty); } + set { SetValue(NoBrowserViewStateProperty, value); } + } + + internal static DependencyProperty NoBrowserViewStateProperty = + DependencyProperty.Register( + "NoBrowserViewState", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnNoBrowserViewStateChanged)); + + private static void OnNoBrowserViewStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.NoBrowserViewState = (bool)e.NewValue; + } + } + + /// + /// Do not display a column header in the view in any view mode. + /// + public bool NoColumnHeader + { + get { return (bool)GetValue(NoColumnHeaderProperty); } + set { SetValue(NoColumnHeaderProperty, value); } + } + + internal static DependencyProperty NoColumnHeaderProperty = + DependencyProperty.Register( + "NoColumnHeader", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnNoColumnHeaderChanged)); + + private static void OnNoColumnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + instance.ExplorerBrowserControl.ContentOptions.NoColumnHeader = (bool)e.NewValue; + } + + /// + /// Only show the column header in details view mode. + /// + public bool NoHeaderInAllViews + { + get { return (bool)GetValue(NoHeaderInAllViewsProperty); } + set { SetValue(NoHeaderInAllViewsProperty, value); } + } + + internal static DependencyProperty NoHeaderInAllViewsProperty = + DependencyProperty.Register( + "NoHeaderInAllViews", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnNoHeaderInAllViewsChanged)); + + private static void OnNoHeaderInAllViewsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.NoHeaderInAllViews = (bool)e.NewValue; + } + } + + /// + /// The view should not display icons. + /// + public bool NoIcons + { + get { return (bool)GetValue(NoIconsProperty); } + set { SetValue(NoIconsProperty, value); } + } + + internal static DependencyProperty NoIconsProperty = + DependencyProperty.Register( + "NoIcons", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnNoIconsChanged)); + + private static void OnNoIconsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.NoIcons = (bool)e.NewValue; + } + } + + /// + /// Do not show subfolders. + /// + public bool NoSubfolders + { + get { return (bool)GetValue(NoSubfoldersProperty); } + set { SetValue(NoSubfoldersProperty, value); } + } + + internal static DependencyProperty NoSubfoldersProperty = + DependencyProperty.Register( + "NoSubfolders", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnNoSubfoldersChanged)); + + private static void OnNoSubfoldersChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.NoSubfolders = (bool)e.NewValue; + } + } + + /// + /// Navigate with a single click + /// + public bool SingleClickActivate + { + get { return (bool)GetValue(SingleClickActivateProperty); } + set { SetValue(SingleClickActivateProperty, value); } + } + + internal static DependencyProperty SingleClickActivateProperty = + DependencyProperty.Register( + "SingleClickActivate", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnSingleClickActivateChanged)); + + private static void OnSingleClickActivateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.SingleClickActivate = (bool)e.NewValue; + } + } + + /// + /// Do not allow more than a single item to be selected. + /// + public bool SingleSelection + { + get { return (bool)GetValue(SingleSelectionProperty); } + set { SetValue(SingleSelectionProperty, value); } + } + + internal static DependencyProperty SingleSelectionProperty = + DependencyProperty.Register( + "SingleSelection", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnSingleSelectionChanged)); + + private static void OnSingleSelectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.SingleSelection = (bool)e.NewValue; + } + } + + /// + /// The size of the thumbnails in the explorer browser + /// + public int ThumbnailSize + { + get { return (int)GetValue(ThumbnailSizeProperty); } + set { SetValue(ThumbnailSizeProperty, value); } + } + + internal static DependencyProperty ThumbnailSizeProperty = + DependencyProperty.Register( + "ThumbnailSize", typeof(int), + typeof(ExplorerBrowser), + new PropertyMetadata(32, OnThumbnailSizeChanged)); + + private static void OnThumbnailSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.ContentOptions.ThumbnailSize = (int)e.NewValue; + } + } + + + + /// + /// The various view modes of the explorer browser control + /// + public ExplorerBrowserViewMode ViewMode + { + get { return (ExplorerBrowserViewMode)GetValue(ViewModeProperty); } + set { SetValue(ViewModeProperty, value); } + } + + internal static DependencyProperty ViewModeProperty = + DependencyProperty.Register( + "ViewMode", typeof(ExplorerBrowserViewMode), + typeof(ExplorerBrowser), + new PropertyMetadata(ExplorerBrowserViewMode.Auto, OnViewModeChanged)); + + private static void OnViewModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + + if (instance.ExplorerBrowserControl != null) + { + if (instance.ExplorerBrowserControl.explorerBrowserControl == null) + { + instance.initialViewMode = (ExplorerBrowserViewMode)e.NewValue; + } + else + { + instance.ExplorerBrowserControl.ContentOptions.ViewMode = (ExplorerBrowserViewMode)e.NewValue; + } + } + } + + + /// + /// Always navigate, even if you are attempting to navigate to the current folder. + /// + public bool AlwaysNavigate + { + get { return (bool)GetValue(AlwaysNavigateProperty); } + set { SetValue(AlwaysNavigateProperty, value); } + } + + internal static DependencyProperty AlwaysNavigateProperty = + DependencyProperty.Register( + "AlwaysNavigate", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnAlwaysNavigateChanged)); + + private static void OnAlwaysNavigateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.AlwaysNavigate = (bool)e.NewValue; + } + } + + /// + /// Do not navigate further than the initial navigation. + /// + public bool NavigateOnce + { + get { return (bool)GetValue(NavigateOnceProperty); } + set { SetValue(NavigateOnceProperty, value); } + } + + internal static DependencyProperty NavigateOnceProperty = + DependencyProperty.Register( + "NavigateOnce", typeof(bool), + typeof(ExplorerBrowser), + new PropertyMetadata(false, OnNavigateOnceChanged)); + + private static void OnNavigateOnceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.NavigateOnce = (bool)e.NewValue; + } + } + + /// + /// Show/Hide the AdvancedQuery pane on subsequent navigation + /// + public PaneVisibilityState AdvancedQueryPane + { + get { return (PaneVisibilityState)GetValue(AdvancedQueryPaneProperty); } + set { SetValue(AdvancedQueryPaneProperty, value); } + } + + internal static DependencyProperty AdvancedQueryPaneProperty = + DependencyProperty.Register( + "AdvancedQueryPane", typeof(PaneVisibilityState), + typeof(ExplorerBrowser), + new PropertyMetadata(PaneVisibilityState.DoNotCare, OnAdvancedQueryPaneChanged)); + + private static void OnAdvancedQueryPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.AdvancedQuery = (PaneVisibilityState)e.NewValue; + } + } + + /// + /// Show/Hide the Commands pane on subsequent navigation + /// + public PaneVisibilityState CommandsPane + { + get { return (PaneVisibilityState)GetValue(CommandsPaneProperty); } + set { SetValue(CommandsPaneProperty, value); } + } + + internal static DependencyProperty CommandsPaneProperty = + DependencyProperty.Register( + "CommandsPane", typeof(PaneVisibilityState), + typeof(ExplorerBrowser), + new PropertyMetadata(PaneVisibilityState.DoNotCare, OnCommandsPaneChanged)); + + private static void OnCommandsPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Commands = + (PaneVisibilityState)e.NewValue; + } + } + + /// + /// Show/Hide the Organize menu in the Commands pane on subsequent navigation + /// + public PaneVisibilityState CommandsOrganizePane + { + get { return (PaneVisibilityState)GetValue(CommandsOrganizePaneProperty); } + set { SetValue(CommandsOrganizePaneProperty, value); } + } + + internal static DependencyProperty CommandsOrganizePaneProperty = + DependencyProperty.Register( + "CommandsOrganizePane", typeof(PaneVisibilityState), + typeof(ExplorerBrowser), + new PropertyMetadata(PaneVisibilityState.DoNotCare, OnCommandsOrganizePaneChanged)); + + private static void OnCommandsOrganizePaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.CommandsOrganize = + (PaneVisibilityState)e.NewValue; + } + } + + /// + /// Show/Hide the View menu in the Commands pane on subsequent navigation + /// + public PaneVisibilityState CommandsViewPane + { + get { return (PaneVisibilityState)GetValue(CommandsViewPaneProperty); } + set { SetValue(CommandsViewPaneProperty, value); } + } + + internal static DependencyProperty CommandsViewPaneProperty = + DependencyProperty.Register( + "CommandsViewPane", typeof(PaneVisibilityState), + typeof(ExplorerBrowser), + new PropertyMetadata(PaneVisibilityState.DoNotCare, OnCommandsViewPaneChanged)); + + private static void OnCommandsViewPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.CommandsView = (PaneVisibilityState)e.NewValue; + } + } + + /// + /// Show/Hide the Details pane on subsequent navigation + /// + public PaneVisibilityState DetailsPane + { + get { return (PaneVisibilityState)GetValue(DetailsPaneProperty); } + set { SetValue(DetailsPaneProperty, value); } + } + + internal static DependencyProperty DetailsPaneProperty = + DependencyProperty.Register( + "DetailsPane", typeof(PaneVisibilityState), + typeof(ExplorerBrowser), + new PropertyMetadata(PaneVisibilityState.DoNotCare, OnDetailsPaneChanged)); + + private static void OnDetailsPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Details = (PaneVisibilityState)e.NewValue; + } + } + + /// + /// Show/Hide the Navigation pane on subsequent navigation + /// + public PaneVisibilityState NavigationPane + { + get { return (PaneVisibilityState)GetValue(NavigationPaneProperty); } + set { SetValue(NavigationPaneProperty, value); } + } + + internal static DependencyProperty NavigationPaneProperty = + DependencyProperty.Register( + "NavigationPane", typeof(PaneVisibilityState), + typeof(ExplorerBrowser), + new PropertyMetadata(PaneVisibilityState.DoNotCare, OnNavigationPaneChanged)); + + private static void OnNavigationPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Navigation = (PaneVisibilityState)e.NewValue; + } + } + + /// + /// Show/Hide the Preview pane on subsequent navigation + /// + public PaneVisibilityState PreviewPane + { + get { return (PaneVisibilityState)GetValue(PreviewPaneProperty); } + set { SetValue(PreviewPaneProperty, value); } + } + + internal static DependencyProperty PreviewPaneProperty = + DependencyProperty.Register( + "PreviewPane", typeof(PaneVisibilityState), + typeof(ExplorerBrowser), + new PropertyMetadata(PaneVisibilityState.DoNotCare, OnPreviewPaneChanged)); + + private static void OnPreviewPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Preview = (PaneVisibilityState)e.NewValue; + } + } + + /// + /// Show/Hide the Query pane on subsequent navigation + /// + public PaneVisibilityState QueryPane + { + get { return (PaneVisibilityState)GetValue(QueryPaneProperty); } + set { SetValue(QueryPaneProperty, value); } + } + + internal static DependencyProperty QueryPaneProperty = + DependencyProperty.Register( + "QueryPane", typeof(PaneVisibilityState), + typeof(ExplorerBrowser), + new PropertyMetadata(PaneVisibilityState.DoNotCare, OnQueryPaneChanged)); + + private static void OnQueryPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + { + instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Query = (PaneVisibilityState)e.NewValue; + } + } + + + /// + /// Navigation log index + /// + public int NavigationLogIndex + { + get { return (int)GetValue(NavigationLogIndexProperty); } + set { SetValue(NavigationLogIndexProperty, value); } + } + + internal static DependencyProperty NavigationLogIndexProperty = + DependencyProperty.Register( + "NavigationLogIndex", typeof(int), + typeof(ExplorerBrowser), + new PropertyMetadata(0, OnNavigationLogIndexChanged)); + + private static void OnNavigationLogIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ExplorerBrowser instance = d as ExplorerBrowser; + if (instance.ExplorerBrowserControl != null) + instance.ExplorerBrowserControl.NavigationLog.NavigateLog((int)e.NewValue); + } + + + #region IDisposable Members + + /// + /// Disposes the class + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Disposes the browser. + /// + /// + protected virtual void Dispose(bool disposed) + { + if (disposed) + { + if (itemsChanged != null) + { + itemsChanged.Close(); + } + + if (selectionChanged != null) + { + selectionChanged.Close(); + } + } + } + + #endregion + } +} diff --git a/Shell/ExplorerBrowser/ExplorerBrowser.cs b/Shell/ExplorerBrowser/ExplorerBrowser.cs new file mode 100644 index 0000000..29ff092 --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowser.cs @@ -0,0 +1,889 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; +using System.Text; +using System.Linq; +using Microsoft.WindowsAPICodePack.Shell.Interop; + +namespace Microsoft.WindowsAPICodePack.Controls.WindowsForms +{ + /// + /// This class is a wrapper around the Windows Explorer Browser control. + /// + public sealed class ExplorerBrowser : + System.Windows.Forms.UserControl, + Microsoft.WindowsAPICodePack.Controls.IServiceProvider, + IExplorerPaneVisibility, + IExplorerBrowserEvents, + ICommDlgBrowser3, + IMessageFilter + { + #region properties + /// + /// Options that control how the ExplorerBrowser navigates + /// + public ExplorerBrowserNavigationOptions NavigationOptions { get; private set; } + + /// + /// Options that control how the content of the ExplorerBorwser looks + /// + public ExplorerBrowserContentOptions ContentOptions { get; private set; } + + private IShellItemArray shellItemsArray; + private ShellObjectCollection itemsCollection; + /// + /// The set of ShellObjects in the Explorer Browser + /// + public ShellObjectCollection Items + { + get + { + if (shellItemsArray != null) + { + Marshal.ReleaseComObject(shellItemsArray); + } + + if (itemsCollection != null) + { + itemsCollection.Dispose(); + itemsCollection = null; + } + + shellItemsArray = GetItemsArray(); + itemsCollection = new ShellObjectCollection(shellItemsArray, true); + + return itemsCollection; + } + } + + private IShellItemArray selectedShellItemsArray; + private ShellObjectCollection selectedItemsCollection; + /// + /// The set of selected ShellObjects in the Explorer Browser + /// + public ShellObjectCollection SelectedItems + { + get + { + if (selectedShellItemsArray != null) + { + Marshal.ReleaseComObject(selectedShellItemsArray); + } + + if (selectedItemsCollection != null) + { + selectedItemsCollection.Dispose(); + selectedItemsCollection = null; + } + + selectedShellItemsArray = GetSelectedItemsArray(); + selectedItemsCollection = new ShellObjectCollection(selectedShellItemsArray, true); + + return selectedItemsCollection; + } + } + + /// + /// Contains the navigation history of the ExplorerBrowser + /// + public ExplorerBrowserNavigationLog NavigationLog { get; private set; } + + /// + /// The name of the property bag used to persist changes to the ExplorerBrowser's view state. + /// + public string PropertyBagName + { + get { return propertyBagName; } + set + { + propertyBagName = value; + if (explorerBrowserControl != null) + { + explorerBrowserControl.SetPropertyBag(propertyBagName); + } + } + } + + #endregion + + #region operations + /// + /// Clears the Explorer Browser of existing content, fills it with + /// content from the specified container, and adds a new point to the Travel Log. + /// + /// The shell container to navigate to. + /// Will throw if navigation fails for any other reason. + public void Navigate(ShellObject shellObject) + { + if (shellObject == null) + { + throw new ArgumentNullException("shellObject"); + } + + if (explorerBrowserControl == null) + { + antecreationNavigationTarget = shellObject; + } + else + { + HResult hr = explorerBrowserControl.BrowseToObject(shellObject.NativeShellItem, 0); + if (hr != HResult.Ok) + { + if ((hr == HResult.ResourceInUse || hr == HResult.Canceled) && NavigationFailed != null) + { + NavigationFailedEventArgs args = new NavigationFailedEventArgs(); + args.FailedLocation = shellObject; + NavigationFailed(this, args); + } + else + { + throw new CommonControlException(LocalizedMessages.ExplorerBrowserBrowseToObjectFailed, hr); + } + } + } + } + + /// + /// Navigates within the navigation log. This does not change the set of + /// locations in the navigation log. + /// + /// Forward of Backward + /// True if the navigation succeeded, false if it failed for any reason. + public bool NavigateLogLocation(NavigationLogDirection direction) + { + return NavigationLog.NavigateLog(direction); + } + + /// + /// Navigate within the navigation log. This does not change the set of + /// locations in the navigation log. + /// + /// An index into the navigation logs Locations collection. + /// True if the navigation succeeded, false if it failed for any reason. + public bool NavigateLogLocation(int navigationLogIndex) + { + return NavigationLog.NavigateLog(navigationLogIndex); + } + #endregion + + #region events + + /// + /// Fires when the SelectedItems collection changes. + /// + public event EventHandler SelectionChanged; + + /// + /// Fires when the Items colection changes. + /// + public event EventHandler ItemsChanged; + + /// + /// Fires when a navigation has been initiated, but is not yet complete. + /// + public event EventHandler NavigationPending; + + /// + /// Fires when a navigation has been 'completed': no NavigationPending listener + /// has cancelled, and the ExplorerBorwser has created a new view. The view + /// will be populated with new items asynchronously, and ItemsChanged will be + /// fired to reflect this some time later. + /// + public event EventHandler NavigationComplete; + + /// + /// Fires when either a NavigationPending listener cancels the navigation, or + /// if the operating system determines that navigation is not possible. + /// + public event EventHandler NavigationFailed; + + /// + /// Fires when the ExplorerBorwser view has finished enumerating files. + /// + public event EventHandler ViewEnumerationComplete; + + /// + /// Fires when the item selected in the view has changed (i.e., a rename ). + /// This is not the same as SelectionChanged. + /// + public event EventHandler ViewSelectedItemChanged; + + #endregion + + #region implementation + + #region construction + internal ExplorerBrowserClass explorerBrowserControl; + + // for the IExplorerBrowserEvents Advise call + internal uint eventsCookie; + + // name of the property bag that contains the view state options of the browser + string propertyBagName = typeof(ExplorerBrowser).FullName; + + /// + /// Initializes the ExplorerBorwser WinForms wrapper. + /// + public ExplorerBrowser() + : base() + { + NavigationOptions = new ExplorerBrowserNavigationOptions(this); + ContentOptions = new ExplorerBrowserContentOptions(this); + NavigationLog = new ExplorerBrowserNavigationLog(this); + } + + #endregion + + #region message handlers + + /// + /// Displays a placeholder for the explorer browser in design mode + /// + /// Contains information about the paint event. + protected override void OnPaint(PaintEventArgs e) + { + if (DesignMode && e != null) + { + using (LinearGradientBrush linGrBrush = new LinearGradientBrush( + ClientRectangle, + Color.Aqua, + Color.CadetBlue, + LinearGradientMode.ForwardDiagonal)) + { + e.Graphics.FillRectangle(linGrBrush, ClientRectangle); + } + + using (Font font = new Font("Garamond", 30)) + { + using (StringFormat sf = new StringFormat()) + { + sf.Alignment = StringAlignment.Center; + sf.LineAlignment = StringAlignment.Center; + e.Graphics.DrawString( + "ExplorerBrowserControl", + font, + Brushes.White, + ClientRectangle, + sf); + } + } + } + + base.OnPaint(e); + } + + ShellObject antecreationNavigationTarget; + ExplorerBrowserViewEvents viewEvents; + + /// + /// Creates and initializes the native ExplorerBrowser control + /// + protected override void OnCreateControl() + { + base.OnCreateControl(); + + if (this.DesignMode == false) + { + explorerBrowserControl = new ExplorerBrowserClass(); + + // hooks up IExplorerPaneVisibility and ICommDlgBrowser event notifications + ExplorerBrowserNativeMethods.IUnknown_SetSite(explorerBrowserControl, this); + + // hooks up IExplorerBrowserEvents event notification + explorerBrowserControl.Advise( + Marshal.GetComInterfaceForObject(this, typeof(IExplorerBrowserEvents)), + out eventsCookie); + + // sets up ExplorerBrowser view connection point events + viewEvents = new ExplorerBrowserViewEvents(this); + + NativeRect rect = new NativeRect(); + rect.Top = ClientRectangle.Top; + rect.Left = ClientRectangle.Left; + rect.Right = ClientRectangle.Right; + rect.Bottom = ClientRectangle.Bottom; + + explorerBrowserControl.Initialize(this.Handle, ref rect, null); + + // Force an initial show frames so that IExplorerPaneVisibility works the first time it is set. + // This also enables the control panel to be browsed to. If it is not set, then navigating to + // the control panel succeeds, but no items are visible in the view. + explorerBrowserControl.SetOptions(ExplorerBrowserOptions.ShowFrames); + + explorerBrowserControl.SetPropertyBag(propertyBagName); + + if (antecreationNavigationTarget != null) + { + BeginInvoke(new MethodInvoker( + delegate + { + Navigate(antecreationNavigationTarget); + antecreationNavigationTarget = null; + })); + } + } + + Application.AddMessageFilter(this); + } + + /// + /// Sizes the native control to match the WinForms control wrapper. + /// + /// Contains information about the size changed event. + protected override void OnSizeChanged(EventArgs e) + { + if (explorerBrowserControl != null) + { + NativeRect rect = new NativeRect(); + rect.Top = ClientRectangle.Top; + rect.Left = ClientRectangle.Left; + rect.Right = ClientRectangle.Right; + rect.Bottom = ClientRectangle.Bottom; + + IntPtr ptr = IntPtr.Zero; + explorerBrowserControl.SetRect(ref ptr, rect); + } + + base.OnSizeChanged(e); + } + + /// + /// Cleans up the explorer browser events+object when the window is being taken down. + /// + /// An EventArgs that contains event data. + protected override void OnHandleDestroyed(EventArgs e) + { + if (explorerBrowserControl != null) + { + // unhook events + viewEvents.DisconnectFromView(); + explorerBrowserControl.Unadvise(eventsCookie); + ExplorerBrowserNativeMethods.IUnknown_SetSite(explorerBrowserControl, null); + + // destroy the explorer browser control + explorerBrowserControl.Destroy(); + + // release com reference to it + Marshal.ReleaseComObject(explorerBrowserControl); + explorerBrowserControl = null; + } + + base.OnHandleDestroyed(e); + } + #endregion + + #region object interfaces + + #region IServiceProvider + /// + /// + /// + /// calling service + /// requested interface guid + /// caller-allocated memory for interface pointer + /// + HResult Microsoft.WindowsAPICodePack.Controls.IServiceProvider.QueryService( + ref Guid guidService, ref Guid riid, out IntPtr ppvObject) + { + HResult hr = HResult.Ok; + + if (guidService.CompareTo(new Guid(ExplorerBrowserIIDGuid.IExplorerPaneVisibility)) == 0) + { + // Responding to this SID allows us to control the visibility of the + // explorer browser panes + ppvObject = + Marshal.GetComInterfaceForObject(this, typeof(IExplorerPaneVisibility)); + hr = HResult.Ok; + } + else if (guidService.CompareTo(new Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser)) == 0) + { + if (riid.CompareTo(new Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser)) == 0) + { + ppvObject = Marshal.GetComInterfaceForObject(this, typeof(ICommDlgBrowser3)); + hr = HResult.Ok; + } + // The below lines are commented out to decline requests for the ICommDlgBrowser2 interface. + // This interface is incorrectly marshaled back to unmanaged, and causes an exception. + // There is a bug for this, I have not figured the underlying cause. + // Remove this comment and uncomment the following code to enable the ICommDlgBrowser2 interface + //else if (riid.CompareTo(new Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser2)) == 0) + //{ + // ppvObject = Marshal.GetComInterfaceForObject(this, typeof(ICommDlgBrowser3)); + // hr = HResult.Ok; + //} + else if (riid.CompareTo(new Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser3)) == 0) + { + ppvObject = Marshal.GetComInterfaceForObject(this, typeof(ICommDlgBrowser3)); + hr = HResult.Ok; + } + else + { + ppvObject = IntPtr.Zero; + hr = HResult.NoInterface; + } + } + else + { + IntPtr nullObj = IntPtr.Zero; + ppvObject = nullObj; + hr = HResult.NoInterface; + } + + return hr; + } + #endregion + + #region IExplorerPaneVisibility + /// + /// Controls the visibility of the explorer borwser panes + /// + /// a guid identifying the pane + /// the pane state desired + /// + HResult IExplorerPaneVisibility.GetPaneState(ref Guid explorerPane, out ExplorerPaneState peps) + { + switch (explorerPane.ToString()) + { + case ExplorerBrowserViewPanes.AdvancedQuery: + peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.AdvancedQuery); + break; + case ExplorerBrowserViewPanes.Commands: + peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Commands); + break; + case ExplorerBrowserViewPanes.CommandsOrganize: + peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.CommandsOrganize); + break; + case ExplorerBrowserViewPanes.CommandsView: + peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.CommandsView); + break; + case ExplorerBrowserViewPanes.Details: + peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Details); + break; + case ExplorerBrowserViewPanes.Navigation: + peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Navigation); + break; + case ExplorerBrowserViewPanes.Preview: + peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Preview); + break; + case ExplorerBrowserViewPanes.Query: + peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Query); + break; + default: +#if LOG_UNKNOWN_PANES + System.Diagnostics.Debugger.Log( 4, "ExplorerBrowser", "unknown pane view state. id=" + explorerPane.ToString( ) ); +#endif + peps = VisibilityToPaneState(PaneVisibilityState.Show); + break; + } + + return HResult.Ok; + } + + private static ExplorerPaneState VisibilityToPaneState(PaneVisibilityState visibility) + { + switch (visibility) + { + case PaneVisibilityState.DoNotCare: + return ExplorerPaneState.DoNotCare; + + case PaneVisibilityState.Hide: + return ExplorerPaneState.DefaultOff | ExplorerPaneState.Force; + + case PaneVisibilityState.Show: + return ExplorerPaneState.DefaultOn | ExplorerPaneState.Force; + + default: + throw new ArgumentException("unexpected PaneVisibilityState"); + } + } + + #endregion + + #region IExplorerBrowserEvents + HResult IExplorerBrowserEvents.OnNavigationPending(IntPtr pidlFolder) + { + bool canceled = false; + + if (NavigationPending != null) + { + NavigationPendingEventArgs args = new NavigationPendingEventArgs(); + + // For some special items (like network machines), ShellObject.FromIDList + // might return null + args.PendingLocation = ShellObjectFactory.Create(pidlFolder); + + if (args.PendingLocation != null) + { + foreach (Delegate del in NavigationPending.GetInvocationList()) + { + del.DynamicInvoke(new object[] { this, args }); + if (args.Cancel) + { + canceled = true; + } + } + } + } + + return canceled ? HResult.Canceled : HResult.Ok; + } + + HResult IExplorerBrowserEvents.OnViewCreated(object psv) + { + viewEvents.ConnectToView((IShellView)psv); + + return HResult.Ok; + } + + HResult IExplorerBrowserEvents.OnNavigationComplete(IntPtr pidlFolder) + { + // view mode may change + ContentOptions.folderSettings.ViewMode = GetCurrentViewMode(); + + if (NavigationComplete != null) + { + NavigationCompleteEventArgs args = new NavigationCompleteEventArgs(); + args.NewLocation = ShellObjectFactory.Create(pidlFolder); + NavigationComplete(this, args); + } + return HResult.Ok; + } + + HResult IExplorerBrowserEvents.OnNavigationFailed(IntPtr pidlFolder) + { + if (NavigationFailed != null) + { + NavigationFailedEventArgs args = new NavigationFailedEventArgs(); + args.FailedLocation = ShellObjectFactory.Create(pidlFolder); + NavigationFailed(this, args); + } + return HResult.Ok; + } + #endregion + + #region ICommDlgBrowser + HResult ICommDlgBrowser3.OnDefaultCommand(IntPtr ppshv) + { + return HResult.False; + //return HResult.Ok; + } + + HResult ICommDlgBrowser3.OnStateChange(IntPtr ppshv, CommDlgBrowserStateChange uChange) + { + if (uChange == CommDlgBrowserStateChange.SelectionChange) + { + FireSelectionChanged(); + } + + return HResult.Ok; + } + + HResult ICommDlgBrowser3.IncludeObject(IntPtr ppshv, IntPtr pidl) + { + // items in the view have changed, so the collections need updating + FireContentChanged(); + + return HResult.Ok; + } + + #endregion + + #region ICommDlgBrowser2 Members + + // The below methods can be called into, but marshalling the response causes an exception to be + // thrown from unmanaged code. At this time, I decline calls requesting the ICommDlgBrowser2 + // interface. This is logged as a bug, but moved to less of a priority, as it only affects being + // able to change the default action text for remapping the default action. + + HResult ICommDlgBrowser3.GetDefaultMenuText(IShellView shellView, IntPtr text, int cchMax) + { + return HResult.False; + //return HResult.Ok; + //OK if new + //False if default + //other if error + } + + HResult ICommDlgBrowser3.GetViewFlags(out uint pdwFlags) + { + //var flags = CommDlgBrowser2ViewFlags.NoSelectVerb; + //Marshal.WriteInt32(pdwFlags, 0); + pdwFlags = (uint)CommDlgBrowser2ViewFlags.ShowAllFiles; + return HResult.Ok; + } + + HResult ICommDlgBrowser3.Notify(IntPtr pshv, CommDlgBrowserNotifyType notifyType) + { + return HResult.Ok; + } + + #endregion + + #region ICommDlgBrowser3 Members + + HResult ICommDlgBrowser3.GetCurrentFilter(StringBuilder pszFileSpec, int cchFileSpec) + { + // If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + return HResult.Ok; + } + + HResult ICommDlgBrowser3.OnColumnClicked(IShellView ppshv, int iColumn) + { + // If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + return HResult.Ok; + } + + HResult ICommDlgBrowser3.OnPreViewCreated(IShellView ppshv) + { + // If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code + return HResult.Ok; + } + + #endregion + + #region IMessageFilter Members + + bool IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message m) + { + HResult hr = HResult.False; + if (explorerBrowserControl != null) + { + // translate keyboard input + hr = ((IInputObject)explorerBrowserControl).TranslateAcceleratorIO(ref m); + } + return (hr == HResult.Ok); + } + + #endregion + + #endregion + + #region utilities + + /// + /// Returns the current view mode of the browser + /// + /// + internal FolderViewMode GetCurrentViewMode() + { + IFolderView2 ifv2 = GetFolderView2(); + uint viewMode = 0; + if (ifv2 != null) + { + try + { + HResult hr = ifv2.GetCurrentViewMode(out viewMode); + if (hr != HResult.Ok) { throw new ShellException(hr); } + } + finally + { + Marshal.ReleaseComObject(ifv2); + ifv2 = null; + } + } + return (FolderViewMode)viewMode; + } + + /// + /// Gets the IFolderView2 interface from the explorer browser. + /// + /// + internal IFolderView2 GetFolderView2() + { + Guid iid = new Guid(ExplorerBrowserIIDGuid.IFolderView2); + IntPtr view = IntPtr.Zero; + if (this.explorerBrowserControl != null) + { + HResult hr = this.explorerBrowserControl.GetCurrentView(ref iid, out view); + switch (hr) + { + case HResult.Ok: + break; + + case HResult.NoInterface: + case HResult.Fail: +#if LOG_KNOWN_COM_ERRORS + Debugger.Log( 2, "ExplorerBrowser", "Unable to obtain view. Error=" + e.ToString( ) ); +#endif + return null; + + default: + throw new CommonControlException(LocalizedMessages.ExplorerBrowserFailedToGetView, hr); + } + + return (IFolderView2)Marshal.GetObjectForIUnknown(view); + } + return null; + } + + /// + /// Gets the selected items in the explorer browser as an IShellItemArray + /// + /// + internal IShellItemArray GetSelectedItemsArray() + { + IShellItemArray iArray = null; + IFolderView2 iFV2 = GetFolderView2(); + if (iFV2 != null) + { + try + { + Guid iidShellItemArray = new Guid(ShellIIDGuid.IShellItemArray); + object oArray = null; + HResult hr = iFV2.Items((uint)ShellViewGetItemObject.Selection, ref iidShellItemArray, out oArray); + iArray = oArray as IShellItemArray; + if (hr != HResult.Ok && + hr != HResult.ElementNotFound && + hr != HResult.Fail) + { + throw new CommonControlException(LocalizedMessages.ExplorerBrowserUnexpectedError, hr); + } + } + finally + { + Marshal.ReleaseComObject(iFV2); + iFV2 = null; + } + } + + return iArray; + } + + internal int GetItemsCount() + { + int itemsCount = 0; + + IFolderView2 iFV2 = GetFolderView2(); + if (iFV2 != null) + { + try + { + HResult hr = iFV2.ItemCount((uint)ShellViewGetItemObject.AllView, out itemsCount); + + if (hr != HResult.Ok && + hr != HResult.ElementNotFound && + hr != HResult.Fail) + { + throw new CommonControlException(LocalizedMessages.ExplorerBrowserItemCount, hr); + } + } + finally + { + Marshal.ReleaseComObject(iFV2); + iFV2 = null; + } + } + + return itemsCount; + } + + internal int GetSelectedItemsCount() + { + int itemsCount = 0; + + IFolderView2 iFV2 = GetFolderView2(); + if (iFV2 != null) + { + try + { + HResult hr = iFV2.ItemCount((uint)ShellViewGetItemObject.Selection, out itemsCount); + + if (hr != HResult.Ok && + hr != HResult.ElementNotFound && + hr != HResult.Fail) + { + throw new CommonControlException(LocalizedMessages.ExplorerBrowserSelectedItemCount, hr); + } + } + finally + { + Marshal.ReleaseComObject(iFV2); + iFV2 = null; + } + } + + return itemsCount; + } + + /// + /// Gets the items in the ExplorerBrowser as an IShellItemArray + /// + /// + internal IShellItemArray GetItemsArray() + { + IShellItemArray iArray = null; + IFolderView2 iFV2 = GetFolderView2(); + if (iFV2 != null) + { + try + { + Guid iidShellItemArray = new Guid(ShellIIDGuid.IShellItemArray); + object oArray = null; + HResult hr = iFV2.Items((uint)ShellViewGetItemObject.AllView, ref iidShellItemArray, out oArray); + if (hr != HResult.Ok && + hr != HResult.Fail && + hr != HResult.ElementNotFound && + hr != HResult.InvalidArguments) + { + throw new CommonControlException(LocalizedMessages.ExplorerBrowserViewItems, hr); + } + + iArray = oArray as IShellItemArray; + } + finally + { + Marshal.ReleaseComObject(iFV2); + iFV2 = null; + } + } + return iArray; + } + + #endregion + + #region view event forwarding + internal void FireSelectionChanged() + { + if (SelectionChanged != null) + { + SelectionChanged(this, EventArgs.Empty); + } + } + + internal void FireContentChanged() + { + if (ItemsChanged != null) + { + ItemsChanged.Invoke(this, EventArgs.Empty); + } + } + + internal void FireContentEnumerationComplete() + { + if (ViewEnumerationComplete != null) + { + ViewEnumerationComplete.Invoke(this, EventArgs.Empty); + } + } + + internal void FireSelectedItemChanged() + { + if (ViewSelectedItemChanged != null) + { + ViewSelectedItemChanged.Invoke(this, EventArgs.Empty); + } + } + #endregion + + #endregion + + } + +} diff --git a/Shell/ExplorerBrowser/ExplorerBrowserContentOptions.cs b/Shell/ExplorerBrowser/ExplorerBrowserContentOptions.cs new file mode 100644 index 0000000..dfeccae --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowserContentOptions.cs @@ -0,0 +1,334 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Controls.WindowsForms; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + /// + /// These options control how the content of the Explorer Browser + /// is rendered. + /// + public class ExplorerBrowserContentOptions + { + #region construction + ExplorerBrowser eb; + internal ExplorerBrowserContentOptions(ExplorerBrowser eb) + { + this.eb = eb; + } + #endregion + + #region ViewMode property + // This is a one-way property of the explorer browser. + // Keeping it around for the get implementations. + internal FolderSettings folderSettings = new FolderSettings(); + + /// + /// The viewing mode of the Explorer Browser + /// + public ExplorerBrowserViewMode ViewMode + { + get + { + return (ExplorerBrowserViewMode)folderSettings.ViewMode; + } + set + { + folderSettings.ViewMode = (FolderViewMode)value; + + if (eb.explorerBrowserControl != null) + { + eb.explorerBrowserControl.SetFolderSettings(folderSettings); + } + } + } + #endregion + + #region Flags property + /// + /// The binary representation of the ExplorerBrowser content flags + /// + public ExplorerBrowserContentSectionOptions Flags + { + get + { + return (ExplorerBrowserContentSectionOptions)folderSettings.Options; + } + set + { + folderSettings.Options = (FolderOptions)value | FolderOptions.UseSearchFolders | FolderOptions.NoWebView; + if (eb.explorerBrowserControl != null) + { + eb.explorerBrowserControl.SetFolderSettings(folderSettings); + } + } + } + #endregion + + #region content flags to properties mapping + /// + /// The view should be left-aligned. + /// + public bool AlignLeft + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.AlignLeft); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.AlignLeft, value); + } + } + /// + /// Automatically arrange the elements in the view. + /// + public bool AutoArrange + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.AutoArrange); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.AutoArrange, value); + } + } + /// + /// Turns on check mode for the view + /// + public bool CheckSelect + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.CheckSelect); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.CheckSelect, value); + } + } + /// + /// When the view is in "tile view mode" the layout of a single item should be extended to the width of the view. + /// + public bool ExtendedTiles + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.ExtendedTiles); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.ExtendedTiles, value); + } + } + /// + /// When an item is selected, the item and all its sub-items are highlighted. + /// + public bool FullRowSelect + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.FullRowSelect); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.FullRowSelect, value); + } + } + /// + /// The view should not display file names + /// + public bool HideFileNames + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.HideFileNames); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.HideFileNames, value); + } + } + /// + /// The view should not save view state in the browser. + /// + public bool NoBrowserViewState + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.NoBrowserViewState); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.NoBrowserViewState, value); + } + } + /// + /// Do not display a column header in the view in any view mode. + /// + public bool NoColumnHeader + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.NoColumnHeader); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.NoColumnHeader, value); + } + } + /// + /// Only show the column header in details view mode. + /// + public bool NoHeaderInAllViews + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.NoHeaderInAllViews); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.NoHeaderInAllViews, value); + } + } + /// + /// The view should not display icons. + /// + public bool NoIcons + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.NoIcons); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.NoIcons, value); + } + } + /// + /// Do not show subfolders. + /// + public bool NoSubfolders + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.NoSubfolders); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.NoSubfolders, value); + } + } + /// + /// Navigate with a single click + /// + public bool SingleClickActivate + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.SingleClickActivate); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.SingleClickActivate, value); + } + } + /// + /// Do not allow more than a single item to be selected. + /// + public bool SingleSelection + { + get + { + return IsFlagSet(ExplorerBrowserContentSectionOptions.SingleSelection); + } + set + { + SetFlag(ExplorerBrowserContentSectionOptions.SingleSelection, value); + } + } + + private bool IsFlagSet(ExplorerBrowserContentSectionOptions flag) + { + return (folderSettings.Options & (FolderOptions)flag) != 0; + } + + private void SetFlag(ExplorerBrowserContentSectionOptions flag, bool value) + { + if (value) + folderSettings.Options |= (FolderOptions)flag; + else + folderSettings.Options = folderSettings.Options & ~(FolderOptions)flag; + + if (eb.explorerBrowserControl != null) + eb.explorerBrowserControl.SetFolderSettings(folderSettings); + } + + #endregion + + #region thumbnail size + /// + /// The size of the thumbnails in pixels + /// + public int ThumbnailSize + { + get + { + int iconSize = 0; + IFolderView2 iFV2 = eb.GetFolderView2(); + if (iFV2 != null) + { + try + { + int fvm = 0; + HResult hr = iFV2.GetViewModeAndIconSize(out fvm, out iconSize); + if (hr != HResult.Ok) + { + throw new CommonControlException(LocalizedMessages.ExplorerBrowserIconSize, hr); + } + } + finally + { + Marshal.ReleaseComObject(iFV2); + iFV2 = null; + } + } + + return iconSize; + } + set + { + IFolderView2 iFV2 = eb.GetFolderView2(); + if (iFV2 != null) + { + try + { + int fvm = 0; + int iconSize = 0; + HResult hr = iFV2.GetViewModeAndIconSize(out fvm, out iconSize); + if (hr != HResult.Ok) + { + throw new CommonControlException(LocalizedMessages.ExplorerBrowserIconSize, hr); + } + hr = iFV2.SetViewModeAndIconSize(fvm, value); + if (hr != HResult.Ok) + { + throw new CommonControlException(LocalizedMessages.ExplorerBrowserIconSize, hr); + } + } + finally + { + Marshal.ReleaseComObject(iFV2); + iFV2 = null; + } + } + } + } + #endregion + } + +} diff --git a/Shell/ExplorerBrowser/ExplorerBrowserDiagram.cd b/Shell/ExplorerBrowser/ExplorerBrowserDiagram.cd new file mode 100644 index 0000000..5188dd1 --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowserDiagram.cd @@ -0,0 +1,94 @@ + + + + + + + + AADgIAAAIAgBOAEAAABAQAAAAEAACAAGAAAQcACAAAA= + ExplorerBrowser\ExplorerBrowser.cs + + + + + + + + + + + AAAABAAAAAoIAgEAAggAEAAgEQAAAAACABJAAAUAAAA= + ExplorerBrowser\ExplorerBrowserContentOptions.cs + + + + + + + + + AABAggAAAAgJAAAAAACAABAAAAAAAAwFAAQAQAAAQBA= + ExplorerBrowser\ExplorerBrowserPaneVisibility.cs + + + + + + + + AAAAAAAAAAAAABAAAAIgAAEAAAAAAABAAAAQAAAAAAQ= + ExplorerBrowser\ExplorerBrowserNavigationLog.cs + + + + + + + + + + + AAAABAAIAAAIAAAAEAACAAAgAAAAAAAAACAAAAAAAAA= + ExplorerBrowser\ExplorerBrowserNavigationOptions.cs + + + + + + AAAAAAAAQAAAAAAAAAAAAAAAAAAAABAAAAAAAAAgAAA= + ExplorerBrowser\ExplorerBrowserEvents.cs + + + + + + AAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + ExplorerBrowser\ExplorerBrowserEvents.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAA= + ExplorerBrowser\ExplorerBrowserEvents.cs + + + + \ No newline at end of file diff --git a/Shell/ExplorerBrowser/ExplorerBrowserEnums.cs b/Shell/ExplorerBrowser/ExplorerBrowserEnums.cs new file mode 100644 index 0000000..3ccb002 --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowserEnums.cs @@ -0,0 +1,162 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + /// + /// Indicates the viewing mode of the explorer browser + /// + public enum ExplorerBrowserViewMode + { + /// + /// Choose the best view mode for the folder + /// + Auto = -1, + + /// + /// (New for Windows7) + /// + Content = 8, + + /// + /// Object names and other selected information, such as the size or date last updated, are shown. + /// + Details = 4, + + /// + /// The view should display medium-size icons. + /// + Icon = 1, + + /// + /// Object names are displayed in a list view. + /// + List = 3, + + /// + /// The view should display small icons. + /// + SmallIcon = 2, + + /// + /// The view should display thumbnail icons. + /// + Thumbnail = 5, + + /// + /// The view should display icons in a filmstrip format. + /// + ThumbStrip = 7, + + /// + /// The view should display large icons. + /// + Tile = 6 + } + + /// + /// Specifies the options that control subsequent navigation. + /// Typically use one, or a bitwise combination of these + /// flags to specify how the explorer browser navigates. + /// + [Flags] + public enum ExplorerBrowserNavigateOptions + { + /// + /// Always navigate, even if you are attempting to navigate to the current folder. + /// + AlwaysNavigate = 0x00000004, + + /// + /// Do not navigate further than the initial navigation. + /// + NavigateOnce = 0x00000001, + } + + /// + /// Indicates the content options of the explorer browser. + /// Typically use one, or a bitwise combination of these + /// flags to specify how conent should appear in the + /// explorer browser control + /// + [Flags] + public enum ExplorerBrowserContentSectionOptions + { + /// + /// No options. + /// + None = 0, + /// + /// The view should be left-aligned. + /// + AlignLeft = 0x00000800, + /// + /// Automatically arrange the elements in the view. + /// + AutoArrange = 0x00000001, + /// + /// Turns on check mode for the view + /// + CheckSelect = 0x08040000, + /// + /// When the view is set to "Tile" the layout of a single item should be extended to the width of the view. + /// + ExtendedTiles = 0x02000000, + /// + /// When an item is selected, the item and all its sub-items are highlighted. + /// + FullRowSelect = 0x00200000, + /// + /// The view should not display file names + /// + HideFileNames = 0x00020000, + /// + /// The view should not save view state in the browser. + /// + NoBrowserViewState = 0x10000000, + /// + /// Do not display a column header in the view in any view mode. + /// + NoColumnHeader = 0x00800000, + /// + /// Only show the column header in details view mode. + /// + NoHeaderInAllViews = 0x01000000, + /// + /// The view should not display icons. + /// + NoIcons = 0x00001000, + /// + /// Do not show subfolders. + /// + NoSubfolders = 0x00000080, + /// + /// Navigate with a single click + /// + SingleClickActivate = 0x00008000, + /// + /// Do not allow more than a single item to be selected. + /// + SingleSelection = 0x00000040, + } + + /// + /// Indicates the visibility state of an ExplorerBrowser pane + /// + public enum PaneVisibilityState + { + /// + /// Allow the explorer browser to determine if this pane is displayed. + /// + DoNotCare, + /// + /// Hide the pane + /// + Hide, + /// + /// Show the pane + /// + Show + } +} \ No newline at end of file diff --git a/Shell/ExplorerBrowser/ExplorerBrowserEvents.cs b/Shell/ExplorerBrowser/ExplorerBrowserEvents.cs new file mode 100644 index 0000000..1efcb79 --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowserEvents.cs @@ -0,0 +1,47 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + + /// + /// Event argument for The NavigationPending event + /// + public class NavigationPendingEventArgs : EventArgs + { + /// + /// The location being navigated to + /// + public ShellObject PendingLocation { get; set; } + + /// + /// Set to 'True' to cancel the navigation. + /// + public bool Cancel { get; set; } + + } + + /// + /// Event argument for The NavigationComplete event + /// + public class NavigationCompleteEventArgs : EventArgs + { + /// + /// The new location of the explorer browser + /// + public ShellObject NewLocation { get; set; } + } + + /// + /// Event argument for the NavigatinoFailed event + /// + public class NavigationFailedEventArgs : EventArgs + { + /// + /// The location the the browser would have navigated to. + /// + public ShellObject FailedLocation { get; set; } + } +} \ No newline at end of file diff --git a/Shell/ExplorerBrowser/ExplorerBrowserPaneVisibility.cs b/Shell/ExplorerBrowser/ExplorerBrowserPaneVisibility.cs new file mode 100644 index 0000000..23fe146 --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowserPaneVisibility.cs @@ -0,0 +1,57 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Controls +{ + /// + /// Controls the visibility of the various ExplorerBrowser panes on subsequent navigation + /// + public class ExplorerBrowserPaneVisibility + { + /// + /// The pane on the left side of the Windows Explorer window that hosts the folders tree and Favorites. + /// + public PaneVisibilityState Navigation { get; set; } + + + /// + /// Commands module along the top of the Windows Explorer window. + /// + public PaneVisibilityState Commands { get; set; } + + /// + /// Organize menu within the commands module. + /// + public PaneVisibilityState CommandsOrganize { get; set; } + + + /// + /// View menu within the commands module. + /// + public PaneVisibilityState CommandsView { get; set; } + + + /// + /// Pane showing metadata along the bottom of the Windows Explorer window. + /// + public PaneVisibilityState Details { get; set; } + + + /// + /// Pane on the right of the Windows Explorer window that shows a large reading preview of the file. + /// + public PaneVisibilityState Preview { get; set; } + + + /// + /// Quick filter buttons to aid in a search. + /// + public PaneVisibilityState Query { get; set; } + + + /// + /// Additional fields and options to aid in a search. + /// + public PaneVisibilityState AdvancedQuery { get; set; } + + } +} diff --git a/Shell/ExplorerBrowser/ExplorerBrowserViewEvents.cs b/Shell/ExplorerBrowser/ExplorerBrowserViewEvents.cs new file mode 100644 index 0000000..b47a1fe --- /dev/null +++ b/Shell/ExplorerBrowser/ExplorerBrowserViewEvents.cs @@ -0,0 +1,161 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Controls; +using Microsoft.WindowsAPICodePack.Controls.WindowsForms; + +namespace MS.WindowsAPICodePack.Internal +{ + /// + /// This provides a connection point container compatible dispatch interface for + /// hooking into the ExplorerBrowser view. + /// + [ComVisible(true)] + [ClassInterface(ClassInterfaceType.AutoDual)] + public class ExplorerBrowserViewEvents : IDisposable + { + #region implementation + private uint viewConnectionPointCookie; + private object viewDispatch; + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] + private IntPtr nullPtr = IntPtr.Zero; + + private Guid IID_DShellFolderViewEvents = new Guid(ExplorerBrowserIIDGuid.DShellFolderViewEvents); + private Guid IID_IDispatch = new Guid(ExplorerBrowserIIDGuid.IDispatch); + private ExplorerBrowser parent; + #endregion + + #region contstruction + /// + /// Default constructor for ExplorerBrowserViewEvents + /// + public ExplorerBrowserViewEvents() : this(null) { } + + internal ExplorerBrowserViewEvents(ExplorerBrowser parent) + { + this.parent = parent; + } + #endregion + + #region operations + internal void ConnectToView(IShellView psv) + { + DisconnectFromView(); + + HResult hr = psv.GetItemObject( + ShellViewGetItemObject.Background, + ref IID_IDispatch, + out viewDispatch); + + if (hr == HResult.Ok) + { + hr = ExplorerBrowserNativeMethods.ConnectToConnectionPoint( + this, + ref IID_DShellFolderViewEvents, + true, + viewDispatch, + ref viewConnectionPointCookie, + ref nullPtr); + + if (hr != HResult.Ok) + { + Marshal.ReleaseComObject(viewDispatch); + } + } + } + + internal void DisconnectFromView() + { + if (viewDispatch != null) + { + ExplorerBrowserNativeMethods.ConnectToConnectionPoint( + IntPtr.Zero, + ref IID_DShellFolderViewEvents, + false, + viewDispatch, + ref viewConnectionPointCookie, + ref nullPtr); + + Marshal.ReleaseComObject(viewDispatch); + viewDispatch = null; + viewConnectionPointCookie = 0; + } + } + #endregion + + #region IDispatch events + // These need to be public to be accessible via AutoDual reflection + + /// + /// The view selection has changed + /// + [DispId(ExplorerBrowserViewDispatchIds.SelectionChanged)] + public void ViewSelectionChanged() + { + parent.FireSelectionChanged(); + } + + /// + /// The contents of the view have changed + /// + [DispId(ExplorerBrowserViewDispatchIds.ContentsChanged)] + public void ViewContentsChanged() + { + parent.FireContentChanged(); + } + + /// + /// The enumeration of files in the view is complete + /// + [DispId(ExplorerBrowserViewDispatchIds.FileListEnumDone)] + public void ViewFileListEnumDone() + { + parent.FireContentEnumerationComplete(); + } + + /// + /// The selected item in the view has changed (not the same as the selection has changed) + /// + [DispId(ExplorerBrowserViewDispatchIds.SelectedItemChanged)] + public void ViewSelectedItemChanged() + { + parent.FireSelectedItemChanged(); + } + #endregion + + /// + /// Finalizer for ExplorerBrowserViewEvents + /// + ~ExplorerBrowserViewEvents() + { + Dispose(false); + } + + #region IDisposable Members + + /// + /// Disconnects and disposes object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Disconnects and disposes object. + /// + /// + protected virtual void Dispose(bool disposed) + { + if (disposed) + { + DisconnectFromView(); + } + } + + #endregion + } +} diff --git a/Shell/ExplorerBrowser/NavigationLog.cs b/Shell/ExplorerBrowser/NavigationLog.cs new file mode 100644 index 0000000..7770264 --- /dev/null +++ b/Shell/ExplorerBrowser/NavigationLog.cs @@ -0,0 +1,262 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using Microsoft.WindowsAPICodePack.Controls.WindowsForms; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + + /// + /// The navigation log is a history of the locations visited by the explorer browser. + /// + public class ExplorerBrowserNavigationLog + { + #region operations + /// + /// Clears the contents of the navigation log. + /// + public void ClearLog() + { + // nothing to do + if (_locations.Count == 0) { return; } + + bool oldCanNavigateBackward = CanNavigateBackward; + bool oldCanNavigateForward = CanNavigateForward; + + _locations.Clear(); + this.currentLocationIndex = -1; + + NavigationLogEventArgs args = new NavigationLogEventArgs(); + args.LocationsChanged = true; + args.CanNavigateBackwardChanged = (oldCanNavigateBackward != CanNavigateBackward); + args.CanNavigateForwardChanged = (oldCanNavigateForward != CanNavigateForward); + if (NavigationLogChanged != null) + { + NavigationLogChanged(this, args); + } + } + #endregion + + #region properties + /// + /// Indicates the presence of locations in the log that can be + /// reached by calling Navigate(Forward) + /// + public bool CanNavigateForward + { + get + { + return (CurrentLocationIndex < (_locations.Count - 1)); + } + } + + /// + /// Indicates the presence of locations in the log that can be + /// reached by calling Navigate(Backward) + /// + public bool CanNavigateBackward + { + get + { + return (CurrentLocationIndex > 0); + } + } + + /// + /// The navigation log + /// + public IEnumerable Locations + { + get { foreach (var obj in _locations) { yield return obj; } } + } + private List _locations = new List(); + + /// + /// An index into the Locations collection. The ShellObject pointed to + /// by this index is the current location of the ExplorerBrowser. + /// + public int CurrentLocationIndex + { + get + { + return currentLocationIndex; + } + } + + + /// + /// Gets the shell object in the Locations collection pointed to + /// by CurrentLocationIndex. + /// + public ShellObject CurrentLocation + { + get + { + if (currentLocationIndex < 0) { return null; } + + return _locations[currentLocationIndex]; + } + } + #endregion + + #region events + /// + /// Fires when the navigation log changes or + /// the current navigation position changes + /// + public event EventHandler NavigationLogChanged; + #endregion + + #region implementation + + private ExplorerBrowser parent = null; + + /// + /// The pending navigation log action. null if the user is not navigating + /// via the navigation log. + /// + private PendingNavigation pendingNavigation; + + /// + /// The index into the Locations collection. -1 if the Locations colleciton + /// is empty. + /// + private int currentLocationIndex = -1; + + internal ExplorerBrowserNavigationLog(ExplorerBrowser parent) + { + if (parent == null) + { + throw new ArgumentException(LocalizedMessages.NavigationLogNullParent, "parent"); + } + + // Hook navigation events from the parent to distinguish between + // navigation log induced navigation, and other navigations. + this.parent = parent; + this.parent.NavigationComplete += new EventHandler(OnNavigationComplete); + this.parent.NavigationFailed += new EventHandler(OnNavigationFailed); + } + + private void OnNavigationFailed(object sender, NavigationFailedEventArgs args) + { + pendingNavigation = null; + } + + private void OnNavigationComplete(object sender, NavigationCompleteEventArgs args) + { + NavigationLogEventArgs eventArgs = new NavigationLogEventArgs(); + bool oldCanNavigateBackward = CanNavigateBackward; + bool oldCanNavigateForward = CanNavigateForward; + + if ((pendingNavigation != null)) + { + // navigation log traversal in progress + + // determine if new location is the same as the traversal request + int result = 0; + pendingNavigation.Location.NativeShellItem.Compare( + args.NewLocation.NativeShellItem, SICHINTF.SICHINT_ALLFIELDS, out result); + bool shellItemsEqual = (result == 0); + if (shellItemsEqual == false) + { + // new location is different than traversal request, + // behave is if it never happened! + // remove history following currentLocationIndex, append new item + if (currentLocationIndex < (_locations.Count - 1)) + { + _locations.RemoveRange((int)currentLocationIndex + 1, (int)(_locations.Count - (currentLocationIndex + 1))); + } + _locations.Add(args.NewLocation); + currentLocationIndex = (_locations.Count - 1); + eventArgs.LocationsChanged = true; + } + else + { + // log traversal successful, update index + currentLocationIndex = (int)pendingNavigation.Index; + eventArgs.LocationsChanged = false; + } + pendingNavigation = null; + } + else + { + // remove history following currentLocationIndex, append new item + if (currentLocationIndex < (_locations.Count - 1)) + { + _locations.RemoveRange((int)currentLocationIndex + 1, (int)(_locations.Count - (currentLocationIndex + 1))); + } + _locations.Add(args.NewLocation); + currentLocationIndex = (_locations.Count - 1); + eventArgs.LocationsChanged = true; + } + + // update event args + eventArgs.CanNavigateBackwardChanged = (oldCanNavigateBackward != CanNavigateBackward); + eventArgs.CanNavigateForwardChanged = (oldCanNavigateForward != CanNavigateForward); + + if (NavigationLogChanged != null) + { + NavigationLogChanged(this, eventArgs); + } + } + + internal bool NavigateLog(NavigationLogDirection direction) + { + // determine proper index to navigate to + int locationIndex = 0; + if (direction == NavigationLogDirection.Backward && CanNavigateBackward) + { + locationIndex = (currentLocationIndex - 1); + } + else if (direction == NavigationLogDirection.Forward && CanNavigateForward) + { + locationIndex = (currentLocationIndex + 1); + } + else + { + return false; + } + + // initiate traversal request + ShellObject location = _locations[(int)locationIndex]; + pendingNavigation = new PendingNavigation(location, locationIndex); + parent.Navigate(location); + return true; + } + + internal bool NavigateLog(int index) + { + // can't go anywhere + if (index >= _locations.Count || index < 0) { return false; } + + // no need to re navigate to the same location + if (index == currentLocationIndex) { return false; } + + // initiate traversal request + ShellObject location = _locations[(int)index]; + pendingNavigation = new PendingNavigation(location, index); + parent.Navigate(location); + return true; + } + + #endregion + } + + /// + /// A navigation traversal request + /// + internal class PendingNavigation + { + internal PendingNavigation(ShellObject location, int index) + { + Location = location; + Index = index; + } + + internal ShellObject Location { get; set; } + internal int Index { get; set; } + } +} \ No newline at end of file diff --git a/Shell/ExplorerBrowser/NavigationLogEnums.cs b/Shell/ExplorerBrowser/NavigationLogEnums.cs new file mode 100644 index 0000000..b7e3ba3 --- /dev/null +++ b/Shell/ExplorerBrowser/NavigationLogEnums.cs @@ -0,0 +1,21 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + + +namespace Microsoft.WindowsAPICodePack.Controls +{ + /// + /// The direction argument for Navigate + /// + public enum NavigationLogDirection + { + /// + /// Navigates forward through the navigation log + /// + Forward, + + /// + /// Navigates backward through the travel log + /// + Backward + } +} \ No newline at end of file diff --git a/Shell/ExplorerBrowser/NavigationLogEvents.cs b/Shell/ExplorerBrowser/NavigationLogEvents.cs new file mode 100644 index 0000000..377738e --- /dev/null +++ b/Shell/ExplorerBrowser/NavigationLogEvents.cs @@ -0,0 +1,27 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + /// + /// The event argument for NavigationLogChangedEvent + /// + public class NavigationLogEventArgs : EventArgs + { + /// + /// Indicates CanNavigateForward has changed + /// + public bool CanNavigateForwardChanged { get; set; } + + /// + /// Indicates CanNavigateBackward has changed + /// + public bool CanNavigateBackwardChanged { get; set; } + + /// + /// Indicates the Locations collection has changed + /// + public bool LocationsChanged { get; set; } + } +} \ No newline at end of file diff --git a/Shell/ExplorerBrowser/NavigationOptions.cs b/Shell/ExplorerBrowser/NavigationOptions.cs new file mode 100644 index 0000000..e34a8c5 --- /dev/null +++ b/Shell/ExplorerBrowser/NavigationOptions.cs @@ -0,0 +1,105 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. +using Microsoft.WindowsAPICodePack.Controls.WindowsForms; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + + /// + /// These options control the results subsequent navigations of the ExplorerBrowser + /// + public class ExplorerBrowserNavigationOptions + { + #region construction + ExplorerBrowser eb; + internal ExplorerBrowserNavigationOptions(ExplorerBrowser eb) + { + this.eb = eb; + PaneVisibility = new ExplorerBrowserPaneVisibility(); + } + #endregion + + #region Flags property + /// + /// The binary flags that are passed to the explorer browser control's GetOptions/SetOptions methods + /// + public ExplorerBrowserNavigateOptions Flags + { + get + { + ExplorerBrowserOptions ebo = new ExplorerBrowserOptions(); + if (eb.explorerBrowserControl != null) + { + eb.explorerBrowserControl.GetOptions(out ebo); + return (ExplorerBrowserNavigateOptions)ebo; + } + return (ExplorerBrowserNavigateOptions)ebo; + } + set + { + ExplorerBrowserOptions ebo = (ExplorerBrowserOptions)value; + if (eb.explorerBrowserControl != null) + { + // Always forcing SHOWFRAMES because we handle IExplorerPaneVisibility + eb.explorerBrowserControl.SetOptions(ebo | ExplorerBrowserOptions.ShowFrames); + } + } + } + #endregion + + #region control flags to properties mapping + /// + /// Do not navigate further than the initial navigation. + /// + public bool NavigateOnce + { + get + { + return IsFlagSet(ExplorerBrowserNavigateOptions.NavigateOnce); + } + set + { + SetFlag(ExplorerBrowserNavigateOptions.NavigateOnce, value); + } + } + /// + /// Always navigate, even if you are attempting to navigate to the current folder. + /// + public bool AlwaysNavigate + { + get + { + return IsFlagSet(ExplorerBrowserNavigateOptions.AlwaysNavigate); + } + set + { + SetFlag(ExplorerBrowserNavigateOptions.AlwaysNavigate, value); + } + } + + private bool IsFlagSet(ExplorerBrowserNavigateOptions flag) + { + return (Flags & flag) != 0; + } + + private void SetFlag(ExplorerBrowserNavigateOptions flag, bool value) + { + if (value) + { + Flags |= flag; + } + else + { + Flags = Flags & ~flag; + } + } + #endregion + + #region ExplorerBrowser pane visibility + /// + /// Controls the visibility of the various ExplorerBrowser panes on subsequent navigation + /// + public ExplorerBrowserPaneVisibility PaneVisibility { get; private set; } + + #endregion + } +} diff --git a/Shell/GlobalSuppressions.cs b/Shell/GlobalSuppressions.cs new file mode 100644 index 0000000..ec82e06 --- /dev/null +++ b/Shell/GlobalSuppressions.cs @@ -0,0 +1,871 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. +// +// To add a suppression to this file, right-click the message in the +// Error List, point to "Suppress Message(s)", and click +// "In Project Suppression File". +// You do not need to add suppressions to this file manually. + + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.PowerPersonalityGuids.#All")] + +#region CA1709 - Identifiers should use proper casing - "API" acronym chosen for clarity +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Dialogs", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.Interop", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Taskbar", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "MS.WindowsAPICodePack.Internal", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Dialogs.Controls", MessageId = "API")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Sensors", MessageId = "API")] +#endregion + +#region CA1709 - Identifiers should use proper casing - acronyms capitalized for clarity +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaHDDVDROM", MessageId = "HDDVDROM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaHDDVDRAM", MessageId = "HDDVDRAM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaHDDVDR", MessageId = "HDDVDR")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaCDRW", MessageId = "CDRW")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaCDR", MessageId = "CDR")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRayROM", MessageId = "ROM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#DriveHDDVD", MessageId = "HDDVD")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaHDDVDROM", MessageId = "HDDVDROM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaHDDVDRAM", MessageId = "HDDVDRAM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaHDDVDR", MessageId = "HDDVDR")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaCDRW", MessageId = "CDRW")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaCDR", MessageId = "CDR")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRayROM", MessageId = "ROM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#DriveHDDVD", MessageId = "HDDVD")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder.#SetFolderTypeID(System.Guid)", MessageId = "ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectCollection.#BuildShellIDList()", MessageId = "ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.QueryParserManagerOption.#AppendLCIDToLocalizedPath", MessageId = "LCID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsDTVContent", MessageId="DTV")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsSAP", MessageId="SAP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsATSCContent", MessageId="ATSC")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#HandlerID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#HandlerCollectionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#ItemID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemShell.#SFGAOFlagsStrings", MessageId="SFGAO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ISOSpeed", MessageId="ISO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#EXIFVersion", MessageId="EXIF")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Music.#AlbumID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Identity.#ProviderID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Identity.#UniqueID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Document.#ClientID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Document.#DocumentID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+PropGroup.#GPS", MessageId="GPS")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link.#TargetSFGAOFlagsStrings", MessageId="SFGAO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link.#TargetSFGAOFlags", MessageId="SFGAO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Search.#EntryID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#ContentID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#ClassSecondaryID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#CollectionGroupID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#DVDID", MessageId="DVDID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#ClassPrimaryID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#CollectionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#MCDI", MessageId="MCDI")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPropGroup.#GPS", MessageId="GPS")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Photo.#ISOSpeed", MessageId="ISO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Photo.#EXIFVersion", MessageId="EXIF")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlagsStrings", MessageId="SFGAO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlags", MessageId="SFGAO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#ImageID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOP", MessageId="DOP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#VersionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOPNumerator", MessageId="DOP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOPDenominator", MessageId="DOP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#ID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#ConversationID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#CcName", MessageId="Cc")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#CcAddress", MessageId="Cc")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#MCDI", MessageId="MCDI")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#CollectionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#ClassPrimaryID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#ClassSecondaryID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#ContentID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#DVDID", MessageId="DVDID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#CollectionGroupID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel.#ID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Sync.#HandlerID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Sync.#ItemID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Sync.#HandlerCollectionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+RecordedTV.#IsSAP", MessageId="SAP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+RecordedTV.#IsATSCContent", MessageId="ATSC")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+RecordedTV.#IsDTVContent", MessageId="DTV")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#ProviderItemID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DescriptionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#MIMEType", MessageId="MIME")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DRM", MessageId="DRM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SFGAOFlags", MessageId="SFGAO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#GPS", MessageId="GPS")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileFRN", MessageId="FRN")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#AcquisitionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#ConversationID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#CcName", MessageId="Cc")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#CcAddress", MessageId="Cc")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyConditionOperation.#DOSWildCards", MessageId="DOS")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#SFGAOFlags", MessageId="SFGAO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FileFRN", MessageId="FRN")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#DescriptionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#ProviderItemID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#MIMEType", MessageId="MIME")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#AcquisitionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Contact.#TTYTDDTelephone", MessageId="TTYTDD")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Shell.#SFGAOFlagsStrings", MessageId="SFGAO")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMusic.#AlbumID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS.#VersionID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS.#DOPNumerator", MessageId="DOP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS.#DOPDenominator", MessageId="DOP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Image.#ImageID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact.#TTYTDDTelephone", MessageId="TTYTDD")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity.#ProviderID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity.#UniqueID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#ClientID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#DocumentID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#EntryID", MessageId="ID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.MappingAvailableServices.#TransliterationDevanagariToLatin", MessageId="Devanagari")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.MappingAvailableServices.#TransliterationHantToHans", MessageId="Hant")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.MappingAvailableServices.#TransliterationHansToHant", MessageId="Hant")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog.#Multiselect", MessageId="Multiselect")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.Interop.Message.#LParam", MessageId="Param")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.Interop.Message.#WParam", MessageId="Param")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.KnownFolders.#Ringtones", MessageId="Ringtones")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.KnownFolders.#SamplePlaylists", MessageId="Playlists")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.KnownFolders.#Playlists", MessageId="Playlists")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.KnownFolders.#PublicRingtones", MessageId="Ringtones")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.RedirectionCapability.#Redirectable", MessageId="Redirectable")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRay", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRayRE", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#DriveBluRay", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaSvcd", MessageId="Svcd")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRayROM", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaVcd", MessageId="Vcd")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRayR", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRayR", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRay", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRayRE", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#DriveBluRay", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaSvcd", MessageId="Svcd")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRayROM", MessageId="Blu")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaVcd", MessageId="Vcd")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.QueryParserManagerOption.#UnlocalizedSchemaBinaryPath", MessageId="Unlocalized")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.DefinitionOptions.#Roamable", MessageId="Roamable")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.DefinitionOptions.#Precreate", MessageId="Precreate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.ShellObjectChangeTypes.#NetUnshare", MessageId="Unshare")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#TranscodedForSync", MessageId="Transcoded")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Photo.#TranscodedForSync", MessageId="Transcoded")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#RelaunchCommand", MessageId="Relaunch")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#RelaunchDisplayNameResource", MessageId="Relaunch")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#RelaunchIconResource", MessageId="Relaunch")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel.#RelaunchDisplayNameResource", MessageId="Relaunch")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel.#RelaunchIconResource", MessageId="Relaunch")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel.#RelaunchCommand", MessageId="Relaunch")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Video.#TranscodedForSync", MessageId="Transcoded")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#TranscodedForSync", MessageId="Transcoded")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#GetProperty`1(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#GetProperty`1(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS.#DOP", MessageId = "DOP")] +#endregion + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS", MessageId = "GPS")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS", MessageId = "GPS")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM", MessageId = "DRM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+DRM", MessageId = "DRM")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListener.#get_Running()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.Interop.ShellObjectWatcherNativeMethods.#CreateBindCtx(System.Int32,System.Runtime.InteropServices.ComTypes.IBindCtx&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.#SHGetPathFromIDListW(System.IntPtr,System.Text.StringBuilder)")] + + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListener.#.cctor()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ChangeNotifyLock.#.ctor(Microsoft.WindowsAPICodePack.Shell.Interop.Message)")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant", Justification = "There are places where unsigned values are used, which is considered not Cls compliant.")] + +// Suppressed - Valid +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchCondition.#GetSubConditions()", Justification = "This method either creates a new instance of an object or has the potential of throwing an exception.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#GetPropertyWriter()", Justification = "This method either creates a new instance of an object or has the potential of throwing an exception.")] + +// There is logic that needs to be intialized within the static constructor that would require a different implementation if moved inline. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.FolderIdentifiers.#.cctor()")] + +// These enum's do not represent flags (even though their values may suggest it) +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnailFormatOption")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnailRetrievalOption")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyColumnStateOptions")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserContentSectionOptions")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyTypeOptions")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectChangeTypes")] + +// For whatever reason, the FxCop dictionary won't accept these exceptions. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "WildCards", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyConditionOperation.#DOSWildCards")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "ShowPlaces", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog.#ShowPlacesList")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Csc", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.KnownFolders.#SearchCsc")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NativePoint.#X")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NativePoint.#Y")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NativePoint.#.ctor(System.Int32,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "y", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NativePoint.#.ctor(System.Int32,System.Int32)")] + +// Excessive switch/case. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#CreateTypedProperty(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#CreateTypedProperty(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,Microsoft.WindowsAPICodePack.Shell.PropertySystem.IPropertyStore)")] + +// Follows native values +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserViewMode")] + +// Initialized via being marshaled. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.Interop.LogFont", Justification = "Initialized via marshaler.")] + +// Need to index based on this type. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey]")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PropertyHandlers.PropertyStoreCache.#Item[Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey]")] + +// This exception is captured, but thrown later. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpList.#Refresh()")] + +// This needs to be read-write collection for WPF databinding +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation.ExplorerBrowser.#Items")] + +// This interface probably isn't required, or could be converted to something else. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Taskbar.IJumpListTask")] + +// Fix these +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation")] + +// Investigate further? +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Interoperability", "CA1408:DoNotUseAutoDualClassInterfaceType", Scope = "type", Target = "MS.WindowsAPICodePack.Internal.ExplorerBrowserViewEvents")] + +// Suppressed - FxCop bug? +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.#SetImage(System.Windows.Media.Imaging.BitmapSource)")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.PreviewHandler.#Microsoft.WindowsAPICodePack.Shell.Interop.IPreviewHandler.DoPreview()", Justification = "The exception is handled at a later time.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.PreviewHandler`1.#Microsoft.WindowsAPICodePack.Shell.Interop.IPreviewHandler.DoPreview()", Justification = "The exception is handled at a later time.")] + +#region CA1006 - Nested Generic Types - Investigate +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#NamespaceClsid")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#FollowUpIconIndex")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#MissedCall")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#NewMessage")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#NewVoicemail")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#StorageFull")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#StorageFullLinkText")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#AcquisitionID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Capacity")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateAccessed")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateAcquired")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateArchived")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateCompleted")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateCreated")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateImported")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateModified")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DueDate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#EndDate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileAllocationSize")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileAttributes")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileFRN")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagColor")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagStatus")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FreeSpace")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Importance")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsAttachment")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsDefaultNonOwnerSaveLocation")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsDefaultSaveLocation")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsDeleted")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsEncrypted")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsFlagged")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsFlaggedComplete")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsIncomplete")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsLocationSupported")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsPinnedToNamespaceTree")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsRead")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsSearchOnlyItem")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsSendToTarget")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsShared")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#ItemDate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#NamespaceCLSID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#OfflineAvailability")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#OfflineStatus")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#PerceivedType")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#PercentFull")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Priority")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Rating")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Sensitivity")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SFGAOFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#ShareUserRating")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SharingStatus")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SimpleRating")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Size")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#StartDate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Thumbnail")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#ThumbnailCacheId")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#TotalFileSize")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#ExcludeFromShowInNewInstall")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#IsDestListSeparator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#PreventPinning")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#ChannelCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#EncodingBitrate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#IsVariableBitRate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#PeakValue")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#SampleRate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#SampleSize")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#StreamNumber")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#IsOnline")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#IsRecurring")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#ReminderTime")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#ResponseStatus")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#ShowTimeAs")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#DateItemExpires")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#FollowupIconIndex")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#HeaderItem")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#SecurityFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#TaskStatus")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact.#Anniversary")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact.#Birthday")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact.#GenderValue")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#BatteryLife")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#BatteryPlusCharging")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#ChargingState")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#Connected")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#ContainerId")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#IsDefault")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#IsNetworkConnected")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#IsShared")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#IsSoftwareInstalling")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#LaunchDeviceStageFromExplorer")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#LocalMachine")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#MissedCalls")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#NewPictures")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#NotificationStore")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#NotWorkingProperly")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#Paired")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#Roaming")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#SafeRemovalRequired")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#SignalStrength")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#StorageCapacity")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#StorageFreeSpace")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#StorageFreeSpacePercent")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#TextMessages")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#Voicemail")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#ByteCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#CharacterCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#DateCreated")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#DatePrinted")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#DateSaved")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#HiddenSlideCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#LineCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#MultimediaClipCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#NoteCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#PageCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#ParagraphCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#Security")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#SlideCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#TotalEditingTime")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#WordCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM.#DatePlayExpires")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM.#DatePlayStarts")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM.#IsProtected")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM.#PlayCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Altitude")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#AltitudeDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#AltitudeNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#AltitudeRef")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Date")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestBearing")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestBearingDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestBearingNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestDistance")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestDistanceDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestDistanceNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Differential")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOPDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOPNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImgDirection")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImgDirectionDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImgDirectionNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Speed")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#SpeedDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#SpeedNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Track")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#TrackDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#TrackNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity.#IsMeIdentity")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity.#ProviderID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#BitDepth")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#ColorSpace")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#CompressedBitsPerPixel")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#CompressedBitsPerPixelDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#CompressedBitsPerPixelNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#Compression")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#HorizontalResolution")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#HorizontalSize")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#ResolutionUnit")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#VerticalResolution")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#VerticalSize")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#DateVisited")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#Status")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#AverageLevel")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#DateEncoded")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#Duration")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#FrameCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#Year")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#DateReceived")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#DateSent")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#Flags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#HasAttachments")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#IsFwdOrReply")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#ProofInProgress")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#ToDoFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMusic.#IsCompilation")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMusic.#TrackNumber")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemNote.#Color")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Aperture")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ApertureDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ApertureNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Brightness")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#BrightnessDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#BrightnessNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Contrast")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#DateTaken")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#DigitalZoom")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#DigitalZoomDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#DigitalZoomNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureBias")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureBiasDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureBiasNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureIndex")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureIndexDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureIndexNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureProgram")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureTime")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureTimeDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureTimeNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Flash")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FlashEnergy")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FlashEnergyDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FlashEnergyNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FNumber")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FNumberDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FNumberNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalLength")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalLengthDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalLengthInFilm")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalLengthNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneXResolution")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneXResolutionDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneXResolutionNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneYResolution")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneYResolutionDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneYResolutionNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#GainControl")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#GainControlDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#GainControlNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ISOSpeed")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#LightSource")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MakerNoteOffset")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MaxAperture")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MaxApertureDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MaxApertureNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MeteringMode")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Orientation")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#PhotometricInterpretation")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ProgramMode")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Saturation")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Sharpness")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ShutterSpeed")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ShutterSpeedDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ShutterSpeedNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#SubjectDistance")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#SubjectDistanceDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#SubjectDistanceNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#TranscodedForSync")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#WhiteBalance")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#ChannelNumber")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#DateContentExpires")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsATSCContent")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsClosedCaptioningAvailable")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsDTVContent")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsHDContent")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsRepeatBroadcast")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsSAP")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#OriginalBroadcastDate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#RecordingTime")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#EntryID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#GatherTime")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#HitCount")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#IsClosedDirectory")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#IsFullyContained")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#Rank")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSoftware.#DateLastUsed")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#HandlerCollectionID")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#HandlerType")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#ProgressPercentage")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#State")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#EncodingBitrate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#FourCC")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#FrameHeight")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#FrameRate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#FrameWidth")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#HorizontalAspectRatio")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#SampleSize")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#StreamNumber")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#TranscodedForSync")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#VerticalAspectRatio")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVolume.#IsMappedDrive")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVolume.#IsRoot")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#TotalBitrate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#LowBattery")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#IsDestinationListSeparator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#IsVariableBitrate")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationBearing")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationBearingDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationBearingNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationDistance")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationDistanceNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImageDirection")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImageDirectionDenominator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImageDirectionNumerator")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationDistanceDenominator")] +#endregion + +#region CA1034 - Visible Nested Types - Investigate, should be fixed when we address Property System issues +// The layout of the PropertySystem has many public types nested within a type +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyContactJA")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemComputer")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevice")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDeviceInterface")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentityProvider")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemJournal")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLayoutPattern")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMusic")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemNote")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPropGroup")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPropList")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemShell")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSoftware")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemTask")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVolume")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Audio")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Calendar")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Communication")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Computer")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Contact")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Contact+JA")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Device")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+DeviceInterface")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Devices")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Devices+Notifications")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Document")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+DRM")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Identity")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+IdentityProvider")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Image")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+JA")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Journal")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+LayoutPattern")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Music")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Note")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Notifications")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Photo")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+PropGroup")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+PropList")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+RecordedTV")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Search")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Shell")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Software")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Sync")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Task")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Video")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Volume")] +#endregion + +#region CA1065 - Investigate and fix +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserContentOptions.#ThumbnailSize")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#Parent")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey]")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[System.String]")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchCondition.#PropertyKey")] +#endregion + +#region CA1710 - Use Correct suffix - won't fix (for now?) +// Changing the type names will break the naming pattern in the ShellObject area. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellFileSystemFolder")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellFolder")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchConnector")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellNonFileSystemFolder")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellLibrary")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.FileSystemKnownFolder")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.NonFileSystemKnownFolder")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.IKnownFolder")] +#endregion + +#region CA1724 - Conflicting typename/namespace - Fix - Property System Changes +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Shell")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem")] +#endregion + +#region CA1726 - Flags reserved name - Investigate, but they may be valid use of the word. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagColor")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagColorText")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagStatus")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagStatusText")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FlagColor")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FlagStatus")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FlagStatusText")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserContentOptions.#Flags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserNavigationOptions.#Flags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SFGAOFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#SecurityFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlagsStrings")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#Flags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#ToDoFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemShell.#SFGAOFlagsStrings")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#TypeFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#ViewFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Communication.#SecurityFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link.#TargetSFGAOFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link.#TargetSFGAOFlagsStrings")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#Flags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#ToDoFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FlagColorText")] + +#endregion + +#region CA1806 - Ignoring Method Results - Fix these eventually. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#ResetAeroGlass()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#ExcludeElementFromAeroGlass(System.Windows.FrameworkElement)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#ExcludeControlFromAeroGlass(System.Windows.Forms.Control)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#ResetAeroGlass()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.IPropertyStore.SetValue(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,MS.WindowsAPICodePack.Internal.PropVariant@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarNativeMethods.#SetWindowProperty(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailNativeMethods.ReleaseDC(System.IntPtr,System.IntPtr)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailScreenCapture.#GrabWindowBitmap(System.IntPtr,System.Drawing.Size)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#CanonicalName")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHCreateShellItemArrayFromDataObject(System.Runtime.InteropServices.ComTypes.IDataObject,System.Guid@,Microsoft.WindowsAPICodePack.Shell.IShellItemArray@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectCollection.#FromDataObject(System.Runtime.InteropServices.ComTypes.IDataObject)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHCreateItemFromParsingName(System.String,System.IntPtr,System.Guid@,Microsoft.WindowsAPICodePack.Shell.IShellItem@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellLibrary.#.ctor(System.String,System.String,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHCreateItemFromParsingName(System.String,System.IntPtr,System.Guid@,Microsoft.WindowsAPICodePack.Shell.IShellItem@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellLibrary.#DefaultSaveFolder")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHGetDesktopFolder(Microsoft.WindowsAPICodePack.Shell.IShellFolder@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellContainer.#GetEnumerator()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.String,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.Int32,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.Double,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.DateTime,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.Boolean,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.IPropertyStore.SetValue(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,MS.WindowsAPICodePack.Internal.PropVariant@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListSeparator.#NativeShellLink")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.IPropertyStore.SetValue(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,MS.WindowsAPICodePack.Internal.PropVariant@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListLink.#NativeShellLink")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#ResetAeroGlass()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#ExcludeElementFromAeroGlass(System.Windows.FrameworkElement)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmEnableComposition(MS.WindowsAPICodePack.Internal.CompositionEnable)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#AeroGlassCompositionEnabled")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#ResetAeroGlass()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#ExcludeControlFromAeroGlass(System.Windows.Forms.Control)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHCreateItemFromParsingName(System.String,System.IntPtr,System.Guid@,Microsoft.WindowsAPICodePack.Shell.IShellItem2@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog.#ApplyNativeSettings(Microsoft.WindowsAPICodePack.Dialogs.IFileDialog)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmEnableComposition(MS.WindowsAPICodePack.Internal.CompositionEnable)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#AeroGlassCompositionEnabled")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailNativeMethods.DwmInvalidateIconicBitmaps(System.IntPtr)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindowManager.#InvalidatePreview(Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindow)")] +#endregion + +#region CA1811 - Uncalled code - Mostly getters for properties, investigate. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Uncalled property getters. Removing the getter can affect Marshaling and will raise a Read-Only FxCop warning.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailProxyWindow.#WindowsControl")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Uncalled property getters. Removing the getter can affect Marshaling and will raise a Read-Only FxCop warning.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListCustomCategoryCollection.#IsReadOnly")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Uncalled property getters. Removing the getter can affect Marshaling and will raise a Read-Only FxCop warning.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog+NativeDialogEventSink.#Cookie")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Uncalled property getters. Removing the getter can affect Marshaling and will raise a Read-Only FxCop warning.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.#AddedToTaskbar")] +#endregion + +#region CA1822 - Investigate these, probably leave as is. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailManager.#SetThumbnailClip(System.IntPtr,System.Nullable`1)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetProgressValue(System.Int32,System.Int32,System.Windows.Window)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetProgressValue(System.Int32,System.Int32,System.IntPtr)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState,System.Windows.Window)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState,System.IntPtr)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetOverlayIcon(System.Windows.Window,System.Drawing.Icon,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetOverlayIcon(System.IntPtr,System.Drawing.Icon,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetCurrentProcessAppId(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetApplicationIdForSpecificWindow(System.IntPtr,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#IsPlatformSupported")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#GetCurrentProcessAppId()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetApplicationIdForSpecificWindow(System.Windows.Window,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarManager.#AddButtons(System.Windows.UIElement,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarManager.#AddButtons(System.IntPtr,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")] +#endregion + +#region CA2000 - Dispose objects before they lose scope - Investigate. +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.PreviewHandler.#Microsoft.WindowsAPICodePack.Shell.Interop.IPreviewHandler.DoPreview()", Justification = "Control added to list which is disposed via IDisposable.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#.ctor(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailScreenCapture.#GrabWindowBitmap(System.IntPtr,System.Drawing.Size)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindowManager.#AddThumbnailButtons(System.Windows.UIElement,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindowManager.#AddThumbnailButtons(System.IntPtr,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#ParseStructuredQuery(System.String,System.Globalization.CultureInfo)")] +#endregion + +#region CA2118, CA2122, CA2123 - LinkDemand related +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#DwmEnableComposition(MS.WindowsAPICodePack.Internal.CompositionEnable)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#DwmIsCompositionEnabled()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#GetClientRect(System.IntPtr,MS.WindowsAPICodePack.Internal.CoreNativeMethods+Rect&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#GetWindowRect(System.IntPtr,MS.WindowsAPICodePack.Internal.CoreNativeMethods+Rect&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserNativeMethods.#ConnectToConnectionPoint(System.Object,System.Guid&,System.Boolean,System.Object,System.UInt32&,System.IntPtr&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#GetClientRect(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.NativeRect&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#GetWindowRect(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.NativeRect&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectFactory.#IsVirtualKnownFolder(Microsoft.WindowsAPICodePack.Shell.IShellItem2)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListener.#.ctor()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PropertyHandlers.PropertyHandler.#.ctor()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.ShellObjectBasedPreviewHandler`1.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessModes)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProviders.ShellObjectBasedThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessModes)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#ProcessChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowMessageEventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#ProcessParentChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowMessageEventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#StopWatching()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StorageStream.#Read(System.Byte[],System.Int32,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StorageStream.#Seek(System.Int64,System.IO.SeekOrigin)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StorageStream.#Write(System.Byte[],System.Int32,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#.ctor(Microsoft.WindowsAPICodePack.Shell.ShellObject,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListener.#CrossThreadCreateWindow()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.IntPtrExtensions.#MarshalAs`1(System.IntPtr)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ReadOnlyIStreamStream.#Read(System.Byte[],System.Int32,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ReadOnlyIStreamStream.#Seek(System.Int64,System.IO.SeekOrigin)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProviders.ShellItemBasedThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessModes)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.ShellObjectBasedPreviewHandler.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessModes)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProviders.ThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IThumbnailProvider.GetThumbnail(System.UInt32,System.IntPtr&,System.UInt32&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ReadOnlyIStreamStream.#Read(System.Byte[],System.Int32,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ReadOnlyIStreamStream.#Seek(System.Int64,System.IO.SeekOrigin)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProviders.ShellItemBasedThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessMode)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.ShellObjectBasedPreviewHandler.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessMode)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IThumbnailProvider.GetThumbnail(System.UInt32,System.IntPtr&,System.UInt32&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListenerWindow.#Initialize()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListenerWindow.#.ctor()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.ShellObjectWatcher.#ProcessChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowsMessageEventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.ShellObjectWatcher.#ProcessParentChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowsMessageEventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#ProcessChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowsMessageEventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#StartWatching()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#ProcessParentChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowsMessageEventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.ShellObjectWatcher.#StartWatching()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#FormatForDisplay(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyDescriptionFormatOptions)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#TryFormatForDisplay(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyDescriptionFormatOptions,System.String&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.CommandLink.#CreateParams")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog.#AddPlace(System.String,Microsoft.WindowsAPICodePack.Shell.FileDialogAddPlaceLocation)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog.#SetCollectedPropertyKeys(System.Boolean,Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification =" Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#GetFolderView2()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#GetItemsArray()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#GetSelectedItemsArray()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#Items")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#SelectedItems")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserContentOptions.#ThumbnailSize")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.ExplorerBrowserViewEvents.#DisconnectFromView()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.FileSystemKnownFolder.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#WndProc(System.Windows.Forms.Message&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#SetAeroGlassTransparency()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpList.#RemoveCustomCategoryItem(Microsoft.WindowsAPICodePack.Shell.IShellItem)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListLink.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListLink.#NativeShellLink")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListSeparator.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListSeparator.#NativeShellLink")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.KnownFolders.#GetAllFolders()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.KnownFolderSettings.#GetFolderProperties(Microsoft.WindowsAPICodePack.Shell.IKnownFolderNative)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NonFileSystemKnownFolder.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchCondition.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchCondition.#GetSubConditions()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateAndOrCondition(Microsoft.WindowsAPICodePack.Shell.SearchConditionType,System.Boolean,Microsoft.WindowsAPICodePack.Shell.SearchCondition[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(System.String,MS.WindowsAPICodePack.Internal.PropVariant,System.String,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateNotCondition(Microsoft.WindowsAPICodePack.Shell.SearchCondition,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#ParseStructuredQuery(System.String,System.Globalization.CultureInfo)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellContainer.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellHelper.#GetParsingName(Microsoft.WindowsAPICodePack.Shell.IShellItem)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellHelper.#PidlFromShellItem(Microsoft.WindowsAPICodePack.Shell.IShellItem)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellLibrary.#GetFolders()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#GetHashCode()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#Name")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#NativeShellItem2")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectCollection.#BuildShellIDList()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectCollection.#.ctor(Microsoft.WindowsAPICodePack.Shell.IShellItemArray,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectFactory.#Create(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#CreateTypedProperty(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#FormatForDisplay(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyDescriptionFormat)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#GetImageReference()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#StorePropVariantValue(MS.WindowsAPICodePack.Internal.PropVariant)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#TryFormatForDisplay(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyDescriptionFormat,System.String&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#ValueAsObject")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#.ctor(Microsoft.WindowsAPICodePack.Shell.ShellObject)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#DisplayName")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#Dispose(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#EditInvitation")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#GetSortDescriptionLabel(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyWriter.#Close()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyWriter.#.ctor(Microsoft.WindowsAPICodePack.Shell.ShellObject)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyWriter.#WriteProperty(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.Object,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyWriter.#WriteProperty(System.String,System.Object,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder.#SetStacks(System.String[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder.#SetVisibleColumns(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder.#SortColumns(Microsoft.WindowsAPICodePack.Shell.SortColumn[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#ExtraLargeIcon")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#GetHBitmap(System.Windows.Size)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#Icon")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#LargeIcon")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#MediumIcon")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#SmallIcon")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcon.#GetHIcon()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.#GetPropertyDescription(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.#SetImage(System.Drawing.Bitmap)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.#SetImage(System.Windows.Media.Imaging.BitmapSource)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailManager.#SetThumbnailClip(System.IntPtr,System.Nullable`1)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailNativeMethods.#EnableCustomWindowPreview(System.IntPtr,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailScreenCapture.#GrabWindowBitmap(System.IntPtr,System.Drawing.Size)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailScreenCapture.#GrabWindowBitmap(System.Windows.UIElement,System.Int32,System.Int32,System.Int32,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#OwnerHandle")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarNativeMethods.#GetWindowPropertyStore(System.IntPtr)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarNativeMethods.#SetWindowProperty(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolbarProxyWindow.#.ctor(System.IntPtr,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolbarProxyWindow.#.ctor(System.Windows.UIElement,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolbarProxyWindow.#WindowToTellTaskbarAbout")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Justification = "Suppressed all LinkDemand relaged warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.CommandLink.#CreateParams")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Justification = "Suppressed all LinkDemand relaged warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#WndProc(System.Windows.Forms.Message&)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Justification = "Suppressed all LinkDemand relaged warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#System.Windows.Forms.IMessageFilter.PreFilterMessage(System.Windows.Forms.Message&)")] +#endregion + +#region CA2201 - Reserved Exception Types - Investigate and fix these +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "These can throw an exception deriving from ExternalException, which is reserved.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.Controls.CommonFileDialogRadioButtonList.#Attach(Microsoft.WindowsAPICodePack.Dialogs.IFileDialogCustomize)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "These can throw an exception deriving from ExternalException, which is reserved.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[System.String]")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "These can throw an exception deriving from ExternalException, which is reserved.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey]")] +#endregion + diff --git a/Shell/Interop/Common/IntPtrExtensions.cs b/Shell/Interop/Common/IntPtrExtensions.cs new file mode 100644 index 0000000..967cff9 --- /dev/null +++ b/Shell/Interop/Common/IntPtrExtensions.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal static class IntPtrExtensions + { + public static T MarshalAs(this IntPtr ptr) + { + return (T)Marshal.PtrToStructure(ptr, typeof(T)); + } + } +} diff --git a/Shell/Interop/Common/ShellCOMClasses.cs b/Shell/Interop/Common/ShellCOMClasses.cs new file mode 100644 index 0000000..58a0021 --- /dev/null +++ b/Shell/Interop/Common/ShellCOMClasses.cs @@ -0,0 +1,22 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + [ComImport, + Guid(ShellIIDGuid.IShellLibrary), + CoClass(typeof(ShellLibraryCoClass))] + internal interface INativeShellLibrary : IShellLibrary + { + } + + [ComImport, + ClassInterface(ClassInterfaceType.None), + TypeLibType(TypeLibTypeFlags.FCanCreate), + Guid(ShellCLSIDGuid.ShellLibrary)] + internal class ShellLibraryCoClass + { + } +} diff --git a/Shell/Interop/Common/ShellCOMGuids.cs b/Shell/Interop/Common/ShellCOMGuids.cs new file mode 100644 index 0000000..484b13f --- /dev/null +++ b/Shell/Interop/Common/ShellCOMGuids.cs @@ -0,0 +1,85 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal static class ShellIIDGuid + { + + // IID GUID strings for relevant Shell COM interfaces. + internal const string IModalWindow = "B4DB1657-70D7-485E-8E3E-6FCB5A5C1802"; + internal const string IFileDialog = "42F85136-DB7E-439C-85F1-E4075D135FC8"; + internal const string IFileOpenDialog = "D57C7288-D4AD-4768-BE02-9D969532D960"; + internal const string IFileSaveDialog = "84BCCD23-5FDE-4CDB-AEA4-AF64B83D78AB"; + internal const string IFileDialogEvents = "973510DB-7D7F-452B-8975-74A85828D354"; + internal const string IFileDialogControlEvents = "36116642-D713-4B97-9B83-7484A9D00433"; + internal const string IFileDialogCustomize = "E6FDD21A-163F-4975-9C8C-A69F1BA37034"; + + internal const string IShellItem = "43826D1E-E718-42EE-BC55-A1E261C37BFE"; + internal const string IShellItem2 = "7E9FB0D3-919F-4307-AB2E-9B1860310C93"; + internal const string IShellItemArray = "B63EA76D-1F85-456F-A19C-48159EFA858B"; + internal const string IShellLibrary = "11A66EFA-382E-451A-9234-1E0E12EF3085"; + internal const string IThumbnailCache = "F676C15D-596A-4ce2-8234-33996F445DB1"; + internal const string ISharedBitmap = "091162a4-bc96-411f-aae8-c5122cd03363"; + internal const string IShellFolder = "000214E6-0000-0000-C000-000000000046"; + internal const string IShellFolder2 = "93F2F68C-1D1B-11D3-A30E-00C04F79ABD1"; + internal const string IEnumIDList = "000214F2-0000-0000-C000-000000000046"; + internal const string IShellLinkW = "000214F9-0000-0000-C000-000000000046"; + internal const string CShellLink = "00021401-0000-0000-C000-000000000046"; + + internal const string IPropertyStore = "886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"; + internal const string IPropertyStoreCache = "3017056d-9a91-4e90-937d-746c72abbf4f"; + internal const string IPropertyDescription = "6F79D558-3E96-4549-A1D1-7D75D2288814"; + internal const string IPropertyDescription2 = "57D2EDED-5062-400E-B107-5DAE79FE57A6"; + internal const string IPropertyDescriptionList = "1F9FC1D0-C39B-4B26-817F-011967D3440E"; + internal const string IPropertyEnumType = "11E1FBF9-2D56-4A6B-8DB3-7CD193A471F2"; + internal const string IPropertyEnumType2 = "9B6E051C-5DDD-4321-9070-FE2ACB55E794"; + internal const string IPropertyEnumTypeList = "A99400F4-3D84-4557-94BA-1242FB2CC9A6"; + internal const string IPropertyStoreCapabilities = "c8e2d566-186e-4d49-bf41-6909ead56acc"; + + internal const string ICondition = "0FC988D4-C935-4b97-A973-46282EA175C8"; + internal const string ISearchFolderItemFactory = "a0ffbc28-5482-4366-be27-3e81e78e06c2"; + internal const string IConditionFactory = "A5EFE073-B16F-474f-9F3E-9F8B497A3E08"; + internal const string IRichChunk = "4FDEF69C-DBC9-454e-9910-B34F3C64B510"; + internal const string IPersistStream = "00000109-0000-0000-C000-000000000046"; + internal const string IPersist = "0000010c-0000-0000-C000-000000000046"; + internal const string IEnumUnknown = "00000100-0000-0000-C000-000000000046"; + internal const string IQuerySolution = "D6EBC66B-8921-4193-AFDD-A1789FB7FF57"; + internal const string IQueryParser = "2EBDEE67-3505-43f8-9946-EA44ABC8E5B0"; + internal const string IQueryParserManager = "A879E3C4-AF77-44fb-8F37-EBD1487CF920"; + } + + internal static class ShellCLSIDGuid + { + + // CLSID GUID strings for relevant coclasses. + internal const string FileOpenDialog = "DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7"; + internal const string FileSaveDialog = "C0B4E2F3-BA21-4773-8DBA-335EC946EB8B"; + internal const string KnownFolderManager = "4DF0C730-DF9D-4AE3-9153-AA6B82E9795A"; + internal const string ShellLibrary = "D9B3211D-E57F-4426-AAEF-30A806ADD397"; + internal const string SearchFolderItemFactory = "14010e02-bbbd-41f0-88e3-eda371216584"; + internal const string ConditionFactory = "E03E85B0-7BE3-4000-BA98-6C13DE9FA486"; + internal const string QueryParserManager = "5088B39A-29B4-4d9d-8245-4EE289222F66"; + } + + internal static class ShellKFIDGuid + { + + internal const string ComputerFolder = "0AC0837C-BBF8-452A-850D-79D08E667CA7"; + internal const string Favorites = "1777F761-68AD-4D8A-87BD-30B759FA33DD"; + internal const string Documents = "FDD39AD0-238F-46AF-ADB4-6C85480369C7"; + internal const string Profile = "5E6C858F-0E22-4760-9AFE-EA3317B67173"; + + internal const string GenericLibrary = "5c4f28b5-f869-4e84-8e60-f11db97c5cc7"; + internal const string DocumentsLibrary = "7d49d726-3c21-4f05-99aa-fdc2c9474656"; + internal const string MusicLibrary = "94d6ddcc-4a68-4175-a374-bd584a510b78"; + internal const string PicturesLibrary = "b3690e58-e961-423b-b687-386ebfd83239"; + internal const string VideosLibrary = "5fa96407-7e77-483c-ac93-691d05850de8"; + + internal const string Libraries = "1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE"; + } + + internal static class ShellBHIDGuid + { + internal const string ShellFolderObject = "3981e224-f559-11d3-8e3a-00c04f6837d5"; + } +} diff --git a/Shell/Interop/Common/ShellCOMInterfaces.cs b/Shell/Interop/Common/ShellCOMInterfaces.cs new file mode 100644 index 0000000..78e1bad --- /dev/null +++ b/Shell/Interop/Common/ShellCOMInterfaces.cs @@ -0,0 +1,880 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using System.Text; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using Microsoft.WindowsAPICodePack.Taskbar; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal enum SICHINTF + { + SICHINT_DISPLAY = 0x00000000, + SICHINT_CANONICAL = 0x10000000, + SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000, + SICHINT_ALLFIELDS = unchecked((int)0x80000000) + } + + // Disable warning if a method declaration hides another inherited from a parent COM interface + // To successfully import a COM interface, all inherited methods need to be declared again with + // the exception of those already declared in "IUnknown" +#pragma warning disable 108 + + #region COM Interfaces + + [ComImport(), + Guid(ShellIIDGuid.IModalWindow), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IModalWindow + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), + PreserveSig] + int Show([In] IntPtr parent); + } + + [ComImport, + Guid(ShellIIDGuid.IShellItem), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IShellItem + { + // Not supported: IBindCtx. + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult BindToHandler( + [In] IntPtr pbc, + [In] ref Guid bhid, + [In] ref Guid riid, + [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetDisplayName( + [In] ShellNativeMethods.ShellItemDesignNameOptions sigdnName, + out IntPtr ppszName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAttributes([In] ShellNativeMethods.ShellFileGetAttributesOptions sfgaoMask, out ShellNativeMethods.ShellFileGetAttributesOptions psfgaoAttribs); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Compare( + [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, + [In] SICHINTF hint, + out int piOrder); + } + + [ComImport, + Guid(ShellIIDGuid.IShellItem2), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IShellItem2 : IShellItem + { + // Not supported: IBindCtx. + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult BindToHandler( + [In] IntPtr pbc, + [In] ref Guid bhid, + [In] ref Guid riid, + [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetDisplayName( + [In] ShellNativeMethods.ShellItemDesignNameOptions sigdnName, + [MarshalAs(UnmanagedType.LPWStr)] out string ppszName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAttributes([In] ShellNativeMethods.ShellFileGetAttributesOptions sfgaoMask, out ShellNativeMethods.ShellFileGetAttributesOptions psfgaoAttribs); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Compare( + [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, + [In] uint hint, + out int piOrder); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), PreserveSig] + int GetPropertyStore( + [In] ShellNativeMethods.GetPropertyStoreOptions Flags, + [In] ref Guid riid, + [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyStore ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetPropertyStoreWithCreateObject([In] ShellNativeMethods.GetPropertyStoreOptions Flags, [In, MarshalAs(UnmanagedType.IUnknown)] object punkCreateObject, [In] ref Guid riid, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetPropertyStoreForKeys([In] ref PropertyKey rgKeys, [In] uint cKeys, [In] ShellNativeMethods.GetPropertyStoreOptions Flags, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.IUnknown)] out IPropertyStore ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetPropertyDescriptionList([In] ref PropertyKey keyType, [In] ref Guid riid, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Update([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetProperty([In] ref PropertyKey key, [Out] PropVariant ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCLSID([In] ref PropertyKey key, out Guid pclsid); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFileTime([In] ref PropertyKey key, out System.Runtime.InteropServices.ComTypes.FILETIME pft); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetInt32([In] ref PropertyKey key, out int pi); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetString([In] ref PropertyKey key, [MarshalAs(UnmanagedType.LPWStr)] out string ppsz); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetUInt32([In] ref PropertyKey key, out uint pui); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetUInt64([In] ref PropertyKey key, out ulong pull); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetBool([In] ref PropertyKey key, out int pf); + } + + [ComImport, + Guid(ShellIIDGuid.IShellItemArray), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IShellItemArray + { + // Not supported: IBindCtx. + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult BindToHandler( + [In, MarshalAs(UnmanagedType.Interface)] IntPtr pbc, + [In] ref Guid rbhid, + [In] ref Guid riid, + out IntPtr ppvOut); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetPropertyStore( + [In] int Flags, + [In] ref Guid riid, + out IntPtr ppv); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetPropertyDescriptionList( + [In] ref PropertyKey keyType, + [In] ref Guid riid, + out IntPtr ppv); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetAttributes( + [In] ShellNativeMethods.ShellItemAttributeOptions dwAttribFlags, + [In] ShellNativeMethods.ShellFileGetAttributesOptions sfgaoMask, + out ShellNativeMethods.ShellFileGetAttributesOptions psfgaoAttribs); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetCount(out uint pdwNumItems); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetItemAt( + [In] uint dwIndex, + [MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + // Not supported: IEnumShellItems (will use GetCount and GetItemAt instead). + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult EnumItems([MarshalAs(UnmanagedType.Interface)] out IntPtr ppenumShellItems); + } + + [ComImport, + Guid(ShellIIDGuid.IShellLibrary), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IShellLibrary + { + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult LoadLibraryFromItem( + [In, MarshalAs(UnmanagedType.Interface)] IShellItem library, + [In] AccessModes grfMode); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void LoadLibraryFromKnownFolder( + [In] ref Guid knownfidLibrary, + [In] AccessModes grfMode); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem location); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void RemoveFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem location); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetFolders( + [In] ShellNativeMethods.LibraryFolderFilter lff, + [In] ref Guid riid, + [MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void ResolveFolder( + [In, MarshalAs(UnmanagedType.Interface)] IShellItem folderToResolve, + [In] uint timeout, + [In] ref Guid riid, + [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDefaultSaveFolder( + [In] ShellNativeMethods.DefaultSaveFolderType dsft, + [In] ref Guid riid, + [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetDefaultSaveFolder( + [In] ShellNativeMethods.DefaultSaveFolderType dsft, + [In, MarshalAs(UnmanagedType.Interface)] IShellItem si); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetOptions( + out ShellNativeMethods.LibraryOptions lofOptions); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetOptions( + [In] ShellNativeMethods.LibraryOptions lofMask, + [In] ShellNativeMethods.LibraryOptions lofOptions); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFolderType(out Guid ftid); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFolderType([In] ref Guid ftid); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetIcon([MarshalAs(UnmanagedType.LPWStr)] out string icon); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetIcon([In, MarshalAs(UnmanagedType.LPWStr)] string icon); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Commit(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Save( + [In, MarshalAs(UnmanagedType.Interface)] IShellItem folderToSaveIn, + [In, MarshalAs(UnmanagedType.LPWStr)] string libraryName, + [In] ShellNativeMethods.LibrarySaveOptions lsf, + [MarshalAs(UnmanagedType.Interface)] out IShellItem2 savedTo); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SaveInKnownFolder( + [In] ref Guid kfidToSaveIn, + [In, MarshalAs(UnmanagedType.LPWStr)] string libraryName, + [In] ShellNativeMethods.LibrarySaveOptions lsf, + [MarshalAs(UnmanagedType.Interface)] out IShellItem2 savedTo); + }; + + [ComImportAttribute()] + [GuidAttribute("bcc18b79-ba16-442f-80c4-8a59c30c463b")] + [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] + interface IShellItemImageFactory + { + [PreserveSig] + HResult GetImage( + [In, MarshalAs(UnmanagedType.Struct)] CoreNativeMethods.Size size, + [In] ShellNativeMethods.SIIGBF flags, + [Out] out IntPtr phbm); + } + + [ComImport, + Guid(ShellIIDGuid.IThumbnailCache), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IThumbnailCache + { + void GetThumbnail([In] IShellItem pShellItem, + [In] uint cxyRequestedThumbSize, + [In] Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailOptions flags, + [Out] out ISharedBitmap ppvThumb, + [Out] out Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailCacheOptions pOutFlags, + [Out] Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailId pThumbnailID); + + void GetThumbnailByID([In] Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailId thumbnailID, + [In] uint cxyRequestedThumbSize, + [Out] out ISharedBitmap ppvThumb, + [Out] out Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailCacheOptions pOutFlags); + } + + [ComImport, + Guid(ShellIIDGuid.ISharedBitmap), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface ISharedBitmap + { + void GetSharedBitmap([Out] out IntPtr phbm); + void GetSize([Out] out CoreNativeMethods.Size pSize); + void GetFormat([Out] out ThumbnailAlphaType pat); + void InitializeBitmap([In] IntPtr hbm, [In] ThumbnailAlphaType wtsAT); + void Detach([Out] out IntPtr phbm); + } + [ComImport, + Guid(ShellIIDGuid.IShellFolder), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown), + ComConversionLoss] + internal interface IShellFolder + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void ParseDisplayName(IntPtr hwnd, [In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, [In, Out] ref uint pchEaten, [Out] IntPtr ppidl, [In, Out] ref uint pdwAttributes); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult EnumObjects([In] IntPtr hwnd, [In] ShellNativeMethods.ShellFolderEnumerationOptions grfFlags, [MarshalAs(UnmanagedType.Interface)] out IEnumIDList ppenumIDList); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult BindToObject([In] IntPtr pidl, /*[In, MarshalAs(UnmanagedType.Interface)] IBindCtx*/ IntPtr pbc, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void BindToStorage([In] ref IntPtr pidl, [In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In] ref Guid riid, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void CompareIDs([In] IntPtr lParam, [In] ref IntPtr pidl1, [In] ref IntPtr pidl2); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void CreateViewObject([In] IntPtr hwndOwner, [In] ref Guid riid, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAttributesOf([In] uint cidl, [In] IntPtr apidl, [In, Out] ref uint rgfInOut); + + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetUIObjectOf([In] IntPtr hwndOwner, [In] uint cidl, [In] IntPtr apidl, [In] ref Guid riid, [In, Out] ref uint rgfReserved, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDisplayNameOf([In] ref IntPtr pidl, [In] uint uFlags, out IntPtr pName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetNameOf([In] IntPtr hwnd, [In] ref IntPtr pidl, [In, MarshalAs(UnmanagedType.LPWStr)] string pszName, [In] uint uFlags, [Out] IntPtr ppidlOut); + } + + [ComImport, + Guid(ShellIIDGuid.IShellFolder2), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown), + ComConversionLoss] + internal interface IShellFolder2 : IShellFolder + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void ParseDisplayName([In] IntPtr hwnd, [In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, [In, Out] ref uint pchEaten, [Out] IntPtr ppidl, [In, Out] ref uint pdwAttributes); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void EnumObjects([In] IntPtr hwnd, [In] ShellNativeMethods.ShellFolderEnumerationOptions grfFlags, [MarshalAs(UnmanagedType.Interface)] out IEnumIDList ppenumIDList); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void BindToObject([In] IntPtr pidl, /*[In, MarshalAs(UnmanagedType.Interface)] IBindCtx*/ IntPtr pbc, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void BindToStorage([In] ref IntPtr pidl, [In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In] ref Guid riid, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void CompareIDs([In] IntPtr lParam, [In] ref IntPtr pidl1, [In] ref IntPtr pidl2); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void CreateViewObject([In] IntPtr hwndOwner, [In] ref Guid riid, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAttributesOf([In] uint cidl, [In] IntPtr apidl, [In, Out] ref uint rgfInOut); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetUIObjectOf([In] IntPtr hwndOwner, [In] uint cidl, [In] IntPtr apidl, [In] ref Guid riid, [In, Out] ref uint rgfReserved, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDisplayNameOf([In] ref IntPtr pidl, [In] uint uFlags, out IntPtr pName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetNameOf([In] IntPtr hwnd, [In] ref IntPtr pidl, [In, MarshalAs(UnmanagedType.LPWStr)] string pszName, [In] uint uFlags, [Out] IntPtr ppidlOut); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDefaultSearchGUID(out Guid pguid); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void EnumSearches([Out] out IntPtr ppenum); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDefaultColumn([In] uint dwRes, out uint pSort, out uint pDisplay); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDefaultColumnState([In] uint iColumn, out uint pcsFlags); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDetailsEx([In] ref IntPtr pidl, [In] ref PropertyKey pscid, [MarshalAs(UnmanagedType.Struct)] out object pv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDetailsOf([In] ref IntPtr pidl, [In] uint iColumn, out IntPtr psd); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void MapColumnToSCID([In] uint iColumn, out PropertyKey pscid); + } + + [ComImport, + Guid(ShellIIDGuid.IEnumIDList), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IEnumIDList + { + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Next(uint celt, out IntPtr rgelt, out uint pceltFetched); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Skip([In] uint celt); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Reset(); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Clone([MarshalAs(UnmanagedType.Interface)] out IEnumIDList ppenum); + } + + [ComImport, + Guid(ShellIIDGuid.IShellLinkW), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IShellLinkW + { + void GetPath( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, + int cchMaxPath, + //ref _WIN32_FIND_DATAW pfd, + IntPtr pfd, + uint fFlags); + void GetIDList(out IntPtr ppidl); + void SetIDList(IntPtr pidl); + void GetDescription( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, + int cchMaxName); + void SetDescription( + [MarshalAs(UnmanagedType.LPWStr)] string pszName); + void GetWorkingDirectory( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, + int cchMaxPath + ); + void SetWorkingDirectory( + [MarshalAs(UnmanagedType.LPWStr)] string pszDir); + void GetArguments( + [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, + int cchMaxPath); + void SetArguments( + [MarshalAs(UnmanagedType.LPWStr)] string pszArgs); + void GetHotKey(out short wHotKey); + void SetHotKey(short wHotKey); + void GetShowCmd(out uint iShowCmd); + void SetShowCmd(uint iShowCmd); + void GetIconLocation( + [Out(), MarshalAs(UnmanagedType.LPWStr)] out StringBuilder pszIconPath, + int cchIconPath, + out int iIcon); + void SetIconLocation( + [MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, + int iIcon); + void SetRelativePath( + [MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, + uint dwReserved); + void Resolve(IntPtr hwnd, uint fFlags); + void SetPath( + [MarshalAs(UnmanagedType.LPWStr)] string pszFile); + } + + [ComImport, + Guid(ShellIIDGuid.CShellLink), + ClassInterface(ClassInterfaceType.None)] + internal class CShellLink { } + + // Summary: + // Provides the managed definition of the IPersistStream interface, with functionality + // from IPersist. + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("00000109-0000-0000-C000-000000000046")] + internal interface IPersistStream + { + // Summary: + // Retrieves the class identifier (CLSID) of an object. + // + // Parameters: + // pClassID: + // When this method returns, contains a reference to the CLSID. This parameter + // is passed uninitialized. + [PreserveSig] + void GetClassID(out Guid pClassID); + // + // Summary: + // Checks an object for changes since it was last saved to its current file. + // + // Returns: + // S_OK if the file has changed since it was last saved; S_FALSE if the file + // has not changed since it was last saved. + [PreserveSig] + HResult IsDirty(); + + [PreserveSig] + HResult Load([In, MarshalAs(UnmanagedType.Interface)] IStream stm); + + [PreserveSig] + HResult Save([In, MarshalAs(UnmanagedType.Interface)] IStream stm, bool fRemember); + + [PreserveSig] + HResult GetSizeMax(out ulong cbSize); + } + + [ComImport(), + Guid(ShellIIDGuid.ICondition), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface ICondition : IPersistStream + { + // Summary: + // Retrieves the class identifier (CLSID) of an object. + // + // Parameters: + // pClassID: + // When this method returns, contains a reference to the CLSID. This parameter + // is passed uninitialized. + [PreserveSig] + void GetClassID(out Guid pClassID); + // + // Summary: + // Checks an object for changes since it was last saved to its current file. + // + // Returns: + // S_OK if the file has changed since it was last saved; S_FALSE if the file + // has not changed since it was last saved. + [PreserveSig] + HResult IsDirty(); + + [PreserveSig] + HResult Load([In, MarshalAs(UnmanagedType.Interface)] IStream stm); + + [PreserveSig] + HResult Save([In, MarshalAs(UnmanagedType.Interface)] IStream stm, bool fRemember); + + [PreserveSig] + HResult GetSizeMax(out ulong cbSize); + + // For any node, return what kind of node it is. + [PreserveSig] + HResult GetConditionType([Out()] out SearchConditionType pNodeType); + + // riid must be IID_IEnumUnknown, IID_IEnumVARIANT or IID_IObjectArray, or in the case of a negation node IID_ICondition. + // If this is a leaf node, E_FAIL will be returned. + // If this is a negation node, then if riid is IID_ICondition, *ppv will be set to a single ICondition, otherwise an enumeration of one. + // If this is a conjunction or a disjunction, *ppv will be set to an enumeration of the subconditions. + [PreserveSig] + HResult GetSubConditions([In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out object ppv); + + // If this is not a leaf node, E_FAIL will be returned. + // Retrieve the property name, operation and value from the leaf node. + // Any one of ppszPropertyName, pcop and ppropvar may be NULL. + [PreserveSig] + HResult GetComparisonInfo( + [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszPropertyName, + [Out] out SearchConditionOperation pcop, + [Out] PropVariant ppropvar); + + // If this is not a leaf node, E_FAIL will be returned. + // *ppszValueTypeName will be set to the semantic type of the value, or to NULL if this is not meaningful. + [PreserveSig] + HResult GetValueType([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszValueTypeName); + + // If this is not a leaf node, E_FAIL will be returned. + // If the value of the leaf node is VT_EMPTY, *ppszNormalization will be set to an empty string. + // If the value is a string (VT_LPWSTR, VT_BSTR or VT_LPSTR), then *ppszNormalization will be set to a + // character-normalized form of the value. + // Otherwise, *ppszNormalization will be set to some (character-normalized) string representation of the value. + [PreserveSig] + HResult GetValueNormalization([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszNormalization); + + // Return information about what parts of the input produced the property, the operation and the value. + // Any one of ppPropertyTerm, ppOperationTerm and ppValueTerm may be NULL. + // For a leaf node returned by the parser, the position information of each IRichChunk identifies the tokens that + // contributed the property/operation/value, the string value is the corresponding part of the input string, and + // the PROPVARIANT is VT_EMPTY. + [PreserveSig] + HResult GetInputTerms([Out] out IRichChunk ppPropertyTerm, [Out] out IRichChunk ppOperationTerm, [Out] out IRichChunk ppValueTerm); + + // Make a deep copy of this ICondition. + [PreserveSig] + HResult Clone([Out()] out ICondition ppc); + }; + + [ComImport, + Guid(ShellIIDGuid.IRichChunk), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IRichChunk + { + // The position *pFirstPos is zero-based. + // Any one of pFirstPos, pLength, ppsz and pValue may be NULL. + [PreserveSig] + HResult GetData(/*[out, annotation("__out_opt")] ULONG* pFirstPos, [out, annotation("__out_opt")] ULONG* pLength, [out, annotation("__deref_opt_out_opt")] LPWSTR* ppsz, [out, annotation("__out_opt")] PROPVARIANT* pValue*/); + } + + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid(ShellIIDGuid.IEnumUnknown)] + internal interface IEnumUnknown + { + [PreserveSig] + HResult Next(UInt32 requestedNumber, ref IntPtr buffer, ref UInt32 fetchedNumber); + [PreserveSig] + HResult Skip(UInt32 number); + [PreserveSig] + HResult Reset(); + [PreserveSig] + HResult Clone(out IEnumUnknown result); + } + + + [ComImport, + Guid(ShellIIDGuid.IConditionFactory), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IConditionFactory + { + [PreserveSig] + HResult MakeNot([In] ICondition pcSub, [In] bool fSimplify, [Out] out ICondition ppcResult); + + [PreserveSig] + HResult MakeAndOr([In] SearchConditionType ct, [In] IEnumUnknown peuSubs, [In] bool fSimplify, [Out] out ICondition ppcResult); + + [PreserveSig] + HResult MakeLeaf( + [In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, + [In] SearchConditionOperation cop, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszValueType, + [In] PropVariant ppropvar, + IRichChunk richChunk1, + IRichChunk richChunk2, + IRichChunk richChunk3, + [In] bool fExpand, + [Out] out ICondition ppcResult); + + [PreserveSig] + HResult Resolve(/*[In] ICondition pc, [In] STRUCTURED_QUERY_RESOLVE_OPTION sqro, [In] ref SYSTEMTIME pstReferenceTime, [Out] out ICondition ppcResolved*/); + + }; + + [ComImport, + Guid(ShellIIDGuid.IConditionFactory), + CoClass(typeof(ConditionFactoryCoClass))] + internal interface INativeConditionFactory : IConditionFactory + { + } + + [ComImport, + ClassInterface(ClassInterfaceType.None), + TypeLibType(TypeLibTypeFlags.FCanCreate), + Guid(ShellCLSIDGuid.ConditionFactory)] + internal class ConditionFactoryCoClass + { + } + + + + [ComImport, + Guid(ShellIIDGuid.ISearchFolderItemFactory), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface ISearchFolderItemFactory + { + [PreserveSig] + HResult SetDisplayName([In, MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName); + + [PreserveSig] + HResult SetFolderTypeID([In] Guid ftid); + + [PreserveSig] + HResult SetFolderLogicalViewMode([In] FolderLogicalViewMode flvm); + + [PreserveSig] + HResult SetIconSize([In] int iIconSize); + + [PreserveSig] + HResult SetVisibleColumns([In] uint cVisibleColumns, [In, MarshalAs(UnmanagedType.LPArray)] PropertyKey[] rgKey); + + [PreserveSig] + HResult SetSortColumns([In] uint cSortColumns, [In, MarshalAs(UnmanagedType.LPArray)] SortColumn[] rgSortColumns); + + [PreserveSig] + HResult SetGroupColumn([In] ref PropertyKey keyGroup); + + [PreserveSig] + HResult SetStacks([In] uint cStackKeys, [In, MarshalAs(UnmanagedType.LPArray)] PropertyKey[] rgStackKeys); + + [PreserveSig] + HResult SetScope([In, MarshalAs(UnmanagedType.Interface)] IShellItemArray ppv); + + [PreserveSig] + HResult SetCondition([In] ICondition pCondition); + + [PreserveSig] + int GetShellItem(ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IShellItem ppv); + + [PreserveSig] + HResult GetIDList([Out] IntPtr ppidl); + }; + + [ComImport, + Guid(ShellIIDGuid.ISearchFolderItemFactory), + CoClass(typeof(SearchFolderItemFactoryCoClass))] + internal interface INativeSearchFolderItemFactory : ISearchFolderItemFactory + { + } + + [ComImport, + ClassInterface(ClassInterfaceType.None), + TypeLibType(TypeLibTypeFlags.FCanCreate), + Guid(ShellCLSIDGuid.SearchFolderItemFactory)] + internal class SearchFolderItemFactoryCoClass + { + } + + [ComImport, + Guid(ShellIIDGuid.IQuerySolution), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IQuerySolution : IConditionFactory + { + [PreserveSig] + HResult MakeNot([In] ICondition pcSub, [In] bool fSimplify, [Out] out ICondition ppcResult); + + [PreserveSig] + HResult MakeAndOr([In] SearchConditionType ct, [In] IEnumUnknown peuSubs, [In] bool fSimplify, [Out] out ICondition ppcResult); + + [PreserveSig] + HResult MakeLeaf( + [In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, + [In] SearchConditionOperation cop, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszValueType, + [In] PropVariant ppropvar, + IRichChunk richChunk1, + IRichChunk richChunk2, + IRichChunk richChunk3, + [In] bool fExpand, + [Out] out ICondition ppcResult); + + [PreserveSig] + HResult Resolve(/*[In] ICondition pc, [In] int sqro, [In] ref SYSTEMTIME pstReferenceTime, [Out] out ICondition ppcResolved*/); + + // Retrieve the condition tree and the "main type" of the solution. + // ppQueryNode and ppMainType may be NULL. + [PreserveSig] + HResult GetQuery([Out, MarshalAs(UnmanagedType.Interface)] out ICondition ppQueryNode, [Out, MarshalAs(UnmanagedType.Interface)] out IEntity ppMainType); + + // Identify parts of the input string not accounted for. + // Each parse error is represented by an IRichChunk where the position information + // reflect token counts, the string is NULL and the value is a VT_I4 + // where lVal is from the ParseErrorType enumeration. The valid + // values for riid are IID_IEnumUnknown and IID_IEnumVARIANT. + [PreserveSig] + HResult GetErrors([In] ref Guid riid, [Out] out /* void** */ IntPtr ppParseErrors); + + // Report the query string, how it was tokenized and what LCID and word breaker were used (for recognizing keywords). + // ppszInputString, ppTokens, pLocale and ppWordBreaker may be NULL. + [PreserveSig] + HResult GetLexicalData([MarshalAs(UnmanagedType.LPWStr)] out string ppszInputString, [Out] /* ITokenCollection** */ out IntPtr ppTokens, [Out] out uint plcid, [Out] /* IUnknown** */ out IntPtr ppWordBreaker); + } + + [ComImport, + Guid(ShellIIDGuid.IQueryParser), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IQueryParser + { + // Parse parses an input string, producing a query solution. + // pCustomProperties should be an enumeration of IRichChunk objects, one for each custom property + // the application has recognized. pCustomProperties may be NULL, equivalent to an empty enumeration. + // For each IRichChunk, the position information identifies the character span of the custom property, + // the string value should be the name of an actual property, and the PROPVARIANT is completely ignored. + [PreserveSig] + HResult Parse([In, MarshalAs(UnmanagedType.LPWStr)] string pszInputString, [In] IEnumUnknown pCustomProperties, [Out] out IQuerySolution ppSolution); + + // Set a single option. See STRUCTURED_QUERY_SINGLE_OPTION above. + [PreserveSig] + HResult SetOption([In] StructuredQuerySingleOption option, [In] PropVariant pOptionValue); + + [PreserveSig] + HResult GetOption([In] StructuredQuerySingleOption option, [Out] PropVariant pOptionValue); + + // Set a multi option. See STRUCTURED_QUERY_MULTIOPTION above. + [PreserveSig] + HResult SetMultiOption([In] StructuredQueryMultipleOption option, [In, MarshalAs(UnmanagedType.LPWStr)] string pszOptionKey, [In] PropVariant pOptionValue); + + // Get a schema provider for browsing the currently loaded schema. + [PreserveSig] + HResult GetSchemaProvider([Out] out /*ISchemaProvider*/ IntPtr ppSchemaProvider); + + // Restate a condition as a query string according to the currently selected syntax. + // The parameter fUseEnglish is reserved for future use; must be FALSE. + [PreserveSig] + HResult RestateToString([In] ICondition pCondition, [In] bool fUseEnglish, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszQueryString); + + // Parse a condition for a given property. It can be anything that would go after 'PROPERTY:' in an AQS expession. + [PreserveSig] + HResult ParsePropertyValue([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, [In, MarshalAs(UnmanagedType.LPWStr)] string pszInputString, [Out] out IQuerySolution ppSolution); + + // Restate a condition for a given property. If the condition contains a leaf with any other property name, or no property name at all, + // E_INVALIDARG will be returned. + [PreserveSig] + HResult RestatePropertyValueToString([In] ICondition pCondition, [In] bool fUseEnglish, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszPropertyName, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszQueryString); + } + + [ComImport, + Guid(ShellIIDGuid.IQueryParserManager), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IQueryParserManager + { + // Create a query parser loaded with the schema for a certain catalog localize to a certain language, and initialized with + // standard defaults. One valid value for riid is IID_IQueryParser. + [PreserveSig] + HResult CreateLoadedParser([In, MarshalAs(UnmanagedType.LPWStr)] string pszCatalog, [In] ushort langidForKeywords, [In] ref Guid riid, [Out] out IQueryParser ppQueryParser); + + // In addition to setting AQS/NQS and automatic wildcard for the given query parser, this sets up standard named entity handlers and + // sets the keyboard locale as locale for word breaking. + [PreserveSig] + HResult InitializeOptions([In] bool fUnderstandNQS, [In] bool fAutoWildCard, [In] IQueryParser pQueryParser); + + // Change one of the settings for the query parser manager, such as the name of the schema binary, or the location of the localized and unlocalized + // schema binaries. By default, the settings point to the schema binaries used by Windows Shell. + [PreserveSig] + HResult SetOption([In] QueryParserManagerOption option, [In] PropVariant pOptionValue); + + }; + + [ComImport, + Guid(ShellIIDGuid.IQueryParserManager), + CoClass(typeof(QueryParserManagerCoClass))] + internal interface INativeQueryParserManager : IQueryParserManager + { + } + + [ComImport, + ClassInterface(ClassInterfaceType.None), + TypeLibType(TypeLibTypeFlags.FCanCreate), + Guid(ShellCLSIDGuid.QueryParserManager)] + internal class QueryParserManagerCoClass + { + } + + [ComImport, + Guid("24264891-E80B-4fd3-B7CE-4FF2FAE8931F"), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IEntity + { + // TODO + } + #endregion + +#pragma warning restore 108 +} diff --git a/Shell/Interop/Common/ShellNativeMethods.cs b/Shell/Interop/Common/ShellNativeMethods.cs new file mode 100644 index 0000000..6130eb2 --- /dev/null +++ b/Shell/Interop/Common/ShellNativeMethods.cs @@ -0,0 +1,690 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal static class ShellNativeMethods + { + #region Shell Enums + + [Flags] + internal enum FileOpenOptions + { + OverwritePrompt = 0x00000002, + StrictFileTypes = 0x00000004, + NoChangeDirectory = 0x00000008, + PickFolders = 0x00000020, + // Ensure that items returned are filesystem items. + ForceFilesystem = 0x00000040, + // Allow choosing items that have no storage. + AllNonStorageItems = 0x00000080, + NoValidate = 0x00000100, + AllowMultiSelect = 0x00000200, + PathMustExist = 0x00000800, + FileMustExist = 0x00001000, + CreatePrompt = 0x00002000, + ShareAware = 0x00004000, + NoReadOnlyReturn = 0x00008000, + NoTestFileCreate = 0x00010000, + HideMruPlaces = 0x00020000, + HidePinnedPlaces = 0x00040000, + NoDereferenceLinks = 0x00100000, + DontAddToRecent = 0x02000000, + ForceShowHidden = 0x10000000, + DefaultNoMiniMode = 0x20000000 + } + internal enum ControlState + { + Inactive = 0x00000000, + Enable = 0x00000001, + Visible = 0x00000002 + } + internal enum ShellItemDesignNameOptions + { + Normal = 0x00000000, // SIGDN_NORMAL + ParentRelativeParsing = unchecked((int)0x80018001), // SIGDN_INFOLDER | SIGDN_FORPARSING + DesktopAbsoluteParsing = unchecked((int)0x80028000), // SIGDN_FORPARSING + ParentRelativeEditing = unchecked((int)0x80031001), // SIGDN_INFOLDER | SIGDN_FOREDITING + DesktopAbsoluteEditing = unchecked((int)0x8004c000), // SIGDN_FORPARSING | SIGDN_FORADDRESSBAR + FileSystemPath = unchecked((int)0x80058000), // SIGDN_FORPARSING + Url = unchecked((int)0x80068000), // SIGDN_FORPARSING + ParentRelativeForAddressBar = unchecked((int)0x8007c001), // SIGDN_INFOLDER | SIGDN_FORPARSING | SIGDN_FORADDRESSBAR + ParentRelative = unchecked((int)0x80080001) // SIGDN_INFOLDER + } + + /// + /// Indicate flags that modify the property store object retrieved by methods + /// that create a property store, such as IShellItem2::GetPropertyStore or + /// IPropertyStoreFactory::GetPropertyStore. + /// + [Flags] + internal enum GetPropertyStoreOptions + { + /// + /// Meaning to a calling process: Return a read-only property store that contains all + /// properties. Slow items (offline files) are not opened. + /// Combination with other flags: Can be overridden by other flags. + /// + Default = 0, + + /// + /// Meaning to a calling process: Include only properties directly from the property + /// handler, which opens the file on the disk, network, or device. Meaning to a file + /// folder: Only include properties directly from the handler. + /// + /// Meaning to other folders: When delegating to a file folder, pass this flag on + /// to the file folder; do not do any multiplexing (MUX). When not delegating to a + /// file folder, ignore this flag instead of returning a failure code. + /// + /// Combination with other flags: Cannot be combined with GPS_TEMPORARY, + /// GPS_FASTPROPERTIESONLY, or GPS_BESTEFFORT. + /// + HandlePropertiesOnly = 0x1, + + /// + /// Meaning to a calling process: Can write properties to the item. + /// Note: The store may contain fewer properties than a read-only store. + /// + /// Meaning to a file folder: ReadWrite. + /// + /// Meaning to other folders: ReadWrite. Note: When using default MUX, + /// return a single unmultiplexed store because the default MUX does not support ReadWrite. + /// + /// Combination with other flags: Cannot be combined with GPS_TEMPORARY, GPS_FASTPROPERTIESONLY, + /// GPS_BESTEFFORT, or GPS_DELAYCREATION. Implies GPS_HANDLERPROPERTIESONLY. + /// + ReadWrite = 0x2, + + /// + /// Meaning to a calling process: Provides a writable store, with no initial properties, + /// that exists for the lifetime of the Shell item instance; basically, a property bag + /// attached to the item instance. + /// + /// Meaning to a file folder: Not applicable. Handled by the Shell item. + /// + /// Meaning to other folders: Not applicable. Handled by the Shell item. + /// + /// Combination with other flags: Cannot be combined with any other flag. Implies GPS_READWRITE + /// + Temporary = 0x4, + + /// + /// Meaning to a calling process: Provides a store that does not involve reading from the + /// disk or network. Note: Some values may be different, or missing, compared to a store + /// without this flag. + /// + /// Meaning to a file folder: Include the "innate" and "fallback" stores only. Do not load the handler. + /// + /// Meaning to other folders: Include only properties that are available in memory or can + /// be computed very quickly (no properties from disk, network, or peripheral IO devices). + /// This is normally only data sources from the IDLIST. When delegating to other folders, pass this flag on to them. + /// + /// Combination with other flags: Cannot be combined with GPS_TEMPORARY, GPS_READWRITE, + /// GPS_HANDLERPROPERTIESONLY, or GPS_DELAYCREATION. + /// + FastPropertiesOnly = 0x8, + + /// + /// Meaning to a calling process: Open a slow item (offline file) if necessary. + /// Meaning to a file folder: Retrieve a file from offline storage, if necessary. + /// Note: Without this flag, the handler is not created for offline files. + /// + /// Meaning to other folders: Do not return any properties that are very slow. + /// + /// Combination with other flags: Cannot be combined with GPS_TEMPORARY or GPS_FASTPROPERTIESONLY. + /// + OpensLowItem = 0x10, + + /// + /// Meaning to a calling process: Delay memory-intensive operations, such as file access, until + /// a property is requested that requires such access. + /// + /// Meaning to a file folder: Do not create the handler until needed; for example, either + /// GetCount/GetAt or GetValue, where the innate store does not satisfy the request. + /// Note: GetValue might fail due to file access problems. + /// + /// Meaning to other folders: If the folder has memory-intensive properties, such as + /// delegating to a file folder or network access, it can optimize performance by + /// supporting IDelayedPropertyStoreFactory and splitting up its properties into a + /// fast and a slow store. It can then use delayed MUX to recombine them. + /// + /// Combination with other flags: Cannot be combined with GPS_TEMPORARY or + /// GPS_READWRITE + /// + DelayCreation = 0x20, + + /// + /// Meaning to a calling process: Succeed at getting the store, even if some + /// properties are not returned. Note: Some values may be different, or missing, + /// compared to a store without this flag. + /// + /// Meaning to a file folder: Succeed and return a store, even if the handler or + /// innate store has an error during creation. Only fail if substores fail. + /// + /// Meaning to other folders: Succeed on getting the store, even if some properties + /// are not returned. + /// + /// Combination with other flags: Cannot be combined with GPS_TEMPORARY, + /// GPS_READWRITE, or GPS_HANDLERPROPERTIESONLY. + /// + BestEffort = 0x40, + + /// + /// Mask for valid GETPROPERTYSTOREFLAGS values. + /// + MaskValid = 0xff, + } + + internal enum ShellItemAttributeOptions + { + // if multiple items and the attirbutes together. + And = 0x00000001, + // if multiple items or the attributes together. + Or = 0x00000002, + // Call GetAttributes directly on the + // ShellFolder for multiple attributes. + AppCompat = 0x00000003, + + // A mask for SIATTRIBFLAGS_AND, SIATTRIBFLAGS_OR, and SIATTRIBFLAGS_APPCOMPAT. Callers normally do not use this value. + Mask = 0x00000003, + + // Windows 7 and later. Examine all items in the array to compute the attributes. + // Note that this can result in poor performance over large arrays and therefore it + // should be used only when needed. Cases in which you pass this flag should be extremely rare. + AllItems = 0x00004000 + } + + internal enum FileDialogEventShareViolationResponse + { + Default = 0x00000000, + Accept = 0x00000001, + Refuse = 0x00000002 + } + internal enum FileDialogEventOverwriteResponse + { + Default = 0x00000000, + Accept = 0x00000001, + Refuse = 0x00000002 + } + internal enum FileDialogAddPlacement + { + Bottom = 0x00000000, + Top = 0x00000001, + } + + [Flags] + internal enum SIIGBF + { + ResizeToFit = 0x00, + BiggerSizeOk = 0x01, + MemoryOnly = 0x02, + IconOnly = 0x04, + ThumbnailOnly = 0x08, + InCacheOnly = 0x10, + } + + [Flags] + internal enum ThumbnailOptions + { + Extract = 0x00000000, + InCacheOnly = 0x00000001, + FastExtract = 0x00000002, + ForceExtraction = 0x00000004, + SlowReclaim = 0x00000008, + ExtractDoNotCache = 0x00000020 + } + + [Flags] + internal enum ThumbnailCacheOptions + { + Default = 0x00000000, + LowQuality = 0x00000001, + Cached = 0x00000002, + } + + [Flags] + internal enum ShellFileGetAttributesOptions + { + /// + /// The specified items can be copied. + /// + CanCopy = 0x00000001, + + /// + /// The specified items can be moved. + /// + CanMove = 0x00000002, + + /// + /// Shortcuts can be created for the specified items. This flag has the same value as DROPEFFECT. + /// The normal use of this flag is to add a Create Shortcut item to the shortcut menu that is displayed + /// during drag-and-drop operations. However, SFGAO_CANLINK also adds a Create Shortcut item to the Microsoft + /// Windows Explorer's File menu and to normal shortcut menus. + /// If this item is selected, your application's IContextMenu::InvokeCommand is invoked with the lpVerb + /// member of the CMINVOKECOMMANDINFO structure set to "link." Your application is responsible for creating the link. + /// + CanLink = 0x00000004, + + /// + /// The specified items can be bound to an IStorage interface through IShellFolder::BindToObject. + /// + Storage = 0x00000008, + + /// + /// The specified items can be renamed. + /// + CanRename = 0x00000010, + + /// + /// The specified items can be deleted. + /// + CanDelete = 0x00000020, + + /// + /// The specified items have property sheets. + /// + HasPropertySheet = 0x00000040, + + /// + /// The specified items are drop targets. + /// + DropTarget = 0x00000100, + + /// + /// This flag is a mask for the capability flags. + /// + CapabilityMask = 0x00000177, + + /// + /// Windows 7 and later. The specified items are system items. + /// + System = 0x00001000, + + /// + /// The specified items are encrypted. + /// + Encrypted = 0x00002000, + + /// + /// Indicates that accessing the object = through IStream or other storage interfaces, + /// is a slow operation. + /// Applications should avoid accessing items flagged with SFGAO_ISSLOW. + /// + IsSlow = 0x00004000, + + /// + /// The specified items are ghosted icons. + /// + Ghosted = 0x00008000, + + /// + /// The specified items are shortcuts. + /// + Link = 0x00010000, + + /// + /// The specified folder objects are shared. + /// + Share = 0x00020000, + + /// + /// The specified items are read-only. In the case of folders, this means + /// that new items cannot be created in those folders. + /// + ReadOnly = 0x00040000, + + /// + /// The item is hidden and should not be displayed unless the + /// Show hidden files and folders option is enabled in Folder Settings. + /// + Hidden = 0x00080000, + + /// + /// This flag is a mask for the display attributes. + /// + DisplayAttributeMask = 0x000FC000, + + /// + /// The specified folders contain one or more file system folders. + /// + FileSystemAncestor = 0x10000000, + + /// + /// The specified items are folders. + /// + Folder = 0x20000000, + + /// + /// The specified folders or file objects are part of the file system + /// that is, they are files, directories, or root directories). + /// + FileSystem = 0x40000000, + + /// + /// The specified folders have subfolders = and are, therefore, + /// expandable in the left pane of Windows Explorer). + /// + HasSubFolder = unchecked((int)0x80000000), + + /// + /// This flag is a mask for the contents attributes. + /// + ContentsMask = unchecked((int)0x80000000), + + /// + /// When specified as input, SFGAO_VALIDATE instructs the folder to validate that the items + /// pointed to by the contents of apidl exist. If one or more of those items do not exist, + /// IShellFolder::GetAttributesOf returns a failure code. + /// When used with the file system folder, SFGAO_VALIDATE instructs the folder to discard cached + /// properties retrieved by clients of IShellFolder2::GetDetailsEx that may + /// have accumulated for the specified items. + /// + Validate = 0x01000000, + + /// + /// The specified items are on removable media or are themselves removable devices. + /// + Removable = 0x02000000, + + /// + /// The specified items are compressed. + /// + Compressed = 0x04000000, + + /// + /// The specified items can be browsed in place. + /// + Browsable = 0x08000000, + + /// + /// The items are nonenumerated items. + /// + Nonenumerated = 0x00100000, + + /// + /// The objects contain new content. + /// + NewContent = 0x00200000, + + /// + /// It is possible to create monikers for the specified file objects or folders. + /// + CanMoniker = 0x00400000, + + /// + /// Not supported. + /// + HasStorage = 0x00400000, + + /// + /// Indicates that the item has a stream associated with it that can be accessed + /// by a call to IShellFolder::BindToObject with IID_IStream in the riid parameter. + /// + Stream = 0x00400000, + + /// + /// Children of this item are accessible through IStream or IStorage. + /// Those children are flagged with SFGAO_STORAGE or SFGAO_STREAM. + /// + StorageAncestor = 0x00800000, + + /// + /// This flag is a mask for the storage capability attributes. + /// + StorageCapabilityMask = 0x70C50008, + + /// + /// Mask used by PKEY_SFGAOFlags to remove certain values that are considered + /// to cause slow calculations or lack context. + /// Equal to SFGAO_VALIDATE | SFGAO_ISSLOW | SFGAO_HASSUBFOLDER. + /// + PkeyMask = unchecked((int)0x81044000), + } + + [Flags] + internal enum ShellFolderEnumerationOptions : ushort + { + CheckingForChildren = 0x0010, + Folders = 0x0020, + NonFolders = 0x0040, + IncludeHidden = 0x0080, + InitializeOnFirstNext = 0x0100, + NetPrinterSearch = 0x0200, + Shareable = 0x0400, + Storage = 0x0800, + NavigationEnum = 0x1000, + FastItems = 0x2000, + FlatList = 0x4000, + EnableAsync = 0x8000 + } + + #endregion + + #region Shell Structs + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + internal struct FilterSpec + { + [MarshalAs(UnmanagedType.LPWStr)] + internal string Name; + [MarshalAs(UnmanagedType.LPWStr)] + internal string Spec; + + internal FilterSpec(string name, string spec) + { + Name = name; + Spec = spec; + } + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + internal struct ThumbnailId + { + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 16)] + byte rgbKey; + } + + #endregion + + #region Shell Helper Methods + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int SHCreateShellItemArrayFromDataObject( + System.Runtime.InteropServices.ComTypes.IDataObject pdo, + ref Guid riid, + [MarshalAs(UnmanagedType.Interface)] out IShellItemArray iShellItemArray); + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int SHCreateItemFromParsingName( + [MarshalAs(UnmanagedType.LPWStr)] string path, + // The following parameter is not used - binding context. + IntPtr pbc, + ref Guid riid, + [MarshalAs(UnmanagedType.Interface)] out IShellItem2 shellItem); + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int SHCreateItemFromParsingName( + [MarshalAs(UnmanagedType.LPWStr)] string path, + // The following parameter is not used - binding context. + IntPtr pbc, + ref Guid riid, + [MarshalAs(UnmanagedType.Interface)] out IShellItem shellItem); + + [DllImport("shlwapi.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int PathParseIconLocation( + [MarshalAs(UnmanagedType.LPWStr)] ref string pszIconFile); + + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int SHCreateItemFromIDList( + /*PCIDLIST_ABSOLUTE*/ IntPtr pidl, + ref Guid riid, + [MarshalAs(UnmanagedType.Interface)] out IShellItem2 ppv); + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int SHParseDisplayName( + [MarshalAs(UnmanagedType.LPWStr)] string pszName, + IntPtr pbc, + out IntPtr ppidl, + ShellFileGetAttributesOptions sfgaoIn, + out ShellFileGetAttributesOptions psfgaoOut + ); + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int SHGetIDListFromObject(IntPtr iUnknown, + out IntPtr ppidl + ); + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int SHGetDesktopFolder( + [MarshalAs(UnmanagedType.Interface)] out IShellFolder ppshf + ); + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int SHCreateShellItem( + IntPtr pidlParent, + [In, MarshalAs(UnmanagedType.Interface)] IShellFolder psfParent, + IntPtr pidl, + [MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi + ); + + [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern uint ILGetSize(IntPtr pidl); + + [DllImport("shell32.dll", CharSet = CharSet.None)] + public static extern void ILFree(IntPtr pidl); + + [DllImport("gdi32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool DeleteObject(IntPtr hObject); + + #endregion + + #region Shell Library Enums + + internal enum LibraryFolderFilter + { + ForceFileSystem = 1, + StorageItems = 2, + AllItems = 3 + }; + + [Flags] + internal enum LibraryOptions + { + Default = 0, + PinnedToNavigationPane = 0x1, + MaskAll = 0x1 + }; + + internal enum DefaultSaveFolderType + { + Detect = 1, + Private = 2, + Public = 3 + }; + + internal enum LibrarySaveOptions + { + FailIfThere = 0, + OverrideExisting = 1, + MakeUniqueName = 2 + }; + + internal enum LibraryManageDialogOptions + { + Default = 0, + NonIndexableLocationWarning = 1 + }; + + + #endregion + + #region Shell Library Helper Methods + + [DllImport("Shell32", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)] + internal static extern int SHShowManageLibraryUI( + [In, MarshalAs(UnmanagedType.Interface)] IShellItem library, + [In] IntPtr hwndOwner, + [In] string title, + [In] string instruction, + [In] LibraryManageDialogOptions lmdOptions); + + #endregion + + #region Command Link Definitions + + internal const int CommandLink = 0x0000000E; + internal const uint SetNote = 0x00001609; + internal const uint GetNote = 0x0000160A; + internal const uint GetNoteLength = 0x0000160B; + internal const uint SetShield = 0x0000160C; + + #endregion + + #region Shell notification definitions + internal const int MaxPath = 260; + + [DllImport("shell32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool SHGetPathFromIDListW(IntPtr pidl, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszPath); + + [StructLayout(LayoutKind.Sequential)] + internal struct ShellNotifyStruct + { + internal IntPtr item1; + internal IntPtr item2; + }; + + [StructLayout(LayoutKind.Sequential)] + internal struct SHChangeNotifyEntry + { + internal IntPtr pIdl; + + [MarshalAs(UnmanagedType.Bool)] + internal bool recursively; + } + + [DllImport("shell32.dll")] + internal static extern uint SHChangeNotifyRegister( + IntPtr windowHandle, + ShellChangeNotifyEventSource sources, + ShellObjectChangeTypes events, + uint message, + int entries, + ref SHChangeNotifyEntry changeNotifyEntry); + + [DllImport("shell32.dll")] + internal static extern IntPtr SHChangeNotification_Lock( + IntPtr windowHandle, + int processId, + out IntPtr pidl, + out uint lEvent); + + [DllImport("shell32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern Boolean SHChangeNotification_Unlock(IntPtr hLock); + + [DllImport("shell32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern Boolean SHChangeNotifyDeregister(uint hNotify); + + [Flags] + internal enum ShellChangeNotifyEventSource + { + InterruptLevel = 0x0001, + ShellLevel = 0x0002, + RecursiveInterrupt = 0x1000, + NewDelivery = 0x8000 + } + + + + #endregion + + internal const int InPlaceStringTruncated = 0x00401A0; + } +} diff --git a/Shell/Interop/Common/ShellNativeStructs.cs b/Shell/Interop/Common/ShellNativeStructs.cs new file mode 100644 index 0000000..46d7f4d --- /dev/null +++ b/Shell/Interop/Common/ShellNativeStructs.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// The STGM constants are flags that indicate + /// conditions for creating and deleting the object and access modes + /// for the object. + /// + /// You can combine these flags, but you can only choose one flag + /// from each group of related flags. Typically one flag from each + /// of the access and sharing groups must be specified for all + /// functions and methods which use these constants. + /// + [Flags] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification="Follows native api.")] + public enum AccessModes + { + /// + /// Indicates that, in direct mode, each change to a storage + /// or stream element is written as it occurs. + /// + Direct = 0x00000000, + + /// + /// Indicates that, in transacted mode, changes are buffered + /// and written only if an explicit commit operation is called. + /// + Transacted = 0x00010000, + + /// + /// Provides a faster implementation of a compound file + /// in a limited, but frequently used, case. + /// + Simple = 0x08000000, + + /// + /// Indicates that the object is read-only, + /// meaning that modifications cannot be made. + /// + Read = 0x00000000, + + /// + /// Enables you to save changes to the object, + /// but does not permit access to its data. + /// + Write = 0x00000001, + + /// + /// Enables access and modification of object data. + /// + ReadWrite = 0x00000002, + + /// + /// Specifies that subsequent openings of the object are + /// not denied read or write access. + /// + ShareDenyNone = 0x00000040, + + /// + /// Prevents others from subsequently opening the object in Read mode. + /// + ShareDenyRead = 0x00000030, + + /// + /// Prevents others from subsequently opening the object + /// for Write or ReadWrite access. + /// + ShareDenyWrite = 0x00000020, + + /// + /// Prevents others from subsequently opening the object in any mode. + /// + ShareExclusive = 0x00000010, + + /// + /// Opens the storage object with exclusive access to the most + /// recently committed version. + /// + Priority = 0x00040000, + + /// + /// Indicates that the underlying file is to be automatically destroyed when the root + /// storage object is released. This feature is most useful for creating temporary files. + /// + DeleteOnRelease = 0x04000000, + + /// + /// Indicates that, in transacted mode, a temporary scratch file is usually used + /// to save modifications until the Commit method is called. + /// Specifying NoScratch permits the unused portion of the original file + /// to be used as work space instead of creating a new file for that purpose. + /// + NoScratch = 0x00100000, + + /// + /// Indicates that an existing storage object + /// or stream should be removed before the new object replaces it. + /// + Create = 0x00001000, + + /// + /// Creates the new object while preserving existing data in a stream named "Contents". + /// + Convert = 0x00020000, + + /// + /// Causes the create operation to fail if an existing object with the specified name exists. + /// + FailIfThere = 0x00000000, + + /// + /// This flag is used when opening a storage object with Transacted + /// and without ShareExclusive or ShareDenyWrite. + /// In this case, specifying NoSnapshot prevents the system-provided + /// implementation from creating a snapshot copy of the file. + /// Instead, changes to the file are written to the end of the file. + /// + NoSnapshot = 0x00200000, + + /// + /// Supports direct mode for single-writer, multireader file operations. + /// + DirectSingleWriterMultipleReader = 0x00400000 + }; +} diff --git a/Shell/Interop/Common/WindowUtilities.cs b/Shell/Interop/Common/WindowUtilities.cs new file mode 100644 index 0000000..30a7c4a --- /dev/null +++ b/Shell/Interop/Common/WindowUtilities.cs @@ -0,0 +1,222 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using Microsoft.WindowsAPICodePack.Taskbar; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Shell.Interop; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + + internal static class WindowUtilities + { + internal static System.Drawing.Point GetParentOffsetOfChild(IntPtr hwnd, IntPtr hwndParent) + { + var childScreenCoord = new NativePoint(); + + TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref childScreenCoord); + + var parentScreenCoord = new NativePoint(); + + TabbedThumbnailNativeMethods.ClientToScreen(hwndParent, ref parentScreenCoord); + + System.Drawing.Point offset = new System.Drawing.Point( + childScreenCoord.X - parentScreenCoord.X, + childScreenCoord.Y - parentScreenCoord.Y); + + return offset; + } + + internal static System.Drawing.Size GetNonClientArea(IntPtr hwnd) + { + var c = new NativePoint(); + + TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref c); + + var r = new NativeRect(); + + TabbedThumbnailNativeMethods.GetWindowRect(hwnd, ref r); + + return new System.Drawing.Size(c.X - r.Left, c.Y - r.Top); + } + } + + [Flags] + internal enum WindowStyles + { + /// + /// The window has a thin-line border. + /// + Border = 0x00800000, + + /// + /// The window has a title bar (includes the WS_BORDER style). + /// + Caption = 0x00C00000, + + /// + /// The window is a child window. + /// A window with this style cannot have a menu bar. + /// This style cannot be used with the WS_POPUP style. + /// + Child = 0x40000000, + + /// + /// Same as the WS_CHILD style. + /// + ChildWindow = 0x40000000, + + /// + /// Excludes the area occupied by child windows when drawing occurs within the parent window. + /// This style is used when creating the parent window. + /// + ClipChildren = 0x02000000, + + /// + /// Clips child windows relative to each other; + /// that is, when a particular child window receives a WM_PAINT message, + /// the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. + /// If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, + /// when drawing within the client area of a child window, to draw within the client area of a neighboring child window. + /// + ClipSiblings = 0x04000000, + + /// + /// The window is initially disabled. A disabled window cannot receive input from the user. + /// To change this after a window has been created, use the EnableWindow function. + /// + Disabled = 0x08000000, + + /// + /// The window has a border of a style typically used with dialog boxes. + /// A window with this style cannot have a title bar. + /// + DialogFrame = 0x0040000, + + /// + /// The window is the first control of a group of controls. + /// The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. + /// The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. + /// The user can subsequently change the keyboard focus from one control in the group to the next control + /// in the group by using the direction keys. + /// + /// You can turn this style on and off to change dialog box navigation. + /// To change this style after a window has been created, use the SetWindowLong function. + /// + Group = 0x00020000, + + /// + /// The window has a horizontal scroll bar. + /// + HorizontalScroll = 0x00100000, + + /// + /// The window is initially minimized. + /// Same as the WS_MINIMIZE style. + /// + Iconic = 0x20000000, + + /// + /// The window is initially maximized. + /// + Maximize = 0x01000000, + + /// + /// The window has a maximize button. + /// Cannot be combined with the WS_EX_CONTEXTHELP style. + /// The WS_SYSMENU style must also be specifie + /// + MaximizeBox = 0x00010000, + + /// + /// The window is initially minimized. + /// Same as the WS_ICONIC style. + /// + Minimize = 0x20000000, + + /// + /// The window has a minimize button. + /// Cannot be combined with the WS_EX_CONTEXTHELP style. + /// The WS_SYSMENU style must also be specified. + /// + MinimizeBox = 0x00020000, + + /// + /// The window is an overlapped window. + /// An overlapped window has a title bar and a border. + /// Same as the WS_TILED style. + /// + Overlapped = 0x00000000, + + /// + /// The windows is a pop-up window. + /// This style cannot be used with the WS_CHILD style. + /// + Popup = unchecked((int)0x80000000), + + /// + /// The window has a sizing border. + /// Same as the WS_THICKFRAME style. + /// + SizeBox = 0x00040000, + + /// + /// The window has a window menu on its title bar. + /// The WS_CAPTION style must also be specified. + /// + SystemMenu = 0x00080000, + + /// + /// The window is a control that can receive the keyboard focus when the user presses the TAB key. + /// Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style. + /// + /// You can turn this style on and off to change dialog box navigation. + /// To change this style after a window has been created, use the SetWindowLong function. + /// For user-created windows and modeless dialogs to work with tab stops, + /// alter the message loop to call the IsDialogMessage function. + /// + Tabstop = 0x00010000, + + /// + /// The window has a sizing border. + /// Same as the WS_SIZEBOX style. + /// + ThickFrame = 0x00040000, + + /// + /// The window is an overlapped window. + /// An overlapped window has a title bar and a border. + /// Same as the WS_OVERLAPPED style. + /// + Tiled = 0x00000000, + + /// + /// The window is initially visible. + /// + /// This style can be turned on and off by using the ShowWindow or SetWindowPos function. + /// + Visible = 0x10000000, + + /// + /// The window has a vertical scroll bar. + /// + VerticalScroll = 0x00200000, + + /// + /// The window is an overlapped window. + /// Same as the WS_OVERLAPPEDWINDOW style. + /// + TiledWindowMask = Overlapped | Caption | SystemMenu | ThickFrame | MinimizeBox | MaximizeBox, + + /// + /// The window is a pop-up window. + /// The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible. + /// + PopupWindowMask = Popup | Border | SystemMenu, + + /// + /// The window is an overlapped window. Same as the WS_TILEDWINDOW style. + /// + OverlappedWindowMask = Overlapped | Caption | SystemMenu | ThickFrame | MinimizeBox | MaximizeBox, + } +} diff --git a/Shell/Interop/Dialogs/DialogsCOMClasses.cs b/Shell/Interop/Dialogs/DialogsCOMClasses.cs new file mode 100644 index 0000000..cc35d91 --- /dev/null +++ b/Shell/Interop/Dialogs/DialogsCOMClasses.cs @@ -0,0 +1,51 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + + // Dummy base interface for CommonFileDialog coclasses. + internal interface NativeCommonFileDialog + { + } + + // Coclass interfaces - designed to "look like" the object + // in the API, so that the 'new' operator can be used in a + // straightforward way. Behind the scenes, the C# compiler + // morphs all 'new CoClass()' calls to 'new CoClassWrapper()'. + + [ComImport, + Guid(ShellIIDGuid.IFileOpenDialog), + CoClass(typeof(FileOpenDialogRCW))] + internal interface NativeFileOpenDialog : IFileOpenDialog + { + } + + [ComImport, + Guid(ShellIIDGuid.IFileSaveDialog), + CoClass(typeof(FileSaveDialogRCW))] + internal interface NativeFileSaveDialog : IFileSaveDialog + { + } + + // .NET classes representing runtime callable wrappers. + [ComImport, + ClassInterface(ClassInterfaceType.None), + TypeLibType(TypeLibTypeFlags.FCanCreate), + Guid(ShellCLSIDGuid.FileOpenDialog)] + internal class FileOpenDialogRCW + { + } + + [ComImport, + ClassInterface(ClassInterfaceType.None), + TypeLibType(TypeLibTypeFlags.FCanCreate), + Guid(ShellCLSIDGuid.FileSaveDialog)] + internal class FileSaveDialogRCW + { + } + +} diff --git a/Shell/Interop/Dialogs/DialogsCOMInterfaces.cs b/Shell/Interop/Dialogs/DialogsCOMInterfaces.cs new file mode 100644 index 0000000..9d07efd --- /dev/null +++ b/Shell/Interop/Dialogs/DialogsCOMInterfaces.cs @@ -0,0 +1,507 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Dialogs +{ + // Disable warning if a method declaration hides another inherited from a parent COM interface + // To successfully import a COM interface, all inherited methods need to be declared again with + // the exception of those already declared in "IUnknown" +#pragma warning disable 0108 + + [ComImport(), + Guid(ShellIIDGuid.IFileDialog), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IFileDialog : IModalWindow + { + // Defined on IModalWindow - repeated here due to requirements of COM interop layer. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), + PreserveSig] + int Show([In] IntPtr parent); + + // IFileDialog-Specific interface members. + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileTypes( + [In] uint cFileTypes, + [In, MarshalAs(UnmanagedType.LPArray)] ShellNativeMethods.FilterSpec[] rgFilterSpec); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileTypeIndex([In] uint iFileType); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFileTypeIndex(out uint piFileType); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Advise( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialogEvents pfde, + out uint pdwCookie); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Unadvise([In] uint dwCookie); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetOptions([In] ShellNativeMethods.FileOpenOptions fos); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetOptions(out ShellNativeMethods.FileOpenOptions pfos); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, ShellNativeMethods.FileDialogAddPlacement fdap); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Close([MarshalAs(UnmanagedType.Error)] int hr); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetClientGuid([In] ref Guid guid); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void ClearClientData(); + + // Not supported: IShellItemFilter is not defined, converting to IntPtr. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter); + } + + [ComImport(), + Guid(ShellIIDGuid.IFileOpenDialog), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IFileOpenDialog : IFileDialog + { + // Defined on IModalWindow - repeated here due to requirements of COM interop layer. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), + PreserveSig] + int Show([In] IntPtr parent); + + // Defined on IFileDialog - repeated here due to requirements of COM interop layer. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileTypes([In] uint cFileTypes, [In] ref ShellNativeMethods.FilterSpec rgFilterSpec); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileTypeIndex([In] uint iFileType); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFileTypeIndex(out uint piFileType); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Advise( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialogEvents pfde, + out uint pdwCookie); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Unadvise([In] uint dwCookie); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetOptions([In] ShellNativeMethods.FileOpenOptions fos); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetOptions(out ShellNativeMethods.FileOpenOptions pfos); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, ShellNativeMethods.FileDialogAddPlacement fdap); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Close([MarshalAs(UnmanagedType.Error)] int hr); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetClientGuid([In] ref Guid guid); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void ClearClientData(); + + // Not supported: IShellItemFilter is not defined, converting to IntPtr. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter); + + // Defined by IFileOpenDialog. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetResults([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppenum); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSelectedItems([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppsai); + } + + [ComImport(), + Guid(ShellIIDGuid.IFileSaveDialog), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IFileSaveDialog : IFileDialog + { + // Defined on IModalWindow - repeated here due to requirements of COM interop layer. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), + PreserveSig] + int Show([In] IntPtr parent); + + // Defined on IFileDialog - repeated here due to requirements of COM interop layer. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileTypes( + [In] uint cFileTypes, + [In] ref ShellNativeMethods.FilterSpec rgFilterSpec); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileTypeIndex([In] uint iFileType); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFileTypeIndex(out uint piFileType); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Advise( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialogEvents pfde, + out uint pdwCookie); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Unadvise([In] uint dwCookie); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetOptions([In] ShellNativeMethods.FileOpenOptions fos); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetOptions(out ShellNativeMethods.FileOpenOptions pfos); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddPlace( + [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, + ShellNativeMethods.FileDialogAddPlacement fdap); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Close([MarshalAs(UnmanagedType.Error)] int hr); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetClientGuid([In] ref Guid guid); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void ClearClientData(); + + // Not supported: IShellItemFilter is not defined, converting to IntPtr. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter); + + // Defined by IFileSaveDialog interface. + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetSaveAsItem([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); + + // Not currently supported: IPropertyStore. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetProperties([In, MarshalAs(UnmanagedType.Interface)] IntPtr pStore); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + int SetCollectedProperties( + [In] IPropertyDescriptionList pList, + [In] bool fAppendDefault); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [PreserveSig] + HResult GetProperties(out IPropertyStore ppStore); + + // Not currently supported: IPropertyStore, IFileOperationProgressSink. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void ApplyProperties( + [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, + [In, MarshalAs(UnmanagedType.Interface)] IntPtr pStore, + [In, ComAliasName("ShellObjects.wireHWND")] ref IntPtr hwnd, + [In, MarshalAs(UnmanagedType.Interface)] IntPtr pSink); + } + + [ComImport, + Guid(ShellIIDGuid.IFileDialogEvents), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IFileDialogEvents + { + // NOTE: some of these callbacks are cancelable - returning S_FALSE means that + // the dialog should not proceed (e.g. with closing, changing folder); to + // support this, we need to use the PreserveSig attribute to enable us to return + // the proper HRESULT. + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), + PreserveSig] + HResult OnFileOk([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), + PreserveSig] + HResult OnFolderChanging( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd, + [In, MarshalAs(UnmanagedType.Interface)] IShellItem psiFolder); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnFolderChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnSelectionChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnShareViolation( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd, + [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, + out ShellNativeMethods.FileDialogEventShareViolationResponse pResponse); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnTypeChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnOverwrite([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd, + [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, + out ShellNativeMethods.FileDialogEventOverwriteResponse pResponse); + } + + [ComImport, + Guid(ShellIIDGuid.IFileDialogCustomize), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IFileDialogCustomize + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void EnableOpenDropDown([In] int dwIDCtl); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddMenu( + [In] int dwIDCtl, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddPushButton( + [In] int dwIDCtl, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddComboBox([In] int dwIDCtl); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddRadioButtonList([In] int dwIDCtl); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddCheckButton( + [In] int dwIDCtl, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel, + [In] bool bChecked); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddEditBox( + [In] int dwIDCtl, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszText); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddSeparator([In] int dwIDCtl); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddText( + [In] int dwIDCtl, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszText); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetControlLabel( + [In] int dwIDCtl, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetControlState( + [In] int dwIDCtl, + [Out] out ShellNativeMethods.ControlState pdwState); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetControlState( + [In] int dwIDCtl, + [In] ShellNativeMethods.ControlState dwState); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetEditBoxText( + [In] int dwIDCtl, + [MarshalAs(UnmanagedType.LPWStr)] out string ppszText); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetEditBoxText( + [In] int dwIDCtl, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszText); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCheckButtonState( + [In] int dwIDCtl, + [Out] out bool pbChecked); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetCheckButtonState( + [In] int dwIDCtl, + [In] bool bChecked); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void AddControlItem( + [In] int dwIDCtl, + [In] int dwIDItem, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void RemoveControlItem( + [In] int dwIDCtl, + [In] int dwIDItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void RemoveAllControlItems([In] int dwIDCtl); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetControlItemState( + [In] int dwIDCtl, + [In] int dwIDItem, + [Out] out ShellNativeMethods.ControlState pdwState); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetControlItemState( + [In] int dwIDCtl, + [In] int dwIDItem, + [In] ShellNativeMethods.ControlState dwState); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSelectedControlItem( + [In] int dwIDCtl, + [Out] out int pdwIDItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetSelectedControlItem( + [In] int dwIDCtl, + [In] int dwIDItem); // Not valid for OpenDropDown. + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void StartVisualGroup( + [In] int dwIDCtl, + [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void EndVisualGroup(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void MakeProminent([In] int dwIDCtl); + } + + [ComImport, + Guid(ShellIIDGuid.IFileDialogControlEvents), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IFileDialogControlEvents + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnItemSelected( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialogCustomize pfdc, + [In] int dwIDCtl, + [In] int dwIDItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnButtonClicked( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialogCustomize pfdc, + [In] int dwIDCtl); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnCheckButtonToggled( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialogCustomize pfdc, + [In] int dwIDCtl, + [In] bool bChecked); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnControlActivating( + [In, MarshalAs(UnmanagedType.Interface)] IFileDialogCustomize pfdc, + [In] int dwIDCtl); + } + // Restore the warning +#pragma warning restore 0108 + +} diff --git a/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMGuids.cs b/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMGuids.cs new file mode 100644 index 0000000..7b389fc --- /dev/null +++ b/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMGuids.cs @@ -0,0 +1,51 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Controls +{ + internal static class ExplorerBrowserIIDGuid + { + // IID GUID strings for relevant Shell COM interfaces. + internal const string IExplorerBrowser = "DFD3B6B5-C10C-4BE9-85F6-A66969F402F6"; + internal const string IKnownFolderManager = "8BE2D872-86AA-4d47-B776-32CCA40C7018"; + internal const string IFolderView = "cde725b0-ccc9-4519-917e-325d72fab4ce"; + internal const string IFolderView2 = "1af3a467-214f-4298-908e-06b03e0b39f9"; + internal const string IServiceProvider = "6d5140c1-7436-11ce-8034-00aa006009fa"; + internal const string IExplorerPaneVisibility = "e07010ec-bc17-44c0-97b0-46c7c95b9edc"; + internal const string IExplorerBrowserEvents = "361bbdc7-e6ee-4e13-be58-58e2240c810f"; + internal const string IInputObject = "68284fAA-6A48-11D0-8c78-00C04fd918b4"; + internal const string IShellView = "000214E3-0000-0000-C000-000000000046"; + internal const string IDispatch = "00020400-0000-0000-C000-000000000046"; + internal const string DShellFolderViewEvents = "62112AA2-EBE4-11cf-A5FB-0020AFE7292D"; + + internal const string ICommDlgBrowser = "000214F1-0000-0000-C000-000000000046"; + internal const string ICommDlgBrowser2 = "10339516-2894-11d2-9039-00C04F8EEB3E"; + internal const string ICommDlgBrowser3 = "c8ad25a1-3294-41ee-8165-71174bd01c57"; + + } + + internal static class ExplorerBrowserViewPanes + { + internal const string Navigation = "cb316b22-25f7-42b8-8a09-540d23a43c2f"; + internal const string Commands = "d9745868-ca5f-4a76-91cd-f5a129fbb076"; + internal const string CommandsOrganize = "72e81700-e3ec-4660-bf24-3c3b7b648806"; + internal const string CommandsView = "21f7c32d-eeaa-439b-bb51-37b96fd6a943"; + internal const string Details = "43abf98b-89b8-472d-b9ce-e69b8229f019"; + internal const string Preview = "893c63d1-45c8-4d17-be19-223be71be365"; + internal const string Query = "65bcde4f-4f07-4f27-83a7-1afca4df7ddd"; + internal const string AdvancedQuery = "b4e9db8b-34ba-4c39-b5cc-16a1bd2c411c"; + } + + internal static class ExplorerBrowserCLSIDGuid + { + // CLSID GUID strings for relevant coclasses. + internal const string ExplorerBrowser = "71F96385-DDD6-48D3-A0C1-AE06E8B055FB"; + } + + internal static class ExplorerBrowserViewDispatchIds + { + internal const int SelectionChanged = 200; + internal const int ContentsChanged = 207; + internal const int FileListEnumDone = 201; + internal const int SelectedItemChanged = 220; + } +} diff --git a/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMInterfaces.cs b/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMInterfaces.cs new file mode 100644 index 0000000..03a37be --- /dev/null +++ b/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMInterfaces.cs @@ -0,0 +1,796 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell; +using MS.WindowsAPICodePack.Internal; +using System.Text; +using Microsoft.WindowsAPICodePack.Shell.Interop; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + + internal enum ShellViewGetItemObject + { + Background = 0x00000000, + Selection = 0x00000001, + AllView = 0x00000002, + Checked = 0x00000003, + TypeMask = 0x0000000F, + ViewOrderFlag = unchecked((int)0x80000000) + } + + [Flags] + internal enum FolderOptions + { + AutoArrange = 0x00000001, + AbbreviatedNames = 0x00000002, + SnapToGrid = 0x00000004, + OwnerData = 0x00000008, + BestFitWindow = 0x00000010, + Desktop = 0x00000020, + SingleSelection = 0x00000040, + NoSubfolders = 0x00000080, + Transparent = 0x00000100, + NoClientEdge = 0x00000200, + NoScroll = 0x00000400, + AlignLeft = 0x00000800, + NoIcons = 0x00001000, + ShowSelectionAlways = 0x00002000, + NoVisible = 0x00004000, + SingleClickActivate = 0x00008000, + NoWebView = 0x00010000, + HideFilenames = 0x00020000, + CheckSelect = 0x00040000, + NoEnumRefresh = 0x00080000, + NoGrouping = 0x00100000, + FullRowSelect = 0x00200000, + NoFilters = 0x00400000, + NoColumnHeaders = 0x00800000, + NoHeaderInAllViews = 0x01000000, + ExtendedTiles = 0x02000000, + TriCheckSelect = 0x04000000, + AutoCheckSelect = 0x08000000, + NoBrowserViewState = 0x10000000, + SubsetGroups = 0x20000000, + UseSearchFolders = 0x40000000, + AllowRightToLeftReading = unchecked((int)0x80000000) + } + + internal enum FolderViewMode + { + Auto = -1, + First = 1, + Icon = 1, + SmallIcon = 2, + List = 3, + Details = 4, + Thumbnail = 5, + Tile = 6, + Thumbstrip = 7, + Content = 8, + Last = 8 + } + + internal enum ExplorerPaneState + { + DoNotCare = 0x00000000, + DefaultOn = 0x00000001, + DefaultOff = 0x00000002, + StateMask = 0x0000ffff, + InitialState = 0x00010000, + Force = 0x00020000 + } + + [StructLayout(LayoutKind.Sequential, Pack = 4)] + internal class FolderSettings + { + public FolderViewMode ViewMode; + public FolderOptions Options; + } + + [Flags] + internal enum ExplorerBrowserOptions + { + NavigateOnce = 0x00000001, + ShowFrames = 0x00000002, + AlwaysNavigate = 0x00000004, + NoTravelLog = 0x00000008, + NoWrapperWindow = 0x00000010, + HtmlSharepointView = 0x00000020 + } + + internal enum CommDlgBrowserStateChange + { + SetFocus = 0, + KillFocus = 1, + SelectionChange = 2, + Rename = 3, + StateChange = 4 + } + + internal enum CommDlgBrowserNotifyType + { + Done = 1, + Start = 2 + } + + internal enum CommDlgBrowser2ViewFlags + { + ShowAllFiles = 0x00000001, + IsFileSave = 0x00000002, + AllowPreviewPane = 0x00000004, + NoSelectVerb = 0x00000008, + NoIncludeItem = 0x00000010, + IsFolderPicker = 0x00000020 + } + + // Disable warning if a method declaration hides another inherited from a parent COM interface + // To successfully import a COM interface, all inherited methods need to be declared again with + // the exception of those already declared in "IUnknown" +#pragma warning disable 108 + + + [ComImport, + TypeLibType(TypeLibTypeFlags.FCanCreate), + ClassInterface(ClassInterfaceType.None), + Guid(ExplorerBrowserCLSIDGuid.ExplorerBrowser)] + internal class ExplorerBrowserClass : IExplorerBrowser + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void Initialize(IntPtr hwndParent, [In]ref NativeRect prc, [In] FolderSettings pfs); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void Destroy(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void SetRect([In, Out] ref IntPtr phdwp, NativeRect rcBrowser); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void SetPropertyBag([MarshalAs(UnmanagedType.LPWStr)] string pszPropertyBag); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void SetEmptyText([MarshalAs(UnmanagedType.LPWStr)] string pszEmptyText); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern HResult SetFolderSettings(FolderSettings pfs); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern HResult Advise(IntPtr psbe, out uint pdwCookie); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern HResult Unadvise(uint dwCookie); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void SetOptions([In]ExplorerBrowserOptions dwFlag); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void GetOptions(out ExplorerBrowserOptions pdwFlag); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void BrowseToIDList(IntPtr pidl, uint uFlags); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern HResult BrowseToObject([MarshalAs(UnmanagedType.IUnknown)] object punk, uint uFlags); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void FillFromObject([MarshalAs(UnmanagedType.IUnknown)] object punk, int dwFlags); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void RemoveAll(); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + public virtual extern HResult GetCurrentView(ref Guid riid, out IntPtr ppv); + } + + + [ComImport, + InterfaceType(ComInterfaceType.InterfaceIsIUnknown), + Guid(ExplorerBrowserIIDGuid.IExplorerBrowser)] + internal interface IExplorerBrowser + { + /// + /// Prepares the browser to be navigated. + /// + /// A handle to the owner window or control. + /// A pointer to a RECT containing the coordinates of the bounding rectangle + /// the browser will occupy. The coordinates are relative to hwndParent. If this parameter is NULL, + /// then method IExplorerBrowser::SetRect should subsequently be called. + /// A pointer to a FOLDERSETTINGS structure that determines how the folder will be + /// displayed in the view. If this parameter is NULL, then method IExplorerBrowser::SetFolderSettings + /// should be called, otherwise, the default view settings for the folder are used. + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Initialize(IntPtr hwndParent, [In] ref NativeRect prc, [In] FolderSettings pfs); + + /// + /// Destroys the browser. + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Destroy(); + + /// + /// Sets the size and position of the view windows created by the browser. + /// + /// A pointer to a DeferWindowPos handle. This paramater can be NULL. + /// The coordinates that the browser will occupy. + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetRect([In, Out] ref IntPtr phdwp, NativeRect rcBrowser); + + /// + /// Sets the name of the property bag. + /// + /// A pointer to a constant, null-terminated, Unicode string that contains + /// the name of the property bag. View state information that is specific to the application of the + /// client is stored (persisted) using this name. + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetPropertyBag([MarshalAs(UnmanagedType.LPWStr)] string pszPropertyBag); + + /// + /// Sets the default empty text. + /// + /// A pointer to a constant, null-terminated, Unicode string that contains + /// the empty text. + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetEmptyText([MarshalAs(UnmanagedType.LPWStr)] string pszEmptyText); + + /// + /// Sets the folder settings for the current view. + /// + /// A pointer to a FOLDERSETTINGS structure that contains the folder settings + /// to be applied. + /// + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult SetFolderSettings(FolderSettings pfs); + + /// + /// Initiates a connection with IExplorerBrowser for event callbacks. + /// + /// A pointer to the IExplorerBrowserEvents interface of the object to be + /// advised of IExplorerBrowser events + /// When this method returns, contains a token that uniquely identifies + /// the event listener. This allows several event listeners to be subscribed at a time. + /// + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Advise(IntPtr psbe, out uint pdwCookie); + + /// + /// Terminates an advisory connection. + /// + /// A connection token previously returned from IExplorerBrowser::Advise. + /// Identifies the connection to be terminated. + /// + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Unadvise([In] uint dwCookie); + + /// + /// Sets the current browser options. + /// + /// One or more EXPLORER_BROWSER_OPTIONS flags to be set. + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetOptions([In]ExplorerBrowserOptions dwFlag); + + /// + /// Gets the current browser options. + /// + /// When this method returns, contains the current EXPLORER_BROWSER_OPTIONS + /// for the browser. + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetOptions(out ExplorerBrowserOptions pdwFlag); + + /// + /// Browses to a pointer to an item identifier list (PIDL) + /// + /// A pointer to a const ITEMIDLIST (item identifier list) that specifies an object's + /// location as the destination to navigate to. This parameter can be NULL. + /// A flag that specifies the category of the pidl. This affects how + /// navigation is accomplished + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void BrowseToIDList(IntPtr pidl, uint uFlags); + + /// + /// Browse to an object + /// + /// A pointer to an object to browse to. If the object cannot be browsed, + /// an error value is returned. + /// A flag that specifies the category of the pidl. This affects how + /// navigation is accomplished. + /// + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult BrowseToObject([MarshalAs(UnmanagedType.IUnknown)] object punk, uint uFlags); + + /// + /// Creates a results folder and fills it with items. + /// + /// An interface pointer on the source object that will fill the IResultsFolder + /// One of the EXPLORER_BROWSER_FILL_FLAGS + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void FillFromObject([MarshalAs(UnmanagedType.IUnknown)] object punk, int dwFlags); + + /// + /// Removes all items from the results folder. + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void RemoveAll(); + + /// + /// Gets an interface for the current view of the browser. + /// + /// A reference to the desired interface ID. + /// When this method returns, contains the interface pointer requested in riid. + /// This will typically be IShellView or IShellView2. + /// + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetCurrentView(ref Guid riid, out IntPtr ppv); + } + + [ComImport, + Guid(ExplorerBrowserIIDGuid.IServiceProvider), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IServiceProvider + { + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall)] + HResult QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject); + }; + + [ComImport, + Guid(ExplorerBrowserIIDGuid.IFolderView), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IFolderView + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCurrentViewMode([Out] out uint pViewMode); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetCurrentViewMode(uint ViewMode); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFolder(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Item(int iItemIndex, out IntPtr ppidl); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void ItemCount(uint uFlags, out int pcItems); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Items(uint uFlags, ref Guid riid, [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSelectionMarkedItem(out int piItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFocusedItem(out int piItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetItemPosition(IntPtr pidl, out NativePoint ppt); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSpacing([Out] out NativePoint ppt); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDefaultSpacing(out NativePoint ppt); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAutoArrange(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SelectItem(int iItem, uint dwFlags); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SelectAndPositionItems(uint cidl, IntPtr apidl, ref NativePoint apt, uint dwFlags); + } + + [ComImport, + Guid(ExplorerBrowserIIDGuid.IFolderView2), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IFolderView2 : IFolderView + { + // IFolderView + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetCurrentViewMode(out uint pViewMode); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetCurrentViewMode(uint ViewMode); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFolder(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Item(int iItemIndex, out IntPtr ppidl); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult ItemCount(uint uFlags, out int pcItems); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Items(uint uFlags, ref Guid riid, [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSelectionMarkedItem(out int piItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetFocusedItem(out int piItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetItemPosition(IntPtr pidl, out NativePoint ppt); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSpacing([Out] out NativePoint ppt); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDefaultSpacing(out NativePoint ppt); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAutoArrange(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SelectItem(int iItem, uint dwFlags); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SelectAndPositionItems(uint cidl, IntPtr apidl, ref NativePoint apt, uint dwFlags); + + // IFolderView2 + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetGroupBy(IntPtr key, bool fAscending); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetGroupBy(ref IntPtr pkey, ref bool pfAscending); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetViewProperty(IntPtr pidl, IntPtr propkey, object propvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetViewProperty(IntPtr pidl, IntPtr propkey, out object ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetTileViewProperties(IntPtr pidl, [MarshalAs(UnmanagedType.LPWStr)] string pszPropList); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetExtendedTileViewProperties(IntPtr pidl, [MarshalAs(UnmanagedType.LPWStr)] string pszPropList); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetText(int iType, [MarshalAs(UnmanagedType.LPWStr)] string pwszText); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetCurrentFolderFlags(uint dwMask, uint dwFlags); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCurrentFolderFlags(out uint pdwFlags); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSortColumnCount(out int pcColumns); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetSortColumns(IntPtr rgSortColumns, int cColumns); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSortColumns(out IntPtr rgSortColumns, int cColumns); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetItem(int iItem, ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetVisibleItem(int iStart, bool fPrevious, out int piItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSelectedItem(int iStart, out int piItem); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSelection(bool fNoneImpliesFolder, out IShellItemArray ppsia); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSelectionState(IntPtr pidl, out uint pdwFlags); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void InvokeVerbOnSelection([In, MarshalAs(UnmanagedType.LPWStr)] string pszVerb); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult SetViewModeAndIconSize(int uViewMode, int iImageSize); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetViewModeAndIconSize(out int puViewMode, out int piImageSize); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetGroupSubsetCount(uint cVisibleRows); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetGroupSubsetCount(out uint pcVisibleRows); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetRedraw(bool fRedrawOn); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void IsMoveInSameFolder(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void DoRename(); + } + + [ComImport, + Guid(ExplorerBrowserIIDGuid.IExplorerPaneVisibility), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IExplorerPaneVisibility + { + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetPaneState(ref Guid explorerPane, out ExplorerPaneState peps); + }; + + [ComImport, + Guid(ExplorerBrowserIIDGuid.IExplorerBrowserEvents), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IExplorerBrowserEvents + { + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult OnNavigationPending(IntPtr pidlFolder); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult OnViewCreated([MarshalAs(UnmanagedType.IUnknown)] object psv); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult OnNavigationComplete(IntPtr pidlFolder); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult OnNavigationFailed(IntPtr pidlFolder); + } + + #region Unused - Keeping for debugging bug #885228 + + //[ComImport, + // Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser), + // InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + //internal interface ICommDlgBrowser + //{ + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult OnDefaultCommand(IntPtr ppshv); + + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult OnStateChange( + // IntPtr ppshv, + // CommDlgBrowserStateChange uChange); + + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult IncludeObject( + // IntPtr ppshv, + // IntPtr pidl); + //} + + //[ComImport, + // Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser2), + // InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + //internal interface ICommDlgBrowser2 + //{ + // // dlg + + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult OnDefaultCommand(IntPtr ppshv); + + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult OnStateChange( + // IntPtr ppshv, + // CommDlgBrowserStateChange uChange); + + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult IncludeObject( + // IntPtr ppshv, + // IntPtr pidl); + + // // dlg2 + + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult GetDefaultMenuText( + // [In] IShellView shellView, + // StringBuilder buffer, //A pointer to a buffer that is used by the Shell browser to return the default shortcut menu text. + // [In] int bufferMaxLength); //should be max size = 260? + + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult GetViewFlags(CommDlgBrowser2ViewFlags pdwFlags); + + + // [PreserveSig] + // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + // HResult Notify( + // IntPtr pshv, + // CommDlgBrowserNotifyType notifyType); + //} + + #endregion + + [ComImport, + Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser3), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface ICommDlgBrowser3 + { + // dlg1 + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult OnDefaultCommand(IntPtr ppshv); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult OnStateChange( + IntPtr ppshv, + CommDlgBrowserStateChange uChange); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult IncludeObject( + IntPtr ppshv, + IntPtr pidl); + + // dlg2 + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetDefaultMenuText( + IShellView shellView, + IntPtr buffer, //A pointer to a buffer that is used by the Shell browser to return the default shortcut menu text. + int bufferMaxLength); //should be max size = 260? + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetViewFlags( + [Out] out uint pdwFlags); // CommDlgBrowser2ViewFlags + + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Notify( + IntPtr pshv, CommDlgBrowserNotifyType notifyType); + + // dlg3 + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetCurrentFilter( + StringBuilder pszFileSpec, + int cchFileSpec); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult OnColumnClicked( + IShellView ppshv, + int iColumn); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult OnPreViewCreated(IShellView ppshv); + } + + [ComImport, + Guid(ExplorerBrowserIIDGuid.IInputObject), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IInputObject + { + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult UIActivateIO(bool fActivate, ref System.Windows.Forms.Message pMsg); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult HasFocusIO(); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult TranslateAcceleratorIO(ref System.Windows.Forms.Message pMsg); + + }; + + [ComImport, + Guid(ExplorerBrowserIIDGuid.IShellView), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IShellView + { + // IOleWindow + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetWindow( + out IntPtr phwnd); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult ContextSensitiveHelp( + bool fEnterMode); + + // IShellView + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult TranslateAccelerator( + IntPtr pmsg); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult EnableModeless( + bool fEnable); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult UIActivate( + uint uState); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Refresh(); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult CreateViewWindow( + [MarshalAs(UnmanagedType.IUnknown)] object psvPrevious, + IntPtr pfs, + [MarshalAs(UnmanagedType.IUnknown)] object psb, + IntPtr prcView, + out IntPtr phWnd); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult DestroyViewWindow(); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetCurrentInfo( + out IntPtr pfs); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult AddPropertySheetPages( + uint dwReserved, + IntPtr pfn, + uint lparam); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult SaveViewState(); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult SelectItem( + IntPtr pidlItem, + uint uFlags); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetItemObject( + ShellViewGetItemObject uItem, + ref Guid riid, + [MarshalAs(UnmanagedType.IUnknown)] out object ppv); + } + +#pragma warning restore 108 + +} diff --git a/Shell/Interop/ExplorerBrowser/ExplorerBrowserNativeMethods.cs b/Shell/Interop/ExplorerBrowser/ExplorerBrowserNativeMethods.cs new file mode 100644 index 0000000..430d3ef --- /dev/null +++ b/Shell/Interop/ExplorerBrowser/ExplorerBrowserNativeMethods.cs @@ -0,0 +1,33 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using System.Security; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Controls +{ + /// + /// Internal class that contains interop declarations for + /// functions that are not benign and are performance critical. + /// + [SuppressUnmanagedCodeSecurity] + internal static class ExplorerBrowserNativeMethods + { + [DllImport("SHLWAPI.DLL", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern HResult IUnknown_SetSite( + [In, MarshalAs(UnmanagedType.IUnknown)] object punk, + [In, MarshalAs(UnmanagedType.IUnknown)] object punkSite); + + + [DllImport("SHLWAPI.DLL", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern HResult ConnectToConnectionPoint( + [In, MarshalAs(UnmanagedType.IUnknown)] object punk, + ref Guid riidEvent, + [MarshalAs(UnmanagedType.Bool)] bool fConnect, + [In, MarshalAs(UnmanagedType.IUnknown)] object punkTarget, + ref uint pdwCookie, + ref IntPtr ppcpOut); + + } +} diff --git a/Shell/Interop/KnownFolders/KnownFoldersCOMGuids.cs b/Shell/Interop/KnownFolders/KnownFoldersCOMGuids.cs new file mode 100644 index 0000000..a0d6564 --- /dev/null +++ b/Shell/Interop/KnownFolders/KnownFoldersCOMGuids.cs @@ -0,0 +1,25 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal static class KnownFoldersIIDGuid + { + // IID GUID strings for relevant Shell COM interfaces. + internal const string IKnownFolder = "3AA7AF7E-9B36-420c-A8E3-F77D4674A488"; + internal const string IKnownFolderManager = "8BE2D872-86AA-4d47-B776-32CCA40C7018"; + } + + internal static class KnownFoldersCLSIDGuid + { + // CLSID GUID strings for relevant coclasses. + internal const string KnownFolderManager = "4df0c730-df9d-4ae3-9153-aa6b82e9795a"; + } + + internal static class KnownFoldersKFIDGuid + { + internal const string ComputerFolder = "0AC0837C-BBF8-452A-850D-79D08E667CA7"; + internal const string Favorites = "1777F761-68AD-4D8A-87BD-30B759FA33DD"; + internal const string Documents = "FDD39AD0-238F-46AF-ADB4-6C85480369C7"; + internal const string Profile = "5E6C858F-0E22-4760-9AFE-EA3317B67173"; + } +} diff --git a/Shell/Interop/KnownFolders/KnownFoldersCOMInterfaces.cs b/Shell/Interop/KnownFolders/KnownFoldersCOMInterfaces.cs new file mode 100644 index 0000000..04c9fef --- /dev/null +++ b/Shell/Interop/KnownFolders/KnownFoldersCOMInterfaces.cs @@ -0,0 +1,185 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + // Disable warning if a method declaration hides another inherited from a parent COM interface + // To successfully import a COM interface, all inherited methods need to be declared again with + // the exception of those already declared in "IUnknown" +#pragma warning disable 0108 + + [ComImport, + Guid(KnownFoldersIIDGuid.IKnownFolder), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IKnownFolderNative + { + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + Guid GetId(); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + FolderCategory GetCategory(); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + [PreserveSig] + HResult GetShellItem([In] int i, + ref Guid interfaceGuid, + [Out, MarshalAs(UnmanagedType.Interface)] out IShellItem2 shellItem); + + [return: MarshalAs(UnmanagedType.LPWStr)] + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + string GetPath([In] int option); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void SetPath([In] int i, [In] string path); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void GetIDList([In] int i, + [Out] out IntPtr itemIdentifierListPointer); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + Guid GetFolderType(); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + RedirectionCapability GetRedirectionCapabilities(); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void GetFolderDefinition( + [Out, MarshalAs(UnmanagedType.Struct)] out KnownFoldersSafeNativeMethods.NativeFolderDefinition definition); + + } + + [ComImport, + Guid(KnownFoldersIIDGuid.IKnownFolderManager), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IKnownFolderManager + { + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void FolderIdFromCsidl(int csidl, + [Out] out Guid knownFolderID); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void FolderIdToCsidl([In, MarshalAs(UnmanagedType.LPStruct)] Guid id, + [Out] out int csidl); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void GetFolderIds([Out] out IntPtr folders, + [Out] out UInt32 count); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + HResult GetFolder([In, MarshalAs(UnmanagedType.LPStruct)] Guid id, + [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void GetFolderByName(string canonicalName, + [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void RegisterFolder( + [In, MarshalAs(UnmanagedType.LPStruct)] Guid knownFolderGuid, + [In] ref KnownFoldersSafeNativeMethods.NativeFolderDefinition knownFolderDefinition); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void UnregisterFolder( + [In, MarshalAs(UnmanagedType.LPStruct)] Guid knownFolderGuid); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void FindFolderFromPath( + [In, MarshalAs(UnmanagedType.LPWStr)] string path, + [In] int mode, + [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + HResult FindFolderFromIDList(IntPtr pidl, [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + void Redirect(); + } + + [ComImport] + [Guid("4df0c730-df9d-4ae3-9153-aa6b82e9795a")] + internal class KnownFolderManagerClass : IKnownFolderManager + { + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void FolderIdFromCsidl(int csidl, + [Out] out Guid knownFolderID); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void FolderIdToCsidl( + [In, MarshalAs(UnmanagedType.LPStruct)] Guid id, + [Out] out int csidl); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void GetFolderIds( + [Out] out IntPtr folders, + [Out] out UInt32 count); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern HResult GetFolder( + [In, MarshalAs(UnmanagedType.LPStruct)] Guid id, + [Out, MarshalAs(UnmanagedType.Interface)] + out IKnownFolderNative knownFolder); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void GetFolderByName( + string canonicalName, + [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void RegisterFolder( + [In, MarshalAs(UnmanagedType.LPStruct)] Guid knownFolderGuid, + [In] ref KnownFoldersSafeNativeMethods.NativeFolderDefinition knownFolderDefinition); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void UnregisterFolder( + [In, MarshalAs(UnmanagedType.LPStruct)] Guid knownFolderGuid); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void FindFolderFromPath( + [In, MarshalAs(UnmanagedType.LPWStr)] string path, + [In] int mode, + [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder); + + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern HResult FindFolderFromIDList(IntPtr pidl, [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder); + + [MethodImpl(MethodImplOptions.InternalCall, + MethodCodeType = MethodCodeType.Runtime)] + public virtual extern void Redirect(); + } +} diff --git a/Shell/Interop/KnownFolders/KnownFoldersNativeMethods.cs b/Shell/Interop/KnownFolders/KnownFoldersNativeMethods.cs new file mode 100644 index 0000000..a63a557 --- /dev/null +++ b/Shell/Interop/KnownFolders/KnownFoldersNativeMethods.cs @@ -0,0 +1,43 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Internal class that contains interop declarations for + /// functions that are considered benign but that + /// are performance critical. + /// + /// + /// Functions that are benign but not performance critical + /// should be located in the NativeMethods class. + /// + [SuppressUnmanagedCodeSecurity] + internal static class KnownFoldersSafeNativeMethods + { + #region KnownFolders + + [StructLayout(LayoutKind.Sequential)] + internal struct NativeFolderDefinition + { + internal FolderCategory category; + internal IntPtr name; + internal IntPtr description; + internal Guid parentId; + internal IntPtr relativePath; + internal IntPtr parsingName; + internal IntPtr tooltip; + internal IntPtr localizedName; + internal IntPtr icon; + internal IntPtr security; + internal UInt32 attributes; + internal DefinitionOptions definitionOptions; + internal Guid folderTypeId; + } + + #endregion + } +} diff --git a/Shell/Interop/PropertySystem/PropertySystemCOMInterfaces.cs b/Shell/Interop/PropertySystem/PropertySystemCOMInterfaces.cs new file mode 100644 index 0000000..14d84f7 --- /dev/null +++ b/Shell/Interop/PropertySystem/PropertySystemCOMInterfaces.cs @@ -0,0 +1,345 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + // Disable warning if a method declaration hides another inherited from a parent COM interface + // To successfully import a COM interface, all inherited methods need to be declared again with + // the exception of those already declared in "IUnknown" +#pragma warning disable 108 + + #region Property System COM Interfaces + + [ComImport] + [Guid(ShellIIDGuid.IPropertyStoreCapabilities)] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IPropertyStoreCapabilities + { + HResult IsPropertyWritable([In]ref PropertyKey propertyKey); + } + + /// + /// An in-memory property store cache + /// + [ComImport] + [Guid(ShellIIDGuid.IPropertyStoreCache)] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IPropertyStoreCache + { + /// + /// Gets the state of a property stored in the cache + /// + /// + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetState(ref PropertyKey key, [Out] out PropertyStoreCacheState state); + + /// + /// Gets the valeu and state of a property in the cache + /// + /// + /// + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetValueAndState(ref PropertyKey propKey, [Out] PropVariant pv, [Out] out PropertyStoreCacheState state); + + /// + /// Sets the state of a property in the cache. + /// + /// + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult SetState(ref PropertyKey propKey, PropertyStoreCacheState state); + + /// + /// Sets the value and state in the cache. + /// + /// + /// + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult SetValueAndState(ref PropertyKey propKey, [In] PropVariant pv, PropertyStoreCacheState state); + } + + /// + /// A property store + /// + [ComImport] + [Guid(ShellIIDGuid.IPropertyStore)] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IPropertyStore + { + /// + /// Gets the number of properties contained in the property store. + /// + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetCount([Out] out uint propertyCount); + + /// + /// Get a property key located at a specific index. + /// + /// + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetAt([In] uint propertyIndex, out PropertyKey key); + + /// + /// Gets the value of a property from the store + /// + /// + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetValue([In] ref PropertyKey key, [Out] PropVariant pv); + + /// + /// Sets the value of a property in the store + /// + /// + /// + /// + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), PreserveSig] + HResult SetValue([In] ref PropertyKey key, [In] PropVariant pv); + + /// + /// Commits the changes. + /// + /// + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult Commit(); + } + + [ComImport, + Guid(ShellIIDGuid.IPropertyDescriptionList), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IPropertyDescriptionList + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCount(out uint pcElem); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAt([In] uint iElem, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IPropertyDescription ppv); + } + + [ComImport, + Guid(ShellIIDGuid.IPropertyDescription), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IPropertyDescription + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetPropertyKey(out PropertyKey pkey); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCanonicalName([MarshalAs(UnmanagedType.LPWStr)] out string ppszName); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetPropertyType(out VarEnum pvartype); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), + PreserveSig] + HResult GetDisplayName(out IntPtr ppszName); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetEditInvitation(out IntPtr ppszInvite); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetTypeFlags([In] PropertyTypeOptions mask, out PropertyTypeOptions ppdtFlags); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetViewFlags(out PropertyViewOptions ppdvFlags); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetDefaultColumnWidth(out uint pcxChars); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetDisplayType(out PropertyDisplayType pdisplaytype); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetColumnState(out PropertyColumnStateOptions pcsFlags); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetGroupingRange(out PropertyGroupingRange pgr); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetRelativeDescriptionType(out PropertySystemNativeMethods.RelativeDescriptionType prdt); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetRelativeDescription([In] PropVariant propvar1, [In] PropVariant propvar2, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDesc1, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDesc2); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetSortDescription(out PropertySortDescription psd); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetSortDescriptionLabel([In] bool fDescending, out IntPtr ppszDescription); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetAggregationType(out PropertyAggregationType paggtype); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetConditionType(out PropertyConditionType pcontype, out PropertyConditionOperation popDefault); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult GetEnumTypeList([In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyEnumTypeList ppv); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void CoerceToCanonicalValue([In, Out] PropVariant propvar); + [PreserveSig] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] // Note: this method signature may be wrong, but it is not used. + HResult FormatForDisplay([In] PropVariant propvar, [In] ref PropertyDescriptionFormatOptions pdfFlags, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplay); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult IsValueCanonical([In] PropVariant propvar); + } + + [ComImport, + Guid(ShellIIDGuid.IPropertyDescription2), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IPropertyDescription2 : IPropertyDescription + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetPropertyKey(out PropertyKey pkey); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCanonicalName([MarshalAs(UnmanagedType.LPWStr)] out string ppszName); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetPropertyType(out VarEnum pvartype); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDisplayName([MarshalAs(UnmanagedType.LPWStr)] out string ppszName); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetEditInvitation([MarshalAs(UnmanagedType.LPWStr)] out string ppszInvite); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetTypeFlags([In] PropertyTypeOptions mask, out PropertyTypeOptions ppdtFlags); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetViewFlags(out PropertyViewOptions ppdvFlags); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDefaultColumnWidth(out uint pcxChars); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDisplayType(out PropertyDisplayType pdisplaytype); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetColumnState(out uint pcsFlags); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetGroupingRange(out PropertyGroupingRange pgr); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetRelativeDescriptionType(out PropertySystemNativeMethods.RelativeDescriptionType prdt); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetRelativeDescription( + [In] PropVariant propvar1, + [In] PropVariant propvar2, + [MarshalAs(UnmanagedType.LPWStr)] out string ppszDesc1, + [MarshalAs(UnmanagedType.LPWStr)] out string ppszDesc2); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSortDescription(out PropertySortDescription psd); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetSortDescriptionLabel([In] int fDescending, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDescription); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAggregationType(out PropertyAggregationType paggtype); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetConditionType( + out PropertyConditionType pcontype, + out PropertyConditionOperation popDefault); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetEnumTypeList([In] ref Guid riid, out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void CoerceToCanonicalValue([In, Out] PropVariant ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void FormatForDisplay([In] PropVariant propvar, [In] ref PropertyDescriptionFormatOptions pdfFlags, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplay); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + HResult IsValueCanonical([In] PropVariant propvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetImageReferenceForValue( + [In] PropVariant propvar, + [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszImageRes); + } + + [ComImport, + Guid(ShellIIDGuid.IPropertyEnumType), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IPropertyEnumType + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetEnumType([Out] out PropEnumType penumtype); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetValue([Out] PropVariant ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetRangeMinValue([Out] PropVariant ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetRangeSetValue([Out] PropVariant ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDisplayText([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplay); + } + + [ComImport, + Guid(ShellIIDGuid.IPropertyEnumType2), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IPropertyEnumType2 : IPropertyEnumType + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetEnumType([Out] out PropEnumType penumtype); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetValue([Out] PropVariant ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetRangeMinValue([Out] PropVariant ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetRangeSetValue([Out] PropVariant ppropvar); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetDisplayText([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplay); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetImageReference([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszImageRes); + } + + + [ComImport, + Guid(ShellIIDGuid.IPropertyEnumTypeList), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IPropertyEnumTypeList + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetCount([Out] out uint pctypes); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetAt( + [In] uint itype, + [In] ref Guid riid, // riid may be IID_IPropertyEnumType + [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyEnumType ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetConditionAt( + [In] uint index, + [In] ref Guid riid, + out IntPtr ppv); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void FindMatchingIndex( + [In] PropVariant propvarCmp, + [Out] out uint pnIndex); + } + + #endregion + +#pragma warning restore 108 + +} diff --git a/Shell/Interop/PropertySystem/PropertySystemNativeMethods.cs b/Shell/Interop/PropertySystem/PropertySystemNativeMethods.cs new file mode 100644 index 0000000..12ffa70 --- /dev/null +++ b/Shell/Interop/PropertySystem/PropertySystemNativeMethods.cs @@ -0,0 +1,62 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + internal static class PropertySystemNativeMethods + { + #region Property Definitions + + internal enum RelativeDescriptionType + { + General, + Date, + Size, + Count, + Revision, + Length, + Duration, + Speed, + Rate, + Rating, + Priority + } + + #endregion + + #region Property System Helpers + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int PSGetNameFromPropertyKey( + ref PropertyKey propkey, + [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszCanonicalName + ); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern HResult PSGetPropertyDescription( + ref PropertyKey propkey, + ref Guid riid, + [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyDescription ppv + ); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int PSGetPropertyKeyFromName( + [In, MarshalAs(UnmanagedType.LPWStr)] string pszCanonicalName, + out PropertyKey propkey + ); + + [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern int PSGetPropertyDescriptionListFromString( + [In, MarshalAs(UnmanagedType.LPWStr)] string pszPropList, + [In] ref Guid riid, + out IPropertyDescriptionList ppv + ); + + + + #endregion + } +} diff --git a/Shell/Interop/ShellExtensions/HandlerNativeMethods.cs b/Shell/Interop/ShellExtensions/HandlerNativeMethods.cs new file mode 100644 index 0000000..7acf531 --- /dev/null +++ b/Shell/Interop/ShellExtensions/HandlerNativeMethods.cs @@ -0,0 +1,226 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; + +namespace Microsoft.WindowsAPICodePack.Shell.Interop +{ + internal static class HandlerNativeMethods + { + [DllImport("user32.dll")] + internal static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + internal static extern IntPtr GetFocus(); + + internal static readonly Guid PreviewHandlerGuid = new Guid("{8895b1c6-b41f-4c1c-a562-0d564250836f}"); + internal static readonly Guid ThumbnailProviderGuid = new Guid("{e357fccd-a995-4576-b01f-234630154e96}"); + } + + #region Interfaces + + /// + /// ComVisible interface for native IThumbnailProvider + /// + [ComVisible(true)] + [Guid("e357fccd-a995-4576-b01f-234630154e96")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IThumbnailProvider + { + /// + /// Gets a pointer to a bitmap to display as a thumbnail + /// + /// + /// + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "2#"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "1#")] + void GetThumbnail(uint squareLength, out IntPtr bitmapHandle, out UInt32 bitmapType); + } + + /// + /// Provides means by which to intiailze with a file. + /// + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("b7d14566-0509-4cce-a71f-0a554233bd9b")] + public interface IInitializeWithFile + { + /// + /// Initializes with a file. + /// + /// + /// + void Initialize([MarshalAs(UnmanagedType.LPWStr)] string filePath, AccessModes fileMode); + } + + /// + /// Provides means by which to initialize with a stream. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] + [ComVisible(true)] + [Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IInitializeWithStream + { + /// + /// Initializes with a stream. + /// + /// + /// + void Initialize(IStream stream, AccessModes fileMode); + } + + /// + /// Provides means by which to initialize with a ShellObject + /// + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("7f73be3f-fb79-493c-a6c7-7ee14e245841")] + public interface IInitializeWithItem + { + /// + /// Initializes with ShellItem + /// + /// + /// + void Initialize(IntPtr shellItem, AccessModes accessMode); + } + + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("fc4801a3-2ba9-11cf-a229-00aa003d7352")] + interface IObjectWithSite + { + void SetSite([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkSite); + void GetSite(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppvSite); + } + + [ComImport] + [Guid("00000114-0000-0000-C000-000000000046")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IOleWindow + { + void GetWindow(out IntPtr phwnd); + void ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); + } + + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("8895b1c6-b41f-4c1c-a562-0d564250836f")] + interface IPreviewHandler + { + void SetWindow(IntPtr hwnd, ref RECT rect); + void SetRect(ref RECT rect); + void DoPreview(); + void Unload(); + void SetFocus(); + void QueryFocus(out IntPtr phwnd); + [PreserveSig] + uint TranslateAccelerator(ref MSG pmsg); + } + + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("fec87aaf-35f9-447a-adb7-20234491401a")] + interface IPreviewHandlerFrame + { + void GetWindowContext(IntPtr pinfo); + [PreserveSig] + uint TranslateAccelerator(ref MSG pmsg); + }; + + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("8327b13c-b63f-4b24-9b8a-d010dcc3f599")] + interface IPreviewHandlerVisuals + { + void SetBackgroundColor(COLORREF color); + void SetFont(ref LogFont plf); + void SetTextColor(COLORREF color); + } + #endregion + + #region Structs + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + internal class LogFont + { + internal int height; + internal int width; + internal int escapement; + internal int orientation; + internal int weight; + internal byte italic; + internal byte underline; + internal byte strikeOut; + internal byte charSet; + internal byte outPrecision; + internal byte clipPrecision; + internal byte quality; + internal byte pitchAndFamily; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + internal string lfFaceName = string.Empty; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct COLORREF + { + public uint Dword; + public Color Color + { + get + { + return Color.FromArgb( + (int)(0x000000FFU & Dword), + (int)(0x0000FF00U & Dword) >> 8, + (int)(0x00FF0000U & Dword) >> 16); + } + } + } + + [StructLayout(LayoutKind.Sequential)] + internal struct MSG + { + public IntPtr hwnd; + public int message; + public IntPtr wParam; + public IntPtr lParam; + public int time; + public int pt_x; + public int pt_y; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct RECT + { + public readonly int left; + public readonly int top; + public readonly int right; + public readonly int bottom; + public Rectangle ToRectangle() { return Rectangle.FromLTRB(left, top, right, bottom); } + } + + #endregion + + /// + /// Thumbnail Alpha Types + /// + public enum ThumbnailAlphaType + { + /// + /// Let the system decide. + /// + Unknown = 0, + + /// + /// No transparency + /// + NoAlphaChannel = 1, + + /// + /// Has transparency + /// + HasAlphaChannel = 2, + } + +} diff --git a/Shell/Interop/ShellObjectWatcher/ShellObjectWatcherNativeMethods.cs b/Shell/Interop/ShellObjectWatcher/ShellObjectWatcherNativeMethods.cs new file mode 100644 index 0000000..bc74d73 --- /dev/null +++ b/Shell/Interop/ShellObjectWatcher/ShellObjectWatcherNativeMethods.cs @@ -0,0 +1,198 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using MS.WindowsAPICodePack.Internal; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; + +namespace Microsoft.WindowsAPICodePack.Shell.Interop +{ + + internal static class ShellObjectWatcherNativeMethods + { + [DllImport("Ole32.dll")] + public static extern HResult CreateBindCtx( + int reserved, // must be 0 + [Out] out IBindCtx bindCtx); + + [DllImport("User32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern uint RegisterClassEx( + ref WindowClassEx windowClass + ); + + [DllImport("User32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern IntPtr CreateWindowEx( + int extendedStyle, + [MarshalAs(UnmanagedType.LPWStr)] + string className, //string className, //optional + [MarshalAs(UnmanagedType.LPWStr)] + string windowName, //window name + int style, + int x, + int y, + int width, + int height, + IntPtr parentHandle, + IntPtr menuHandle, + IntPtr instanceHandle, + IntPtr additionalData); + + [DllImport("User32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool GetMessage( + [Out] out Message message, + IntPtr windowHandle, + uint filterMinMessage, + uint filterMaxMessage); + + [DllImport("User32.dll")] + public static extern int DefWindowProc( + IntPtr hwnd, + uint msg, + IntPtr wparam, + IntPtr lparam); + + [DllImport("User32.dll")] + public static extern void DispatchMessage([In] ref Message message); + + public delegate int WndProcDelegate(IntPtr hwnd, uint msg, IntPtr wparam, IntPtr lparam); + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct WindowClassEx + { + internal uint Size; + internal uint Style; + + internal ShellObjectWatcherNativeMethods.WndProcDelegate WndProc; + + internal int ExtraClassBytes; + internal int ExtraWindowBytes; + internal IntPtr InstanceHandle; + internal IntPtr IconHandle; + internal IntPtr CursorHandle; + internal IntPtr BackgroundBrushHandle; + + internal string MenuName; + internal string ClassName; + + internal IntPtr SmallIconHandle; + } + + /// + /// Wraps the native Windows MSG structure. + /// + public struct Message + { + private IntPtr windowHandle; + private uint msg; + private IntPtr wparam; + private IntPtr lparam; + private int time; + private NativePoint point; + + /// + /// Gets the window handle + /// + public IntPtr WindowHandle { get { return windowHandle; } } + + /// + /// Gets the window message + /// + public uint Msg { get { return msg; } } + + /// + /// Gets the WParam + /// + public IntPtr WParam { get { return wparam; } } + + /// + /// Gets the LParam + /// + public IntPtr LParam { get { return lparam; } } + + /// + /// Gets the time + /// + public int Time { get { return time; } } + + /// + /// Gets the point + /// + public NativePoint Point { get { return point; } } + + /// + /// Creates a new instance of the Message struct + /// + /// Window handle + /// Message + /// WParam + /// LParam + /// Time + /// Point + internal Message(IntPtr windowHandle, uint msg, IntPtr wparam, IntPtr lparam, int time, NativePoint point) + : this() + { + this.windowHandle = windowHandle; + this.msg = msg; + this.wparam = wparam; + this.lparam = lparam; + this.time = time; + this.point = point; + } + + /// + /// Determines if two messages are equal. + /// + /// First message + /// Second message + /// True if first and second message are equal; false otherwise. + public static bool operator ==(Message first, Message second) + { + return first.WindowHandle == second.WindowHandle + && first.Msg == second.Msg + && first.WParam == second.WParam + && first.LParam == second.LParam + && first.Time == second.Time + && first.Point == second.Point; + } + + /// + /// Determines if two messages are not equal. + /// + /// First message + /// Second message + /// True if first and second message are not equal; false otherwise. + public static bool operator !=(Message first, Message second) + { + return !(first == second); + } + + /// + /// Determines if this message is equal to another. + /// + /// Another message + /// True if this message is equal argument; false otherwise. + public override bool Equals(object obj) + { + return (obj != null && obj is Message) ? this == (Message)obj : false; + } + + /// + /// Gets a hash code for the message. + /// + /// Hash code for this message. + public override int GetHashCode() + { + int hash = WindowHandle.GetHashCode(); + hash = hash * 31 + Msg.GetHashCode(); + hash = hash * 31 + WParam.GetHashCode(); + hash = hash * 31 + LParam.GetHashCode(); + hash = hash * 31 + Time.GetHashCode(); + hash = hash * 31 + Point.GetHashCode(); + return hash; + } + } + +} diff --git a/Shell/Interop/StockIcons/StockIconsNativeMethods.cs b/Shell/Interop/StockIcons/StockIconsNativeMethods.cs new file mode 100644 index 0000000..0ffd336 --- /dev/null +++ b/Shell/Interop/StockIcons/StockIconsNativeMethods.cs @@ -0,0 +1,83 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal static class StockIconsNativeMethods + { + #region StockIcon declarations + + /// + /// Specifies options for the appearance of the + /// stock icon. + /// + [Flags] + internal enum StockIconOptions + { + /// + /// Retrieve the small version of the icon, as specified by + /// SM_CXICON and SM_CYICON system metrics. + /// + Large = 0x000000000, + + /// + /// Retrieve the small version of the icon, as specified by + /// SM_CXSMICON and SM_CYSMICON system metrics. + /// + Small = 0x000000001, + + /// + /// Retrieve the shell-sized icons (instead of the + /// size specified by the system metrics). + /// + ShellSize = 0x000000004, + + /// + /// Specified that the hIcon member of the SHSTOCKICONINFO + /// structure receives a handle to the specified icon. + /// + Handle = 0x000000100, + + /// + /// Specifies that the iSysImageImage member of the SHSTOCKICONINFO + /// structure receives the index of the specified + /// icon in the system imagelist. + /// + SystemIndex = 0x000004000, + + /// + /// Adds the link overlay to the icon. + /// + LinkOverlay = 0x000008000, + + /// + /// Adds the system highlight color to the icon. + /// + Selected = 0x000010000 + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct StockIconInfo + { + internal UInt32 StuctureSize; + internal IntPtr Handle; + internal Int32 ImageIndex; + internal Int32 Identifier; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + internal string Path; + } + + [PreserveSig] + [DllImport("Shell32.dll", CharSet = CharSet.Unicode, + ExactSpelling = true, SetLastError = false)] + internal static extern HResult SHGetStockIconInfo( + StockIconIdentifier identifier, + StockIconOptions flags, + ref StockIconInfo info); + + #endregion + } +} diff --git a/Shell/Interop/Taskbar/TabbedThumbnailNativeMethods.cs b/Shell/Interop/Taskbar/TabbedThumbnailNativeMethods.cs new file mode 100644 index 0000000..9c10ad4 --- /dev/null +++ b/Shell/Interop/Taskbar/TabbedThumbnailNativeMethods.cs @@ -0,0 +1,210 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Shell.Interop; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + internal static class TabbedThumbnailNativeMethods + { + internal const int DisplayFrame = 0x00000001; + + internal const int ForceIconicRepresentation = 7; + internal const int HasIconicBitmap = 10; + + internal const uint WmDwmSendIconicThumbnail = 0x0323; + internal const uint WmDwmSendIconicLivePreviewBitmap = 0x0326; + + internal const uint WaActive = 1; + internal const uint WaClickActive = 2; + + internal const int ScClose = 0xF060; + internal const int ScMaximize = 0xF030; + internal const int ScMinimize = 0xF020; + + internal const uint MsgfltAdd = 1; + internal const uint MsgfltRemove = 2; + + [DllImport("dwmapi.dll")] + internal static extern int DwmSetIconicThumbnail( + IntPtr hwnd, IntPtr hbitmap, uint flags); + + [DllImport("dwmapi.dll")] + internal static extern int DwmInvalidateIconicBitmaps(IntPtr hwnd); + + [DllImport("dwmapi.dll")] + internal static extern int DwmSetIconicLivePreviewBitmap( + IntPtr hwnd, + IntPtr hbitmap, + ref NativePoint ptClient, + uint flags); + + [DllImport("dwmapi.dll")] + internal static extern int DwmSetIconicLivePreviewBitmap( + IntPtr hwnd, IntPtr hbitmap, IntPtr ptClient, uint flags); + + [DllImport("dwmapi.dll", PreserveSig = true)] + internal static extern int DwmSetWindowAttribute( + IntPtr hwnd, + //DWMWA_* values. + uint dwAttributeToSet, + IntPtr pvAttributeValue, + uint cbAttribute); + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool GetWindowRect(IntPtr hwnd, ref NativeRect rect); + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool GetClientRect(IntPtr hwnd, ref NativeRect rect); + + internal static bool GetClientSize(IntPtr hwnd, out System.Drawing.Size size) + { + NativeRect rect = new NativeRect(); + if (!GetClientRect(hwnd, ref rect)) + { + size = new System.Drawing.Size(-1, -1); + return false; + } + size = new System.Drawing.Size(rect.Right, rect.Bottom); + return true; + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool ClientToScreen( + IntPtr hwnd, + ref NativePoint point); + + + [DllImport("gdi32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool StretchBlt( + IntPtr hDestDC, int destX, int destY, int destWidth, int destHeight, + IntPtr hSrcDC, int srcX, int srcY, int srcWidth, int srcHeight, + uint operation); + + [DllImport("user32.dll")] + internal static extern IntPtr GetWindowDC(IntPtr hwnd); + + [DllImport("user32.dll")] + internal static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc); + + [DllImport("user32.dll", SetLastError = true)] + internal static extern IntPtr ChangeWindowMessageFilter(uint message, uint dwFlag); + + /// + /// Sets the specified iconic thumbnail for the specified window. + /// This is typically done in response to a DWM message. + /// + /// The window handle. + /// The thumbnail bitmap. + internal static void SetIconicThumbnail(IntPtr hwnd, IntPtr hBitmap) + { + int rc = DwmSetIconicThumbnail( + hwnd, + hBitmap, + DisplayFrame); + if (rc != 0) + { + throw Marshal.GetExceptionForHR(rc); + } + } + + /// + /// Sets the specified peek (live preview) bitmap for the specified + /// window. This is typically done in response to a DWM message. + /// + /// The window handle. + /// The thumbnail bitmap. + /// Whether to display a standard window + /// frame around the bitmap. + internal static void SetPeekBitmap(IntPtr hwnd, IntPtr bitmap, bool displayFrame) + { + int rc = DwmSetIconicLivePreviewBitmap( + hwnd, + bitmap, + IntPtr.Zero, + displayFrame ? DisplayFrame : (uint)0); + if (rc != 0) + { + throw Marshal.GetExceptionForHR(rc); + } + } + + /// + /// Sets the specified peek (live preview) bitmap for the specified + /// window. This is typically done in response to a DWM message. + /// + /// The window handle. + /// The thumbnail bitmap. + /// The client area offset at which to display + /// the specified bitmap. The rest of the parent window will be + /// displayed as "remembered" by the DWM. + /// Whether to display a standard window + /// frame around the bitmap. + internal static void SetPeekBitmap(IntPtr hwnd, IntPtr bitmap, System.Drawing.Point offset, bool displayFrame) + { + var nativePoint = new NativePoint(offset.X, offset.Y); + int rc = DwmSetIconicLivePreviewBitmap( + hwnd, + bitmap, + ref nativePoint, + displayFrame ? DisplayFrame : (uint)0); + + if (rc != 0) + { + Exception e = Marshal.GetExceptionForHR(rc); + + if (e is ArgumentException) + { + // Ignore argument exception as it's not really recommended to be throwing + // exception when rendering the peek bitmap. If it's some other kind of exception, + // then throw it. + } + else + { + throw e; + } + } + } + + /// + /// Call this method to either enable custom previews on the taskbar (second argument as true) + /// or to disable (second argument as false). If called with True, the method will call DwmSetWindowAttribute + /// for the specific window handle and let DWM know that we will be providing a custom bitmap for the thumbnail + /// as well as Aero peek. + /// + /// + /// + internal static void EnableCustomWindowPreview(IntPtr hwnd, bool enable) + { + IntPtr t = Marshal.AllocHGlobal(4); + Marshal.WriteInt32(t, enable ? 1 : 0); + + try + { + int rc = DwmSetWindowAttribute(hwnd, HasIconicBitmap, t, 4); + if (rc != 0) + { + throw Marshal.GetExceptionForHR(rc); + } + + rc = DwmSetWindowAttribute(hwnd, ForceIconicRepresentation, t, 4); + if (rc != 0) + { + throw Marshal.GetExceptionForHR(rc); + } + } + finally + { + Marshal.FreeHGlobal(t); + } + } + + } +} diff --git a/Shell/Interop/Taskbar/TaskbarCOMInterfaces.cs b/Shell/Interop/Taskbar/TaskbarCOMInterfaces.cs new file mode 100644 index 0000000..96ef577 --- /dev/null +++ b/Shell/Interop/Taskbar/TaskbarCOMInterfaces.cs @@ -0,0 +1,154 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + [ComImportAttribute()] + [GuidAttribute("6332DEBF-87B5-4670-90C0-5E57B408A49E")] + [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] + internal interface ICustomDestinationList + { + void SetAppID( + [MarshalAs(UnmanagedType.LPWStr)] string pszAppID); + [PreserveSig] + HResult BeginList( + out uint cMaxSlots, + ref Guid riid, + [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject); + [PreserveSig] + HResult AppendCategory( + [MarshalAs(UnmanagedType.LPWStr)] string pszCategory, + [MarshalAs(UnmanagedType.Interface)] IObjectArray poa); + void AppendKnownCategory( + [MarshalAs(UnmanagedType.I4)] KnownDestinationCategory category); + [PreserveSig] + HResult AddUserTasks( + [MarshalAs(UnmanagedType.Interface)] IObjectArray poa); + void CommitList(); + void GetRemovedDestinations( + ref Guid riid, + [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject); + void DeleteList( + [MarshalAs(UnmanagedType.LPWStr)] string pszAppID); + void AbortList(); + } + + [GuidAttribute("77F10CF0-3DB5-4966-B520-B7C54FD35ED6")] + [ClassInterfaceAttribute(ClassInterfaceType.None)] + [ComImportAttribute()] + internal class CDestinationList { } + + [ComImportAttribute()] + [GuidAttribute("92CA9DCD-5622-4BBA-A805-5E9F541BD8C9")] + [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IObjectArray + { + void GetCount(out uint cObjects); + void GetAt( + uint iIndex, + ref Guid riid, + [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject); + } + + [ComImportAttribute()] + [GuidAttribute("5632B1A4-E38A-400A-928A-D4CD63230295")] + [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IObjectCollection + { + // IObjectArray + [PreserveSig] + void GetCount(out uint cObjects); + [PreserveSig] + void GetAt( + uint iIndex, + ref Guid riid, + [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject); + + // IObjectCollection + void AddObject( + [MarshalAs(UnmanagedType.Interface)] object pvObject); + void AddFromArray( + [MarshalAs(UnmanagedType.Interface)] IObjectArray poaSource); + void RemoveObject(uint uiIndex); + void Clear(); + } + + [GuidAttribute("2D3468C1-36A7-43B6-AC24-D3F02FD9607A")] + [ClassInterfaceAttribute(ClassInterfaceType.None)] + [ComImportAttribute()] + internal class CEnumerableObjectCollection { } + + [ComImportAttribute()] + [GuidAttribute("c43dc798-95d1-4bea-9030-bb99e2983a1a")] + [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] + internal interface ITaskbarList4 + { + // ITaskbarList + [PreserveSig] + void HrInit(); + [PreserveSig] + void AddTab(IntPtr hwnd); + [PreserveSig] + void DeleteTab(IntPtr hwnd); + [PreserveSig] + void ActivateTab(IntPtr hwnd); + [PreserveSig] + void SetActiveAlt(IntPtr hwnd); + + // ITaskbarList2 + [PreserveSig] + void MarkFullscreenWindow( + IntPtr hwnd, + [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); + + // ITaskbarList3 + [PreserveSig] + void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal); + [PreserveSig] + void SetProgressState(IntPtr hwnd, TaskbarProgressBarStatus tbpFlags); + [PreserveSig] + void RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); + [PreserveSig] + void UnregisterTab(IntPtr hwndTab); + [PreserveSig] + void SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); + [PreserveSig] + void SetTabActive(IntPtr hwndTab, IntPtr hwndInsertBefore, uint dwReserved); + [PreserveSig] + HResult ThumbBarAddButtons( + IntPtr hwnd, + uint cButtons, + [MarshalAs(UnmanagedType.LPArray)] ThumbButton[] pButtons); + [PreserveSig] + HResult ThumbBarUpdateButtons( + IntPtr hwnd, + uint cButtons, + [MarshalAs(UnmanagedType.LPArray)] ThumbButton[] pButtons); + [PreserveSig] + void ThumbBarSetImageList(IntPtr hwnd, IntPtr himl); + [PreserveSig] + void SetOverlayIcon( + IntPtr hwnd, + IntPtr hIcon, + [MarshalAs(UnmanagedType.LPWStr)] string pszDescription); + [PreserveSig] + void SetThumbnailTooltip( + IntPtr hwnd, + [MarshalAs(UnmanagedType.LPWStr)] string pszTip); + [PreserveSig] + void SetThumbnailClip( + IntPtr hwnd, + IntPtr prcClip); + + // ITaskbarList4 + void SetTabProperties(IntPtr hwndTab, SetTabPropertiesOption stpFlags); + } + + [GuidAttribute("56FDF344-FD6D-11d0-958A-006097C9A090")] + [ClassInterfaceAttribute(ClassInterfaceType.None)] + [ComImportAttribute()] + internal class CTaskbarList { } +} diff --git a/Shell/Interop/Taskbar/TaskbarNativeMethods.cs b/Shell/Interop/Taskbar/TaskbarNativeMethods.cs new file mode 100644 index 0000000..b5ae125 --- /dev/null +++ b/Shell/Interop/Taskbar/TaskbarNativeMethods.cs @@ -0,0 +1,210 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + #region Enums + internal enum KnownDestinationCategory + { + Frequent = 1, + Recent + } + + internal enum ShellAddToRecentDocs + { + Pidl = 0x1, + PathA = 0x2, + PathW = 0x3, + AppIdInfo = 0x4, // indicates the data type is a pointer to a SHARDAPPIDINFO structure + AppIdInfoIdList = 0x5, // indicates the data type is a pointer to a SHARDAPPIDINFOIDLIST structure + Link = 0x6, // indicates the data type is a pointer to an IShellLink instance + AppIdInfoLink = 0x7, // indicates the data type is a pointer to a SHARDAPPIDINFOLINK structure + } + + internal enum TaskbarProgressBarStatus + { + NoProgress = 0, + Indeterminate = 0x1, + Normal = 0x2, + Error = 0x4, + Paused = 0x8 + } + + internal enum TaskbarActiveTabSetting + { + UseMdiThumbnail = 0x1, + UseMdiLivePreview = 0x2 + } + + internal enum ThumbButtonMask + { + Bitmap = 0x1, + Icon = 0x2, + Tooltip = 0x4, + THB_FLAGS = 0x8 + } + + [Flags] + internal enum ThumbButtonOptions + { + Enabled = 0x00000000, + Disabled = 0x00000001, + DismissOnClick = 0x00000002, + NoBackground = 0x00000004, + Hidden = 0x00000008, + NonInteractive = 0x00000010 + } + + internal enum SetTabPropertiesOption + { + None = 0x0, + UseAppThumbnailAlways = 0x1, + UseAppThumbnailWhenActive = 0x2, + UseAppPeekAlways = 0x4, + UseAppPeekWhenActive = 0x8 + } + + #endregion + + #region Structs + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + internal struct ThumbButton + { + /// + /// WPARAM value for a THUMBBUTTON being clicked. + /// + internal const int Clicked = 0x1800; + + [MarshalAs(UnmanagedType.U4)] + internal ThumbButtonMask Mask; + internal uint Id; + internal uint Bitmap; + internal IntPtr Icon; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + internal string Tip; + [MarshalAs(UnmanagedType.U4)] + internal ThumbButtonOptions Flags; + } + #endregion; + + internal static class TaskbarNativeMethods + { + internal static class TaskbarGuids + { + internal static Guid IObjectArray = new Guid("92CA9DCD-5622-4BBA-A805-5E9F541BD8C9"); + internal static Guid IUnknown = new Guid("00000000-0000-0000-C000-000000000046"); + } + + internal const int WmCommand = 0x0111; + + // Register Window Message used by Shell to notify that the corresponding taskbar button has been added to the taskbar. + internal static readonly uint WmTaskbarButtonCreated = RegisterWindowMessage("TaskbarButtonCreated"); + + internal const uint WmDwmSendIconThumbnail = 0x0323; + internal const uint WmDwmSendIconicLivePreviewBitmap = 0x0326; + + #region Methods + + [DllImport("shell32.dll")] + internal static extern void SetCurrentProcessExplicitAppUserModelID( + [MarshalAs(UnmanagedType.LPWStr)] string AppID); + + [DllImport("shell32.dll")] + internal static extern void GetCurrentProcessExplicitAppUserModelID( + [Out(), MarshalAs(UnmanagedType.LPWStr)] out string AppID); + + [DllImport("shell32.dll")] + internal static extern void SHAddToRecentDocs( + ShellAddToRecentDocs flags, + [MarshalAs(UnmanagedType.LPWStr)] string path); + + internal static void SHAddToRecentDocs(string path) + { + SHAddToRecentDocs(ShellAddToRecentDocs.PathW, path); + } + + [DllImport("user32.dll", EntryPoint = "RegisterWindowMessage", SetLastError = true, CharSet = CharSet.Unicode)] + internal static extern uint RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString); + + + [DllImport("shell32.dll")] + public static extern int SHGetPropertyStoreForWindow( + IntPtr hwnd, + ref Guid iid /*IID_IPropertyStore*/, + [Out(), MarshalAs(UnmanagedType.Interface)]out IPropertyStore propertyStore); + + /// + /// Sets the window's application id by its window handle. + /// + /// The window handle. + /// The application id. + internal static void SetWindowAppId(IntPtr hwnd, string appId) + { + SetWindowProperty(hwnd, SystemProperties.System.AppUserModel.ID, appId); + } + + internal static void SetWindowProperty(IntPtr hwnd, PropertyKey propkey, string value) + { + // Get the IPropertyStore for the given window handle + IPropertyStore propStore = GetWindowPropertyStore(hwnd); + + // Set the value + using (PropVariant pv = new PropVariant(value)) + { + HResult result = propStore.SetValue(ref propkey, pv); + if (!CoreErrorHelper.Succeeded(result)) + { + throw new ShellException(result); + } + } + + + // Dispose the IPropertyStore and PropVariant + Marshal.ReleaseComObject(propStore); + } + + internal static IPropertyStore GetWindowPropertyStore(IntPtr hwnd) + { + IPropertyStore propStore; + Guid guid = new Guid(ShellIIDGuid.IPropertyStore); + int rc = SHGetPropertyStoreForWindow( + hwnd, + ref guid, + out propStore); + if (rc != 0) + { + throw Marshal.GetExceptionForHR(rc); + } + return propStore; + } + + #endregion + } + + /// + /// Thumbnail Alpha Types + /// + public enum ThumbnailAlphaType + { + /// + /// Let the system decide. + /// + Unknown = 0, + + /// + /// No transparency + /// + NoAlphaChannel = 1, + + /// + /// Has transparency + /// + HasAlphaChannel = 2, + } +} diff --git a/Shell/KnownFolders/DefinitionOptions.cs b/Shell/KnownFolders/DefinitionOptions.cs new file mode 100644 index 0000000..b66c174 --- /dev/null +++ b/Shell/KnownFolders/DefinitionOptions.cs @@ -0,0 +1,32 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Specifies behaviors for known folders. + /// + [Flags] + public enum DefinitionOptions + { + /// + /// No behaviors are defined. + /// + None = 0x0, + /// + /// Prevents a per-user known folder from being + /// redirected to a network location. + /// + LocalRedirectOnly = 0x2, + + /// + /// The known folder can be roamed through PC-to-PC synchronization. + /// + Roamable = 0x4, + + /// + /// Creates the known folder when the user first logs on. + /// + Precreate = 0x8 + } +} \ No newline at end of file diff --git a/Shell/KnownFolders/FileSystemKnownFolder.cs b/Shell/KnownFolders/FileSystemKnownFolder.cs new file mode 100644 index 0000000..6f5fd0d --- /dev/null +++ b/Shell/KnownFolders/FileSystemKnownFolder.cs @@ -0,0 +1,282 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a registered file system Known Folder + /// + public class FileSystemKnownFolder : ShellFileSystemFolder, IKnownFolder, IDisposable + { + #region Private Fields + + private IKnownFolderNative knownFolderNative; + private KnownFolderSettings knownFolderSettings; + + #endregion + + #region Internal Constructors + + internal FileSystemKnownFolder(IShellItem2 shellItem) : base(shellItem) { } + + internal FileSystemKnownFolder(IKnownFolderNative kf) + { + Debug.Assert(kf != null); + knownFolderNative = kf; + + // Set the native shell item + // and set it on the base class (ShellObject) + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + knownFolderNative.GetShellItem(0, ref guid, out nativeShellItem); + } + + #endregion + + #region Private Members + + private KnownFolderSettings KnownFolderSettings + { + get + { + if (knownFolderNative == null) + { + // We need to get the PIDL either from the NativeShellItem, + // or from base class's property (if someone already set it on us). + // Need to use the PIDL to get the native IKnownFolder interface. + + // Get the PIDL for the ShellItem + if (nativeShellItem != null && base.PIDL == IntPtr.Zero) + { + base.PIDL = ShellHelper.PidlFromShellItem(nativeShellItem); + } + + // If we have a valid PIDL, get the native IKnownFolder + if (base.PIDL != IntPtr.Zero) + { + knownFolderNative = KnownFolderHelper.FromPIDL(base.PIDL); + } + + Debug.Assert(knownFolderNative != null); + } + + // If this is the first time this property is being called, + // get the native Folder Defination (KnownFolder properties) + if (knownFolderSettings == null) + { + knownFolderSettings = new KnownFolderSettings(knownFolderNative); + } + + return knownFolderSettings; + } + } + + #endregion + + #region IKnownFolder Members + + /// + /// Gets the path for this known folder. + /// + /// A object. + public override string Path + { + get { return KnownFolderSettings.Path; } + } + + /// + /// Gets the category designation for this known folder. + /// + /// A value. + public FolderCategory Category + { + get { return KnownFolderSettings.Category; } + } + + /// + /// Gets this known folder's canonical name. + /// + /// A object. + public string CanonicalName + { + get { return KnownFolderSettings.CanonicalName; } + } + + /// + /// Gets this known folder's description. + /// + /// A object. + public string Description + { + get { return KnownFolderSettings.Description; } + } + + /// + /// Gets the unique identifier for this known folder's parent folder. + /// + /// A value. + public Guid ParentId + { + get { return KnownFolderSettings.ParentId; } + } + + /// + /// Gets this known folder's relative path. + /// + /// A object. + public string RelativePath + { + get { return KnownFolderSettings.RelativePath; } + } + + /// + /// Gets this known folder's parsing name. + /// + /// A object. + public override string ParsingName + { + get { return base.ParsingName; } + } + + /// + /// Gets this known folder's tool tip text. + /// + /// A object. + public string Tooltip + { + get { return KnownFolderSettings.Tooltip; } + } + /// + /// Gets the resource identifier for this + /// known folder's tool tip text. + /// + /// A object. + public string TooltipResourceId + { + get { return KnownFolderSettings.TooltipResourceId; } + } + + /// + /// Gets this known folder's localized name. + /// + /// A object. + public string LocalizedName + { + get { return KnownFolderSettings.LocalizedName; } + } + /// + /// Gets the resource identifier for this + /// known folder's localized name. + /// + /// A object. + public string LocalizedNameResourceId + { + get { return KnownFolderSettings.LocalizedNameResourceId; } + } + + /// + /// Gets this known folder's security attributes. + /// + /// A object. + public string Security + { + get { return KnownFolderSettings.Security; } + } + + /// + /// Gets this known folder's file attributes, + /// such as "read-only". + /// + /// A value. + public System.IO.FileAttributes FileAttributes + { + get { return KnownFolderSettings.FileAttributes; } + } + + /// + /// Gets an value that describes this known folder's behaviors. + /// + /// A value. + public DefinitionOptions DefinitionOptions + { + get { return KnownFolderSettings.DefinitionOptions; } + } + + /// + /// Gets the unique identifier for this known folder's type. + /// + /// A value. + public Guid FolderTypeId + { + get { return KnownFolderSettings.FolderTypeId; } + } + + /// + /// Gets a string representation of this known folder's type. + /// + /// A object. + public string FolderType + { + get { return KnownFolderSettings.FolderType; } + } + /// + /// Gets the unique identifier for this known folder. + /// + /// A value. + public Guid FolderId + { + get { return KnownFolderSettings.FolderId; } + } + + /// + /// Gets a value that indicates whether this known folder's path exists on the computer. + /// + /// A bool value. + /// If this property value is false, + /// the folder might be a virtual folder ( property will + /// be for virtual folders) + public bool PathExists + { + get { return KnownFolderSettings.PathExists; } + } + + /// + /// Gets a value that states whether this known folder + /// can have its path set to a new value, + /// including any restrictions on the redirection. + /// + /// A value. + public RedirectionCapability Redirection + { + get { return KnownFolderSettings.Redirection; } + } + + #endregion + + #region IDisposable Members + + /// + /// Release resources + /// + /// Indicates that this mothod is being called from Dispose() rather than the finalizer. + protected override void Dispose(bool disposing) + { + if (disposing) + { + knownFolderSettings = null; + } + + if (knownFolderNative != null) + { + Marshal.ReleaseComObject(knownFolderNative); + knownFolderNative = null; + } + + base.Dispose(disposing); + } + + #endregion + } +} diff --git a/Shell/KnownFolders/FolderCategory.cs b/Shell/KnownFolders/FolderCategory.cs new file mode 100644 index 0000000..762cffa --- /dev/null +++ b/Shell/KnownFolders/FolderCategory.cs @@ -0,0 +1,45 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Specifies the categories for known folders. + /// + public enum FolderCategory + { + /// + /// The folder category is not specified. + /// + None = 0x00, + /// + /// The folder is a virtual folder. Virtual folders are not part + /// of the file system. For example, Control Panel and + /// Printers are virtual folders. A number of properties + /// such as folder path and redirection do not apply to this category. + /// + Virtual = 0x1, + /// + /// The folder is fixed. Fixed file system folders are not + /// managed by the Shell and are usually given a permanent + /// path when the system is installed. For example, the + /// Windows and Program Files folders are fixed folders. + /// A number of properties such as redirection do not apply + /// to this category. + /// + Fixed = 0x2, + /// + /// The folder is a common folder. Common folders are + /// used for sharing data and settings + /// accessible by all users of a system. For example, + /// all users share a common Documents folder as well + /// as their per-user Documents folder. + /// + Common = 0x3, + /// + /// Each user has their own copy of the folder. Per-user folders + /// are those stored under each user's profile and + /// accessible only by that user. + /// + PerUser = 0x4 + } +} \ No newline at end of file diff --git a/Shell/KnownFolders/FolderProperties.cs b/Shell/KnownFolders/FolderProperties.cs new file mode 100644 index 0000000..aeb9ddc --- /dev/null +++ b/Shell/KnownFolders/FolderProperties.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using System.Windows.Media.Imaging; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Structure used internally to store property values for + /// a known folder. This structure holds the information + /// returned in the FOLDER_DEFINITION structure, and + /// resources referenced by fields in NativeFolderDefinition, + /// such as icon and tool tip. + /// + [StructLayout(LayoutKind.Sequential)] + internal struct FolderProperties + { + internal string name; + internal FolderCategory category; + internal string canonicalName; + internal string description; + internal Guid parentId; + internal string parent; + internal string relativePath; + internal string parsingName; + internal string tooltipResourceId; + internal string tooltip; + internal string localizedName; + internal string localizedNameResourceId; + internal string iconResourceId; + internal BitmapSource icon; + internal DefinitionOptions definitionOptions; + internal System.IO.FileAttributes fileAttributes; + internal Guid folderTypeId; + internal string folderType; + internal Guid folderId; + internal string path; + internal bool pathExists; + internal RedirectionCapability redirection; + internal string security; + } +} diff --git a/Shell/KnownFolders/FolderTypes.cs b/Shell/KnownFolders/FolderTypes.cs new file mode 100644 index 0000000..a8050d6 --- /dev/null +++ b/Shell/KnownFolders/FolderTypes.cs @@ -0,0 +1,227 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// The FolderTypes values represent a view template applied to a folder, + /// usually based on its intended use and contents. + /// + internal static class FolderTypes + { + /// + /// No particular content type has been detected or specified. This value is not supported in Windows 7 and later systems. + /// + internal static Guid NotSpecified = new Guid( + 0x5c4f28b5, 0xf869, 0x4e84, 0x8e, 0x60, 0xf1, 0x1d, 0xb9, 0x7c, 0x5c, 0xc7); + + /// + /// The folder is invalid. There are several things that can cause this judgement: hard disk errors, file system errors, and compression errors among them. + /// + internal static Guid Invalid = new Guid( + 0x57807898, 0x8c4f, 0x4462, 0xbb, 0x63, 0x71, 0x04, 0x23, 0x80, 0xb1, 0x09); + + /// + /// The folder contains document files. These can be of mixed format—.doc, .txt, and others. + /// + internal static Guid Documents = new Guid( + 0x7d49d726, 0x3c21, 0x4f05, 0x99, 0xaa, 0xfd, 0xc2, 0xc9, 0x47, 0x46, 0x56); + + /// + /// Image files, such as .jpg, .tif, or .png files. + /// + internal static Guid Pictures = new Guid( + 0xb3690e58, 0xe961, 0x423b, 0xb6, 0x87, 0x38, 0x6e, 0xbf, 0xd8, 0x32, 0x39); + + /// + /// Windows 7 and later. The folder contains audio files, such as .mp3 and .wma files. + /// + internal static Guid Music = new Guid( + 0xaf9c03d6, 0x7db9, 0x4a15, 0x94, 0x64, 0x13, 0xbf, 0x9f, 0xb6, 0x9a, 0x2a); + + /// + /// A list of music files displayed in Icons view. This value is not supported in Windows 7 and later systems. + /// + internal static Guid MusicIcons = new Guid( + 0x0b7467fb, 0x84ba, 0x4aae, 0xa0, 0x9b, 0x15, 0xb7, 0x10, 0x97, 0xaf, 0x9e); + + /// + /// The folder is the Games folder found in the Start menu. + /// + internal static Guid Games = new Guid( + 0xb689b0d0, 0x76d3, 0x4cbb, 0x87, 0xf7, 0x58, 0x5d, 0x0e, 0x0c, 0xe0, 0x70); + + /// + /// The Control Panel in category view. This is a virtual folder. + /// + internal static Guid ControlPanelCategory = new Guid( + 0xde4f0660, 0xfa10, 0x4b8f, 0xa4, 0x94, 0x06, 0x8b, 0x20, 0xb2, 0x23, 0x07); + + /// + /// The Control Panel in classic view. This is a virtual folder. + /// + internal static Guid ControlPanelClassic = new Guid( + 0x0c3794f3, 0xb545, 0x43aa, 0xa3, 0x29, 0xc3, 0x74, 0x30, 0xc5, 0x8d, 0x2a); + + /// + /// Printers that have been added to the system. This is a virtual folder. + /// + internal static Guid Printers = new Guid( + 0x2c7bbec6, 0xc844, 0x4a0a, 0x91, 0xfa, 0xce, 0xf6, 0xf5, 0x9c, 0xfd, 0xa1); + + /// + /// The Recycle Bin. This is a virtual folder. + /// + internal static Guid RecycleBin = new Guid( + 0xd6d9e004, 0xcd87, 0x442b, 0x9d, 0x57, 0x5e, 0x0a, 0xeb, 0x4f, 0x6f, 0x72); + + /// + /// The software explorer window used by the Add or Remove Programs control panel icon. + /// + internal static Guid SoftwareExplorer = new Guid( + 0xd674391b, 0x52d9, 0x4e07, 0x83, 0x4e, 0x67, 0xc9, 0x86, 0x10, 0xf3, 0x9d); + + /// + /// The folder is a compressed archive, such as a compressed file with a .zip file name extension. + /// + internal static Guid CompressedFolder = new Guid( + 0x80213e82, 0xbcfd, 0x4c4f, 0x88, 0x17, 0xbb, 0x27, 0x60, 0x12, 0x67, 0xa9); + + /// + /// An e-mail-related folder that contains contact information. + /// + internal static Guid Contacts = new Guid( + 0xde2b70ec, 0x9bf7, 0x4a93, 0xbd, 0x3d, 0x24, 0x3f, 0x78, 0x81, 0xd4, 0x92); + + /// + /// A default library view without a more specific template. This value is not supported in Windows 7 and later systems. + /// + internal static Guid Library = new Guid( + 0x4badfc68, 0xc4ac, 0x4716, 0xa0, 0xa0, 0x4d, 0x5d, 0xaa, 0x6b, 0x0f, 0x3e); + + /// + /// The Network Explorer folder. + /// + internal static Guid NetworkExplorer = new Guid( + 0x25cc242b, 0x9a7c, 0x4f51, 0x80, 0xe0, 0x7a, 0x29, 0x28, 0xfe, 0xbe, 0x42); + + /// + /// The folder is the FOLDERID_UsersFiles folder. + /// + internal static Guid UserFiles = new Guid( + 0xcd0fc69b, 0x71e2, 0x46e5, 0x96, 0x90, 0x5b, 0xcd, 0x9f, 0x57, 0xaa, 0xb3); + + /// + /// Windows 7 and later. The folder contains search results, but they are of mixed or no specific type. + /// + internal static Guid GenericSearchResults = new Guid( + 0x7fde1a1e, 0x8b31, 0x49a5, 0x93, 0xb8, 0x6b, 0xe1, 0x4c, 0xfa, 0x49, 0x43); + + /// + /// Windows 7 and later. The folder is a library, but of no specified type. + /// + internal static Guid GenericLibrary = new Guid( + 0x5f4eab9a, 0x6833, 0x4f61, 0x89, 0x9d, 0x31, 0xcf, 0x46, 0x97, 0x9d, 0x49); + + /// + /// Windows 7 and later. The folder contains video files. These can be of mixed format—.wmv, .mov, and others. + /// + internal static Guid Videos = new Guid( + 0x5fa96407, 0x7e77, 0x483c, 0xac, 0x93, 0x69, 0x1d, 0x05, 0x85, 0x0d, 0xe8); + + /// + /// Windows 7 and later. The view shown when the user clicks the Windows Explorer button on the taskbar. + /// + internal static Guid UsersLibraries = new Guid( + 0xc4d98f09, 0x6124, 0x4fe0, 0x99, 0x42, 0x82, 0x64, 0x16, 0x8, 0x2d, 0xa9); + + /// + /// Windows 7 and later. The homegroup view. + /// + internal static Guid OtherUsers = new Guid( + 0xb337fd00, 0x9dd5, 0x4635, 0xa6, 0xd4, 0xda, 0x33, 0xfd, 0x10, 0x2b, 0x7a); + + /// + /// Windows 7 and later. A folder that contains communication-related files such as e-mails, calendar information, and contact information. + /// + internal static Guid Communications = new Guid( + 0x91475fe5, 0x586b, 0x4eba, 0x8d, 0x75, 0xd1, 0x74, 0x34, 0xb8, 0xcd, 0xf6); + + /// + /// Windows 7 and later. The folder contains recorded television broadcasts. + /// + internal static Guid RecordedTV = new Guid( + 0x5557a28f, 0x5da6, 0x4f83, 0x88, 0x09, 0xc2, 0xc9, 0x8a, 0x11, 0xa6, 0xfa); + + /// + /// Windows 7 and later. The folder contains saved game states. + /// + internal static Guid SavedGames = new Guid( + 0xd0363307, 0x28cb, 0x4106, 0x9f, 0x23, 0x29, 0x56, 0xe3, 0xe5, 0xe0, 0xe7); + + /// + /// Windows 7 and later. The folder contains federated search OpenSearch results. + /// + internal static Guid OpenSearch = new Guid( + 0x8faf9629, 0x1980, 0x46ff, 0x80, 0x23, 0x9d, 0xce, 0xab, 0x9c, 0x3e, 0xe3); + + /// + /// Windows 7 and later. Before you search. + /// + internal static Guid SearchConnector = new Guid( + 0x982725ee, 0x6f47, 0x479e, 0xb4, 0x47, 0x81, 0x2b, 0xfa, 0x7d, 0x2e, 0x8f); + + /// + /// Windows 7 and later. A user's Searches folder, normally found at C:\Users\username\Searches. + /// + internal static Guid Searches = new Guid( + 0x0b0ba2e3, 0x405f, 0x415e, 0xa6, 0xee, 0xca, 0xd6, 0x25, 0x20, 0x78, 0x53); + + + static Dictionary types; + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")] + static FolderTypes() + { + types = new Dictionary(); + // Review: These Localized messages could probably be a reflected value of the field's name. + types.Add(NotSpecified, LocalizedMessages.FolderTypeNotSpecified); + types.Add(Invalid, LocalizedMessages.FolderTypeInvalid); + types.Add(Communications, LocalizedMessages.FolderTypeCommunications); + types.Add(CompressedFolder, LocalizedMessages.FolderTypeCompressedFolder); + types.Add(Contacts, LocalizedMessages.FolderTypeContacts); + types.Add(ControlPanelCategory, LocalizedMessages.FolderTypeCategory); + types.Add(ControlPanelClassic, LocalizedMessages.FolderTypeClassic); + types.Add(Documents, LocalizedMessages.FolderTypeDocuments); + types.Add(Games, LocalizedMessages.FolderTypeGames); + types.Add(GenericSearchResults, LocalizedMessages.FolderTypeSearchResults); + types.Add(GenericLibrary, LocalizedMessages.FolderTypeGenericLibrary); + types.Add(Library, LocalizedMessages.FolderTypeLibrary); + types.Add(Music, LocalizedMessages.FolderTypeMusic); + types.Add(MusicIcons, LocalizedMessages.FolderTypeMusicIcons); + types.Add(NetworkExplorer, LocalizedMessages.FolderTypeNetworkExplorer); + types.Add(OtherUsers, LocalizedMessages.FolderTypeOtherUsers); + types.Add(OpenSearch, LocalizedMessages.FolderTypeOpenSearch); + types.Add(Pictures, LocalizedMessages.FolderTypePictures); + types.Add(Printers, LocalizedMessages.FolderTypePrinters); + types.Add(RecycleBin, LocalizedMessages.FolderTypeRecycleBin); + types.Add(RecordedTV, LocalizedMessages.FolderTypeRecordedTV); + types.Add(SoftwareExplorer, LocalizedMessages.FolderTypeSoftwareExplorer); + types.Add(SavedGames, LocalizedMessages.FolderTypeSavedGames); + types.Add(SearchConnector, LocalizedMessages.FolderTypeSearchConnector); + types.Add(Searches, LocalizedMessages.FolderTypeSearches); + types.Add(UsersLibraries, LocalizedMessages.FolderTypeUserLibraries); + types.Add(UserFiles, LocalizedMessages.FolderTypeUserFiles); + types.Add(Videos, LocalizedMessages.FolderTypeVideos); + } + + internal static string GetFolderType(Guid typeId) + { + string type; + return types.TryGetValue(typeId, out type) ? type : string.Empty; + } + } +} diff --git a/Shell/KnownFolders/FoldersIdentifiers.cs b/Shell/KnownFolders/FoldersIdentifiers.cs new file mode 100644 index 0000000..fa40974 --- /dev/null +++ b/Shell/KnownFolders/FoldersIdentifiers.cs @@ -0,0 +1,592 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Contains the GUID identifiers for well-known folders. + /// + internal static class FolderIdentifiers + { + private static Dictionary folders; + + static FolderIdentifiers() + { + folders = new Dictionary(); + Type folderIDs = typeof(FolderIdentifiers); + + FieldInfo[] fields = folderIDs.GetFields(BindingFlags.NonPublic | BindingFlags.Static); + foreach (FieldInfo f in fields) + { + // Ignore dictionary field. + if (f.FieldType == typeof(Guid)) + { + Guid id = (Guid)f.GetValue(null); + string name = f.Name; + folders.Add(id, name); + } + } + } + /// + /// Returns the friendly name for a specified folder. + /// + /// The Guid identifier for a known folder. + /// A value. + internal static string NameForGuid(Guid folderId) + { + string folder; + if (!folders.TryGetValue(folderId, out folder)) + { + throw new ArgumentException(LocalizedMessages.FolderIdsUnknownGuid, "folderId"); + } + return folder; + } + /// + /// Returns a sorted list of name, guid pairs for + /// all known folders. + /// + /// + internal static SortedList GetAllFolders() + { + // Make a copy of the dictionary + // because the Keys and Values collections + // are mutable. + ICollection keys = folders.Keys; + + SortedList slist = new SortedList(); + foreach (Guid g in keys) + { + slist.Add(folders[g], g); + } + + return slist; + } + + #region KnownFolder Guids + + /// + /// Computer + /// + internal static Guid Computer = new Guid(0x0AC0837C, 0xBBF8, 0x452A, 0x85, 0x0D, 0x79, 0xD0, 0x8E, 0x66, 0x7C, 0xA7); + + /// + /// Conflicts + /// + internal static Guid Conflict = new Guid(0x4bfefb45, 0x347d, 0x4006, 0xa5, 0xbe, 0xac, 0x0c, 0xb0, 0x56, 0x71, 0x92); + + /// + /// Control Panel + /// + internal static Guid ControlPanel = new Guid(0x82A74AEB, 0xAEB4, 0x465C, 0xA0, 0x14, 0xD0, 0x97, 0xEE, 0x34, 0x6D, 0x63); + + /// + /// Desktop + /// + internal static Guid Desktop = new Guid(0xB4BFCC3A, 0xDB2C, 0x424C, 0xB0, 0x29, 0x7F, 0xE9, 0x9A, 0x87, 0xC6, 0x41); + + /// + /// Internet Explorer + /// + internal static Guid Internet = new Guid(0x4D9F7874, 0x4E0C, 0x4904, 0x96, 0x7B, 0x40, 0xB0, 0xD2, 0x0C, 0x3E, 0x4B); + + /// + /// Network + /// + internal static Guid Network = new Guid(0xD20BEEC4, 0x5CA8, 0x4905, 0xAE, 0x3B, 0xBF, 0x25, 0x1E, 0xA0, 0x9B, 0x53); + + /// + /// Printers + /// + internal static Guid Printers = new Guid(0x76FC4E2D, 0xD6AD, 0x4519, 0xA6, 0x63, 0x37, 0xBD, 0x56, 0x06, 0x81, 0x85); + + /// + /// Sync Center + /// + internal static Guid SyncManager = new Guid(0x43668BF8, 0xC14E, 0x49B2, 0x97, 0xC9, 0x74, 0x77, 0x84, 0xD7, 0x84, 0xB7); + + /// + /// Network Connections + /// + internal static Guid Connections = new Guid(0x6F0CD92B, 0x2E97, 0x45D1, 0x88, 0xFF, 0xB0, 0xD1, 0x86, 0xB8, 0xDE, 0xDD); + + /// + /// Sync Setup + /// + internal static Guid SyncSetup = new Guid(0xf214138, 0xb1d3, 0x4a90, 0xbb, 0xa9, 0x27, 0xcb, 0xc0, 0xc5, 0x38, 0x9a); + + /// + /// Sync Results + /// + internal static Guid SyncResults = new Guid(0x289a9a43, 0xbe44, 0x4057, 0xa4, 0x1b, 0x58, 0x7a, 0x76, 0xd7, 0xe7, 0xf9); + + /// + /// Recycle Bin + /// + internal static Guid RecycleBin = new Guid(0xB7534046, 0x3ECB, 0x4C18, 0xBE, 0x4E, 0x64, 0xCD, 0x4C, 0xB7, 0xD6, 0xAC); + + /// + /// Fonts + /// + internal static Guid Fonts = new Guid(0xFD228CB7, 0xAE11, 0x4AE3, 0x86, 0x4C, 0x16, 0xF3, 0x91, 0x0A, 0xB8, 0xFE); + + /// + /// Startup + /// + internal static Guid Startup = new Guid(0xB97D20BB, 0xF46A, 0x4C97, 0xBA, 0x10, 0x5E, 0x36, 0x08, 0x43, 0x08, 0x54); + + /// + /// Programs + /// + internal static Guid Programs = new Guid(0xA77F5D77, 0x2E2B, 0x44C3, 0xA6, 0xA2, 0xAB, 0xA6, 0x01, 0x05, 0x4A, 0x51); + + /// + /// Start Menu + /// + internal static Guid StartMenu = new Guid(0x625B53C3, 0xAB48, 0x4EC1, 0xBA, 0x1F, 0xA1, 0xEF, 0x41, 0x46, 0xFC, 0x19); + + /// + /// Recent Items + /// + internal static Guid Recent = new Guid(0xAE50C081, 0xEBD2, 0x438A, 0x86, 0x55, 0x8A, 0x09, 0x2E, 0x34, 0x98, 0x7A); + + /// + /// SendTo + /// + internal static Guid SendTo = new Guid(0x8983036C, 0x27C0, 0x404B, 0x8F, 0x08, 0x10, 0x2D, 0x10, 0xDC, 0xFD, 0x74); + + /// + /// Documents + /// + internal static Guid Documents = new Guid(0xFDD39AD0, 0x238F, 0x46AF, 0xAD, 0xB4, 0x6C, 0x85, 0x48, 0x03, 0x69, 0xC7); + + /// + /// Favorites + /// + internal static Guid Favorites = new Guid(0x1777F761, 0x68AD, 0x4D8A, 0x87, 0xBD, 0x30, 0xB7, 0x59, 0xFA, 0x33, 0xDD); + + /// + /// Network Shortcuts + /// + internal static Guid NetHood = new Guid(0xC5ABBF53, 0xE17F, 0x4121, 0x89, 0x00, 0x86, 0x62, 0x6F, 0xC2, 0xC9, 0x73); + + /// + /// Printer Shortcuts + /// + internal static Guid PrintHood = new Guid(0x9274BD8D, 0xCFD1, 0x41C3, 0xB3, 0x5E, 0xB1, 0x3F, 0x55, 0xA7, 0x58, 0xF4); + + /// + /// Templates + /// + internal static Guid Templates = new Guid(0xA63293E8, 0x664E, 0x48DB, 0xA0, 0x79, 0xDF, 0x75, 0x9E, 0x05, 0x09, 0xF7); + + /// + /// Startup + /// + internal static Guid CommonStartup = new Guid(0x82A5EA35, 0xD9CD, 0x47C5, 0x96, 0x29, 0xE1, 0x5D, 0x2F, 0x71, 0x4E, 0x6E); + + /// + /// Programs + /// + internal static Guid CommonPrograms = new Guid(0x0139D44E, 0x6AFE, 0x49F2, 0x86, 0x90, 0x3D, 0xAF, 0xCA, 0xE6, 0xFF, 0xB8); + + /// + /// Start Menu + /// + internal static Guid CommonStartMenu = new Guid(0xA4115719, 0xD62E, 0x491D, 0xAA, 0x7C, 0xE7, 0x4B, 0x8B, 0xE3, 0xB0, 0x67); + + /// + /// Public Desktop + /// + internal static Guid PublicDesktop = new Guid(0xC4AA340D, 0xF20F, 0x4863, 0xAF, 0xEF, 0xF8, 0x7E, 0xF2, 0xE6, 0xBA, 0x25); + + /// + /// ProgramData + /// + internal static Guid ProgramData = new Guid(0x62AB5D82, 0xFDC1, 0x4DC3, 0xA9, 0xDD, 0x07, 0x0D, 0x1D, 0x49, 0x5D, 0x97); + + /// + /// Templates + /// + internal static Guid CommonTemplates = new Guid(0xB94237E7, 0x57AC, 0x4347, 0x91, 0x51, 0xB0, 0x8C, 0x6C, 0x32, 0xD1, 0xF7); + + /// + /// Public Documents + /// + internal static Guid PublicDocuments = new Guid(0xED4824AF, 0xDCE4, 0x45A8, 0x81, 0xE2, 0xFC, 0x79, 0x65, 0x08, 0x36, 0x34); + + /// + /// Roaming + /// + internal static Guid RoamingAppData = new Guid(0x3EB685DB, 0x65F9, 0x4CF6, 0xA0, 0x3A, 0xE3, 0xEF, 0x65, 0x72, 0x9F, 0x3D); + + /// + /// Local + /// + internal static Guid LocalAppData = new Guid(0xF1B32785, 0x6FBA, 0x4FCF, 0x9D, 0x55, 0x7B, 0x8E, 0x7F, 0x15, 0x70, 0x91); + + /// + /// LocalLow + /// + internal static Guid LocalAppDataLow = new Guid(0xA520A1A4, 0x1780, 0x4FF6, 0xBD, 0x18, 0x16, 0x73, 0x43, 0xC5, 0xAF, 0x16); + + /// + /// Temporary Internet Files + /// + internal static Guid InternetCache = new Guid(0x352481E8, 0x33BE, 0x4251, 0xBA, 0x85, 0x60, 0x07, 0xCA, 0xED, 0xCF, 0x9D); + + /// + /// Cookies + /// + internal static Guid Cookies = new Guid(0x2B0F765D, 0xC0E9, 0x4171, 0x90, 0x8E, 0x08, 0xA6, 0x11, 0xB8, 0x4F, 0xF6); + + /// + /// History + /// + internal static Guid History = new Guid(0xD9DC8A3B, 0xB784, 0x432E, 0xA7, 0x81, 0x5A, 0x11, 0x30, 0xA7, 0x59, 0x63); + + /// + /// System32 + /// + internal static Guid System = new Guid(0x1AC14E77, 0x02E7, 0x4E5D, 0xB7, 0x44, 0x2E, 0xB1, 0xAE, 0x51, 0x98, 0xB7); + + /// + /// System32 + /// + internal static Guid SystemX86 = new Guid(0xD65231B0, 0xB2F1, 0x4857, 0xA4, 0xCE, 0xA8, 0xE7, 0xC6, 0xEA, 0x7D, 0x27); + + /// + /// Windows + /// + internal static Guid Windows = new Guid(0xF38BF404, 0x1D43, 0x42F2, 0x93, 0x05, 0x67, 0xDE, 0x0B, 0x28, 0xFC, 0x23); + + /// + /// The user's username (%USERNAME%) + /// + internal static Guid Profile = new Guid(0x5E6C858F, 0x0E22, 0x4760, 0x9A, 0xFE, 0xEA, 0x33, 0x17, 0xB6, 0x71, 0x73); + + /// + /// Pictures + /// + internal static Guid Pictures = new Guid(0x33E28130, 0x4E1E, 0x4676, 0x83, 0x5A, 0x98, 0x39, 0x5C, 0x3B, 0xC3, 0xBB); + + /// + /// Program Files + /// + internal static Guid ProgramFilesX86 = new Guid(0x7C5A40EF, 0xA0FB, 0x4BFC, 0x87, 0x4A, 0xC0, 0xF2, 0xE0, 0xB9, 0xFA, 0x8E); + + /// + /// Common Files + /// + internal static Guid ProgramFilesCommonX86 = new Guid(0xDE974D24, 0xD9C6, 0x4D3E, 0xBF, 0x91, 0xF4, 0x45, 0x51, 0x20, 0xB9, 0x17); + + /// + /// Program Files + /// + internal static Guid ProgramFilesX64 = new Guid(0x6d809377, 0x6af0, 0x444b, 0x89, 0x57, 0xa3, 0x77, 0x3f, 0x02, 0x20, 0x0e); + + /// + /// Common Files + /// + internal static Guid ProgramFilesCommonX64 = new Guid(0x6365d5a7, 0xf0d, 0x45e5, 0x87, 0xf6, 0xd, 0xa5, 0x6b, 0x6a, 0x4f, 0x7d); + + /// + /// Program Files + /// + internal static Guid ProgramFiles = new Guid(0x905e63b6, 0xc1bf, 0x494e, 0xb2, 0x9c, 0x65, 0xb7, 0x32, 0xd3, 0xd2, 0x1a); + + /// + /// Common Files + /// + internal static Guid ProgramFilesCommon = new Guid(0xF7F1ED05, 0x9F6D, 0x47A2, 0xAA, 0xAE, 0x29, 0xD3, 0x17, 0xC6, 0xF0, 0x66); + + /// + /// Administrative Tools + /// + internal static Guid AdminTools = new Guid(0x724EF170, 0xA42D, 0x4FEF, 0x9F, 0x26, 0xB6, 0x0E, 0x84, 0x6F, 0xBA, 0x4F); + + /// + /// Administrative Tools + /// + internal static Guid CommonAdminTools = new Guid(0xD0384E7D, 0xBAC3, 0x4797, 0x8F, 0x14, 0xCB, 0xA2, 0x29, 0xB3, 0x92, 0xB5); + + /// + /// Music + /// + internal static Guid Music = new Guid(0x4BD8D571, 0x6D19, 0x48D3, 0xBE, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0E, 0x43); + + /// + /// Videos + /// + internal static Guid Videos = new Guid(0x18989B1D, 0x99B5, 0x455B, 0x84, 0x1C, 0xAB, 0x7C, 0x74, 0xE4, 0xDD, 0xFC); + + /// + /// Public Pictures + /// + internal static Guid PublicPictures = new Guid(0xB6EBFB86, 0x6907, 0x413C, 0x9A, 0xF7, 0x4F, 0xC2, 0xAB, 0xF0, 0x7C, 0xC5); + + /// + /// Public Music + /// + internal static Guid PublicMusic = new Guid(0x3214FAB5, 0x9757, 0x4298, 0xBB, 0x61, 0x92, 0xA9, 0xDE, 0xAA, 0x44, 0xFF); + + /// + /// Public Videos + /// + internal static Guid PublicVideos = new Guid(0x2400183A, 0x6185, 0x49FB, 0xA2, 0xD8, 0x4A, 0x39, 0x2A, 0x60, 0x2B, 0xA3); + + /// + /// Resources + /// + internal static Guid ResourceDir = new Guid(0x8AD10C31, 0x2ADB, 0x4296, 0xA8, 0xF7, 0xE4, 0x70, 0x12, 0x32, 0xC9, 0x72); + + /// + /// None + /// + internal static Guid LocalizedResourcesDir = new Guid(0x2A00375E, 0x224C, 0x49DE, 0xB8, 0xD1, 0x44, 0x0D, 0xF7, 0xEF, 0x3D, 0xDC); + + /// + /// OEM Links + /// + internal static Guid CommonOEMLinks = new Guid(0xC1BAE2D0, 0x10DF, 0x4334, 0xBE, 0xDD, 0x7A, 0xA2, 0x0B, 0x22, 0x7A, 0x9D); + + /// + /// Temporary Burn Folder + /// + internal static Guid CDBurning = new Guid(0x9E52AB10, 0xF80D, 0x49DF, 0xAC, 0xB8, 0x43, 0x30, 0xF5, 0x68, 0x78, 0x55); + + /// + /// Users + /// + internal static Guid UserProfiles = new Guid(0x0762D272, 0xC50A, 0x4BB0, 0xA3, 0x82, 0x69, 0x7D, 0xCD, 0x72, 0x9B, 0x80); + + /// + /// Playlists + /// + internal static Guid Playlists = new Guid(0xDE92C1C7, 0x837F, 0x4F69, 0xA3, 0xBB, 0x86, 0xE6, 0x31, 0x20, 0x4A, 0x23); + + /// + /// Sample Playlists + /// + internal static Guid SamplePlaylists = new Guid(0x15CA69B3, 0x30EE, 0x49C1, 0xAC, 0xE1, 0x6B, 0x5E, 0xC3, 0x72, 0xAF, 0xB5); + + /// + /// Sample Music + /// + internal static Guid SampleMusic = new Guid(0xB250C668, 0xF57D, 0x4EE1, 0xA6, 0x3C, 0x29, 0x0E, 0xE7, 0xD1, 0xAA, 0x1F); + + /// + /// Sample Pictures + /// + internal static Guid SamplePictures = new Guid(0xC4900540, 0x2379, 0x4C75, 0x84, 0x4B, 0x64, 0xE6, 0xFA, 0xF8, 0x71, 0x6B); + + /// + /// Sample Videos + /// + internal static Guid SampleVideos = new Guid(0x859EAD94, 0x2E85, 0x48AD, 0xA7, 0x1A, 0x09, 0x69, 0xCB, 0x56, 0xA6, 0xCD); + + /// + /// Slide Shows + /// + internal static Guid PhotoAlbums = new Guid(0x69D2CF90, 0xFC33, 0x4FB7, 0x9A, 0x0C, 0xEB, 0xB0, 0xF0, 0xFC, 0xB4, 0x3C); + + /// + /// Public + /// + internal static Guid Public = new Guid(0xDFDF76A2, 0xC82A, 0x4D63, 0x90, 0x6A, 0x56, 0x44, 0xAC, 0x45, 0x73, 0x85); + + /// + /// Programs and Features + /// + internal static Guid ChangeRemovePrograms = new Guid(0xdf7266ac, 0x9274, 0x4867, 0x8d, 0x55, 0x3b, 0xd6, 0x61, 0xde, 0x87, 0x2d); + + /// + /// Installed Updates + /// + internal static Guid AppUpdates = new Guid(0xa305ce99, 0xf527, 0x492b, 0x8b, 0x1a, 0x7e, 0x76, 0xfa, 0x98, 0xd6, 0xe4); + + /// + /// Get Programs + /// + internal static Guid AddNewPrograms = new Guid(0xde61d971, 0x5ebc, 0x4f02, 0xa3, 0xa9, 0x6c, 0x82, 0x89, 0x5e, 0x5c, 0x04); + + /// + /// Downloads + /// + internal static Guid Downloads = new Guid(0x374de290, 0x123f, 0x4565, 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b); + + /// + /// Public Downloads + /// + internal static Guid PublicDownloads = new Guid(0x3d644c9b, 0x1fb8, 0x4f30, 0x9b, 0x45, 0xf6, 0x70, 0x23, 0x5f, 0x79, 0xc0); + + /// + /// Searches + /// + internal static Guid SavedSearches = new Guid(0x7d1d3a04, 0xdebb, 0x4115, 0x95, 0xcf, 0x2f, 0x29, 0xda, 0x29, 0x20, 0xda); + + /// + /// Quick Launch + /// + internal static Guid QuickLaunch = new Guid(0x52a4f021, 0x7b75, 0x48a9, 0x9f, 0x6b, 0x4b, 0x87, 0xa2, 0x10, 0xbc, 0x8f); + + /// + /// Contacts + /// + internal static Guid Contacts = new Guid(0x56784854, 0xc6cb, 0x462b, 0x81, 0x69, 0x88, 0xe3, 0x50, 0xac, 0xb8, 0x82); + + /// + /// Gadgets + /// + internal static Guid SidebarParts = new Guid(0xa75d362e, 0x50fc, 0x4fb7, 0xac, 0x2c, 0xa8, 0xbe, 0xaa, 0x31, 0x44, 0x93); + + /// + /// Gadgets + /// + internal static Guid SidebarDefaultParts = new Guid(0x7b396e54, 0x9ec5, 0x4300, 0xbe, 0xa, 0x24, 0x82, 0xeb, 0xae, 0x1a, 0x26); + + /// + /// Tree property value folder + /// + internal static Guid TreeProperties = new Guid(0x5b3749ad, 0xb49f, 0x49c1, 0x83, 0xeb, 0x15, 0x37, 0x0f, 0xbd, 0x48, 0x82); + + /// + /// GameExplorer + /// + internal static Guid PublicGameTasks = new Guid(0xdebf2536, 0xe1a8, 0x4c59, 0xb6, 0xa2, 0x41, 0x45, 0x86, 0x47, 0x6a, 0xea); + + /// + /// GameExplorer + /// + internal static Guid GameTasks = new Guid(0x54fae61, 0x4dd8, 0x4787, 0x80, 0xb6, 0x9, 0x2, 0x20, 0xc4, 0xb7, 0x0); + + /// + /// Saved Games + /// + internal static Guid SavedGames = new Guid(0x4c5c32ff, 0xbb9d, 0x43b0, 0xb5, 0xb4, 0x2d, 0x72, 0xe5, 0x4e, 0xaa, 0xa4); + + /// + /// Games + /// + internal static Guid Games = new Guid(0xcac52c1a, 0xb53d, 0x4edc, 0x92, 0xd7, 0x6b, 0x2e, 0x8a, 0xc1, 0x94, 0x34); + + /// + /// Recorded TV + /// + internal static Guid RecordedTV = new Guid(0xbd85e001, 0x112e, 0x431e, 0x98, 0x3b, 0x7b, 0x15, 0xac, 0x09, 0xff, 0xf1); + + /// + /// Microsoft Office Outlook + /// + internal static Guid SearchMapi = new Guid(0x98ec0e18, 0x2098, 0x4d44, 0x86, 0x44, 0x66, 0x97, 0x93, 0x15, 0xa2, 0x81); + + /// + /// Offline Files + /// + internal static Guid SearchCsc = new Guid(0xee32e446, 0x31ca, 0x4aba, 0x81, 0x4f, 0xa5, 0xeb, 0xd2, 0xfd, 0x6d, 0x5e); + + /// + /// Links + /// + internal static Guid Links = new Guid(0xbfb9d5e0, 0xc6a9, 0x404c, 0xb2, 0xb2, 0xae, 0x6d, 0xb6, 0xaf, 0x49, 0x68); + + /// + /// The user's full name (for instance, Jean Philippe Bagel) entered when the user account was created. + /// + internal static Guid UsersFiles = new Guid(0xf3ce0f7c, 0x4901, 0x4acc, 0x86, 0x48, 0xd5, 0xd4, 0x4b, 0x04, 0xef, 0x8f); + + /// + /// Search home + /// + internal static Guid SearchHome = new Guid(0x190337d1, 0xb8ca, 0x4121, 0xa6, 0x39, 0x6d, 0x47, 0x2d, 0x16, 0x97, 0x2a); + + /// + /// Original Images + /// + internal static Guid OriginalImages = new Guid(0x2C36C0AA, 0x5812, 0x4b87, 0xbf, 0xd0, 0x4c, 0xd0, 0xdf, 0xb1, 0x9b, 0x39); + + #endregion + + #region Win7 KnownFolders Guids + + /// + /// UserProgramFiles + /// + internal static Guid UserProgramFiles = new Guid(0x5cd7aee2, 0x2219, 0x4a67, 0xb8, 0x5d, 0x6c, 0x9c, 0xe1, 0x56, 0x60, 0xcb); + + /// + /// UserProgramFilesCommon + /// + internal static Guid UserProgramFilesCommon = new Guid(0xbcbd3057, 0xca5c, 0x4622, 0xb4, 0x2d, 0xbc, 0x56, 0xdb, 0x0a, 0xe5, 0x16); + + /// + /// Ringtones + /// + internal static Guid Ringtones = new Guid(0xC870044B, 0xF49E, 0x4126, 0xA9, 0xC3, 0xB5, 0x2A, 0x1F, 0xF4, 0x11, 0xE8); + + /// + /// PublicRingtones + /// + internal static Guid PublicRingtones = new Guid(0xE555AB60, 0x153B, 0x4D17, 0x9F, 0x04, 0xA5, 0xFE, 0x99, 0xFC, 0x15, 0xEC); + + /// + /// UsersLibraries + /// + internal static Guid UsersLibraries = new Guid(0xa302545d, 0xdeff, 0x464b, 0xab, 0xe8, 0x61, 0xc8, 0x64, 0x8d, 0x93, 0x9b); + + /// + /// DocumentsLibrary + /// + internal static Guid DocumentsLibrary = new Guid(0x7b0db17d, 0x9cd2, 0x4a93, 0x97, 0x33, 0x46, 0xcc, 0x89, 0x02, 0x2e, 0x7c); + + /// + /// MusicLibrary + /// + internal static Guid MusicLibrary = new Guid(0x2112ab0a, 0xc86a, 0x4ffe, 0xa3, 0x68, 0xd, 0xe9, 0x6e, 0x47, 0x1, 0x2e); + + /// + /// PicturesLibrary + /// + internal static Guid PicturesLibrary = new Guid(0xa990ae9f, 0xa03b, 0x4e80, 0x94, 0xbc, 0x99, 0x12, 0xd7, 0x50, 0x41, 0x4); + + /// + /// VideosLibrary + /// + internal static Guid VideosLibrary = new Guid(0x491e922f, 0x5643, 0x4af4, 0xa7, 0xeb, 0x4e, 0x7a, 0x13, 0x8d, 0x81, 0x74); + + /// + /// RecordedTVLibrary + /// + internal static Guid RecordedTVLibrary = new Guid(0x1a6fdba2, 0xf42d, 0x4358, 0xa7, 0x98, 0xb7, 0x4d, 0x74, 0x59, 0x26, 0xc5); + + /// + /// OtherUsers + /// + internal static Guid OtherUsers = new Guid(0x52528a6b, 0xb9e3, 0x4add, 0xb6, 0xd, 0x58, 0x8c, 0x2d, 0xba, 0x84, 0x2d); + + /// + /// DeviceMetadataStore + /// + internal static Guid DeviceMetadataStore = new Guid(0x5ce4a5e9, 0xe4eb, 0x479d, 0xb8, 0x9f, 0x13, 0x0c, 0x02, 0x88, 0x61, 0x55); + + /// + /// Libraries + /// + internal static Guid Libraries = new Guid(0x1b3ea5dc, 0xb587, 0x4786, 0xb4, 0xef, 0xbd, 0x1d, 0xc3, 0x32, 0xae, 0xae); + + /// + /// UserPinned + /// + internal static Guid UserPinned = new Guid(0x9e3995ab, 0x1f9c, 0x4f13, 0xb8, 0x27, 0x48, 0xb2, 0x4b, 0x6c, 0x71, 0x74); + + /// + /// ImplicitAppShortcuts + /// + internal static Guid ImplicitAppShortcuts = new Guid(0xbcb5256f, 0x79f6, 0x4cee, 0xb7, 0x25, 0xdc, 0x34, 0xe4, 0x2, 0xfd, 0x46); + + #endregion + } +} \ No newline at end of file diff --git a/Shell/KnownFolders/IKnownFolder.cs b/Shell/KnownFolders/IKnownFolder.cs new file mode 100644 index 0000000..9c73084 --- /dev/null +++ b/Shell/KnownFolders/IKnownFolder.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a registered or known folder in the system. + /// + public interface IKnownFolder : IDisposable, IEnumerable + { + /// + /// Gets the path for this known folder. + /// + string Path { get; } + + /// + /// Gets the category designation for this known folder. + /// + FolderCategory Category { get; } + + /// + /// Gets this known folder's canonical name. + /// + string CanonicalName { get; } + + /// + /// Gets this known folder's description. + /// + string Description { get; } + + /// + /// Gets the unique identifier for this known folder's parent folder. + /// + Guid ParentId { get; } + + /// + /// Gets this known folder's relative path. + /// + string RelativePath { get; } + + /// + /// Gets this known folder's parsing name. + /// + string ParsingName { get; } + + /// + /// Gets this known folder's tool tip text. + /// + string Tooltip { get; } + + /// + /// Gets the resource identifier for this + /// known folder's tool tip text. + /// + string TooltipResourceId { get; } + + /// + /// Gets this known folder's localized name. + /// + string LocalizedName { get; } + + /// + /// Gets the resource identifier for this + /// known folder's localized name. + /// + string LocalizedNameResourceId { get; } + + /// + /// Gets this known folder's security attributes. + /// + string Security { get; } + + /// + /// Gets this known folder's file attributes, + /// such as "read-only". + /// + FileAttributes FileAttributes { get; } + + /// + /// Gets an value that describes this known folder's behaviors. + /// + DefinitionOptions DefinitionOptions { get; } + + /// + /// Gets the unique identifier for this known folder's type. + /// + Guid FolderTypeId { get; } + + /// + /// Gets a string representation of this known folder's type. + /// + string FolderType { get; } + + /// + /// Gets the unique identifier for this known folder. + /// + Guid FolderId { get; } + + /// + /// Gets a value that indicates whether this known folder's path exists on the computer. + /// + /// If this property value is false, + /// the folder might be a virtual folder ( property will + /// be for virtual folders) + bool PathExists { get; } + + /// + /// Gets a value that states whether this known folder + /// can have its path set to a new value, + /// including any restrictions on the redirection. + /// + RedirectionCapability Redirection { get; } + } +} diff --git a/Shell/KnownFolders/KnownFolderHelper.cs b/Shell/KnownFolders/KnownFolderHelper.cs new file mode 100644 index 0000000..c038a7d --- /dev/null +++ b/Shell/KnownFolders/KnownFolderHelper.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Creates the helper class for known folders. + /// + public static class KnownFolderHelper + { + /// + /// Returns the native known folder (IKnownFolderNative) given a PID list + /// + /// + /// + internal static IKnownFolderNative FromPIDL(IntPtr pidl) + { + KnownFolderManagerClass knownFolderManager = new KnownFolderManagerClass(); + + IKnownFolderNative knownFolder; + HResult hr = knownFolderManager.FindFolderFromIDList(pidl, out knownFolder); + + return (hr == HResult.Ok) ? knownFolder : null; + } + + /// + /// Returns a known folder given a globally unique identifier. + /// + /// A GUID for the requested known folder. + /// A known folder representing the specified name. + /// Thrown if the given Known Folder ID is invalid. + public static IKnownFolder FromKnownFolderId(Guid knownFolderId) + { + IKnownFolderNative knownFolderNative; + KnownFolderManagerClass knownFolderManager = new KnownFolderManagerClass(); + + HResult hr = knownFolderManager.GetFolder(knownFolderId, out knownFolderNative); + if (hr != HResult.Ok) { throw new ShellException(hr); } + + IKnownFolder kf = GetKnownFolder(knownFolderNative); + if (kf == null) + { + throw new ArgumentException(LocalizedMessages.KnownFolderInvalidGuid, "knownFolderId"); + } + return kf; + } + + /// + /// Returns a known folder given a globally unique identifier. + /// + /// A GUID for the requested known folder. + /// A known folder representing the specified name. Returns null if Known Folder is not found or could not be created. + internal static IKnownFolder FromKnownFolderIdInternal(Guid knownFolderId) + { + IKnownFolderNative knownFolderNative; + IKnownFolderManager knownFolderManager = (IKnownFolderManager)new KnownFolderManagerClass(); + + HResult hr = knownFolderManager.GetFolder(knownFolderId, out knownFolderNative); + + return (hr == HResult.Ok) ? GetKnownFolder(knownFolderNative) : null; + } + + /// + /// Given a native KnownFolder (IKnownFolderNative), create the right type of + /// IKnownFolder object (FileSystemKnownFolder or NonFileSystemKnownFolder) + /// + /// Native Known Folder + /// + private static IKnownFolder GetKnownFolder(IKnownFolderNative knownFolderNative) + { + Debug.Assert(knownFolderNative != null, "Native IKnownFolder should not be null."); + + // Get the native IShellItem2 from the native IKnownFolder + IShellItem2 shellItem; + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + HResult hr = knownFolderNative.GetShellItem(0, ref guid, out shellItem); + + if (!CoreErrorHelper.Succeeded(hr)) { return null; } + + bool isFileSystem = false; + + // If we have a valid IShellItem, try to get the FileSystem attribute. + if (shellItem != null) + { + ShellNativeMethods.ShellFileGetAttributesOptions sfgao; + shellItem.GetAttributes(ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem, out sfgao); + + // Is this item a FileSystem item? + isFileSystem = (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem) != 0; + } + + // If it's FileSystem, create a FileSystemKnownFolder, else NonFileSystemKnownFolder + if (isFileSystem) + { + FileSystemKnownFolder kf = new FileSystemKnownFolder(knownFolderNative); + return kf; + } + + NonFileSystemKnownFolder knownFsFolder = new NonFileSystemKnownFolder(knownFolderNative); + return knownFsFolder; + } + + /// + /// Returns the known folder given its canonical name. + /// + /// A non-localized canonical name for the known folder, such as MyComputer. + /// A known folder representing the specified name. + /// Thrown if the given canonical name is invalid or if the KnownFolder could not be created. + public static IKnownFolder FromCanonicalName(string canonicalName) + { + IKnownFolderNative knownFolderNative; + IKnownFolderManager knownFolderManager = (IKnownFolderManager)new KnownFolderManagerClass(); + + knownFolderManager.GetFolderByName(canonicalName, out knownFolderNative); + IKnownFolder kf = KnownFolderHelper.GetKnownFolder(knownFolderNative); + + if (kf == null) + { + throw new ArgumentException(LocalizedMessages.ShellInvalidCanonicalName, "canonicalName"); + } + return kf; + } + + /// + /// Returns a known folder given its shell path, such as C:\users\public\documents or + /// ::{645FF040-5081-101B-9F08-00AA002F954E} for the Recycle Bin. + /// + /// The path for the requested known folder; either a physical path or a virtual path. + /// A known folder representing the specified name. + public static IKnownFolder FromPath(string path) + { + return KnownFolderHelper.FromParsingName(path); + } + + /// + /// Returns a known folder given its shell namespace parsing name, such as + /// ::{645FF040-5081-101B-9F08-00AA002F954E} for the Recycle Bin. + /// + /// The parsing name (or path) for the requested known folder. + /// A known folder representing the specified name. + /// Thrown if the given parsing name is invalid. + public static IKnownFolder FromParsingName(string parsingName) + { + if (parsingName == null) + { + throw new ArgumentNullException("parsingName"); + } + + IntPtr pidl = IntPtr.Zero; + IntPtr pidl2 = IntPtr.Zero; + + try + { + pidl = ShellHelper.PidlFromParsingName(parsingName); + + if (pidl == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.KnownFolderParsingName, "parsingName"); + } + + // It's probably a special folder, try to get it + IKnownFolderNative knownFolderNative = KnownFolderHelper.FromPIDL(pidl); + if (knownFolderNative != null) + { + IKnownFolder kf = KnownFolderHelper.GetKnownFolder(knownFolderNative); + if (kf == null) + { + throw new ArgumentException(LocalizedMessages.KnownFolderParsingName, "parsingName"); + } + return kf; + } + + // No physical storage was found for this known folder + // We'll try again with a different name + + // try one more time with a trailing \0 + pidl2 = ShellHelper.PidlFromParsingName(parsingName.PadRight(1, '\0')); + + if (pidl2 == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.KnownFolderParsingName, "parsingName"); + } + + IKnownFolder kf2 = KnownFolderHelper.GetKnownFolder(KnownFolderHelper.FromPIDL(pidl)); + if (kf2 == null) + { + throw new ArgumentException(LocalizedMessages.KnownFolderParsingName, "parsingName"); + } + + return kf2; + } + finally + { + ShellNativeMethods.ILFree(pidl); + ShellNativeMethods.ILFree(pidl2); + } + + } + } +} diff --git a/Shell/KnownFolders/KnownFolderSettings.cs b/Shell/KnownFolders/KnownFolderSettings.cs new file mode 100644 index 0000000..e1a2193 --- /dev/null +++ b/Shell/KnownFolders/KnownFolderSettings.cs @@ -0,0 +1,295 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Internal class to represent the KnownFolder settings/properties + /// + internal class KnownFolderSettings + { + private FolderProperties knownFolderProperties; + + internal KnownFolderSettings(IKnownFolderNative knownFolderNative) + { + GetFolderProperties(knownFolderNative); + } + + #region Private Methods + + /// + /// Populates a structure that contains + /// this known folder's properties. + /// + private void GetFolderProperties(IKnownFolderNative knownFolderNative) + { + Debug.Assert(knownFolderNative != null); + + KnownFoldersSafeNativeMethods.NativeFolderDefinition nativeFolderDefinition; + knownFolderNative.GetFolderDefinition(out nativeFolderDefinition); + + try + { + knownFolderProperties.category = nativeFolderDefinition.category; + knownFolderProperties.canonicalName = Marshal.PtrToStringUni(nativeFolderDefinition.name); + knownFolderProperties.description = Marshal.PtrToStringUni(nativeFolderDefinition.description); + knownFolderProperties.parentId = nativeFolderDefinition.parentId; + knownFolderProperties.relativePath = Marshal.PtrToStringUni(nativeFolderDefinition.relativePath); + knownFolderProperties.parsingName = Marshal.PtrToStringUni(nativeFolderDefinition.parsingName); + knownFolderProperties.tooltipResourceId = Marshal.PtrToStringUni(nativeFolderDefinition.tooltip); + knownFolderProperties.localizedNameResourceId = Marshal.PtrToStringUni(nativeFolderDefinition.localizedName); + knownFolderProperties.iconResourceId = Marshal.PtrToStringUni(nativeFolderDefinition.icon); + knownFolderProperties.security = Marshal.PtrToStringUni(nativeFolderDefinition.security); + knownFolderProperties.fileAttributes = (System.IO.FileAttributes)nativeFolderDefinition.attributes; + knownFolderProperties.definitionOptions = nativeFolderDefinition.definitionOptions; + knownFolderProperties.folderTypeId = nativeFolderDefinition.folderTypeId; + knownFolderProperties.folderType = FolderTypes.GetFolderType(knownFolderProperties.folderTypeId); + + bool pathExists; + knownFolderProperties.path = GetPath(out pathExists, knownFolderNative); + knownFolderProperties.pathExists = pathExists; + + knownFolderProperties.redirection = knownFolderNative.GetRedirectionCapabilities(); + + // Turn tooltip, localized name and icon resource IDs + // into the actual resources. + knownFolderProperties.tooltip = CoreHelpers.GetStringResource(knownFolderProperties.tooltipResourceId); + knownFolderProperties.localizedName = CoreHelpers.GetStringResource(knownFolderProperties.localizedNameResourceId); + + knownFolderProperties.folderId = knownFolderNative.GetId(); + + } + finally + { + // Clean up memory. + Marshal.FreeCoTaskMem(nativeFolderDefinition.name); + Marshal.FreeCoTaskMem(nativeFolderDefinition.description); + Marshal.FreeCoTaskMem(nativeFolderDefinition.relativePath); + Marshal.FreeCoTaskMem(nativeFolderDefinition.parsingName); + Marshal.FreeCoTaskMem(nativeFolderDefinition.tooltip); + Marshal.FreeCoTaskMem(nativeFolderDefinition.localizedName); + Marshal.FreeCoTaskMem(nativeFolderDefinition.icon); + Marshal.FreeCoTaskMem(nativeFolderDefinition.security); + } + } + + /// + /// Gets the path of this this known folder. + /// + /// + /// Returns false if the folder is virtual, or a boolean + /// value that indicates whether this known folder exists. + /// + /// Native IKnownFolder reference + /// + /// A containing the path, or if this known folder does not exist. + /// + private string GetPath(out bool fileExists, IKnownFolderNative knownFolderNative) + { + Debug.Assert(knownFolderNative != null); + + string kfPath = string.Empty; + fileExists = true; + + // Virtual folders do not have path. + if (knownFolderProperties.category == FolderCategory.Virtual) + { + fileExists = false; + return kfPath; + } + + try + { + kfPath = knownFolderNative.GetPath(0); + } + catch (System.IO.FileNotFoundException) + { + fileExists = false; + } + catch (System.IO.DirectoryNotFoundException) + { + fileExists = false; + } + + return kfPath; + } + + #endregion + + #region KnownFolder Properties + + /// + /// Gets the path for this known folder. + /// + /// A object. + public string Path + { + get { return knownFolderProperties.path; } + } + + + /// + /// Gets the category designation for this known folder. + /// + /// A value. + public FolderCategory Category + { + get { return knownFolderProperties.category; } + } + + /// + /// Gets this known folder's canonical name. + /// + /// A object. + public string CanonicalName + { + get { return knownFolderProperties.canonicalName; } + } + + /// + /// Gets this known folder's description. + /// + /// A object. + public string Description + { + get { return knownFolderProperties.description; } + } + + /// + /// Gets the unique identifier for this known folder's parent folder. + /// + /// A value. + public Guid ParentId + { + get { return knownFolderProperties.parentId; } + } + + /// + /// Gets this known folder's relative path. + /// + /// A object. + public string RelativePath + { + get { return knownFolderProperties.relativePath; } + } + + /// + /// Gets this known folder's tool tip text. + /// + /// A object. + public string Tooltip + { + get { return knownFolderProperties.tooltip; } + } + /// + /// Gets the resource identifier for this + /// known folder's tool tip text. + /// + /// A object. + public string TooltipResourceId + { + get { return knownFolderProperties.tooltipResourceId; } + } + + /// + /// Gets this known folder's localized name. + /// + /// A object. + public string LocalizedName + { + get { return knownFolderProperties.localizedName; } + } + /// + /// Gets the resource identifier for this + /// known folder's localized name. + /// + /// A object. + public string LocalizedNameResourceId + { + get { return knownFolderProperties.localizedNameResourceId; } + } + + /// + /// Gets this known folder's security attributes. + /// + /// A object. + public string Security + { + get { return knownFolderProperties.security; } + } + + /// + /// Gets this known folder's file attributes, + /// such as "read-only". + /// + /// A value. + public System.IO.FileAttributes FileAttributes + { + get { return knownFolderProperties.fileAttributes; } + } + + /// + /// Gets an value that describes this known folder's behaviors. + /// + /// A value. + public DefinitionOptions DefinitionOptions + { + get { return knownFolderProperties.definitionOptions; } + } + + /// + /// Gets the unique identifier for this known folder's type. + /// + /// A value. + public Guid FolderTypeId + { + get { return knownFolderProperties.folderTypeId; } + } + + /// + /// Gets a string representation of this known folder's type. + /// + /// A object. + public string FolderType + { + get { return knownFolderProperties.folderType; } + } + /// + /// Gets the unique identifier for this known folder. + /// + /// A value. + public Guid FolderId + { + get { return knownFolderProperties.folderId; } + } + + /// + /// Gets a value that indicates whether this known folder's path exists on the computer. + /// + /// A bool value. + /// If this property value is false, + /// the folder might be a virtual folder ( property will + /// be for virtual folders) + public bool PathExists + { + get { return knownFolderProperties.pathExists; } + } + + /// + /// Gets a value that states whether this known folder + /// can have its path set to a new value, + /// including any restrictions on the redirection. + /// + /// A value. + public RedirectionCapability Redirection + { + get { return knownFolderProperties.redirection; } + } + + #endregion + } +} diff --git a/Shell/KnownFolders/KnownFolders.cs b/Shell/KnownFolders/KnownFolders.cs new file mode 100644 index 0000000..286afcd --- /dev/null +++ b/Shell/KnownFolders/KnownFolders.cs @@ -0,0 +1,1331 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Defines properties for known folders that identify the path of standard known folders. + /// + public static class KnownFolders + { + /// + /// Gets a strongly-typed read-only collection of all the registered known folders. + /// + public static ICollection All + { + get + { + return GetAllFolders(); + } + } + + private static ReadOnlyCollection GetAllFolders() + { + // Should this method be thread-safe?? (It'll take a while + // to get a list of all the known folders, create the managed wrapper + // and return the read-only collection. + + IList foldersList = new List(); + uint count; + IntPtr folders = IntPtr.Zero; + + try + { + + KnownFolderManagerClass knownFolderManager = new KnownFolderManagerClass(); + knownFolderManager.GetFolderIds(out folders, out count); + + if (count > 0 && folders != IntPtr.Zero) + { + // Loop through all the KnownFolderID elements + for (int i = 0; i < count; i++) + { + // Read the current pointer + IntPtr current = new IntPtr(folders.ToInt64() + (Marshal.SizeOf(typeof(Guid)) * i)); + + // Convert to Guid + Guid knownFolderID = (Guid)Marshal.PtrToStructure(current, typeof(Guid)); + + IKnownFolder kf = KnownFolderHelper.FromKnownFolderIdInternal(knownFolderID); + + // Add to our collection if it's not null (some folders might not exist on the system + // or we could have an exception that resulted in the null return from above method call + if (kf != null) { foldersList.Add(kf); } + } + } + } + finally + { + if (folders != IntPtr.Zero) { Marshal.FreeCoTaskMem(folders); } + } + + return new ReadOnlyCollection(foldersList); + } + + private static IKnownFolder GetKnownFolder(Guid guid) + { + return KnownFolderHelper.FromKnownFolderId(guid); + } + + #region Default Known Folders + + /// + /// Gets the metadata for the Computer folder. + /// + /// An object. + public static IKnownFolder Computer + { + get + { + return GetKnownFolder( + FolderIdentifiers.Computer); + } + } + + /// + /// Gets the metadata for the Conflict folder. + /// + /// An object. + public static IKnownFolder Conflict + { + get + { + return GetKnownFolder( + FolderIdentifiers.Conflict); + } + } + + /// + /// Gets the metadata for the ControlPanel folder. + /// + /// An object. + public static IKnownFolder ControlPanel + { + get + { + return GetKnownFolder( + FolderIdentifiers.ControlPanel); + } + } + + /// + /// Gets the metadata for the Desktop folder. + /// + /// An object. + public static IKnownFolder Desktop + { + get + { + return GetKnownFolder( + FolderIdentifiers.Desktop); + } + } + + /// + /// Gets the metadata for the Internet folder. + /// + /// An object. + public static IKnownFolder Internet + { + get + { + return GetKnownFolder( + FolderIdentifiers.Internet); + } + } + + /// + /// Gets the metadata for the Network folder. + /// + /// An object. + public static IKnownFolder Network + { + get + { + return GetKnownFolder( + FolderIdentifiers.Network); + } + } + + /// + /// Gets the metadata for the Printers folder. + /// + /// An object. + public static IKnownFolder Printers + { + get + { + return GetKnownFolder( + FolderIdentifiers.Printers); + } + } + + /// + /// Gets the metadata for the SyncManager folder. + /// + /// An object. + public static IKnownFolder SyncManager + { + get + { + return GetKnownFolder( + FolderIdentifiers.SyncManager); + } + } + + /// + /// Gets the metadata for the Connections folder. + /// + /// An object. + public static IKnownFolder Connections + { + get + { + return GetKnownFolder( + FolderIdentifiers.Connections); + } + } + + /// + /// Gets the metadata for the SyncSetup folder. + /// + /// An object. + public static IKnownFolder SyncSetup + { + get + { + return GetKnownFolder( + FolderIdentifiers.SyncSetup); + } + } + + /// + /// Gets the metadata for the SyncResults folder. + /// + /// An object. + public static IKnownFolder SyncResults + { + get + { + return GetKnownFolder( + FolderIdentifiers.SyncResults); + } + } + + /// + /// Gets the metadata for the RecycleBin folder. + /// + /// An object. + public static IKnownFolder RecycleBin + { + get + { + return GetKnownFolder( + FolderIdentifiers.RecycleBin); + } + } + + /// + /// Gets the metadata for the Fonts folder. + /// + /// An object. + public static IKnownFolder Fonts + { + get + { + return GetKnownFolder(FolderIdentifiers.Fonts); + } + } + + /// + /// Gets the metadata for the Startup folder. + /// + /// An object. + public static IKnownFolder Startup + { + get + { + return GetKnownFolder(FolderIdentifiers.Startup); + } + } + + /// + /// Gets the metadata for the Programs folder. + /// + /// An object. + public static IKnownFolder Programs + { + get + { + return GetKnownFolder(FolderIdentifiers.Programs); + } + } + + /// + /// Gets the metadata for the per-user StartMenu folder. + /// + /// An object. + public static IKnownFolder StartMenu + { + get + { + return GetKnownFolder(FolderIdentifiers.StartMenu); + } + } + + /// + /// Gets the metadata for the per-user Recent folder. + /// + /// An object. + public static IKnownFolder Recent + { + get + { + return GetKnownFolder(FolderIdentifiers.Recent); + } + } + + /// + /// Gets the metadata for the per-user SendTo folder. + /// + /// An object. + public static IKnownFolder SendTo + { + get + { + return GetKnownFolder(FolderIdentifiers.SendTo); + } + } + + /// + /// Gets the metadata for the per-user Documents folder. + /// + /// An object. + public static IKnownFolder Documents + { + get + { + return GetKnownFolder(FolderIdentifiers.Documents); + } + } + + /// + /// Gets the metadata for the per-user Favorites folder. + /// + /// An object. + public static IKnownFolder Favorites + { + get + { + return GetKnownFolder(FolderIdentifiers.Favorites); + } + } + + /// + /// Gets the metadata for the NetHood folder. + /// + /// An object. + public static IKnownFolder NetHood + { + get + { + return GetKnownFolder(FolderIdentifiers.NetHood); + } + } + + /// + /// Gets the metadata for the PrintHood folder. + /// + /// An object. + public static IKnownFolder PrintHood + { + get + { + return GetKnownFolder(FolderIdentifiers.PrintHood); + } + } + + /// + /// Gets the metadata for the Templates folder. + /// + /// An object. + public static IKnownFolder Templates + { + get + { + return GetKnownFolder(FolderIdentifiers.Templates); + } + } + + /// + /// Gets the metadata for the CommonStartup folder. + /// + /// An object. + public static IKnownFolder CommonStartup + { + get + { + return GetKnownFolder(FolderIdentifiers.CommonStartup); + } + } + + /// + /// Gets the metadata for the CommonPrograms folder. + /// + /// An object. + public static IKnownFolder CommonPrograms + { + get + { + return GetKnownFolder(FolderIdentifiers.CommonPrograms); + } + } + + /// + /// Gets the metadata for the CommonStartMenu folder. + /// + /// An object. + public static IKnownFolder CommonStartMenu + { + get + { + return GetKnownFolder(FolderIdentifiers.CommonStartMenu); + } + } + + /// + /// Gets the metadata for the PublicDesktop folder. + /// + /// An object. + public static IKnownFolder PublicDesktop + { + get + { + return GetKnownFolder(FolderIdentifiers.PublicDesktop); + } + } + + /// + /// Gets the metadata for the ProgramData folder. + /// + /// An object. + public static IKnownFolder ProgramData + { + get + { + return GetKnownFolder(FolderIdentifiers.ProgramData); + } + } + + /// + /// Gets the metadata for the CommonTemplates folder. + /// + /// An object. + public static IKnownFolder CommonTemplates + { + get + { + return GetKnownFolder(FolderIdentifiers.CommonTemplates); + } + } + + /// + /// Gets the metadata for the PublicDocuments folder. + /// + /// An object. + public static IKnownFolder PublicDocuments + { + get + { + return GetKnownFolder(FolderIdentifiers.PublicDocuments); + } + } + + /// + /// Gets the metadata for the RoamingAppData folder. + /// + /// An object. + public static IKnownFolder RoamingAppData + { + get + { + return GetKnownFolder(FolderIdentifiers.RoamingAppData); + } + } + + /// + /// Gets the metadata for the per-user LocalAppData + /// folder. + /// + /// An object. + public static IKnownFolder LocalAppData + { + get + { + return GetKnownFolder(FolderIdentifiers.LocalAppData); + } + } + + /// + /// Gets the metadata for the LocalAppDataLow folder. + /// + /// An object. + public static IKnownFolder LocalAppDataLow + { + get + { + return GetKnownFolder(FolderIdentifiers.LocalAppDataLow); + } + } + + /// + /// Gets the metadata for the InternetCache folder. + /// + /// An object. + public static IKnownFolder InternetCache + { + get + { + return GetKnownFolder(FolderIdentifiers.InternetCache); + } + } + + /// + /// Gets the metadata for the Cookies folder. + /// + /// An object. + public static IKnownFolder Cookies + { + get + { + return GetKnownFolder(FolderIdentifiers.Cookies); + } + } + + /// + /// Gets the metadata for the History folder. + /// + /// An object. + public static IKnownFolder History + { + get + { + return GetKnownFolder(FolderIdentifiers.History); + } + } + + /// + /// Gets the metadata for the System folder. + /// + /// An object. + public static IKnownFolder System + { + get + { + return GetKnownFolder(FolderIdentifiers.System); + } + } + + /// + /// Gets the metadata for the SystemX86 + /// folder. + /// + /// An object. + public static IKnownFolder SystemX86 + { + get + { + return GetKnownFolder(FolderIdentifiers.SystemX86); + } + } + + /// + /// Gets the metadata for the Windows folder. + /// + /// An object. + public static IKnownFolder Windows + { + get + { + return GetKnownFolder(FolderIdentifiers.Windows); + } + } + + /// + /// Gets the metadata for the Profile folder. + /// + /// An object. + public static IKnownFolder Profile + { + get + { + return GetKnownFolder(FolderIdentifiers.Profile); + } + } + + /// + /// Gets the metadata for the per-user Pictures folder. + /// + /// An object. + public static IKnownFolder Pictures + { + get + { + return GetKnownFolder(FolderIdentifiers.Pictures); + } + } + + /// + /// Gets the metadata for the ProgramFilesX86 folder. + /// + /// An object. + public static IKnownFolder ProgramFilesX86 + { + get + { + return GetKnownFolder(FolderIdentifiers.ProgramFilesX86); + } + } + + /// + /// Gets the metadata for the ProgramFilesCommonX86 folder. + /// + /// An object. + public static IKnownFolder ProgramFilesCommonX86 + { + get + { + return GetKnownFolder(FolderIdentifiers.ProgramFilesCommonX86); + } + } + + /// + /// Gets the metadata for the ProgramsFilesX64 folder. + /// + /// An object. + public static IKnownFolder ProgramFilesX64 + { + get + { + return GetKnownFolder(FolderIdentifiers.ProgramFilesX64); + } + } + + /// + /// Gets the metadata for the ProgramFilesCommonX64 folder. + /// + /// An object. + public static IKnownFolder ProgramFilesCommonX64 + { + get + { + return GetKnownFolder(FolderIdentifiers.ProgramFilesCommonX64); + } + } + + /// + /// Gets the metadata for the ProgramFiles folder. + /// + /// An object. + public static IKnownFolder ProgramFiles + { + get + { + return GetKnownFolder(FolderIdentifiers.ProgramFiles); + } + } + + /// + /// Gets the metadata for the ProgramFilesCommon folder. + /// + /// An object. + public static IKnownFolder ProgramFilesCommon + { + get + { + return GetKnownFolder(FolderIdentifiers.ProgramFilesCommon); + } + } + + /// + /// Gets the metadata for the AdminTools folder. + /// + /// An object. + public static IKnownFolder AdminTools + { + get + { + return GetKnownFolder(FolderIdentifiers.AdminTools); + } + } + + /// + /// Gets the metadata for the CommonAdminTools folder. + /// + /// An object. + public static IKnownFolder CommonAdminTools + { + get + { + return GetKnownFolder(FolderIdentifiers.CommonAdminTools); + } + } + + /// + /// Gets the metadata for the per-user Music folder. + /// + /// An object. + public static IKnownFolder Music + { + get + { + return GetKnownFolder(FolderIdentifiers.Music); + } + } + + /// + /// Gets the metadata for the Videos folder. + /// + /// An object. + public static IKnownFolder Videos + { + get + { + return GetKnownFolder(FolderIdentifiers.Videos); + } + } + + /// + /// Gets the metadata for the PublicPictures folder. + /// + /// An object. + public static IKnownFolder PublicPictures + { + get + { + return GetKnownFolder(FolderIdentifiers.PublicPictures); + } + } + + /// + /// Gets the metadata for the PublicMusic folder. + /// + /// An object. + public static IKnownFolder PublicMusic + { + get + { + return GetKnownFolder(FolderIdentifiers.PublicMusic); + } + } + + /// + /// Gets the metadata for the PublicVideos folder. + /// + /// An object. + public static IKnownFolder PublicVideos + { + get + { + return GetKnownFolder(FolderIdentifiers.PublicVideos); + } + } + + /// + /// Gets the metadata for the ResourceDir folder. + /// + /// An object. + public static IKnownFolder ResourceDir + { + get + { + return GetKnownFolder(FolderIdentifiers.ResourceDir); + } + } + + /// + /// Gets the metadata for the LocalizedResourcesDir folder. + /// + /// An object. + public static IKnownFolder LocalizedResourcesDir + { + get + { + return GetKnownFolder(FolderIdentifiers.LocalizedResourcesDir); + } + } + + /// + /// Gets the metadata for the CommonOEMLinks folder. + /// + /// An object. + public static IKnownFolder CommonOemLinks + { + get + { + return GetKnownFolder(FolderIdentifiers.CommonOEMLinks); + } + } + + /// + /// Gets the metadata for the CDBurning folder. + /// + /// An object. + public static IKnownFolder CDBurning + { + get + { + return GetKnownFolder(FolderIdentifiers.CDBurning); + } + } + + /// + /// Gets the metadata for the UserProfiles folder. + /// + /// An object. + public static IKnownFolder UserProfiles + { + get + { + return GetKnownFolder(FolderIdentifiers.UserProfiles); + } + } + + /// + /// Gets the metadata for the Playlists folder. + /// + /// An object. + public static IKnownFolder Playlists + { + get + { + return GetKnownFolder(FolderIdentifiers.Playlists); + } + } + + /// + /// Gets the metadata for the SamplePlaylists folder. + /// + /// An object. + public static IKnownFolder SamplePlaylists + { + get + { + return GetKnownFolder(FolderIdentifiers.SamplePlaylists); + } + } + + /// + /// Gets the metadata for the SampleMusic folder. + /// + /// An object. + public static IKnownFolder SampleMusic + { + get + { + return GetKnownFolder(FolderIdentifiers.SampleMusic); + } + } + + /// + /// Gets the metadata for the SamplePictures folder. + /// + /// An object. + public static IKnownFolder SamplePictures + { + get + { + return GetKnownFolder(FolderIdentifiers.SamplePictures); + } + } + + /// + /// Gets the metadata for the SampleVideos folder. + /// + /// An object. + public static IKnownFolder SampleVideos + { + get + { + return GetKnownFolder(FolderIdentifiers.SampleVideos); + } + } + + /// + /// Gets the metadata for the PhotoAlbums folder. + /// + /// An object. + public static IKnownFolder PhotoAlbums + { + get + { + return GetKnownFolder(FolderIdentifiers.PhotoAlbums); + } + } + + /// + /// Gets the metadata for the Public folder. + /// + /// An object. + public static IKnownFolder Public + { + get + { + return GetKnownFolder(FolderIdentifiers.Public); + } + } + + /// + /// Gets the metadata for the ChangeRemovePrograms folder. + /// + /// An object. + public static IKnownFolder ChangeRemovePrograms + { + get + { + return GetKnownFolder(FolderIdentifiers.ChangeRemovePrograms); + } + } + + /// + /// Gets the metadata for the AppUpdates folder. + /// + /// An object. + public static IKnownFolder AppUpdates + { + get + { + return GetKnownFolder(FolderIdentifiers.AppUpdates); + } + } + + /// + /// Gets the metadata for the AddNewPrograms folder. + /// + /// An object. + public static IKnownFolder AddNewPrograms + { + get + { + return GetKnownFolder(FolderIdentifiers.AddNewPrograms); + } + } + + /// + /// Gets the metadata for the per-user Downloads folder. + /// + /// An object. + public static IKnownFolder Downloads + { + get + { + return GetKnownFolder(FolderIdentifiers.Downloads); + } + } + + /// + /// Gets the metadata for the PublicDownloads folder. + /// + /// An object. + public static IKnownFolder PublicDownloads + { + get + { + return GetKnownFolder(FolderIdentifiers.PublicDownloads); + } + } + + /// + /// Gets the metadata for the per-user SavedSearches folder. + /// + /// An object. + public static IKnownFolder SavedSearches + { + get + { + return GetKnownFolder(FolderIdentifiers.SavedSearches); + } + } + + /// + /// Gets the metadata for the per-user QuickLaunch folder. + /// + /// An object. + public static IKnownFolder QuickLaunch + { + get + { + return GetKnownFolder(FolderIdentifiers.QuickLaunch); + } + } + + /// + /// Gets the metadata for the Contacts folder. + /// + /// An object. + public static IKnownFolder Contacts + { + get + { + return GetKnownFolder(FolderIdentifiers.Contacts); + } + } + + /// + /// Gets the metadata for the SidebarParts folder. + /// + /// An object. + public static IKnownFolder SidebarParts + { + get + { + return GetKnownFolder(FolderIdentifiers.SidebarParts); + } + } + + /// + /// Gets the metadata for the SidebarDefaultParts folder. + /// + /// An object. + public static IKnownFolder SidebarDefaultParts + { + get + { + return GetKnownFolder(FolderIdentifiers.SidebarDefaultParts); + } + } + + /// + /// Gets the metadata for the TreeProperties folder. + /// + /// An object. + public static IKnownFolder TreeProperties + { + get + { + return GetKnownFolder(FolderIdentifiers.TreeProperties); + } + } + + /// + /// Gets the metadata for the PublicGameTasks folder. + /// + /// An object. + public static IKnownFolder PublicGameTasks + { + get + { + return GetKnownFolder(FolderIdentifiers.PublicGameTasks); + } + } + + /// + /// Gets the metadata for the GameTasks folder. + /// + /// An object. + public static IKnownFolder GameTasks + { + get + { + return GetKnownFolder(FolderIdentifiers.GameTasks); + } + } + + /// + /// Gets the metadata for the per-user SavedGames folder. + /// + /// An object. + public static IKnownFolder SavedGames + { + get + { + return GetKnownFolder(FolderIdentifiers.SavedGames); + } + } + + /// + /// Gets the metadata for the Games folder. + /// + /// An object. + public static IKnownFolder Games + { + get + { + return GetKnownFolder(FolderIdentifiers.Games); + } + } + + /// + /// Gets the metadata for the RecordedTV folder. + /// + /// An object. + /// This folder is not used. + public static IKnownFolder RecordedTV + { + get + { + return GetKnownFolder(FolderIdentifiers.RecordedTV); + } + } + + /// + /// Gets the metadata for the SearchMapi folder. + /// + /// An object. + public static IKnownFolder SearchMapi + { + get + { + return GetKnownFolder(FolderIdentifiers.SearchMapi); + } + } + + /// + /// Gets the metadata for the SearchCsc folder. + /// + /// An object. + public static IKnownFolder SearchCsc + { + get + { + return GetKnownFolder(FolderIdentifiers.SearchCsc); + } + } + + /// + /// Gets the metadata for the per-user Links folder. + /// + /// An object. + public static IKnownFolder Links + { + get + { + return GetKnownFolder(FolderIdentifiers.Links); + } + } + + /// + /// Gets the metadata for the UsersFiles folder. + /// + /// An object. + public static IKnownFolder UsersFiles + { + get + { + return GetKnownFolder(FolderIdentifiers.UsersFiles); + } + } + + /// + /// Gets the metadata for the SearchHome folder. + /// + /// An object. + public static IKnownFolder SearchHome + { + get + { + return GetKnownFolder(FolderIdentifiers.SearchHome); + } + } + + /// + /// Gets the metadata for the OriginalImages folder. + /// + /// An object. + public static IKnownFolder OriginalImages + { + get + { + return GetKnownFolder(FolderIdentifiers.OriginalImages); + } + } + + /// + /// Gets the metadata for the UserProgramFiles folder. + /// + public static IKnownFolder UserProgramFiles + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.UserProgramFiles); + } + } + + /// + /// Gets the metadata for the UserProgramFilesCommon folder. + /// + public static IKnownFolder UserProgramFilesCommon + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.UserProgramFilesCommon); + } + } + + /// + /// Gets the metadata for the Ringtones folder. + /// + public static IKnownFolder Ringtones + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.Ringtones); + } + } + + /// + /// Gets the metadata for the PublicRingtones folder. + /// + public static IKnownFolder PublicRingtones + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.PublicRingtones); + } + } + + /// + /// Gets the metadata for the UsersLibraries folder. + /// + public static IKnownFolder UsersLibraries + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.UsersLibraries); + } + } + + /// + /// Gets the metadata for the DocumentsLibrary folder. + /// + public static IKnownFolder DocumentsLibrary + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.DocumentsLibrary); + } + } + + /// + /// Gets the metadata for the MusicLibrary folder. + /// + public static IKnownFolder MusicLibrary + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.MusicLibrary); + } + } + + /// + /// Gets the metadata for the PicturesLibrary folder. + /// + public static IKnownFolder PicturesLibrary + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.PicturesLibrary); + } + } + + /// + /// Gets the metadata for the VideosLibrary folder. + /// + public static IKnownFolder VideosLibrary + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.VideosLibrary); + } + } + + /// + /// Gets the metadata for the RecordedTVLibrary folder. + /// + public static IKnownFolder RecordedTVLibrary + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.RecordedTVLibrary); + } + } + + /// + /// Gets the metadata for the OtherUsers folder. + /// + public static IKnownFolder OtherUsers + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.OtherUsers); + } + } + + /// + /// Gets the metadata for the DeviceMetadataStore folder. + /// + public static IKnownFolder DeviceMetadataStore + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.DeviceMetadataStore); + } + } + + /// + /// Gets the metadata for the Libraries folder. + /// + public static IKnownFolder Libraries + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.Libraries); + } + } + + /// + ///Gets the metadata for the UserPinned folder. + /// + public static IKnownFolder UserPinned + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.UserPinned); + } + } + + /// + /// Gets the metadata for the ImplicitAppShortcuts folder. + /// + public static IKnownFolder ImplicitAppShortcuts + { + get + { + CoreHelpers.ThrowIfNotWin7(); + return GetKnownFolder(FolderIdentifiers.ImplicitAppShortcuts); + } + } + + #endregion + + } +} \ No newline at end of file diff --git a/Shell/KnownFolders/NonFileSystemKnownFolder.cs b/Shell/KnownFolders/NonFileSystemKnownFolder.cs new file mode 100644 index 0000000..60130f6 --- /dev/null +++ b/Shell/KnownFolders/NonFileSystemKnownFolder.cs @@ -0,0 +1,282 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a registered non file system Known Folder + /// + public class NonFileSystemKnownFolder : ShellNonFileSystemFolder, IKnownFolder, IDisposable + { + #region Private Fields + + private IKnownFolderNative knownFolderNative; + private KnownFolderSettings knownFolderSettings; + + #endregion + + #region Internal Constructors + + internal NonFileSystemKnownFolder(IShellItem2 shellItem) : base(shellItem) { } + + internal NonFileSystemKnownFolder(IKnownFolderNative kf) + { + Debug.Assert(kf != null); + knownFolderNative = kf; + + // Set the native shell item + // and set it on the base class (ShellObject) + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + knownFolderNative.GetShellItem(0, ref guid, out nativeShellItem); + } + + #endregion + + #region Private Members + + private KnownFolderSettings KnownFolderSettings + { + get + { + if (knownFolderNative == null) + { + // We need to get the PIDL either from the NativeShellItem, + // or from base class's property (if someone already set it on us). + // Need to use the PIDL to get the native IKnownFolder interface. + + // Get teh PIDL for the ShellItem + if (nativeShellItem != null && base.PIDL == IntPtr.Zero) + { + base.PIDL = ShellHelper.PidlFromShellItem(nativeShellItem); + } + + // If we have a valid PIDL, get the native IKnownFolder + if (base.PIDL != IntPtr.Zero) + { + knownFolderNative = KnownFolderHelper.FromPIDL(base.PIDL); + } + + Debug.Assert(knownFolderNative != null); + } + + // If this is the first time this property is being called, + // get the native Folder Defination (KnownFolder properties) + if (knownFolderSettings == null) + { + knownFolderSettings = new KnownFolderSettings(knownFolderNative); + } + + return knownFolderSettings; + } + } + + #endregion + + #region IKnownFolder Members + + /// + /// Gets the path for this known folder. + /// + /// A object. + public string Path + { + get { return KnownFolderSettings.Path; } + } + + /// + /// Gets the category designation for this known folder. + /// + /// A value. + public FolderCategory Category + { + get { return KnownFolderSettings.Category; } + } + + /// + /// Gets this known folder's canonical name. + /// + /// A object. + public string CanonicalName + { + get { return KnownFolderSettings.CanonicalName; } + } + + /// + /// Gets this known folder's description. + /// + /// A object. + public string Description + { + get { return KnownFolderSettings.Description; } + } + + /// + /// Gets the unique identifier for this known folder's parent folder. + /// + /// A value. + public Guid ParentId + { + get { return KnownFolderSettings.ParentId; } + } + + /// + /// Gets this known folder's relative path. + /// + /// A object. + public string RelativePath + { + get { return KnownFolderSettings.RelativePath; } + } + + /// + /// Gets this known folder's parsing name. + /// + /// A object. + public override string ParsingName + { + get { return base.ParsingName; } + } + + /// + /// Gets this known folder's tool tip text. + /// + /// A object. + public string Tooltip + { + get { return KnownFolderSettings.Tooltip; } + } + /// + /// Gets the resource identifier for this + /// known folder's tool tip text. + /// + /// A object. + public string TooltipResourceId + { + get { return KnownFolderSettings.TooltipResourceId; } + } + + /// + /// Gets this known folder's localized name. + /// + /// A object. + public string LocalizedName + { + get { return KnownFolderSettings.LocalizedName; } + } + /// + /// Gets the resource identifier for this + /// known folder's localized name. + /// + /// A object. + public string LocalizedNameResourceId + { + get { return KnownFolderSettings.LocalizedNameResourceId; } + } + + /// + /// Gets this known folder's security attributes. + /// + /// A object. + public string Security + { + get { return KnownFolderSettings.Security; } + } + + /// + /// Gets this known folder's file attributes, + /// such as "read-only". + /// + /// A value. + public System.IO.FileAttributes FileAttributes + { + get { return KnownFolderSettings.FileAttributes; } + } + + /// + /// Gets an value that describes this known folder's behaviors. + /// + /// A value. + public DefinitionOptions DefinitionOptions + { + get { return KnownFolderSettings.DefinitionOptions; } + } + + /// + /// Gets the unique identifier for this known folder's type. + /// + /// A value. + public Guid FolderTypeId + { + get { return KnownFolderSettings.FolderTypeId; } + } + + /// + /// Gets a string representation of this known folder's type. + /// + /// A object. + public string FolderType + { + get { return KnownFolderSettings.FolderType; } + } + /// + /// Gets the unique identifier for this known folder. + /// + /// A value. + public Guid FolderId + { + get { return KnownFolderSettings.FolderId; } + } + + /// + /// Gets a value that indicates whether this known folder's path exists on the computer. + /// + /// A bool value. + /// If this property value is false, + /// the folder might be a virtual folder ( property will + /// be for virtual folders) + public bool PathExists + { + get { return KnownFolderSettings.PathExists; } + } + + /// + /// Gets a value that states whether this known folder + /// can have its path set to a new value, + /// including any restrictions on the redirection. + /// + /// A value. + public RedirectionCapability Redirection + { + get { return KnownFolderSettings.Redirection; } + } + + #endregion + + #region IDisposable Members + + /// + /// Release resources + /// + /// Indicates that this mothod is being called from Dispose() rather than the finalizer. + protected override void Dispose(bool disposing) + { + if (disposing) + { + knownFolderSettings = null; + } + + if (knownFolderNative != null) + { + Marshal.ReleaseComObject(knownFolderNative); + knownFolderNative = null; + } + + base.Dispose(disposing); + } + + #endregion + } +} diff --git a/Shell/KnownFolders/RedirectionCapabilities.cs b/Shell/KnownFolders/RedirectionCapabilities.cs new file mode 100644 index 0000000..352b128 --- /dev/null +++ b/Shell/KnownFolders/RedirectionCapabilities.cs @@ -0,0 +1,45 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Specifies the redirection capabilities for known folders. + /// + public enum RedirectionCapability + { + /// + /// Redirection capability is unknown. + /// + None = 0x00, + /// + /// The known folder can be redirected. + /// + AllowAll = 0xff, + /// + /// The known folder can be redirected. + /// Currently, redirection exists only for + /// common and user folders; fixed and virtual folders + /// cannot be redirected. + /// + Redirectable = 0x1, + /// + /// Redirection is not allowed. + /// + DenyAll = 0xfff00, + /// + /// The folder cannot be redirected because it is + /// already redirected by group policy. + /// + DenyPolicyRedirected = 0x100, + /// + /// The folder cannot be redirected because the policy + /// prohibits redirecting this folder. + /// + DenyPolicy = 0x200, + /// + /// The folder cannot be redirected because the calling + /// application does not have sufficient permissions. + /// + DenyPermissions = 0x400 + } +} \ No newline at end of file diff --git a/Shell/KnownFolders/RetrievalOptions.cs b/Shell/KnownFolders/RetrievalOptions.cs new file mode 100644 index 0000000..4842a0d --- /dev/null +++ b/Shell/KnownFolders/RetrievalOptions.cs @@ -0,0 +1,21 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Contains special retrieval options for known folders. + /// + internal enum RetrievalOptions + { + None = 0, + Create = 0x00008000, + DontVerify = 0x00004000, + DontUnexpand = 0x00002000, + NoAlias = 0x00001000, + Init = 0x00000800, + DefaultPath = 0x00000400, + NotParentRelative = 0x00000200 + } +} \ No newline at end of file diff --git a/Shell/Makefile.am b/Shell/Makefile.am new file mode 100644 index 0000000..24e07e9 --- /dev/null +++ b/Shell/Makefile.am @@ -0,0 +1,5 @@ +include $(top_srcdir)/xbuild.include + +if ! ENABLE_WINDOWSPLATFORM +SKIP=y +endif diff --git a/Shell/Properties/AssemblyInfo.cs b/Shell/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ce02943 --- /dev/null +++ b/Shell/Properties/AssemblyInfo.cs @@ -0,0 +1,42 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft.WindowsAPICodePack.Shell")] +[assembly: AssemblyDescription("WindowsAPICodePack for Shell")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Microsoft Windows API Code Pack for .NET Framework")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: InternalsVisibleTo("Microsoft.WindowsAPICodePack.ShellExtensions")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("48fe0672-7ff4-48fd-a3fd-83c8fa8c3506")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] + +[assembly: NeutralResourcesLanguageAttribute("en")] \ No newline at end of file diff --git a/Shell/PropertySystem/IShellProperty.cs b/Shell/PropertySystem/IShellProperty.cs new file mode 100644 index 0000000..fb18595 --- /dev/null +++ b/Shell/PropertySystem/IShellProperty.cs @@ -0,0 +1,59 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Defines the properties used by a Shell Property. + /// + public interface IShellProperty + { + /// + /// Gets the property key that identifies this property. + /// + PropertyKey PropertyKey { get; } + + /// + /// Gets a formatted, Unicode string representation of a property value. + /// + /// One or more PropertyDescriptionFormat flags + /// chosen to produce the desired display format. + /// The formatted value as a string. + string FormatForDisplay(PropertyDescriptionFormatOptions format); + + /// + /// Get the property description object. + /// + ShellPropertyDescription Description { get; } + + /// + /// Gets the case-sensitive name of the property as it is known to the system, + /// regardless of its localized name. + /// + string CanonicalName { get; } + + /// + /// Gets the value for this property using the generic Object type. + /// + /// + /// To obtain a specific type for this value, use the more strongly-typed + /// Property<T> class. + /// You can only set a value for this type using the Property<T> + /// class. + /// + object ValueAsObject { get; } + + /// + /// Gets the System.Type value for this property. + /// + Type ValueType { get; } + + /// + /// Gets the image reference path and icon index associated with a property value. + /// This API is only available in Windows 7. + /// + IconReference IconReference { get; } + } +} diff --git a/Shell/PropertySystem/PropertySystemException.cs b/Shell/PropertySystem/PropertySystemException.cs new file mode 100644 index 0000000..ee07981 --- /dev/null +++ b/Shell/PropertySystem/PropertySystemException.cs @@ -0,0 +1,54 @@ +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + + /// + /// An exception thrown when an error occurs while dealing with the Property System API. + /// + [Serializable] + public class PropertySystemException : ExternalException + { + /// + /// Default constructor. + /// + public PropertySystemException() { } + + /// + /// Initializes an excpetion with a custom message. + /// + /// + public PropertySystemException(string message) : base(message) { } + + /// + /// Initializes an exception with custom message and inner exception. + /// + /// + /// + public PropertySystemException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes an exception with custom message and error code. + /// + /// + /// + public PropertySystemException(string message, int errorCode) : base(message, errorCode) { } + + /// + /// Initializes an exception from serialization info and a context. + /// + /// + /// + protected PropertySystemException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) + { + } + + } +} diff --git a/Shell/PropertySystem/ShellProperties.cs b/Shell/PropertySystem/ShellProperties.cs new file mode 100644 index 0000000..fdf9ae9 --- /dev/null +++ b/Shell/PropertySystem/ShellProperties.cs @@ -0,0 +1,168 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Defines a partial class that implements helper methods for retrieving Shell properties + /// using a canonical name, property key, or a strongly-typed property. Also provides + /// access to all the strongly-typed system properties and default properties collections. + /// + public partial class ShellProperties : IDisposable + { + private ShellObject ParentShellObject { get; set; } + private ShellPropertyCollection defaultPropertyCollection; + + internal ShellProperties(ShellObject parent) + { + ParentShellObject = parent; + } + + /// + /// Returns a property available in the default property collection using + /// the given property key. + /// + /// The property key. + /// An IShellProperty. + public IShellProperty GetProperty(PropertyKey key) + { + return CreateTypedProperty(key); + } + + /// + /// Returns a property available in the default property collection using + /// the given canonical name. + /// + /// The canonical name. + /// An IShellProperty. + public IShellProperty GetProperty(string canonicalName) + { + return CreateTypedProperty(canonicalName); + } + + /// + /// Returns a strongly typed property available in the default property collection using + /// the given property key. + /// + /// The type of property to retrieve. + /// The property key. + /// A strongly-typed ShellProperty for the given property key. + public ShellProperty GetProperty(PropertyKey key) + { + return CreateTypedProperty(key) as ShellProperty; + } + + /// + /// Returns a strongly typed property available in the default property collection using + /// the given canonical name. + /// + /// The type of property to retrieve. + /// The canonical name. + /// A strongly-typed ShellProperty for the given canonical name. + public ShellProperty GetProperty(string canonicalName) + { + return CreateTypedProperty(canonicalName) as ShellProperty; + } + + private PropertySystem propertySystem; + /// + /// Gets all the properties for the system through an accessor. + /// + public PropertySystem System + { + get + { + if (propertySystem == null) + { + propertySystem = new PropertySystem(ParentShellObject); + } + + return propertySystem; + } + } + + /// + /// Gets the collection of all the default properties for this item. + /// + public ShellPropertyCollection DefaultPropertyCollection + { + get + { + if (defaultPropertyCollection == null) + { + defaultPropertyCollection = new ShellPropertyCollection(ParentShellObject); + } + + return defaultPropertyCollection; + } + } + + /// + /// Returns the shell property writer used when writing multiple properties. + /// + /// A ShellPropertyWriter. + /// Use the Using pattern with the returned ShellPropertyWriter or + /// manually call the Close method on the writer to commit the changes + /// and dispose the writer + public ShellPropertyWriter GetPropertyWriter() + { + return new ShellPropertyWriter(ParentShellObject); + } + + internal IShellProperty CreateTypedProperty(PropertyKey propKey) + { + ShellPropertyDescription desc = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey); + return new ShellProperty(propKey, desc, ParentShellObject); + } + + internal IShellProperty CreateTypedProperty(PropertyKey propKey) + { + return ShellPropertyFactory.CreateShellProperty(propKey, ParentShellObject); + } + + internal IShellProperty CreateTypedProperty(string canonicalName) + { + // Otherwise, call the native PropertyStore method + PropertyKey propKey; + + int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(canonicalName, out propKey); + + if (!CoreErrorHelper.Succeeded(result)) + { + throw new ArgumentException( + LocalizedMessages.ShellInvalidCanonicalName, + Marshal.GetExceptionForHR(result)); + } + return CreateTypedProperty(propKey); + } + + #region IDisposable Members + + /// + /// Cleans up memory + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Cleans up memory + /// + protected virtual void Dispose(bool disposed) + { + if (disposed && defaultPropertyCollection != null) + { + defaultPropertyCollection.Dispose(); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Shell/PropertySystem/ShellProperty.cs b/Shell/PropertySystem/ShellProperty.cs new file mode 100644 index 0000000..ef41678 --- /dev/null +++ b/Shell/PropertySystem/ShellProperty.cs @@ -0,0 +1,447 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using System.Reflection; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Defines a strongly-typed property object. + /// All writable property objects must be of this type + /// to be able to call the value setter. + /// + /// The type of this property's value. + /// Because a property value can be empty, only nullable types + /// are allowed. + public class ShellProperty : IShellProperty + { + #region Private Fields + + private PropertyKey propertyKey; + string imageReferencePath = null; + int? imageReferenceIconIndex; + private ShellPropertyDescription description = null; + + #endregion + + #region Private Methods + + private ShellObject ParentShellObject { get; set; } + + private IPropertyStore NativePropertyStore { get; set; } + + private void GetImageReference() + { + IPropertyStore store = ShellPropertyCollection.CreateDefaultPropertyStore(ParentShellObject); + + using (PropVariant propVar = new PropVariant()) + { + store.GetValue(ref propertyKey, propVar); + + Marshal.ReleaseComObject(store); + store = null; + + string refPath; + ((IPropertyDescription2)Description.NativePropertyDescription).GetImageReferenceForValue( + propVar, out refPath); + + if (refPath == null) { return; } + + int index = ShellNativeMethods.PathParseIconLocation(ref refPath); + if (refPath != null) + { + imageReferencePath = refPath; + imageReferenceIconIndex = index; + } + } + } + + private void StorePropVariantValue(PropVariant propVar) + { + Guid guid = new Guid(ShellIIDGuid.IPropertyStore); + IPropertyStore writablePropStore = null; + try + { + int hr = ParentShellObject.NativeShellItem2.GetPropertyStore( + ShellNativeMethods.GetPropertyStoreOptions.ReadWrite, + ref guid, + out writablePropStore); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty, + Marshal.GetExceptionForHR(hr)); + } + + HResult result = writablePropStore.SetValue(ref propertyKey, propVar); + + if (!AllowSetTruncatedValue && (int)result == ShellNativeMethods.InPlaceStringTruncated) + { + throw new ArgumentOutOfRangeException("propVar", LocalizedMessages.ShellPropertyValueTruncated); + } + + if (!CoreErrorHelper.Succeeded(result)) + { + throw new PropertySystemException(LocalizedMessages.ShellPropertySetValue, Marshal.GetExceptionForHR((int)result)); + } + + writablePropStore.Commit(); + + } + catch (InvalidComObjectException e) + { + throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty, e); + } + catch (InvalidCastException) + { + throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty); + } + finally + { + if (writablePropStore != null) + { + Marshal.ReleaseComObject(writablePropStore); + writablePropStore = null; + } + } + } + + #endregion + + #region Internal Constructor + + /// + /// Constructs a new Property object + /// + /// + /// + /// + internal ShellProperty( + PropertyKey propertyKey, + ShellPropertyDescription description, + ShellObject parent) + { + this.propertyKey = propertyKey; + this.description = description; + ParentShellObject = parent; + AllowSetTruncatedValue = false; + } + + /// + /// Constructs a new Property object + /// + /// + /// + /// + internal ShellProperty( + PropertyKey propertyKey, + ShellPropertyDescription description, + IPropertyStore propertyStore) + { + this.propertyKey = propertyKey; + this.description = description; + NativePropertyStore = propertyStore; + AllowSetTruncatedValue = false; + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the strongly-typed value of this property. + /// The value of the property is cleared if the value is set to null. + /// + /// + /// If the property value cannot be retrieved or updated in the Property System + /// If the type of this property is not supported; e.g. writing a binary object. + /// Thrown if is false, and either + /// a string value was truncated or a numeric value was rounded. + public T Value + { + get + { + // Make sure we load the correct type + Debug.Assert(ValueType == ShellPropertyFactory.VarEnumToSystemType(Description.VarEnumType)); + + using (PropVariant propVar = new PropVariant()) + { + if (ParentShellObject.NativePropertyStore != null) + { + // If there is a valid property store for this shell object, then use it. + ParentShellObject.NativePropertyStore.GetValue(ref propertyKey, propVar); + } + else if (ParentShellObject != null) + { + // Use IShellItem2.GetProperty instead of creating a new property store + // The file might be locked. This is probably quicker, and sufficient for what we need + ParentShellObject.NativeShellItem2.GetProperty(ref propertyKey, propVar); + } + else if (NativePropertyStore != null) + { + NativePropertyStore.GetValue(ref propertyKey, propVar); + } + + //Get the value + return propVar.Value != null ? (T)propVar.Value : default(T); + } + } + set + { + // Make sure we use the correct type + Debug.Assert(ValueType == ShellPropertyFactory.VarEnumToSystemType(Description.VarEnumType)); + + if (typeof(T) != ValueType) + { + throw new NotSupportedException( + string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.ShellPropertyWrongType, ValueType.Name)); + } + + if (value is Nullable) + { + Type t = typeof(T); + PropertyInfo pi = t.GetProperty("HasValue"); + if (pi != null) + { + bool hasValue = (bool)pi.GetValue(value, null); + if (!hasValue) + { + ClearValue(); + return; + } + } + } + else if (value == null) + { + ClearValue(); + return; + } + + if (ParentShellObject != null) + { + using (ShellPropertyWriter propertyWriter = ParentShellObject.Properties.GetPropertyWriter()) + { + propertyWriter.WriteProperty(this, value, AllowSetTruncatedValue); + } + } + else if (NativePropertyStore != null) + { + throw new InvalidOperationException(LocalizedMessages.ShellPropertyCannotSetProperty); + } + } + } + + + #endregion + + #region IProperty Members + + /// + /// Gets the property key identifying this property. + /// + public PropertyKey PropertyKey + { + get + { + return propertyKey; + } + } + /// + /// Returns a formatted, Unicode string representation of a property value. + /// + /// One or more of the PropertyDescriptionFormat flags + /// that indicate the desired format. + /// The formatted value as a string, or null if this property + /// cannot be formatted for display. + /// True if the method successfully locates the formatted string; otherwise + /// False. + public bool TryFormatForDisplay(PropertyDescriptionFormatOptions format, out string formattedString) + { + + + if (Description == null || Description.NativePropertyDescription == null) + { + // We cannot do anything without a property description + formattedString = null; + return false; + } + + IPropertyStore store = ShellPropertyCollection.CreateDefaultPropertyStore(ParentShellObject); + + using (PropVariant propVar = new PropVariant()) + { + store.GetValue(ref propertyKey, propVar); + + // Release the Propertystore + Marshal.ReleaseComObject(store); + store = null; + + HResult hr = Description.NativePropertyDescription.FormatForDisplay(propVar, ref format, out formattedString); + + // Sometimes, the value cannot be displayed properly, such as for blobs + // or if we get argument exception + if (!CoreErrorHelper.Succeeded(hr)) + { + formattedString = null; + return false; + } + return true; + } + } + + /// + /// Returns a formatted, Unicode string representation of a property value. + /// + /// One or more of the PropertyDescriptionFormat flags + /// that indicate the desired format. + /// The formatted value as a string, or null if this property + /// cannot be formatted for display. + public string FormatForDisplay(PropertyDescriptionFormatOptions format) + { + string formattedString; + + if (Description == null || Description.NativePropertyDescription == null) + { + // We cannot do anything without a property description + return null; + } + + IPropertyStore store = ShellPropertyCollection.CreateDefaultPropertyStore(ParentShellObject); + + using (PropVariant propVar = new PropVariant()) + { + store.GetValue(ref propertyKey, propVar); + + // Release the Propertystore + Marshal.ReleaseComObject(store); + store = null; + + HResult hr = Description.NativePropertyDescription.FormatForDisplay(propVar, ref format, out formattedString); + + // Sometimes, the value cannot be displayed properly, such as for blobs + // or if we get argument exception + if (!CoreErrorHelper.Succeeded(hr)) + throw new ShellException(hr); + + return formattedString; + } + } + + /// + /// Get the property description object. + /// + public ShellPropertyDescription Description + { + get + { + return description; + } + } + + /// + /// Gets the case-sensitive name of a property as it is known to the system, + /// regardless of its localized name. + /// + public string CanonicalName + { + get + { + return Description.CanonicalName; + } + } + + /// + /// Clears the value of the property. + /// + public void ClearValue() + { + using (PropVariant propVar = new PropVariant()) + { + StorePropVariantValue(propVar); + } + } + + /// + /// Gets the value for this property using the generic Object type. + /// To obtain a specific type for this value, use the more type strong + /// Property<T> class. + /// Also, you can only set a value for this type using Property<T> + /// + public object ValueAsObject + { + get + { + using (PropVariant propVar = new PropVariant()) + { + if (ParentShellObject != null) + { + + IPropertyStore store = ShellPropertyCollection.CreateDefaultPropertyStore(ParentShellObject); + + store.GetValue(ref propertyKey, propVar); + + Marshal.ReleaseComObject(store); + store = null; + } + else if (NativePropertyStore != null) + { + NativePropertyStore.GetValue(ref propertyKey, propVar); + } + + return propVar != null ? propVar.Value : null; + } + } + } + + /// + /// Gets the associated runtime type. + /// + public Type ValueType + { + get + { + // The type for this object need to match that of the description + Debug.Assert(Description.ValueType == typeof(T)); + + return Description.ValueType; + } + } + + /// + /// Gets the image reference path and icon index associated with a property value (Windows 7 only). + /// + public IconReference IconReference + { + get + { + if (!CoreHelpers.RunningOnWin7) + { + throw new PlatformNotSupportedException(LocalizedMessages.ShellPropertyWindows7); + } + + GetImageReference(); + int index = (imageReferenceIconIndex.HasValue ? imageReferenceIconIndex.Value : -1); + + return new IconReference(imageReferencePath, index); + } + } + + /// + /// Gets or sets a value that determines if a value can be truncated. The default for this property is false. + /// + /// + /// An will be thrown if + /// this property is not set to true, and a property value was set + /// but later truncated. + /// + /// + public bool AllowSetTruncatedValue { get; set; } + + #endregion + } +} diff --git a/Shell/PropertySystem/ShellPropertyCollection.cs b/Shell/PropertySystem/ShellPropertyCollection.cs new file mode 100644 index 0000000..af3ba9c --- /dev/null +++ b/Shell/PropertySystem/ShellPropertyCollection.cs @@ -0,0 +1,246 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Creates a readonly collection of IProperty objects. + /// + public class ShellPropertyCollection : ReadOnlyCollection, IDisposable + { + #region Internal Constructor + + /// + /// Creates a new Property collection given an IPropertyStore object + /// + /// IPropertyStore + internal ShellPropertyCollection(IPropertyStore nativePropertyStore) + : base(new List()) + { + NativePropertyStore = nativePropertyStore; + AddProperties(nativePropertyStore); + } + + #endregion + + #region Public Constructor + + /// + /// Creates a new Property collection given an IShellItem2 native interface + /// + /// Parent ShellObject + public ShellPropertyCollection(ShellObject parent) + : base(new List()) + { + ParentShellObject = parent; + IPropertyStore nativePropertyStore = null; + try + { + nativePropertyStore = CreateDefaultPropertyStore(ParentShellObject); + AddProperties(nativePropertyStore); + } + catch + { + if (parent != null) + { + parent.Dispose(); + } + throw; + } + finally + { + if (nativePropertyStore != null) + { + Marshal.ReleaseComObject(nativePropertyStore); + nativePropertyStore = null; + } + } + } + + /// + /// Creates a new ShellPropertyCollection object with the specified file or folder path. + /// + /// The path to the file or folder. + public ShellPropertyCollection(string path) : this(ShellObjectFactory.Create(path)) { } + + #endregion + + #region Private Methods + + private ShellObject ParentShellObject { get; set; } + + private IPropertyStore NativePropertyStore { get; set; } + + private void AddProperties(IPropertyStore nativePropertyStore) + { + uint propertyCount; + PropertyKey propKey; + + // Populate the property collection + nativePropertyStore.GetCount(out propertyCount); + for (uint i = 0; i < propertyCount; i++) + { + nativePropertyStore.GetAt(i, out propKey); + + if (ParentShellObject != null) + { + Items.Add(ParentShellObject.Properties.CreateTypedProperty(propKey)); + } + else + { + Items.Add(CreateTypedProperty(propKey, NativePropertyStore)); + } + } + } + + internal static IPropertyStore CreateDefaultPropertyStore(ShellObject shellObj) + { + IPropertyStore nativePropertyStore = null; + + Guid guid = new Guid(ShellIIDGuid.IPropertyStore); + int hr = shellObj.NativeShellItem2.GetPropertyStore( + ShellNativeMethods.GetPropertyStoreOptions.BestEffort, + ref guid, + out nativePropertyStore); + + // throw on failure + if (nativePropertyStore == null || !CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + + return nativePropertyStore; + } + + + + + #endregion + + #region Collection Public Methods + + /// + /// Checks if a property with the given canonical name is available. + /// + /// The canonical name of the property. + /// True if available, false otherwise. + public bool Contains(string canonicalName) + { + if (string.IsNullOrEmpty(canonicalName)) + { + throw new ArgumentException(LocalizedMessages.PropertyCollectionNullCanonicalName, "canonicalName"); + } + + return Items.Any(p => p.CanonicalName == canonicalName); + + } + + /// + /// Checks if a property with the given property key is available. + /// + /// The property key. + /// True if available, false otherwise. + public bool Contains(PropertyKey key) + { + return Items.Any(p => p.PropertyKey == key); + } + + /// + /// Gets the property associated with the supplied canonical name string. + /// The canonical name property is case-sensitive. + /// + /// + /// The canonical name. + /// The property associated with the canonical name, if found. + /// Throws IndexOutOfRangeException + /// if no matching property is found. + public IShellProperty this[string canonicalName] + { + get + { + if (string.IsNullOrEmpty(canonicalName)) + { + throw new ArgumentException(LocalizedMessages.PropertyCollectionNullCanonicalName, "canonicalName"); + } + + IShellProperty prop = Items.FirstOrDefault(p => p.CanonicalName == canonicalName); + if (prop == null) + { + throw new IndexOutOfRangeException(LocalizedMessages.PropertyCollectionCanonicalInvalidIndex); + } + return prop; + } + } + + /// + /// Gets a property associated with the supplied property key. + /// + /// + /// The property key. + /// The property associated with the property key, if found. + /// Throws IndexOutOfRangeException + /// if no matching property is found. + public IShellProperty this[PropertyKey key] + { + get + { + IShellProperty prop = Items.FirstOrDefault(p => p.PropertyKey == key); + if (prop != null) return prop; + + throw new IndexOutOfRangeException(LocalizedMessages.PropertyCollectionInvalidIndex); + } + } + + #endregion + + // TODO - ShellProperties.cs also has a similar class that is used for creating + // a ShellObject specific IShellProperty. These 2 methods should be combined or moved to a + // common location. + internal static IShellProperty CreateTypedProperty(PropertyKey propKey, IPropertyStore NativePropertyStore) + { + return ShellPropertyFactory.CreateShellProperty(propKey, NativePropertyStore); + } + + #region IDisposable Members + + /// + /// Release the native and managed objects + /// + /// Indicates that this is being called from Dispose(), rather than the finalizer. + protected virtual void Dispose(bool disposing) + { + if (NativePropertyStore != null) + { + Marshal.ReleaseComObject(NativePropertyStore); + NativePropertyStore = null; + } + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Implement the finalizer. + /// + ~ShellPropertyCollection() + { + Dispose(false); + } + + #endregion + } +} diff --git a/Shell/PropertySystem/ShellPropertyDescription.cs b/Shell/PropertySystem/ShellPropertyDescription.cs new file mode 100644 index 0000000..cce67e8 --- /dev/null +++ b/Shell/PropertySystem/ShellPropertyDescription.cs @@ -0,0 +1,565 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Defines the shell property description information for a property. + /// + public class ShellPropertyDescription : IDisposable + { + #region Private Fields + + private IPropertyDescription nativePropertyDescription; + private string canonicalName; + private PropertyKey propertyKey; + private string displayName; + private string editInvitation; + private VarEnum? varEnumType = null; + private PropertyDisplayType? displayType; + private PropertyAggregationType? aggregationTypes; + private uint? defaultColumWidth; + private PropertyTypeOptions? propertyTypeFlags; + private PropertyViewOptions? propertyViewFlags; + private Type valueType; + private ReadOnlyCollection propertyEnumTypes; + private PropertyColumnStateOptions? columnState; + private PropertyConditionType? conditionType; + private PropertyConditionOperation? conditionOperation; + private PropertyGroupingRange? groupingRange; + private PropertySortDescription? sortDescription; + + #endregion + + #region Public Properties + + /// + /// Gets the case-sensitive name of a property as it is known to the system, + /// regardless of its localized name. + /// + public string CanonicalName + { + get + { + if (canonicalName == null) + { + PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName); + } + + return canonicalName; + } + } + + /// + /// Gets the property key identifying the underlying property. + /// + public PropertyKey PropertyKey + { + get + { + return propertyKey; + } + } + + /// + /// Gets the display name of the property as it is shown in any user interface (UI). + /// + public string DisplayName + { + get + { + if (NativePropertyDescription != null && displayName == null) + { + IntPtr dispNameptr = IntPtr.Zero; + + HResult hr = NativePropertyDescription.GetDisplayName(out dispNameptr); + + if (CoreErrorHelper.Succeeded(hr) && dispNameptr != IntPtr.Zero) + { + displayName = Marshal.PtrToStringUni(dispNameptr); + + // Free the string + Marshal.FreeCoTaskMem(dispNameptr); + } + } + + return displayName; + } + } + + /// + /// Gets the text used in edit controls hosted in various dialog boxes. + /// + public string EditInvitation + { + get + { + if (NativePropertyDescription != null && editInvitation == null) + { + // EditInvitation can be empty, so ignore the HR value, but don't throw an exception + IntPtr ptr = IntPtr.Zero; + + HResult hr = NativePropertyDescription.GetEditInvitation(out ptr); + + if (CoreErrorHelper.Succeeded(hr) && ptr != IntPtr.Zero) + { + editInvitation = Marshal.PtrToStringUni(ptr); + // Free the string + Marshal.FreeCoTaskMem(ptr); + } + } + + return editInvitation; + } + } + + /// + /// Gets the VarEnum OLE type for this property. + /// + public VarEnum VarEnumType + { + get + { + if (NativePropertyDescription != null && varEnumType == null) + { + VarEnum tempType; + + HResult hr = NativePropertyDescription.GetPropertyType(out tempType); + + if (CoreErrorHelper.Succeeded(hr)) + { + varEnumType = tempType; + } + } + + return varEnumType.HasValue ? varEnumType.Value : default(VarEnum); + } + } + + /// + /// Gets the .NET system type for a value of this property, or + /// null if the value is empty. + /// + public Type ValueType + { + get + { + if (valueType == null) + { + valueType = ShellPropertyFactory.VarEnumToSystemType(VarEnumType); + } + + return valueType; + } + } + + /// + /// Gets the current data type used to display the property. + /// + public PropertyDisplayType DisplayType + { + get + { + if (NativePropertyDescription != null && displayType == null) + { + PropertyDisplayType tempDisplayType; + + HResult hr = NativePropertyDescription.GetDisplayType(out tempDisplayType); + + if (CoreErrorHelper.Succeeded(hr)) + { + displayType = tempDisplayType; + } + } + + return displayType.HasValue ? displayType.Value : default(PropertyDisplayType); + } + } + + /// + /// Gets the default user interface (UI) column width for this property. + /// + public uint DefaultColumWidth + { + get + { + if (NativePropertyDescription != null && !defaultColumWidth.HasValue) + { + uint tempDefaultColumWidth; + + HResult hr = NativePropertyDescription.GetDefaultColumnWidth(out tempDefaultColumWidth); + + if (CoreErrorHelper.Succeeded(hr)) + { + defaultColumWidth = tempDefaultColumWidth; + } + } + + return defaultColumWidth.HasValue ? defaultColumWidth.Value : default(uint); + } + } + + /// + /// Gets a value that describes how the property values are displayed when + /// multiple items are selected in the user interface (UI). + /// + public PropertyAggregationType AggregationTypes + { + get + { + if (NativePropertyDescription != null && aggregationTypes == null) + { + PropertyAggregationType tempAggregationTypes; + + HResult hr = NativePropertyDescription.GetAggregationType(out tempAggregationTypes); + + if (CoreErrorHelper.Succeeded(hr)) + { + aggregationTypes = tempAggregationTypes; + } + } + + return aggregationTypes.HasValue ? aggregationTypes.Value : default(PropertyAggregationType); + } + } + + /// + /// Gets a list of the possible values for this property. + /// + public ReadOnlyCollection PropertyEnumTypes + { + get + { + if (NativePropertyDescription != null && propertyEnumTypes == null) + { + List propEnumTypeList = new List(); + + Guid guid = new Guid(ShellIIDGuid.IPropertyEnumTypeList); + IPropertyEnumTypeList nativeList; + HResult hr = NativePropertyDescription.GetEnumTypeList(ref guid, out nativeList); + + if (nativeList != null && CoreErrorHelper.Succeeded(hr)) + { + + uint count; + nativeList.GetCount(out count); + guid = new Guid(ShellIIDGuid.IPropertyEnumType); + + for (uint i = 0; i < count; i++) + { + IPropertyEnumType nativeEnumType; + nativeList.GetAt(i, ref guid, out nativeEnumType); + propEnumTypeList.Add(new ShellPropertyEnumType(nativeEnumType)); + } + } + + propertyEnumTypes = new ReadOnlyCollection(propEnumTypeList); + } + + return propertyEnumTypes; + + } + } + + /// + /// Gets the column state flag, which describes how the property + /// should be treated by interfaces or APIs that use this flag. + /// + public PropertyColumnStateOptions ColumnState + { + get + { + // If default/first value, try to get it again, otherwise used the cached one. + if (NativePropertyDescription != null && columnState == null) + { + PropertyColumnStateOptions state; + + HResult hr = NativePropertyDescription.GetColumnState(out state); + + if (CoreErrorHelper.Succeeded(hr)) + { + columnState = state; + } + } + + return columnState.HasValue ? columnState.Value : default(PropertyColumnStateOptions); + } + } + + /// + /// Gets the condition type to use when displaying the property in + /// the query builder user interface (UI). This influences the list + /// of predicate conditions (for example, equals, less than, and + /// contains) that are shown for this property. + /// + /// For more information, see the conditionType attribute + /// of the typeInfo element in the property's .propdesc file. + public PropertyConditionType ConditionType + { + get + { + // If default/first value, try to get it again, otherwise used the cached one. + if (NativePropertyDescription != null && conditionType == null) + { + PropertyConditionType tempConditionType; + PropertyConditionOperation tempConditionOperation; + + HResult hr = NativePropertyDescription.GetConditionType(out tempConditionType, out tempConditionOperation); + + if (CoreErrorHelper.Succeeded(hr)) + { + conditionOperation = tempConditionOperation; + conditionType = tempConditionType; + } + } + + return conditionType.HasValue ? conditionType.Value : default(PropertyConditionType); + } + } + + /// + /// Gets the default condition operation to use + /// when displaying the property in the query builder user + /// interface (UI). This influences the list of predicate conditions + /// (for example, equals, less than, and contains) that are shown + /// for this property. + /// + /// For more information, see the conditionType attribute of the + /// typeInfo element in the property's .propdesc file. + public PropertyConditionOperation ConditionOperation + { + get + { + // If default/first value, try to get it again, otherwise used the cached one. + if (NativePropertyDescription != null && conditionOperation == null) + { + PropertyConditionType tempConditionType; + PropertyConditionOperation tempConditionOperation; + + HResult hr = NativePropertyDescription.GetConditionType(out tempConditionType, out tempConditionOperation); + + if (CoreErrorHelper.Succeeded(hr)) + { + conditionOperation = tempConditionOperation; + conditionType = tempConditionType; + } + } + + return conditionOperation.HasValue ? conditionOperation.Value : default(PropertyConditionOperation); + } + } + + /// + /// Gets the method used when a view is grouped by this property. + /// + /// The information retrieved by this method comes from + /// the groupingRange attribute of the typeInfo element in the + /// property's .propdesc file. + public PropertyGroupingRange GroupingRange + { + get + { + // If default/first value, try to get it again, otherwise used the cached one. + if (NativePropertyDescription != null && groupingRange == null) + { + PropertyGroupingRange tempGroupingRange; + + HResult hr = NativePropertyDescription.GetGroupingRange(out tempGroupingRange); + + if (CoreErrorHelper.Succeeded(hr)) + { + groupingRange = tempGroupingRange; + } + } + + return groupingRange.HasValue ? groupingRange.Value : default(PropertyGroupingRange); + } + } + + /// + /// Gets the current sort description flags for the property, + /// which indicate the particular wordings of sort offerings. + /// + /// The settings retrieved by this method are set + /// through the sortDescription attribute of the labelInfo + /// element in the property's .propdesc file. + public PropertySortDescription SortDescription + { + get + { + // If default/first value, try to get it again, otherwise used the cached one. + if (NativePropertyDescription != null && sortDescription == null) + { + PropertySortDescription tempSortDescription; + + HResult hr = NativePropertyDescription.GetSortDescription(out tempSortDescription); + + if (CoreErrorHelper.Succeeded(hr)) + { + sortDescription = tempSortDescription; + } + } + + return sortDescription.HasValue ? sortDescription.Value : default(PropertySortDescription); + } + } + + /// + /// Gets the localized display string that describes the current sort order. + /// + /// Indicates the sort order should + /// reference the string "Z on top"; otherwise, the sort order should reference the string "A on top". + /// The sort description for this property. + /// The string retrieved by this method is determined by flags set in the + /// sortDescription attribute of the labelInfo element in the property's .propdesc file. + public string GetSortDescriptionLabel(bool descending) + { + IntPtr ptr = IntPtr.Zero; + string label = string.Empty; + + if (NativePropertyDescription != null) + { + HResult hr = NativePropertyDescription.GetSortDescriptionLabel(descending, out ptr); + + if (CoreErrorHelper.Succeeded(hr) && ptr != IntPtr.Zero) + { + label = Marshal.PtrToStringUni(ptr); + // Free the string + Marshal.FreeCoTaskMem(ptr); + } + } + + return label; + } + + /// + /// Gets a set of flags that describe the uses and capabilities of the property. + /// + public PropertyTypeOptions TypeFlags + { + get + { + if (NativePropertyDescription != null && propertyTypeFlags == null) + { + PropertyTypeOptions tempFlags; + + HResult hr = NativePropertyDescription.GetTypeFlags(PropertyTypeOptions.MaskAll, out tempFlags); + + propertyTypeFlags = CoreErrorHelper.Succeeded(hr) ? tempFlags : default(PropertyTypeOptions); + } + + return propertyTypeFlags.HasValue ? propertyTypeFlags.Value : default(PropertyTypeOptions); + } + } + + /// + /// Gets the current set of flags governing the property's view. + /// + public PropertyViewOptions ViewFlags + { + get + { + if (NativePropertyDescription != null && propertyViewFlags == null) + { + PropertyViewOptions tempFlags; + HResult hr = NativePropertyDescription.GetViewFlags(out tempFlags); + + propertyViewFlags = CoreErrorHelper.Succeeded(hr) ? tempFlags : default(PropertyViewOptions); + } + + return propertyViewFlags.HasValue ? propertyViewFlags.Value : default(PropertyViewOptions); + } + } + + /// + /// Gets a value that determines if the native property description is present on the system. + /// + public bool HasSystemDescription + { + get { return NativePropertyDescription != null; } + } + + #endregion + + #region Internal Constructor + + internal ShellPropertyDescription(PropertyKey key) + { + this.propertyKey = key; + } + + #endregion + + #region Internal Methods + + /// + /// Get the native property description COM interface + /// + internal IPropertyDescription NativePropertyDescription + { + get + { + if (nativePropertyDescription == null) + { + Guid guid = new Guid(ShellIIDGuid.IPropertyDescription); + PropertySystemNativeMethods.PSGetPropertyDescription(ref propertyKey, ref guid, out nativePropertyDescription); + } + + return nativePropertyDescription; + } + } + + #endregion + + #region IDisposable Members + + /// + /// Release the native objects + /// + /// Indicates that this is being called from Dispose(), rather than the finalizer. + protected virtual void Dispose(bool disposing) + { + if (nativePropertyDescription != null) + { + Marshal.ReleaseComObject(nativePropertyDescription); + nativePropertyDescription = null; + } + + if (disposing) + { + // and the managed ones + canonicalName = null; + displayName = null; + editInvitation = null; + defaultColumWidth = null; + valueType = null; + propertyEnumTypes = null; + } + } + + /// + /// Release the native objects + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Release the native objects + /// + ~ShellPropertyDescription() + { + Dispose(false); + } + + #endregion + } +} diff --git a/Shell/PropertySystem/ShellPropertyDescriptionsCache.cs b/Shell/PropertySystem/ShellPropertyDescriptionsCache.cs new file mode 100644 index 0000000..d975843 --- /dev/null +++ b/Shell/PropertySystem/ShellPropertyDescriptionsCache.cs @@ -0,0 +1,39 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Collections.Generic; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + internal class ShellPropertyDescriptionsCache + { + private ShellPropertyDescriptionsCache() + { + propsDictionary = new Dictionary(); + } + + private IDictionary propsDictionary; + private static ShellPropertyDescriptionsCache cacheInstance; + + public static ShellPropertyDescriptionsCache Cache + { + get + { + if (cacheInstance == null) + { + cacheInstance = new ShellPropertyDescriptionsCache(); + } + return cacheInstance; + } + } + + public ShellPropertyDescription GetPropertyDescription(PropertyKey key) + { + if (!propsDictionary.ContainsKey(key)) + { + propsDictionary.Add(key, new ShellPropertyDescription(key)); + } + return propsDictionary[key]; + } + } +} diff --git a/Shell/PropertySystem/ShellPropertyEnumType.cs b/Shell/PropertySystem/ShellPropertyEnumType.cs new file mode 100644 index 0000000..fbe7b1c --- /dev/null +++ b/Shell/PropertySystem/ShellPropertyEnumType.cs @@ -0,0 +1,131 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Defines the enumeration values for a property type. + /// + public class ShellPropertyEnumType + { + #region Private Properties + + private string displayText; + private PropEnumType? enumType; + private object minValue, setValue, enumerationValue; + + private IPropertyEnumType NativePropertyEnumType + { + set; + get; + } + + #endregion + + #region Internal Constructor + + internal ShellPropertyEnumType(IPropertyEnumType nativePropertyEnumType) + { + NativePropertyEnumType = nativePropertyEnumType; + } + + #endregion + + #region Public Properties + + /// + /// Gets display text from an enumeration information structure. + /// + public string DisplayText + { + get + { + if (displayText == null) + { + NativePropertyEnumType.GetDisplayText(out displayText); + } + return displayText; + } + } + + /// + /// Gets an enumeration type from an enumeration information structure. + /// + public PropEnumType EnumType + { + get + { + if (!enumType.HasValue) + { + PropEnumType tempEnumType; + NativePropertyEnumType.GetEnumType(out tempEnumType); + enumType = tempEnumType; + } + return enumType.Value; + } + } + + /// + /// Gets a minimum value from an enumeration information structure. + /// + public object RangeMinValue + { + get + { + if (minValue == null) + { + using (PropVariant propVar = new PropVariant()) + { + NativePropertyEnumType.GetRangeMinValue(propVar); + minValue = propVar.Value; + } + } + return minValue; + + } + } + + /// + /// Gets a set value from an enumeration information structure. + /// + public object RangeSetValue + { + get + { + if (setValue == null) + { + using (PropVariant propVar = new PropVariant()) + { + NativePropertyEnumType.GetRangeSetValue(propVar); + setValue = propVar.Value; + } + } + return setValue; + + } + } + + /// + /// Gets a value from an enumeration information structure. + /// + public object RangeValue + { + get + { + if (enumerationValue == null) + { + using (PropVariant propVar = new PropVariant()) + { + NativePropertyEnumType.GetValue(propVar); + enumerationValue = propVar.Value; + } + } + return enumerationValue; + } + } + + #endregion + } +} diff --git a/Shell/PropertySystem/ShellPropertyEnums.cs b/Shell/PropertySystem/ShellPropertyEnums.cs new file mode 100644 index 0000000..99c4963 --- /dev/null +++ b/Shell/PropertySystem/ShellPropertyEnums.cs @@ -0,0 +1,737 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + #region Property System Enumerations + + /// + /// Property store cache state + /// + public enum PropertyStoreCacheState + { + /// + /// Contained in file, not updated. + /// + Normal = 0, + + /// + /// Not contained in file. + /// + NotInSource = 1, + + /// + /// Contained in file, has been updated since file was consumed. + /// + Dirty = 2 + } + + /// + /// Delineates the format of a property string. + /// + /// + /// Typically use one, or a bitwise combination of + /// these flags, to specify the format. Some flags are mutually exclusive, + /// so combinations like ShortTime | LongTime | HideTime are not allowed. + /// + [Flags] + public enum PropertyDescriptionFormatOptions + { + /// + /// The format settings specified in the property's .propdesc file. + /// + None = 0, + + /// + /// The value preceded with the property's display name. + /// + /// + /// This flag is ignored when the hideLabelPrefix attribute of the labelInfo element + /// in the property's .propinfo file is set to true. + /// + PrefixName = 0x1, + + /// + /// The string treated as a file name. + /// + FileName = 0x2, + + /// + /// The sizes displayed in kilobytes (KB), regardless of size. + /// + /// + /// This flag applies to properties of Integer types and aligns the values in the column. + /// + AlwaysKB = 0x4, + + /// + /// Reserved. + /// + RightToLeft = 0x8, + + /// + /// The time displayed as 'hh:mm am/pm'. + /// + ShortTime = 0x10, + + /// + /// The time displayed as 'hh:mm:ss am/pm'. + /// + LongTime = 0x20, + + /// + /// The time portion of date/time hidden. + /// + HideTime = 64, + + /// + /// The date displayed as 'MM/DD/YY'. For example, '3/21/04'. + /// + ShortDate = 0x80, + + /// + /// The date displayed as 'DayOfWeek Month day, year'. + /// For example, 'Monday, March 21, 2004'. + /// + LongDate = 0x100, + + /// + /// The date portion of date/time hidden. + /// + HideDate = 0x200, + + /// + /// The friendly date descriptions, such as "Yesterday". + /// + RelativeDate = 0x400, + + /// + /// The text displayed in a text box as a cue for the user, such as 'Enter your name'. + /// + /// + /// The invitation text is returned if formatting failed or the value was empty. + /// Invitation text is text displayed in a text box as a cue for the user, + /// Formatting can fail if the data entered + /// is not of an expected type, such as putting alpha characters in + /// a phone number field. + /// + UseEditInvitation = 0x800, + + /// + /// This flag requires UseEditInvitation to also be specified. When the + /// formatting flags are ReadOnly | UseEditInvitation and the algorithm + /// would have shown invitation text, a string is returned that indicates + /// the value is "Unknown" instead of the invitation text. + /// + ReadOnly = 0x1000, + + /// + /// The detection of the reading order is not automatic. Useful when converting + /// to ANSI to omit the Unicode reading order characters. + /// + NoAutoReadingOrder = 0x2000, + + /// + /// Smart display of DateTime values + /// + SmartDateTime = 0x4000 + } + + /// + /// Specifies the display types for a property. + /// + public enum PropertyDisplayType + { + /// + /// The String Display. This is the default if the property doesn't specify a display type. + /// + String = 0, + + /// + /// The Number Display. + /// + Number = 1, + + /// + /// The Boolean Display. + /// + Boolean = 2, + + /// + /// The DateTime Display. + /// + DateTime = 3, + + /// + /// The Enumerated Display. + /// + Enumerated = 4 + } + + /// + /// Property Aggregation Type + /// + public enum PropertyAggregationType + { + /// + /// The string "Multiple Values" is displayed. + /// + Default = 0, + + /// + /// The first value in the selection is displayed. + /// + First = 1, + + /// + /// The sum of the selected values is displayed. This flag is never returned + /// for data types VT_LPWSTR, VT_BOOL, and VT_FILETIME. + /// + Sum = 2, + + /// + /// The numerical average of the selected values is displayed. This flag + /// is never returned for data types VT_LPWSTR, VT_BOOL, and VT_FILETIME. + /// + Average = 3, + + /// + /// The date range of the selected values is displayed. This flag is only + /// returned for values of the VT_FILETIME data type. + /// + DateRange = 4, + + /// + /// A concatenated string of all the values is displayed. The order of + /// individual values in the string is undefined. The concatenated + /// string omits duplicate values; if a value occurs more than once, + /// it only appears a single time in the concatenated string. + /// + Union = 5, + + /// + /// The highest of the selected values is displayed. + /// + Max = 6, + + /// + /// The lowest of the selected values is displayed. + /// + Min = 7 + } + + /// + /// Property Enumeration Types + /// + public enum PropEnumType + { + /// + /// Use DisplayText and either RangeMinValue or RangeSetValue. + /// + DiscreteValue = 0, + + /// + /// Use DisplayText and either RangeMinValue or RangeSetValue + /// + RangedValue = 1, + + /// + /// Use DisplayText + /// + DefaultValue = 2, + + /// + /// Use Value or RangeMinValue + /// + EndRange = 3 + }; + + /// + /// Describes how a property should be treated for display purposes. + /// + [Flags] + public enum PropertyColumnStateOptions + { + /// + /// Default value + /// + None = 0x00000000, + + /// + /// The value is displayed as a string. + /// + StringType = 0x00000001, + + /// + /// The value is displayed as an integer. + /// + IntegerType = 0x00000002, + + /// + /// The value is displayed as a date/time. + /// + DateType = 0x00000003, + + /// + /// A mask for display type values StringType, IntegerType, and DateType. + /// + TypeMask = 0x0000000f, + + /// + /// The column should be on by default in Details view. + /// + OnByDefault = 0x00000010, + + /// + /// Will be slow to compute. Perform on a background thread. + /// + Slow = 0x00000020, + + /// + /// Provided by a handler, not the folder. + /// + Extended = 0x00000040, + + /// + /// Not displayed in the context menu, but is listed in the More... dialog. + /// + SecondaryUI = 0x00000080, + + /// + /// Not displayed in the user interface (UI). + /// + Hidden = 0x00000100, + + /// + /// VarCmp produces same result as IShellFolder::CompareIDs. + /// + PreferVariantCompare = 0x00000200, + + /// + /// PSFormatForDisplay produces same result as IShellFolder::CompareIDs. + /// + PreferFormatForDisplay = 0x00000400, + + /// + /// Do not sort folders separately. + /// + NoSortByFolders = 0x00000800, + + /// + /// Only displayed in the UI. + /// + ViewOnly = 0x00010000, + + /// + /// Marks columns with values that should be read in a batch. + /// + BatchRead = 0x00020000, + + /// + /// Grouping is disabled for this column. + /// + NoGroupBy = 0x00040000, + + /// + /// Can't resize the column. + /// + FixedWidth = 0x00001000, + + /// + /// The width is the same in all dots per inch (dpi)s. + /// + NoDpiScale = 0x00002000, + + /// + /// Fixed width and height ratio. + /// + FixedRatio = 0x00004000, + + /// + /// Filters out new display flags. + /// + DisplayMask = 0x0000F000, + } + + /// + /// Specifies the condition type to use when displaying the property in the query builder user interface (UI). + /// + public enum PropertyConditionType + { + /// + /// The default condition type. + /// + None = 0, + + /// + /// The string type. + /// + String = 1, + + /// + /// The size type. + /// + Size = 2, + + /// + /// The date/time type. + /// + DateTime = 3, + + /// + /// The Boolean type. + /// + Boolean = 4, + + /// + /// The number type. + /// + Number = 5, + } + + /// + /// Provides a set of flags to be used with IConditionFactory, + /// ICondition, and IConditionGenerator to indicate the operation. + /// + public enum PropertyConditionOperation + { + /// + /// The implicit comparison between the value of the property and the value of the constant. + /// + Implicit, + + /// + /// The value of the property and the value of the constant must be equal. + /// + Equal, + + /// + /// The value of the property and the value of the constant must not be equal. + /// + NotEqual, + + /// + /// The value of the property must be less than the value of the constant. + /// + LessThan, + + /// + /// The value of the property must be greater than the value of the constant. + /// + GreaterThan, + + /// + /// The value of the property must be less than or equal to the value of the constant. + /// + LessThanOrEqual, + + /// + /// The value of the property must be greater than or equal to the value of the constant. + /// + GreaterThanOrEqual, + + /// + /// The value of the property must begin with the value of the constant. + /// + ValueStartsWith, + + /// + /// The value of the property must end with the value of the constant. + /// + ValueEndsWith, + + /// + /// The value of the property must contain the value of the constant. + /// + ValueContains, + + /// + /// The value of the property must not contain the value of the constant. + /// + ValueNotContains, + + /// + /// The value of the property must match the value of the constant, where '?' matches any single character and '*' matches any sequence of characters. + /// + DOSWildCards, + + /// + /// The value of the property must contain a word that is the value of the constant. + /// + WordEqual, + + /// + /// The value of the property must contain a word that begins with the value of the constant. + /// + WordStartsWith, + + /// + /// The application is free to interpret this in any suitable way. + /// + ApplicationSpecific, + } + + /// + /// Specifies the property description grouping ranges. + /// + public enum PropertyGroupingRange + { + /// + /// The individual values. + /// + Discrete = 0, + + /// + /// The static alphanumeric ranges. + /// + Alphanumeric = 1, + + /// + /// The static size ranges. + /// + Size = 2, + + /// + /// The dynamically-created ranges. + /// + Dynamic = 3, + + /// + /// The month and year groups. + /// + Date = 4, + + /// + /// The percent groups. + /// + Percent = 5, + + /// + /// The enumerated groups. + /// + Enumerated = 6, + } + + /// + /// Describes the particular wordings of sort offerings. + /// + /// + /// Note that the strings shown are English versions only; + /// localized strings are used for other locales. + /// + public enum PropertySortDescription + { + /// + /// The default ascending or descending property sort, "Sort going up", "Sort going down". + /// + General, + + /// + /// The alphabetical sort, "A on top", "Z on top". + /// + AToZ, + + /// + /// The numerical sort, "Lowest on top", "Highest on top". + /// + LowestToHighest, + + /// + /// The size sort, "Smallest on top", "Largest on top". + /// + SmallestToBiggest, + + /// + /// The chronological sort, "Oldest on top", "Newest on top". + /// + OldestToNewest, + } + + /// + /// Describes the attributes of the typeInfo element in the property's .propdesc file. + /// + [Flags] + public enum PropertyTypeOptions + { + /// + /// The property uses the default values for all attributes. + /// + None = 0x00000000, + + /// + /// The property can have multiple values. + /// + /// + /// These values are stored as a VT_VECTOR in the PROPVARIANT structure. + /// This value is set by the multipleValues attribute of the typeInfo element in the property's .propdesc file. + /// + MultipleValues = 0x00000001, + + /// + /// This property cannot be written to. + /// + /// + /// This value is set by the isInnate attribute of the typeInfo element in the property's .propdesc file. + /// + IsInnate = 0x00000002, + + /// + /// The property is a group heading. + /// + /// + /// This value is set by the isGroup attribute of the typeInfo element in the property's .propdesc file. + /// + IsGroup = 0x00000004, + + /// + /// The user can group by this property. + /// + /// + /// This value is set by the canGroupBy attribute of the typeInfo element in the property's .propdesc file. + /// + CanGroupBy = 0x00000008, + + /// + /// The user can stack by this property. + /// + /// + /// This value is set by the canStackBy attribute of the typeInfo element in the property's .propdesc file. + /// + CanStackBy = 0x00000010, + + /// + /// This property contains a hierarchy. + /// + /// + /// This value is set by the isTreeProperty attribute of the typeInfo element in the property's .propdesc file. + /// + IsTreeProperty = 0x00000020, + + /// + /// Include this property in any full text query that is performed. + /// + /// + /// This value is set by the includeInFullTextQuery attribute of the typeInfo element in the property's .propdesc file. + /// + IncludeInFullTextQuery = 0x00000040, + + /// + /// This property is meant to be viewed by the user. + /// + /// + /// This influences whether the property shows up in the "Choose Columns" dialog, for example. + /// This value is set by the isViewable attribute of the typeInfo element in the property's .propdesc file. + /// + IsViewable = 0x00000080, + + /// + /// This property is included in the list of properties that can be queried. + /// + /// + /// A queryable property must also be viewable. + /// This influences whether the property shows up in the query builder UI. + /// This value is set by the isQueryable attribute of the typeInfo element in the property's .propdesc file. + /// + IsQueryable = 0x00000100, + + /// + /// Used with an innate property (that is, a value calculated from other property values) to indicate that it can be deleted. + /// + /// + /// Windows Vista with Service Pack 1 (SP1) and later. + /// This value is used by the Remove Properties user interface (UI) to determine whether to display a check box next to an property that allows that property to be selected for removal. + /// Note that a property that is not innate can always be purged regardless of the presence or absence of this flag. + /// + CanBePurged = 0x00000200, + + /// + /// This property is owned by the system. + /// + IsSystemProperty = unchecked((int)0x80000000), + + /// + /// A mask used to retrieve all flags. + /// + MaskAll = unchecked((int)0x800001FF), + } + + /// + /// Associates property names with property description list strings. + /// + [Flags] + public enum PropertyViewOptions + { + /// + /// The property is shown by default. + /// + None = 0x00000000, + + /// + /// The property is centered. + /// + CenterAlign = 0x00000001, + + /// + /// The property is right aligned. + /// + RightAlign = 0x00000002, + + /// + /// The property is shown as the beginning of the next collection of properties in the view. + /// + BeginNewGroup = 0x00000004, + + /// + /// The remainder of the view area is filled with the content of this property. + /// + FillArea = 0x00000008, + + /// + /// The property is reverse sorted if it is a property in a list of sorted properties. + /// + SortDescending = 0x00000010, + + /// + /// The property is only shown if it is present. + /// + ShowOnlyIfPresent = 0x00000020, + + /// + /// The property is shown by default in a view (where applicable). + /// + ShowByDefault = 0x00000040, + + /// + /// The property is shown by default in primary column selection user interface (UI). + /// + ShowInPrimaryList = 0x00000080, + + /// + /// The property is shown by default in secondary column selection UI. + /// + ShowInSecondaryList = 0x00000100, + + /// + /// The label is hidden if the view is normally inclined to show the label. + /// + HideLabel = 0x00000200, + + /// + /// The property is not displayed as a column in the UI. + /// + Hidden = 0x00000800, + + /// + /// The property is wrapped to the next row. + /// + CanWrap = 0x00001000, + + /// + /// A mask used to retrieve all flags. + /// + MaskAll = 0x000003ff, + } + + #endregion +} diff --git a/Shell/PropertySystem/ShellPropertyFactory.cs b/Shell/PropertySystem/ShellPropertyFactory.cs new file mode 100644 index 0000000..f979537 --- /dev/null +++ b/Shell/PropertySystem/ShellPropertyFactory.cs @@ -0,0 +1,189 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + + /// + /// Factory class for creating typed ShellProperties. + /// Generates/caches expressions to create generic ShellProperties. + /// + internal static class ShellPropertyFactory + { + // Constructor cache. It takes object as the third param so a single function will suffice for both constructors. + private static Dictionary> _storeCache + = new Dictionary>(); + + /// + /// Creates a generic ShellProperty. + /// + /// PropertyKey + /// Shell object from which to get property + /// ShellProperty matching type of value in property. + public static IShellProperty CreateShellProperty(PropertyKey propKey, ShellObject shellObject) + { + return GenericCreateShellProperty(propKey, shellObject); + } + + /// + /// Creates a generic ShellProperty. + /// + /// PropertyKey + /// IPropertyStore from which to get property + /// ShellProperty matching type of value in property. + public static IShellProperty CreateShellProperty(PropertyKey propKey, IPropertyStore store) + { + return GenericCreateShellProperty(propKey, store); + } + + private static IShellProperty GenericCreateShellProperty(PropertyKey propKey, T thirdArg) + { + Type thirdType = (thirdArg is ShellObject) ? typeof(ShellObject) : typeof(T); + + ShellPropertyDescription propDesc = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey); + + // Get the generic type + Type type = typeof(ShellProperty<>).MakeGenericType(VarEnumToSystemType(propDesc.VarEnumType)); + + // The hash for the function is based off the generic type and which type (constructor) we're using. + int hash = GetTypeHash(type, thirdType); + + Func ctor; + if (!_storeCache.TryGetValue(hash, out ctor)) + { + Type[] argTypes = { typeof(PropertyKey), typeof(ShellPropertyDescription), thirdType }; + ctor = ExpressConstructor(type, argTypes); + _storeCache.Add(hash, ctor); + } + + return ctor(propKey, propDesc, thirdArg); + } + + /// + /// Converts VarEnum to its associated .net Type. + /// + /// VarEnum value + /// Associated .net equivelent. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] + public static Type VarEnumToSystemType(VarEnum VarEnumType) + { + switch (VarEnumType) + { + case (VarEnum.VT_EMPTY): + case (VarEnum.VT_NULL): + return typeof(Object); + case (VarEnum.VT_UI1): + return typeof(Byte?); + case (VarEnum.VT_I2): + return typeof(Int16?); + case (VarEnum.VT_UI2): + return typeof(UInt16?); + case (VarEnum.VT_I4): + return typeof(Int32?); + case (VarEnum.VT_UI4): + return typeof(UInt32?); + case (VarEnum.VT_I8): + return typeof(Int64?); + case (VarEnum.VT_UI8): + return typeof(UInt64?); + case (VarEnum.VT_R8): + return typeof(Double?); + case (VarEnum.VT_BOOL): + return typeof(Boolean?); + case (VarEnum.VT_FILETIME): + return typeof(DateTime?); + case (VarEnum.VT_CLSID): + return typeof(IntPtr?); + case (VarEnum.VT_CF): + return typeof(IntPtr?); + case (VarEnum.VT_BLOB): + return typeof(Byte[]); + case (VarEnum.VT_LPWSTR): + return typeof(String); + case (VarEnum.VT_UNKNOWN): + return typeof(IntPtr?); + case (VarEnum.VT_STREAM): + return typeof(IStream); + case (VarEnum.VT_VECTOR | VarEnum.VT_UI1): + return typeof(Byte[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_I2): + return typeof(Int16[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_UI2): + return typeof(UInt16[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_I4): + return typeof(Int32[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_UI4): + return typeof(UInt32[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_I8): + return typeof(Int64[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_UI8): + return typeof(UInt64[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_R8): + return typeof(Double[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_BOOL): + return typeof(Boolean[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_FILETIME): + return typeof(DateTime[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_CLSID): + return typeof(IntPtr[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_CF): + return typeof(IntPtr[]); + case (VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR): + return typeof(String[]); + default: + return typeof(Object); + } + } + + #region Private static helper functions + + // Creates an expression for the specific constructor of the given type. + private static Func ExpressConstructor(Type type, Type[] argTypes) + { + int typeHash = GetTypeHash(argTypes); + + // Finds the correct constructor by matching the hash of the types. + ConstructorInfo ctorInfo = type.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) + .FirstOrDefault(x => typeHash == GetTypeHash(x.GetParameters().Select(a => a.ParameterType))); + + if (ctorInfo == null) + { + throw new ArgumentException(LocalizedMessages.ShellPropertyFactoryConstructorNotFound, "type"); + } + + var key = Expression.Parameter(argTypes[0], "propKey"); + var desc = Expression.Parameter(argTypes[1], "desc"); + var third = Expression.Parameter(typeof(object), "third"); //needs to be object to avoid casting later + + var create = Expression.New(ctorInfo, key, desc, + Expression.Convert(third, argTypes[2])); + + return Expression.Lambda>( + create, key, desc, third).Compile(); + } + + private static int GetTypeHash(params Type[] types) + { + return GetTypeHash((IEnumerable)types); + } + + // Creates a hash code, unique to the number and order of types. + private static int GetTypeHash(IEnumerable types) + { + int hash = 0; + foreach (Type type in types) + { + hash = hash * 31 + type.GetHashCode(); + } + return hash; + } + + #endregion + } +} diff --git a/Shell/PropertySystem/ShellPropertyWriter.cs b/Shell/PropertySystem/ShellPropertyWriter.cs new file mode 100644 index 0000000..d90379f --- /dev/null +++ b/Shell/PropertySystem/ShellPropertyWriter.cs @@ -0,0 +1,251 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Creates a property writer capable of setting multiple properties for a given ShellObject. + /// + public class ShellPropertyWriter : IDisposable + { + + private ShellObject parentShellObject; + + // Reference to our writable PropertyStore + internal IPropertyStore writablePropStore; + + internal ShellPropertyWriter(ShellObject parent) + { + ParentShellObject = parent; + + // Open the property store for this shell object... + Guid guid = new Guid(ShellIIDGuid.IPropertyStore); + + try + { + int hr = ParentShellObject.NativeShellItem2.GetPropertyStore( + ShellNativeMethods.GetPropertyStoreOptions.ReadWrite, + ref guid, + out writablePropStore); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty, + Marshal.GetExceptionForHR(hr)); + } + else + { + // If we succeed in creating a valid property store for this ShellObject, + // then set it on the parent shell object for others to use. + // Once this writer is closed/commited, we will set the + if (ParentShellObject.NativePropertyStore == null) + { + ParentShellObject.NativePropertyStore = writablePropStore; + } + } + + } + catch (InvalidComObjectException e) + { + throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty, e); + } + catch (InvalidCastException) + { + throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty); + } + } + + /// + /// Reference to parent ShellObject (associated with this writer) + /// + protected ShellObject ParentShellObject + { + get { return parentShellObject; } + private set { parentShellObject = value; } + } + + /// + /// Writes the given property key and value. + /// + /// The property key. + /// The value associated with the key. + public void WriteProperty(PropertyKey key, object value) + { + WriteProperty(key, value, true); + } + + /// + /// Writes the given property key and value. To allow truncation of the given value, set allowTruncatedValue + /// to true. + /// + /// The property key. + /// The value associated with the key. + /// True to allow truncation (default); otherwise False. + /// If the writable property store is already + /// closed. + /// If AllowTruncatedValue is set to false + /// and while setting the value on the property it had to be truncated in a string or rounded in + /// a numeric value. + public void WriteProperty(PropertyKey key, object value, bool allowTruncatedValue) + { + if (writablePropStore == null) + throw new InvalidOperationException("Writeable store has been closed."); + + using (PropVariant propVar = PropVariant.FromObject(value)) + { + HResult result = writablePropStore.SetValue(ref key, propVar); + + if (!allowTruncatedValue && ((int)result == ShellNativeMethods.InPlaceStringTruncated)) + { + // At this point we can't revert back the commit + // so don't commit, close the property store and throw an exception + // to let the user know. + Marshal.ReleaseComObject(writablePropStore); + writablePropStore = null; + + throw new ArgumentOutOfRangeException("value", LocalizedMessages.ShellPropertyValueTruncated); + } + + if (!CoreErrorHelper.Succeeded(result)) + { + throw new PropertySystemException(LocalizedMessages.ShellPropertySetValue, Marshal.GetExceptionForHR((int)result)); + } + } + } + + /// + /// Writes the specified property given the canonical name and a value. + /// + /// The canonical name. + /// The property value. + public void WriteProperty(string canonicalName, object value) + { + WriteProperty(canonicalName, value, true); + } + + /// + /// Writes the specified property given the canonical name and a value. To allow truncation of the given value, set allowTruncatedValue + /// to true. + /// + /// The canonical name. + /// The property value. + /// True to allow truncation (default); otherwise False. + /// If the given canonical name is not valid. + public void WriteProperty(string canonicalName, object value, bool allowTruncatedValue) + { + // Get the PropertyKey using the canonicalName passed in + PropertyKey propKey; + + int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(canonicalName, out propKey); + + if (!CoreErrorHelper.Succeeded(result)) + { + throw new ArgumentException( + LocalizedMessages.ShellInvalidCanonicalName, + Marshal.GetExceptionForHR(result)); + } + + WriteProperty(propKey, value, allowTruncatedValue); + } + + /// + /// Writes the specified property using an IShellProperty and a value. + /// + /// The property name. + /// The property value. + public void WriteProperty(IShellProperty shellProperty, object value) + { + WriteProperty(shellProperty, value, true); + } + + /// + /// Writes the specified property given an IShellProperty and a value. To allow truncation of the given value, set allowTruncatedValue + /// to true. + /// + /// The property name. + /// The property value. + /// True to allow truncation (default); otherwise False. + public void WriteProperty(IShellProperty shellProperty, object value, bool allowTruncatedValue) + { + if (shellProperty == null) { throw new ArgumentNullException("shellProperty"); } + WriteProperty(shellProperty.PropertyKey, value, allowTruncatedValue); + } + + /// + /// Writes the specified property using a strongly-typed ShellProperty and a value. + /// + /// The type of the property name. + /// The property name. + /// The property value. + public void WriteProperty(ShellProperty shellProperty, T value) + { + WriteProperty(shellProperty, value, true); + } + /// + /// Writes the specified property given a strongly-typed ShellProperty and a value. To allow truncation of the given value, set allowTruncatedValue + /// to true. + /// + /// The type of the property name. + /// The property name. + /// The property value. + /// True to allow truncation (default); otherwise False. + public void WriteProperty(ShellProperty shellProperty, T value, bool allowTruncatedValue) + { + if (shellProperty == null) { throw new ArgumentNullException("shellProperty"); } + WriteProperty(shellProperty.PropertyKey, value, allowTruncatedValue); + } + + #region IDisposable Members + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// + /// + ~ShellPropertyWriter() + { + Dispose(false); + } + + /// + /// Release the native and managed objects. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + Close(); + } + + /// + /// Call this method to commit the writes (calls to WriteProperty method) + /// and dispose off the writer. + /// + public void Close() + { + // Close the property writer (commit, etc) + if (writablePropStore != null) + { + writablePropStore.Commit(); + + Marshal.ReleaseComObject(writablePropStore); + writablePropStore = null; + } + + ParentShellObject.NativePropertyStore = null; + } + + #endregion + } +} diff --git a/Shell/PropertySystem/StronglyTypedProperties.cs b/Shell/PropertySystem/StronglyTypedProperties.cs new file mode 100644 index 0000000..77fe149 --- /dev/null +++ b/Shell/PropertySystem/StronglyTypedProperties.cs @@ -0,0 +1,16343 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Runtime.InteropServices.ComTypes; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + + /// + /// Base class for all the strongly-typed properties + /// + public abstract class PropertyStoreItems + { + // Left empty for base class + } + + // TODO: FIX THIS!!! + public partial class ShellProperties + { + + /// + /// .System Properties + /// + public class PropertySystem : PropertyStoreItems + { + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystem(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.AcquisitionID -- PKEY_AcquisitionID + /// Description: Hash to determine acquisition session. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {65A98875-3C80-40AB-ABBC-EFDAF77DBEE2}, 100 + /// + public ShellProperty AcquisitionID + { + get + { + PropertyKey key = SystemProperties.System.AcquisitionID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ApplicationName -- PKEY_ApplicationName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 18 (PIDSI_APPNAME) + /// + public ShellProperty ApplicationName + { + get + { + PropertyKey key = SystemProperties.System.ApplicationName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Author -- PKEY_Author + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 4 (PIDSI_AUTHOR) + /// + public ShellProperty Author + { + get + { + PropertyKey key = SystemProperties.System.Author; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Capacity -- PKEY_Capacity + /// Description: The amount of total space in bytes. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 3 (PID_VOLUME_CAPACITY) (Filesystem Volume Properties) + /// + public ShellProperty Capacity + { + get + { + PropertyKey key = SystemProperties.System.Capacity; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Category -- PKEY_Category + /// Description: Legacy code treats this as VT_LPSTR. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 2 (PIDDSI_CATEGORY) + /// + public ShellProperty Category + { + get + { + PropertyKey key = SystemProperties.System.Category; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Comment -- PKEY_Comment + /// Description: Comments. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 6 (PIDSI_COMMENTS) + /// + public ShellProperty Comment + { + get + { + PropertyKey key = SystemProperties.System.Comment; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Company -- PKEY_Company + /// Description: The company or publisher. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 15 (PIDDSI_COMPANY) + /// + public ShellProperty Company + { + get + { + PropertyKey key = SystemProperties.System.Company; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ComputerName -- PKEY_ComputerName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 5 (PID_COMPUTERNAME) + /// + public ShellProperty ComputerName + { + get + { + PropertyKey key = SystemProperties.System.ComputerName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ContainedItems -- PKEY_ContainedItems + /// Description: The list of type of items, this item contains. For example, this item contains urls, attachments etc. + ///This is represented as a vector array of GUIDs where each GUID represents certain type. + /// + /// Type: Multivalue Guid -- VT_VECTOR | VT_CLSID (For variants: VT_ARRAY | VT_CLSID) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 29 + /// + public ShellProperty ContainedItems + { + get + { + PropertyKey key = SystemProperties.System.ContainedItems; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ContentStatus -- PKEY_ContentStatus + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 27 + /// + public ShellProperty ContentStatus + { + get + { + PropertyKey key = SystemProperties.System.ContentStatus; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ContentType -- PKEY_ContentType + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 26 + /// + public ShellProperty ContentType + { + get + { + PropertyKey key = SystemProperties.System.ContentType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Copyright -- PKEY_Copyright + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 11 (PIDMSI_COPYRIGHT) + /// + public ShellProperty Copyright + { + get + { + PropertyKey key = SystemProperties.System.Copyright; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DateAccessed -- PKEY_DateAccessed + /// Description: The time of the last access to the item. The Indexing Service friendly name is 'access'. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 16 (PID_STG_ACCESSTIME) + /// + public ShellProperty DateAccessed + { + get + { + PropertyKey key = SystemProperties.System.DateAccessed; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DateAcquired -- PKEY_DateAcquired + /// Description: The time the file entered the system via acquisition. This is not the same as System.DateImported. + ///Examples are when pictures are acquired from a camera, or when music is purchased online. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {2CBAA8F5-D81F-47CA-B17A-F8D822300131}, 100 + /// + public ShellProperty DateAcquired + { + get + { + PropertyKey key = SystemProperties.System.DateAcquired; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DateArchived -- PKEY_DateArchived + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {43F8D7B7-A444-4F87-9383-52271C9B915C}, 100 + /// + public ShellProperty DateArchived + { + get + { + PropertyKey key = SystemProperties.System.DateArchived; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DateCompleted -- PKEY_DateCompleted + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {72FAB781-ACDA-43E5-B155-B2434F85E678}, 100 + /// + public ShellProperty DateCompleted + { + get + { + PropertyKey key = SystemProperties.System.DateCompleted; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DateCreated -- PKEY_DateCreated + /// Description: The date and time the item was created. The Indexing Service friendly name is 'create'. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 15 (PID_STG_CREATETIME) + /// + public ShellProperty DateCreated + { + get + { + PropertyKey key = SystemProperties.System.DateCreated; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DateImported -- PKEY_DateImported + /// Description: The time the file is imported into a separate database. This is not the same as System.DateAcquired. (Eg, 2003:05:22 13:55:04) + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 18258 + /// + public ShellProperty DateImported + { + get + { + PropertyKey key = SystemProperties.System.DateImported; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DateModified -- PKEY_DateModified + /// Description: The date and time of the last write to the item. The Indexing Service friendly name is 'write'. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 14 (PID_STG_WRITETIME) + /// + public ShellProperty DateModified + { + get + { + PropertyKey key = SystemProperties.System.DateModified; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DescriptionID -- PKEY_DescriptionID + /// Description: The contents of a SHDESCRIPTIONID structure as a buffer of bytes. + /// + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 2 (PID_DESCRIPTIONID) + /// + public ShellProperty DescriptionID + { + get + { + PropertyKey key = SystemProperties.System.DescriptionID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DueDate -- PKEY_DueDate + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {3F8472B5-E0AF-4DB2-8071-C53FE76AE7CE}, 100 + /// + public ShellProperty DueDate + { + get + { + PropertyKey key = SystemProperties.System.DueDate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.EndDate -- PKEY_EndDate + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {C75FAA05-96FD-49E7-9CB4-9F601082D553}, 100 + /// + public ShellProperty EndDate + { + get + { + PropertyKey key = SystemProperties.System.EndDate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileAllocationSize -- PKEY_FileAllocationSize + /// Description: + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 18 (PID_STG_ALLOCSIZE) + /// + public ShellProperty FileAllocationSize + { + get + { + PropertyKey key = SystemProperties.System.FileAllocationSize; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileAttributes -- PKEY_FileAttributes + /// Description: This is the WIN32_FIND_DATA dwFileAttributes for the file-based item. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 13 (PID_STG_ATTRIBUTES) + /// + public ShellProperty FileAttributes + { + get + { + PropertyKey key = SystemProperties.System.FileAttributes; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileCount -- PKEY_FileCount + /// Description: + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 12 + /// + public ShellProperty FileCount + { + get + { + PropertyKey key = SystemProperties.System.FileCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileDescription -- PKEY_FileDescription + /// Description: This is a user-friendly description of the file. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 3 (PIDVSI_FileDescription) + /// + public ShellProperty FileDescription + { + get + { + PropertyKey key = SystemProperties.System.FileDescription; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileExtension -- PKEY_FileExtension + /// Description: This is the file extension of the file based item, including the leading period. + /// + ///If System.FileName is VT_EMPTY, then this property should be too. Otherwise, it should be derived + ///appropriately by the data source from System.FileName. If System.FileName does not have a file + ///extension, this value should be VT_EMPTY. + /// + ///To obtain the type of any item (including an item that is not a file), use System.ItemType. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" ".txt" + /// "\\server\share\mydir\goodnews.doc" ".doc" + /// "\\server\share\numbers.xls" ".xls" + /// "\\server\share\folder" VT_EMPTY + /// "c:\foo\MyFolder" VT_EMPTY + /// [desktop] VT_EMPTY + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E4F10A3C-49E6-405D-8288-A23BD4EEAA6C}, 100 + /// + public ShellProperty FileExtension + { + get + { + PropertyKey key = SystemProperties.System.FileExtension; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileFRN -- PKEY_FileFRN + /// Description: This is the unique file ID, also known as the File Reference Number. For a given file, this is the same value + ///as is found in the structure variable FILE_ID_BOTH_DIR_INFO.FileId, via GetFileInformationByHandleEx(). + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 21 (PID_STG_FRN) + /// + public ShellProperty FileFRN + { + get + { + PropertyKey key = SystemProperties.System.FileFRN; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileName -- PKEY_FileName + /// Description: This is the file name (including extension) of the file. + /// + ///It is possible that the item might not exist on a filesystem (ie, it may not be opened + ///using CreateFile). Nonetheless, if the item is represented as a file from the logical sense + ///(and its name follows standard Win32 file-naming syntax), then the data source should emit this property. + /// + ///If an item is not a file, then the value for this property is VT_EMPTY. See + ///System.ItemNameDisplay. + /// + ///This has the same value as System.ParsingName for items that are provided by the Shell's file folder. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "hello.txt" + /// "\\server\share\mydir\goodnews.doc" "goodnews.doc" + /// "\\server\share\numbers.xls" "numbers.xls" + /// "c:\foo\MyFolder" "MyFolder" + /// (email message) VT_EMPTY + /// (song on portable device) "song.wma" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {41CF5AE0-F75A-4806-BD87-59C7D9248EB9}, 100 + /// + public ShellProperty FileName + { + get + { + PropertyKey key = SystemProperties.System.FileName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileOwner -- PKEY_FileOwner + /// Description: This is the owner of the file, according to the file system. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Misc) {9B174B34-40FF-11D2-A27E-00C04FC30871}, 4 (PID_MISC_OWNER) + /// + public ShellProperty FileOwner + { + get + { + PropertyKey key = SystemProperties.System.FileOwner; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FileVersion -- PKEY_FileVersion + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 4 (PIDVSI_FileVersion) + /// + public ShellProperty FileVersion + { + get + { + PropertyKey key = SystemProperties.System.FileVersion; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FindData -- PKEY_FindData + /// Description: WIN32_FIND_DATAW in buffer of bytes. + /// + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 0 (PID_FINDDATA) + /// + public ShellProperty FindData + { + get + { + PropertyKey key = SystemProperties.System.FindData; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FlagColor -- PKEY_FlagColor + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {67DF94DE-0CA7-4D6F-B792-053A3E4F03CF}, 100 + /// + public ShellProperty FlagColor + { + get + { + PropertyKey key = SystemProperties.System.FlagColor; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FlagColorText -- PKEY_FlagColorText + /// Description: This is the user-friendly form of System.FlagColor. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {45EAE747-8E2A-40AE-8CBF-CA52ABA6152A}, 100 + /// + public ShellProperty FlagColorText + { + get + { + PropertyKey key = SystemProperties.System.FlagColorText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FlagStatus -- PKEY_FlagStatus + /// Description: Status of Flag. Values: (0=none 1=white 2=Red). cdoPR_FLAG_STATUS + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 12 + /// + public ShellProperty FlagStatus + { + get + { + PropertyKey key = SystemProperties.System.FlagStatus; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FlagStatusText -- PKEY_FlagStatusText + /// Description: This is the user-friendly form of System.FlagStatus. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DC54FD2E-189D-4871-AA01-08C2F57A4ABC}, 100 + /// + public ShellProperty FlagStatusText + { + get + { + PropertyKey key = SystemProperties.System.FlagStatusText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FreeSpace -- PKEY_FreeSpace + /// Description: The amount of free space in bytes. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 2 (PID_VOLUME_FREE) (Filesystem Volume Properties) + /// + public ShellProperty FreeSpace + { + get + { + PropertyKey key = SystemProperties.System.FreeSpace; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.FullText -- PKEY_FullText + /// Description: This PKEY is used to specify search terms that should be applied as broadly as possible, + ///across all valid properties for the data source(s) being searched. It should not be + ///emitted from a data source. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {1E3EE840-BC2B-476C-8237-2ACD1A839B22}, 6 + /// + public ShellProperty FullText + { + get + { + PropertyKey key = SystemProperties.System.FullText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Identity -- PKEY_Identity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A26F4AFC-7346-4299-BE47-EB1AE613139F}, 100 + /// + public ShellProperty IdentityProperty + { + get + { + PropertyKey key = SystemProperties.System.IdentityProperty; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ImageParsingName -- PKEY_ImageParsingName + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D7750EE0-C6A4-48EC-B53E-B87B52E6D073}, 100 + /// + public ShellProperty ImageParsingName + { + get + { + PropertyKey key = SystemProperties.System.ImageParsingName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Importance -- PKEY_Importance + /// Description: + /// Type: Int32 -- VT_I4 + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 11 + /// + public ShellProperty Importance + { + get + { + PropertyKey key = SystemProperties.System.Importance; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ImportanceText -- PKEY_ImportanceText + /// Description: This is the user-friendly form of System.Importance. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A3B29791-7713-4E1D-BB40-17DB85F01831}, 100 + /// + public ShellProperty ImportanceText + { + get + { + PropertyKey key = SystemProperties.System.ImportanceText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.InfoTipText -- PKEY_InfoTipText + /// Description: The text (with formatted property values) to show in the infotip. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 17 + /// + public ShellProperty InfoTipText + { + get + { + PropertyKey key = SystemProperties.System.InfoTipText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.InternalName -- PKEY_InternalName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 5 (PIDVSI_InternalName) + /// + public ShellProperty InternalName + { + get + { + PropertyKey key = SystemProperties.System.InternalName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsAttachment -- PKEY_IsAttachment + /// Description: Identifies if this item is an attachment. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {F23F425C-71A1-4FA8-922F-678EA4A60408}, 100 + /// + public ShellProperty IsAttachment + { + get + { + PropertyKey key = SystemProperties.System.IsAttachment; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsDefaultNonOwnerSaveLocation -- PKEY_IsDefaultNonOwnerSaveLocation + /// Description: Identifies the default save location for a library for non-owners of the library + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 5 + /// + public ShellProperty IsDefaultNonOwnerSaveLocation + { + get + { + PropertyKey key = SystemProperties.System.IsDefaultNonOwnerSaveLocation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsDefaultSaveLocation -- PKEY_IsDefaultSaveLocation + /// Description: Identifies the default save location for a library for the owner of the library + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 3 + /// + public ShellProperty IsDefaultSaveLocation + { + get + { + PropertyKey key = SystemProperties.System.IsDefaultSaveLocation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsDeleted -- PKEY_IsDeleted + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {5CDA5FC8-33EE-4FF3-9094-AE7BD8868C4D}, 100 + /// + public ShellProperty IsDeleted + { + get + { + PropertyKey key = SystemProperties.System.IsDeleted; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsEncrypted -- PKEY_IsEncrypted + /// Description: Is the item encrypted? + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {90E5E14E-648B-4826-B2AA-ACAF790E3513}, 10 + /// + public ShellProperty IsEncrypted + { + get + { + PropertyKey key = SystemProperties.System.IsEncrypted; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsFlagged -- PKEY_IsFlagged + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {5DA84765-E3FF-4278-86B0-A27967FBDD03}, 100 + /// + public ShellProperty IsFlagged + { + get + { + PropertyKey key = SystemProperties.System.IsFlagged; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsFlaggedComplete -- PKEY_IsFlaggedComplete + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {A6F360D2-55F9-48DE-B909-620E090A647C}, 100 + /// + public ShellProperty IsFlaggedComplete + { + get + { + PropertyKey key = SystemProperties.System.IsFlaggedComplete; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsIncomplete -- PKEY_IsIncomplete + /// Description: Identifies if the message was not completely received for some error condition. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {346C8BD1-2E6A-4C45-89A4-61B78E8E700F}, 100 + /// + public ShellProperty IsIncomplete + { + get + { + PropertyKey key = SystemProperties.System.IsIncomplete; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsLocationSupported -- PKEY_IsLocationSupported + /// Description: A bool value to know if a location is supported (locally indexable, or remotely indexed). + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 8 + /// + public ShellProperty IsLocationSupported + { + get + { + PropertyKey key = SystemProperties.System.IsLocationSupported; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsPinnedToNameSpaceTree -- PKEY_IsPinnedToNameSpaceTree + /// Description: A bool value to know if a shell folder is pinned to the navigation pane + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 2 + /// + public ShellProperty IsPinnedToNamespaceTree + { + get + { + PropertyKey key = SystemProperties.System.IsPinnedToNamespaceTree; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsRead -- PKEY_IsRead + /// Description: Has the item been read? + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 10 + /// + public ShellProperty IsRead + { + get + { + PropertyKey key = SystemProperties.System.IsRead; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsSearchOnlyItem -- PKEY_IsSearchOnlyItem + /// Description: Identifies if a location or a library is search only + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 4 + /// + public ShellProperty IsSearchOnlyItem + { + get + { + PropertyKey key = SystemProperties.System.IsSearchOnlyItem; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsSendToTarget -- PKEY_IsSendToTarget + /// Description: Provided by certain shell folders. Return TRUE if the folder is a valid Send To target. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 33 + /// + public ShellProperty IsSendToTarget + { + get + { + PropertyKey key = SystemProperties.System.IsSendToTarget; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IsShared -- PKEY_IsShared + /// Description: Is this item shared? This only checks for ACLs that are not inherited. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 100 + /// + public ShellProperty IsShared + { + get + { + PropertyKey key = SystemProperties.System.IsShared; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemAuthors -- PKEY_ItemAuthors + /// Description: This is the generic list of authors associated with an item. + /// + ///For example, the artist name for a track is the item author. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D0A04F0A-462A-48A4-BB2F-3706E88DBD7D}, 100 + /// + public ShellProperty ItemAuthors + { + get + { + PropertyKey key = SystemProperties.System.ItemAuthors; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemClassType -- PKEY_ItemClassType + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {048658AD-2DB8-41A4-BBB6-AC1EF1207EB1}, 100 + /// + public ShellProperty ItemClassType + { + get + { + PropertyKey key = SystemProperties.System.ItemClassType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemDate -- PKEY_ItemDate + /// Description: This is the main date for an item. The date of interest. + /// + ///For example, for photos this maps to System.Photo.DateTaken. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {F7DB74B4-4287-4103-AFBA-F1B13DCD75CF}, 100 + /// + public ShellProperty ItemDate + { + get + { + PropertyKey key = SystemProperties.System.ItemDate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemFolderNameDisplay -- PKEY_ItemFolderNameDisplay + /// Description: This is the user-friendly display name of the parent folder of an item. + /// + ///If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it + ///should be derived appropriately by the data source from System.ItemFolderPathDisplay. + /// + ///If the folder is a file folder, the value will be localized if a localized name is available. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "bar" + /// "\\server\share\mydir\goodnews.doc" "mydir" + /// "\\server\share\numbers.xls" "share" + /// "c:\foo\MyFolder" "foo" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 2 (PID_STG_DIRECTORY) + /// + public ShellProperty ItemFolderNameDisplay + { + get + { + PropertyKey key = SystemProperties.System.ItemFolderNameDisplay; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemFolderPathDisplay -- PKEY_ItemFolderPathDisplay + /// Description: This is the user-friendly display path of the parent folder of an item. + /// + ///If System.ItemPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it should + ///be derived appropriately by the data source from System.ItemPathDisplay. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "c:\foo\bar" + /// "\\server\share\mydir\goodnews.doc" "\\server\share\mydir" + /// "\\server\share\numbers.xls" "\\server\share" + /// "c:\foo\MyFolder" "c:\foo" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 6 + /// + public ShellProperty ItemFolderPathDisplay + { + get + { + PropertyKey key = SystemProperties.System.ItemFolderPathDisplay; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemFolderPathDisplayNarrow -- PKEY_ItemFolderPathDisplayNarrow + /// Description: This is the user-friendly display path of the parent folder of an item. The format of the string + ///should be tailored such that the folder name comes first, to optimize for a narrow viewing column. + /// + ///If the folder is a file folder, the value includes localized names if they are present. + /// + ///If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it should + ///be derived appropriately by the data source from System.ItemFolderPathDisplay. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "bar (c:\foo)" + /// "\\server\share\mydir\goodnews.doc" "mydir (\\server\share)" + /// "\\server\share\numbers.xls" "share (\\server)" + /// "c:\foo\MyFolder" "foo (c:\)" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox (/Mailbox Account)" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DABD30ED-0043-4789-A7F8-D013A4736622}, 100 + /// + public ShellProperty ItemFolderPathDisplayNarrow + { + get + { + PropertyKey key = SystemProperties.System.ItemFolderPathDisplayNarrow; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemName -- PKEY_ItemName + /// Description: This is the base-name of the System.ItemNameDisplay. + /// + ///If the item is a file this property + ///includes the extension in all cases, and will be localized if a localized name is available. + /// + ///If the item is a message, then the value of this property does not include the forwarding or + ///reply prefixes (see System.ItemNamePrefix). + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6B8DA074-3B5C-43BC-886F-0A2CDCE00B6F}, 100 + /// + public ShellProperty ItemName + { + get + { + PropertyKey key = SystemProperties.System.ItemName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemNameDisplay -- PKEY_ItemNameDisplay + /// Description: This is the display name in "most complete" form. This is the best effort unique representation + ///of the name of an item that makes sense for end users to read. It is the concatentation of + ///System.ItemNamePrefix and System.ItemName. + /// + ///If the item is a file this property + ///includes the extension in all cases, and will be localized if a localized name is available. + /// + ///There are acceptable cases when System.FileName is not VT_EMPTY, yet the value of this property + ///is completely different. Email messages are a key example. If the item is an email message, + ///the item name is likely the subject. In that case, the value must be the concatenation of the + ///System.ItemNamePrefix and System.ItemName. Since the value of System.ItemNamePrefix excludes + ///any trailing whitespace, the concatenation must include a whitespace when generating System.ItemNameDisplay. + /// + ///Note that this property is not guaranteed to be unique, but the idea is to promote the most likely + ///candidate that can be unique and also makes sense for end users. For example, for documents, you + ///might think about using System.Title as the System.ItemNameDisplay, but in practice the title of + ///the documents may not be useful or unique enough to be of value as the sole System.ItemNameDisplay. + ///Instead, providing the value of System.FileName as the value of System.ItemNameDisplay is a better + ///candidate. In Windows Mail, the emails are stored in the file system as .eml files and the + ///System.FileName for those files are not human-friendly as they contain GUIDs. In this example, + ///promoting System.Subject as System.ItemNameDisplay makes more sense. + /// + ///Compatibility notes: + /// + ///Shell folder implementations on Vista: use PKEY_ItemNameDisplay for the name column when + ///you want Explorer to call ISF::GetDisplayNameOf(SHGDN_NORMAL) to get the value of the name. Use + ///another PKEY (like PKEY_ItemName) when you want Explorer to call either the folder's property store or + ///ISF2::GetDetailsEx in order to get the value of the name. + /// + ///Shell folder implementations on XP: the first column needs to be the name column, and Explorer + ///will call ISF::GetDisplayNameOf to get the value of the name. The PKEY/SCID does not matter. + /// + ///Example values: + /// + /// File: "hello.txt" + /// Message: "Re: Let's talk about Tom's argyle socks!" + /// Device folder: "song.wma" + /// Folder: "Documents" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 10 (PID_STG_NAME) + /// + public ShellProperty ItemNameDisplay + { + get + { + PropertyKey key = SystemProperties.System.ItemNameDisplay; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemNamePrefix -- PKEY_ItemNamePrefix + /// Description: This is the prefix of an item, used for email messages. + ///where the subject begins with "Re:" which is the prefix. + /// + ///If the item is a file, then the value of this property is VT_EMPTY. + /// + ///If the item is a message, then the value of this property is the forwarding or reply + ///prefixes (including delimiting colon, but no whitespace), or VT_EMPTY if there is no prefix. + /// + ///Example values: + /// + ///System.ItemNamePrefix System.ItemName System.ItemNameDisplay + ///--------------------- ------------------- ---------------------- + ///VT_EMPTY "Great day" "Great day" + ///"Re:" "Great day" "Re: Great day" + ///"Fwd: " "Monthly budget" "Fwd: Monthly budget" + ///VT_EMPTY "accounts.xls" "accounts.xls" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D7313FF1-A77A-401C-8C99-3DBDD68ADD36}, 100 + /// + public ShellProperty ItemNamePrefix + { + get + { + PropertyKey key = SystemProperties.System.ItemNamePrefix; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemParticipants -- PKEY_ItemParticipants + /// Description: This is the generic list of people associated with an item and who contributed + ///to the item. + /// + ///For example, this is the combination of people in the To list, Cc list and + ///sender of an email message. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D4D0AA16-9948-41A4-AA85-D97FF9646993}, 100 + /// + public ShellProperty ItemParticipants + { + get + { + PropertyKey key = SystemProperties.System.ItemParticipants; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemPathDisplay -- PKEY_ItemPathDisplay + /// Description: This is the user-friendly display path to the item. + /// + ///If the item is a file or folder this property + ///includes the extension in all cases, and will be localized if a localized name is available. + /// + ///For other items,this is the user-friendly equivalent, assuming the item exists in hierarchical storage. + /// + ///Unlike System.ItemUrl, this property value does not include the URL scheme. + /// + ///To parse an item path, use System.ItemUrl or System.ParsingPath. To reference shell + ///namespace items using shell APIs, use System.ParsingPath. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "c:\foo\bar\hello.txt" + /// "\\server\share\mydir\goodnews.doc" "\\server\share\mydir\goodnews.doc" + /// "\\server\share\numbers.xls" "\\server\share\numbers.xls" + /// "c:\foo\MyFolder" "c:\foo\MyFolder" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox/'Re: Hello!'" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 7 + /// + public ShellProperty ItemPathDisplay + { + get + { + PropertyKey key = SystemProperties.System.ItemPathDisplay; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemPathDisplayNarrow -- PKEY_ItemPathDisplayNarrow + /// Description: This is the user-friendly display path to the item. The format of the string should be + ///tailored such that the name comes first, to optimize for a narrow viewing column. + /// + ///If the item is a file, the value excludes the file extension, and includes localized names if they are present. + ///If the item is a message, the value includes the System.ItemNamePrefix. + /// + ///To parse an item path, use System.ItemUrl or System.ParsingPath. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "hello (c:\foo\bar)" + /// "\\server\share\mydir\goodnews.doc" "goodnews (\\server\share\mydir)" + /// "\\server\share\folder" "folder (\\server\share)" + /// "c:\foo\MyFolder" "MyFolder (c:\foo)" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "Re: Hello! (/Mailbox Account/Inbox)" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 8 + /// + public ShellProperty ItemPathDisplayNarrow + { + get + { + PropertyKey key = SystemProperties.System.ItemPathDisplayNarrow; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemType -- PKEY_ItemType + /// Description: This is the canonical type of the item and is intended to be programmatically + ///parsed. + /// + ///If there is no canonical type, the value is VT_EMPTY. + /// + ///If the item is a file (ie, System.FileName is not VT_EMPTY), the value is the same as + ///System.FileExtension. + /// + ///Use System.ItemTypeText when you want to display the type to end users in a view. (If + /// the item is a file, passing the System.ItemType value to PSFormatForDisplay will + /// result in the same value as System.ItemTypeText.) + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" ".txt" + /// "\\server\share\mydir\goodnews.doc" ".doc" + /// "\\server\share\folder" "Directory" + /// "c:\foo\MyFolder" "Directory" + /// [desktop] "Folder" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "MAPI/IPM.Message" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 11 + /// + public ShellProperty ItemType + { + get + { + PropertyKey key = SystemProperties.System.ItemType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemTypeText -- PKEY_ItemTypeText + /// Description: This is the user friendly type name of the item. This is not intended to be + ///programmatically parsed. + /// + ///If System.ItemType is VT_EMPTY, the value of this property is also VT_EMPTY. + /// + ///If the item is a file, the value of this property is the same as if you passed the + ///file's System.ItemType value to PSFormatForDisplay. + /// + ///This property should not be confused with System.Kind, where System.Kind is a high-level + ///user friendly kind name. For example, for a document, System.Kind = "Document" and + ///System.Item.Type = ".doc" and System.Item.TypeText = "Microsoft Word Document" + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "Text File" + /// "\\server\share\mydir\goodnews.doc" "Microsoft Word Document" + /// "\\server\share\folder" "File Folder" + /// "c:\foo\MyFolder" "File Folder" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "Outlook E-Mail Message" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 4 (PID_STG_STORAGETYPE) + /// + public ShellProperty ItemTypeText + { + get + { + PropertyKey key = SystemProperties.System.ItemTypeText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ItemUrl -- PKEY_ItemUrl + /// Description: This always represents a well formed URL that points to the item. + /// + ///To reference shell namespace items using shell APIs, use System.ParsingPath. + /// + ///Example values: + /// + /// Files: "file:///c:/foo/bar/hello.txt" + /// "csc://{GUID}/..." + /// Messages: "mapi://..." + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 9 (DISPID_QUERY_VIRTUALPATH) + /// + public ShellProperty ItemUrl + { + get + { + PropertyKey key = SystemProperties.System.ItemUrl; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Keywords -- PKEY_Keywords + /// Description: The keywords for the item. Also referred to as tags. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 5 (PIDSI_KEYWORDS) + /// + public ShellProperty Keywords + { + get + { + PropertyKey key = SystemProperties.System.Keywords; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Kind -- PKEY_Kind + /// Description: System.Kind is used to map extensions to various .Search folders. + ///Extensions are mapped to Kinds at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap + ///The list of kinds is not extensible. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {1E3EE840-BC2B-476C-8237-2ACD1A839B22}, 3 + /// + public ShellProperty Kind + { + get + { + PropertyKey key = SystemProperties.System.Kind; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.KindText -- PKEY_KindText + /// Description: This is the user-friendly form of System.Kind. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F04BEF95-C585-4197-A2B7-DF46FDC9EE6D}, 100 + /// + public ShellProperty KindText + { + get + { + PropertyKey key = SystemProperties.System.KindText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Language -- PKEY_Language + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 28 + /// + public ShellProperty Language + { + get + { + PropertyKey key = SystemProperties.System.Language; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.MileageInformation -- PKEY_MileageInformation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FDF84370-031A-4ADD-9E91-0D775F1C6605}, 100 + /// + public ShellProperty MileageInformation + { + get + { + PropertyKey key = SystemProperties.System.MileageInformation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.MIMEType -- PKEY_MIMEType + /// Description: The MIME type. Eg, for EML files: 'message/rfc822'. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0B63E350-9CCC-11D0-BCDB-00805FCCCE04}, 5 + /// + public ShellProperty MIMEType + { + get + { + PropertyKey key = SystemProperties.System.MIMEType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.NamespaceCLSID -- PKEY_NamespaceCLSID + /// Description: The CLSID of the name space extension for an item, the object that implements IShellFolder for this item + /// + /// Type: Guid -- VT_CLSID + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 6 + /// + public ShellProperty NamespaceClsid + { + get + { + PropertyKey key = SystemProperties.System.NamespaceClsid; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Null -- PKEY_Null + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {00000000-0000-0000-0000-000000000000}, 0 + /// + public ShellProperty Null + { + get + { + PropertyKey key = SystemProperties.System.Null; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.OfflineAvailability -- PKEY_OfflineAvailability + /// Description: + /// Type: UInt32 -- VT_UI4 + /// FormatID: {A94688B6-7D9F-4570-A648-E3DFC0AB2B3F}, 100 + /// + public ShellProperty OfflineAvailability + { + get + { + PropertyKey key = SystemProperties.System.OfflineAvailability; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.OfflineStatus -- PKEY_OfflineStatus + /// Description: + /// Type: UInt32 -- VT_UI4 + /// FormatID: {6D24888F-4718-4BDA-AFED-EA0FB4386CD8}, 100 + /// + public ShellProperty OfflineStatus + { + get + { + PropertyKey key = SystemProperties.System.OfflineStatus; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.OriginalFileName -- PKEY_OriginalFileName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 6 + /// + public ShellProperty OriginalFileName + { + get + { + PropertyKey key = SystemProperties.System.OriginalFileName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.OwnerSID -- PKEY_OwnerSID + /// Description: SID of the user that owns the library. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 6 + /// + public ShellProperty OwnerSid + { + get + { + PropertyKey key = SystemProperties.System.OwnerSid; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ParentalRating -- PKEY_ParentalRating + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 21 (PIDMSI_PARENTAL_RATING) + /// + public ShellProperty ParentalRating + { + get + { + PropertyKey key = SystemProperties.System.ParentalRating; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ParentalRatingReason -- PKEY_ParentalRatingReason + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {10984E0A-F9F2-4321-B7EF-BAF195AF4319}, 100 + /// + public ShellProperty ParentalRatingReason + { + get + { + PropertyKey key = SystemProperties.System.ParentalRatingReason; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ParentalRatingsOrganization -- PKEY_ParentalRatingsOrganization + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A7FE0840-1344-46F0-8D37-52ED712A4BF9}, 100 + /// + public ShellProperty ParentalRatingsOrganization + { + get + { + PropertyKey key = SystemProperties.System.ParentalRatingsOrganization; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ParsingBindContext -- PKEY_ParsingBindContext + /// Description: used to get the IBindCtx for an item for parsing + /// + /// Type: Any -- VT_NULL Legacy code may treat this as VT_UNKNOWN. + /// FormatID: {DFB9A04D-362F-4CA3-B30B-0254B17B5B84}, 100 + /// + public ShellProperty ParsingBindContext + { + get + { + PropertyKey key = SystemProperties.System.ParsingBindContext; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ParsingName -- PKEY_ParsingName + /// Description: The shell namespace name of an item relative to a parent folder. This name may be passed to + ///IShellFolder::ParseDisplayName() of the parent shell folder. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 24 + /// + public ShellProperty ParsingName + { + get + { + PropertyKey key = SystemProperties.System.ParsingName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ParsingPath -- PKEY_ParsingPath + /// Description: This is the shell namespace path to the item. This path may be passed to + ///SHParseDisplayName to parse the path to the correct shell folder. + /// + ///If the item is a file, the value is identical to System.ItemPathDisplay. + /// + ///If the item cannot be accessed through the shell namespace, this value is VT_EMPTY. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 30 + /// + public ShellProperty ParsingPath + { + get + { + PropertyKey key = SystemProperties.System.ParsingPath; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PerceivedType -- PKEY_PerceivedType + /// Description: The perceived type of a shell item, based upon its canonical type. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 9 + /// + public ShellProperty PerceivedType + { + get + { + PropertyKey key = SystemProperties.System.PerceivedType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PercentFull -- PKEY_PercentFull + /// Description: The amount filled as a percentage, multiplied by 100 (ie, the valid range is 0 through 100). + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 5 (Filesystem Volume Properties) + /// + public ShellProperty PercentFull + { + get + { + PropertyKey key = SystemProperties.System.PercentFull; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Priority -- PKEY_Priority + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}, 5 + /// + public ShellProperty Priority + { + get + { + PropertyKey key = SystemProperties.System.Priority; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PriorityText -- PKEY_PriorityText + /// Description: This is the user-friendly form of System.Priority. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D98BE98B-B86B-4095-BF52-9D23B2E0A752}, 100 + /// + public ShellProperty PriorityText + { + get + { + PropertyKey key = SystemProperties.System.PriorityText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Project -- PKEY_Project + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {39A7F922-477C-48DE-8BC8-B28441E342E3}, 100 + /// + public ShellProperty Project + { + get + { + PropertyKey key = SystemProperties.System.Project; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ProviderItemID -- PKEY_ProviderItemID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F21D9941-81F0-471A-ADEE-4E74B49217ED}, 100 + /// + public ShellProperty ProviderItemID + { + get + { + PropertyKey key = SystemProperties.System.ProviderItemID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Rating -- PKEY_Rating + /// Description: Indicates the users preference rating of an item on a scale of 1-99 (1-12 = One Star, + ///13-37 = Two Stars, 38-62 = Three Stars, 63-87 = Four Stars, 88-99 = Five Stars). + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 9 (PIDMSI_RATING) + /// + public ShellProperty Rating + { + get + { + PropertyKey key = SystemProperties.System.Rating; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RatingText -- PKEY_RatingText + /// Description: This is the user-friendly form of System.Rating. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {90197CA7-FD8F-4E8C-9DA3-B57E1E609295}, 100 + /// + public ShellProperty RatingText + { + get + { + PropertyKey key = SystemProperties.System.RatingText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sensitivity -- PKEY_Sensitivity + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {F8D3F6AC-4874-42CB-BE59-AB454B30716A}, 100 + /// + public ShellProperty Sensitivity + { + get + { + PropertyKey key = SystemProperties.System.Sensitivity; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.SensitivityText -- PKEY_SensitivityText + /// Description: This is the user-friendly form of System.Sensitivity. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D0C7F054-3F72-4725-8527-129A577CB269}, 100 + /// + public ShellProperty SensitivityText + { + get + { + PropertyKey key = SystemProperties.System.SensitivityText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.SFGAOFlags -- PKEY_SFGAOFlags + /// Description: IShellFolder::GetAttributesOf flags, with SFGAO_PKEYSFGAOMASK attributes masked out. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 25 + /// + public ShellProperty SFGAOFlags + { + get + { + PropertyKey key = SystemProperties.System.SFGAOFlags; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.SharedWith -- PKEY_SharedWith + /// Description: Who is the item shared with? + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 200 + /// + public ShellProperty SharedWith + { + get + { + PropertyKey key = SystemProperties.System.SharedWith; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ShareUserRating -- PKEY_ShareUserRating + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 12 (PIDMSI_SHARE_USER_RATING) + /// + public ShellProperty ShareUserRating + { + get + { + PropertyKey key = SystemProperties.System.ShareUserRating; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.SharingStatus -- PKEY_SharingStatus + /// Description: What is the item's sharing status (not shared, shared, everyone (homegroup or everyone), or private)? + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 300 + /// + public ShellProperty SharingStatus + { + get + { + PropertyKey key = SystemProperties.System.SharingStatus; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.SimpleRating -- PKEY_SimpleRating + /// Description: Indicates the users preference rating of an item on a scale of 0-5 (0=unrated, 1=One Star, 2=Two Stars, 3=Three Stars, + ///4=Four Stars, 5=Five Stars) + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {A09F084E-AD41-489F-8076-AA5BE3082BCA}, 100 + /// + public ShellProperty SimpleRating + { + get + { + PropertyKey key = SystemProperties.System.SimpleRating; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Size -- PKEY_Size + /// Description: + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 12 (PID_STG_SIZE) + /// + public ShellProperty Size + { + get + { + PropertyKey key = SystemProperties.System.Size; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.SoftwareUsed -- PKEY_SoftwareUsed + /// Description: PropertyTagSoftwareUsed + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 305 + /// + public ShellProperty SoftwareUsed + { + get + { + PropertyKey key = SystemProperties.System.SoftwareUsed; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.SourceItem -- PKEY_SourceItem + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {668CDFA5-7A1B-4323-AE4B-E527393A1D81}, 100 + /// + public ShellProperty SourceItem + { + get + { + PropertyKey key = SystemProperties.System.SourceItem; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.StartDate -- PKEY_StartDate + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {48FD6EC8-8A12-4CDF-A03E-4EC5A511EDDE}, 100 + /// + public ShellProperty StartDate + { + get + { + PropertyKey key = SystemProperties.System.StartDate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Status -- PKEY_Status + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_IntSite) {000214A1-0000-0000-C000-000000000046}, 9 + /// + public ShellProperty Status + { + get + { + PropertyKey key = SystemProperties.System.Status; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Subject -- PKEY_Subject + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 3 (PIDSI_SUBJECT) + /// + public ShellProperty Subject + { + get + { + PropertyKey key = SystemProperties.System.Subject; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Thumbnail -- PKEY_Thumbnail + /// Description: A data that represents the thumbnail in VT_CF format. + /// + /// Type: Clipboard -- VT_CF + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 17 (PIDSI_THUMBNAIL) + /// + public ShellProperty Thumbnail + { + get + { + PropertyKey key = SystemProperties.System.Thumbnail; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ThumbnailCacheId -- PKEY_ThumbnailCacheId + /// Description: Unique value that can be used as a key to cache thumbnails. The value changes when the name, volume, or data modified + ///of an item changes. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {446D16B1-8DAD-4870-A748-402EA43D788C}, 100 + /// + public ShellProperty ThumbnailCacheId + { + get + { + PropertyKey key = SystemProperties.System.ThumbnailCacheId; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.ThumbnailStream -- PKEY_ThumbnailStream + /// Description: Data that represents the thumbnail in VT_STREAM format that GDI+/WindowsCodecs supports (jpg, png, etc). + /// + /// Type: Stream -- VT_STREAM + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 27 + /// + public ShellProperty ThumbnailStream + { + get + { + PropertyKey key = SystemProperties.System.ThumbnailStream; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Title -- PKEY_Title + /// Description: Title of item. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 2 (PIDSI_TITLE) + /// + public ShellProperty Title + { + get + { + PropertyKey key = SystemProperties.System.Title; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.TotalFileSize -- PKEY_TotalFileSize + /// Description: + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 14 + /// + public ShellProperty TotalFileSize + { + get + { + PropertyKey key = SystemProperties.System.TotalFileSize; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Trademarks -- PKEY_Trademarks + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 9 (PIDVSI_Trademarks) + /// + public ShellProperty Trademarks + { + get + { + PropertyKey key = SystemProperties.System.Trademarks; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + private PropertySystemAppUserModel internalPropertySystemAppUserModel; + /// + /// System.AppUserModel Properties + /// + public PropertySystemAppUserModel AppUserModel + { + get + { + if (internalPropertySystemAppUserModel == null) + { + internalPropertySystemAppUserModel = new PropertySystemAppUserModel(shellObjectParent); + } + + return internalPropertySystemAppUserModel; + } + } + private PropertySystemAudio internalPropertySystemAudio; + /// + /// System.Audio Properties + /// + public PropertySystemAudio Audio + { + get + { + if (internalPropertySystemAudio == null) + { + internalPropertySystemAudio = new PropertySystemAudio(shellObjectParent); + } + + return internalPropertySystemAudio; + } + } + private PropertySystemCalendar internalPropertySystemCalendar; + /// + /// System.Calendar Properties + /// + public PropertySystemCalendar Calendar + { + get + { + if (internalPropertySystemCalendar == null) + { + internalPropertySystemCalendar = new PropertySystemCalendar(shellObjectParent); + } + + return internalPropertySystemCalendar; + } + } + private PropertySystemCommunication internalPropertySystemCommunication; + /// + /// System.Communication Properties + /// + public PropertySystemCommunication Communication + { + get + { + if (internalPropertySystemCommunication == null) + { + internalPropertySystemCommunication = new PropertySystemCommunication(shellObjectParent); + } + + return internalPropertySystemCommunication; + } + } + private PropertySystemComputer internalPropertySystemComputer; + /// + /// System.Computer Properties + /// + public PropertySystemComputer Computer + { + get + { + if (internalPropertySystemComputer == null) + { + internalPropertySystemComputer = new PropertySystemComputer(shellObjectParent); + } + + return internalPropertySystemComputer; + } + } + private PropertySystemContact internalPropertySystemContact; + /// + /// System.Contact Properties + /// + public PropertySystemContact Contact + { + get + { + if (internalPropertySystemContact == null) + { + internalPropertySystemContact = new PropertySystemContact(shellObjectParent); + } + + return internalPropertySystemContact; + } + } + private PropertySystemDevice internalPropertySystemDevice; + /// + /// System.Device Properties + /// + public PropertySystemDevice Device + { + get + { + if (internalPropertySystemDevice == null) + { + internalPropertySystemDevice = new PropertySystemDevice(shellObjectParent); + } + + return internalPropertySystemDevice; + } + } + private PropertySystemDeviceInterface internalPropertySystemDeviceInterface; + /// + /// System.DeviceInterface Properties + /// + public PropertySystemDeviceInterface DeviceInterface + { + get + { + if (internalPropertySystemDeviceInterface == null) + { + internalPropertySystemDeviceInterface = new PropertySystemDeviceInterface(shellObjectParent); + } + + return internalPropertySystemDeviceInterface; + } + } + private PropertySystemDevices internalPropertySystemDevices; + /// + /// System.Devices Properties + /// + public PropertySystemDevices Devices + { + get + { + if (internalPropertySystemDevices == null) + { + internalPropertySystemDevices = new PropertySystemDevices(shellObjectParent); + } + + return internalPropertySystemDevices; + } + } + private PropertySystemDocument internalPropertySystemDocument; + /// + /// System.Document Properties + /// + public PropertySystemDocument Document + { + get + { + if (internalPropertySystemDocument == null) + { + internalPropertySystemDocument = new PropertySystemDocument(shellObjectParent); + } + + return internalPropertySystemDocument; + } + } + private PropertySystemDRM internalPropertySystemDRM; + /// + /// System.DRM Properties + /// + public PropertySystemDRM DRM + { + get + { + if (internalPropertySystemDRM == null) + { + internalPropertySystemDRM = new PropertySystemDRM(shellObjectParent); + } + + return internalPropertySystemDRM; + } + } + private PropertySystemGPS internalPropertySystemGPS; + /// + /// System.GPS Properties + /// + public PropertySystemGPS GPS + { + get + { + if (internalPropertySystemGPS == null) + { + internalPropertySystemGPS = new PropertySystemGPS(shellObjectParent); + } + + return internalPropertySystemGPS; + } + } + private PropertySystemIdentity internalPropertySystemIdentity; + /// + /// System.Identity Properties + /// + public PropertySystemIdentity Identity + { + get + { + if (internalPropertySystemIdentity == null) + { + internalPropertySystemIdentity = new PropertySystemIdentity(shellObjectParent); + } + + return internalPropertySystemIdentity; + } + } + private PropertySystemIdentityProvider internalPropertySystemIdentityProvider; + /// + /// System.IdentityProvider Properties + /// + public PropertySystemIdentityProvider IdentityProvider + { + get + { + if (internalPropertySystemIdentityProvider == null) + { + internalPropertySystemIdentityProvider = new PropertySystemIdentityProvider(shellObjectParent); + } + + return internalPropertySystemIdentityProvider; + } + } + private PropertySystemImage internalPropertySystemImage; + /// + /// System.Image Properties + /// + public PropertySystemImage Image + { + get + { + if (internalPropertySystemImage == null) + { + internalPropertySystemImage = new PropertySystemImage(shellObjectParent); + } + + return internalPropertySystemImage; + } + } + private PropertySystemJournal internalPropertySystemJournal; + /// + /// System.Journal Properties + /// + public PropertySystemJournal Journal + { + get + { + if (internalPropertySystemJournal == null) + { + internalPropertySystemJournal = new PropertySystemJournal(shellObjectParent); + } + + return internalPropertySystemJournal; + } + } + private PropertySystemLayoutPattern internalPropertySystemLayoutPattern; + /// + /// System.LayoutPattern Properties + /// + public PropertySystemLayoutPattern LayoutPattern + { + get + { + if (internalPropertySystemLayoutPattern == null) + { + internalPropertySystemLayoutPattern = new PropertySystemLayoutPattern(shellObjectParent); + } + + return internalPropertySystemLayoutPattern; + } + } + private PropertySystemLink internalPropertySystemLink; + /// + /// System.Link Properties + /// + public PropertySystemLink Link + { + get + { + if (internalPropertySystemLink == null) + { + internalPropertySystemLink = new PropertySystemLink(shellObjectParent); + } + + return internalPropertySystemLink; + } + } + private PropertySystemMedia internalPropertySystemMedia; + /// + /// System.Media Properties + /// + public PropertySystemMedia Media + { + get + { + if (internalPropertySystemMedia == null) + { + internalPropertySystemMedia = new PropertySystemMedia(shellObjectParent); + } + + return internalPropertySystemMedia; + } + } + private PropertySystemMessage internalPropertySystemMessage; + /// + /// System.Message Properties + /// + public PropertySystemMessage Message + { + get + { + if (internalPropertySystemMessage == null) + { + internalPropertySystemMessage = new PropertySystemMessage(shellObjectParent); + } + + return internalPropertySystemMessage; + } + } + private PropertySystemMusic internalPropertySystemMusic; + /// + /// System.Music Properties + /// + public PropertySystemMusic Music + { + get + { + if (internalPropertySystemMusic == null) + { + internalPropertySystemMusic = new PropertySystemMusic(shellObjectParent); + } + + return internalPropertySystemMusic; + } + } + private PropertySystemNote internalPropertySystemNote; + /// + /// System.Note Properties + /// + public PropertySystemNote Note + { + get + { + if (internalPropertySystemNote == null) + { + internalPropertySystemNote = new PropertySystemNote(shellObjectParent); + } + + return internalPropertySystemNote; + } + } + private PropertySystemPhoto internalPropertySystemPhoto; + /// + /// System.Photo Properties + /// + public PropertySystemPhoto Photo + { + get + { + if (internalPropertySystemPhoto == null) + { + internalPropertySystemPhoto = new PropertySystemPhoto(shellObjectParent); + } + + return internalPropertySystemPhoto; + } + } + private PropertySystemPropGroup internalPropertySystemPropGroup; + /// + /// System.PropGroup Properties + /// + public PropertySystemPropGroup PropGroup + { + get + { + if (internalPropertySystemPropGroup == null) + { + internalPropertySystemPropGroup = new PropertySystemPropGroup(shellObjectParent); + } + + return internalPropertySystemPropGroup; + } + } + private PropertySystemPropList internalPropertySystemPropList; + /// + /// System.PropList Properties + /// + public PropertySystemPropList PropList + { + get + { + if (internalPropertySystemPropList == null) + { + internalPropertySystemPropList = new PropertySystemPropList(shellObjectParent); + } + + return internalPropertySystemPropList; + } + } + private PropertySystemRecordedTV internalPropertySystemRecordedTV; + /// + /// System.RecordedTV Properties + /// + public PropertySystemRecordedTV RecordedTV + { + get + { + if (internalPropertySystemRecordedTV == null) + { + internalPropertySystemRecordedTV = new PropertySystemRecordedTV(shellObjectParent); + } + + return internalPropertySystemRecordedTV; + } + } + private PropertySystemSearch internalPropertySystemSearch; + /// + /// System.Search Properties + /// + public PropertySystemSearch Search + { + get + { + if (internalPropertySystemSearch == null) + { + internalPropertySystemSearch = new PropertySystemSearch(shellObjectParent); + } + + return internalPropertySystemSearch; + } + } + private PropertySystemShell internalPropertySystemShell; + /// + /// System.Shell Properties + /// + public PropertySystemShell Shell + { + get + { + if (internalPropertySystemShell == null) + { + internalPropertySystemShell = new PropertySystemShell(shellObjectParent); + } + + return internalPropertySystemShell; + } + } + private PropertySystemSoftware internalPropertySystemSoftware; + /// + /// System.Software Properties + /// + public PropertySystemSoftware Software + { + get + { + if (internalPropertySystemSoftware == null) + { + internalPropertySystemSoftware = new PropertySystemSoftware(shellObjectParent); + } + + return internalPropertySystemSoftware; + } + } + private PropertySystemSync internalPropertySystemSync; + /// + /// System.Sync Properties + /// + public PropertySystemSync Sync + { + get + { + if (internalPropertySystemSync == null) + { + internalPropertySystemSync = new PropertySystemSync(shellObjectParent); + } + + return internalPropertySystemSync; + } + } + private PropertySystemTask internalPropertySystemTask; + /// + /// System.Task Properties + /// + public PropertySystemTask Task + { + get + { + if (internalPropertySystemTask == null) + { + internalPropertySystemTask = new PropertySystemTask(shellObjectParent); + } + + return internalPropertySystemTask; + } + } + private PropertySystemVideo internalPropertySystemVideo; + /// + /// System.Video Properties + /// + public PropertySystemVideo Video + { + get + { + if (internalPropertySystemVideo == null) + { + internalPropertySystemVideo = new PropertySystemVideo(shellObjectParent); + } + + return internalPropertySystemVideo; + } + } + private PropertySystemVolume internalPropertySystemVolume; + /// + /// System.Volume Properties + /// + public PropertySystemVolume Volume + { + get + { + if (internalPropertySystemVolume == null) + { + internalPropertySystemVolume = new PropertySystemVolume(shellObjectParent); + } + + return internalPropertySystemVolume; + } + } + #endregion + } + + /// + /// System.AppUserModel Properties + /// + public class PropertySystemAppUserModel : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemAppUserModel(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.AppUserModel.ExcludeFromShowInNewInstall -- PKEY_AppUserModel_ExcludeFromShowInNewInstall + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 8 + /// + public ShellProperty ExcludeFromShowInNewInstall + { + get + { + PropertyKey key = SystemProperties.System.AppUserModel.ExcludeFromShowInNewInstall; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.AppUserModel.ID -- PKEY_AppUserModel_ID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 5 + /// + public ShellProperty ID + { + get + { + PropertyKey key = SystemProperties.System.AppUserModel.ID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.AppUserModel.IsDestListSeparator -- PKEY_AppUserModel_IsDestListSeparator + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 6 + /// + public ShellProperty IsDestinationListSeparator + { + get + { + PropertyKey key = SystemProperties.System.AppUserModel.IsDestinationListSeparator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.AppUserModel.PreventPinning -- PKEY_AppUserModel_PreventPinning + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 9 + /// + public ShellProperty PreventPinning + { + get + { + PropertyKey key = SystemProperties.System.AppUserModel.PreventPinning; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.AppUserModel.RelaunchCommand -- PKEY_AppUserModel_RelaunchCommand + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 2 + /// + public ShellProperty RelaunchCommand + { + get + { + PropertyKey key = SystemProperties.System.AppUserModel.RelaunchCommand; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.AppUserModel.RelaunchDisplayNameResource -- PKEY_AppUserModel_RelaunchDisplayNameResource + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 4 + /// + public ShellProperty RelaunchDisplayNameResource + { + get + { + PropertyKey key = SystemProperties.System.AppUserModel.RelaunchDisplayNameResource; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.AppUserModel.RelaunchIconResource -- PKEY_AppUserModel_RelaunchIconResource + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 3 + /// + public ShellProperty RelaunchIconResource + { + get + { + PropertyKey key = SystemProperties.System.AppUserModel.RelaunchIconResource; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Audio Properties + /// + public class PropertySystemAudio : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemAudio(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Audio.ChannelCount -- PKEY_Audio_ChannelCount + /// Description: Indicates the channel count for the audio file. Values: 1 (mono), 2 (stereo). + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 7 (PIDASI_CHANNEL_COUNT) + /// + public ShellProperty ChannelCount + { + get + { + PropertyKey key = SystemProperties.System.Audio.ChannelCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.Compression -- PKEY_Audio_Compression + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 10 (PIDASI_COMPRESSION) + /// + public ShellProperty Compression + { + get + { + PropertyKey key = SystemProperties.System.Audio.Compression; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.EncodingBitrate -- PKEY_Audio_EncodingBitrate + /// Description: Indicates the average data rate in Hz for the audio file in "bits per second". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 4 (PIDASI_AVG_DATA_RATE) + /// + public ShellProperty EncodingBitrate + { + get + { + PropertyKey key = SystemProperties.System.Audio.EncodingBitrate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.Format -- PKEY_Audio_Format + /// Description: Indicates the format of the audio file. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_BSTR. + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 2 (PIDASI_FORMAT) + /// + public ShellProperty Format + { + get + { + PropertyKey key = SystemProperties.System.Audio.Format; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.IsVariableBitRate -- PKEY_Audio_IsVariableBitRate + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {E6822FEE-8C17-4D62-823C-8E9CFCBD1D5C}, 100 + /// + public ShellProperty IsVariableBitrate + { + get + { + PropertyKey key = SystemProperties.System.Audio.IsVariableBitrate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.PeakValue -- PKEY_Audio_PeakValue + /// Description: + /// Type: UInt32 -- VT_UI4 + /// FormatID: {2579E5D0-1116-4084-BD9A-9B4F7CB4DF5E}, 100 + /// + public ShellProperty PeakValue + { + get + { + PropertyKey key = SystemProperties.System.Audio.PeakValue; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.SampleRate -- PKEY_Audio_SampleRate + /// Description: Indicates the audio sample rate for the audio file in "samples per second". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 5 (PIDASI_SAMPLE_RATE) + /// + public ShellProperty SampleRate + { + get + { + PropertyKey key = SystemProperties.System.Audio.SampleRate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.SampleSize -- PKEY_Audio_SampleSize + /// Description: Indicates the audio sample size for the audio file in "bits per sample". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 6 (PIDASI_SAMPLE_SIZE) + /// + public ShellProperty SampleSize + { + get + { + PropertyKey key = SystemProperties.System.Audio.SampleSize; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.StreamName -- PKEY_Audio_StreamName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 9 (PIDASI_STREAM_NAME) + /// + public ShellProperty StreamName + { + get + { + PropertyKey key = SystemProperties.System.Audio.StreamName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Audio.StreamNumber -- PKEY_Audio_StreamNumber + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 8 (PIDASI_STREAM_NUMBER) + /// + public ShellProperty StreamNumber + { + get + { + PropertyKey key = SystemProperties.System.Audio.StreamNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Calendar Properties + /// + public class PropertySystemCalendar : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemCalendar(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Calendar.Duration -- PKEY_Calendar_Duration + /// Description: The duration as specified in a string. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {293CA35A-09AA-4DD2-B180-1FE245728A52}, 100 + /// + public ShellProperty Duration + { + get + { + PropertyKey key = SystemProperties.System.Calendar.Duration; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.IsOnline -- PKEY_Calendar_IsOnline + /// Description: Identifies if the event is an online event. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {BFEE9149-E3E2-49A7-A862-C05988145CEC}, 100 + /// + public ShellProperty IsOnline + { + get + { + PropertyKey key = SystemProperties.System.Calendar.IsOnline; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.IsRecurring -- PKEY_Calendar_IsRecurring + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {315B9C8D-80A9-4EF9-AE16-8E746DA51D70}, 100 + /// + public ShellProperty IsRecurring + { + get + { + PropertyKey key = SystemProperties.System.Calendar.IsRecurring; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.Location -- PKEY_Calendar_Location + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F6272D18-CECC-40B1-B26A-3911717AA7BD}, 100 + /// + public ShellProperty Location + { + get + { + PropertyKey key = SystemProperties.System.Calendar.Location; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.OptionalAttendeeAddresses -- PKEY_Calendar_OptionalAttendeeAddresses + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D55BAE5A-3892-417A-A649-C6AC5AAAEAB3}, 100 + /// + public ShellProperty OptionalAttendeeAddresses + { + get + { + PropertyKey key = SystemProperties.System.Calendar.OptionalAttendeeAddresses; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.OptionalAttendeeNames -- PKEY_Calendar_OptionalAttendeeNames + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {09429607-582D-437F-84C3-DE93A2B24C3C}, 100 + /// + public ShellProperty OptionalAttendeeNames + { + get + { + PropertyKey key = SystemProperties.System.Calendar.OptionalAttendeeNames; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.OrganizerAddress -- PKEY_Calendar_OrganizerAddress + /// Description: Address of the organizer organizing the event. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {744C8242-4DF5-456C-AB9E-014EFB9021E3}, 100 + /// + public ShellProperty OrganizerAddress + { + get + { + PropertyKey key = SystemProperties.System.Calendar.OrganizerAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.OrganizerName -- PKEY_Calendar_OrganizerName + /// Description: Name of the organizer organizing the event. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {AAA660F9-9865-458E-B484-01BC7FE3973E}, 100 + /// + public ShellProperty OrganizerName + { + get + { + PropertyKey key = SystemProperties.System.Calendar.OrganizerName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.ReminderTime -- PKEY_Calendar_ReminderTime + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {72FC5BA4-24F9-4011-9F3F-ADD27AFAD818}, 100 + /// + public ShellProperty ReminderTime + { + get + { + PropertyKey key = SystemProperties.System.Calendar.ReminderTime; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.RequiredAttendeeAddresses -- PKEY_Calendar_RequiredAttendeeAddresses + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {0BA7D6C3-568D-4159-AB91-781A91FB71E5}, 100 + /// + public ShellProperty RequiredAttendeeAddresses + { + get + { + PropertyKey key = SystemProperties.System.Calendar.RequiredAttendeeAddresses; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.RequiredAttendeeNames -- PKEY_Calendar_RequiredAttendeeNames + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {B33AF30B-F552-4584-936C-CB93E5CDA29F}, 100 + /// + public ShellProperty RequiredAttendeeNames + { + get + { + PropertyKey key = SystemProperties.System.Calendar.RequiredAttendeeNames; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.Resources -- PKEY_Calendar_Resources + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {00F58A38-C54B-4C40-8696-97235980EAE1}, 100 + /// + public ShellProperty Resources + { + get + { + PropertyKey key = SystemProperties.System.Calendar.Resources; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.ResponseStatus -- PKEY_Calendar_ResponseStatus + /// Description: This property stores the status of the user responses to meetings in her calendar. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {188C1F91-3C40-4132-9EC5-D8B03B72A8A2}, 100 + /// + public ShellProperty ResponseStatus + { + get + { + PropertyKey key = SystemProperties.System.Calendar.ResponseStatus; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.ShowTimeAs -- PKEY_Calendar_ShowTimeAs + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {5BF396D4-5EB2-466F-BDE9-2FB3F2361D6E}, 100 + /// + public ShellProperty ShowTimeAs + { + get + { + PropertyKey key = SystemProperties.System.Calendar.ShowTimeAs; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Calendar.ShowTimeAsText -- PKEY_Calendar_ShowTimeAsText + /// Description: This is the user-friendly form of System.Calendar.ShowTimeAs. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {53DA57CF-62C0-45C4-81DE-7610BCEFD7F5}, 100 + /// + public ShellProperty ShowTimeAsText + { + get + { + PropertyKey key = SystemProperties.System.Calendar.ShowTimeAsText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + } + + /// + /// System.Communication Properties + /// + public class PropertySystemCommunication : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemCommunication(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Communication.AccountName -- PKEY_Communication_AccountName + /// Description: Account Name + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 9 + /// + public ShellProperty AccountName + { + get + { + PropertyKey key = SystemProperties.System.Communication.AccountName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Communication.DateItemExpires -- PKEY_Communication_DateItemExpires + /// Description: Date the item expires due to the retention policy. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {428040AC-A177-4C8A-9760-F6F761227F9A}, 100 + /// + public ShellProperty DateItemExpires + { + get + { + PropertyKey key = SystemProperties.System.Communication.DateItemExpires; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Communication.FollowupIconIndex -- PKEY_Communication_FollowupIconIndex + /// Description: This is the icon index used on messages marked for followup. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {83A6347E-6FE4-4F40-BA9C-C4865240D1F4}, 100 + /// + public ShellProperty FollowUpIconIndex + { + get + { + PropertyKey key = SystemProperties.System.Communication.FollowUpIconIndex; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Communication.HeaderItem -- PKEY_Communication_HeaderItem + /// Description: This property will be true if the item is a header item which means the item hasn't been fully downloaded. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {C9C34F84-2241-4401-B607-BD20ED75AE7F}, 100 + /// + public ShellProperty HeaderItem + { + get + { + PropertyKey key = SystemProperties.System.Communication.HeaderItem; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Communication.PolicyTag -- PKEY_Communication_PolicyTag + /// Description: This a string used to identify the retention policy applied to the item. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {EC0B4191-AB0B-4C66-90B6-C6637CDEBBAB}, 100 + /// + public ShellProperty PolicyTag + { + get + { + PropertyKey key = SystemProperties.System.Communication.PolicyTag; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Communication.SecurityFlags -- PKEY_Communication_SecurityFlags + /// Description: Security flags associated with the item to know if the item is encrypted, signed or DRM enabled. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {8619A4B6-9F4D-4429-8C0F-B996CA59E335}, 100 + /// + public ShellProperty SecurityFlags + { + get + { + PropertyKey key = SystemProperties.System.Communication.SecurityFlags; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Communication.Suffix -- PKEY_Communication_Suffix + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {807B653A-9E91-43EF-8F97-11CE04EE20C5}, 100 + /// + public ShellProperty Suffix + { + get + { + PropertyKey key = SystemProperties.System.Communication.Suffix; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Communication.TaskStatus -- PKEY_Communication_TaskStatus + /// Description: + /// Type: UInt16 -- VT_UI2 + /// FormatID: {BE1A72C6-9A1D-46B7-AFE7-AFAF8CEF4999}, 100 + /// + public ShellProperty TaskStatus + { + get + { + PropertyKey key = SystemProperties.System.Communication.TaskStatus; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Communication.TaskStatusText -- PKEY_Communication_TaskStatusText + /// Description: This is the user-friendly form of System.Communication.TaskStatus. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A6744477-C237-475B-A075-54F34498292A}, 100 + /// + public ShellProperty TaskStatusText + { + get + { + PropertyKey key = SystemProperties.System.Communication.TaskStatusText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Computer Properties + /// + public class PropertySystemComputer : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemComputer(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Computer.DecoratedFreeSpace -- PKEY_Computer_DecoratedFreeSpace + /// Description: Free space and total space: "%s free of %s" + /// + /// Type: Multivalue UInt64 -- VT_VECTOR | VT_UI8 (For variants: VT_ARRAY | VT_UI8) + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 7 (Filesystem Volume Properties) + /// + public ShellProperty DecoratedFreeSpace + { + get + { + PropertyKey key = SystemProperties.System.Computer.DecoratedFreeSpace; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Contact Properties + /// + public class PropertySystemContact : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemContact(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Contact.Anniversary -- PKEY_Contact_Anniversary + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {9AD5BADB-CEA7-4470-A03D-B84E51B9949E}, 100 + /// + public ShellProperty Anniversary + { + get + { + PropertyKey key = SystemProperties.System.Contact.Anniversary; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.AssistantName -- PKEY_Contact_AssistantName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CD102C9C-5540-4A88-A6F6-64E4981C8CD1}, 100 + /// + public ShellProperty AssistantName + { + get + { + PropertyKey key = SystemProperties.System.Contact.AssistantName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.AssistantTelephone -- PKEY_Contact_AssistantTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9A93244D-A7AD-4FF8-9B99-45EE4CC09AF6}, 100 + /// + public ShellProperty AssistantTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.AssistantTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Birthday -- PKEY_Contact_Birthday + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 47 + /// + public ShellProperty Birthday + { + get + { + PropertyKey key = SystemProperties.System.Contact.Birthday; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessAddress -- PKEY_Contact_BusinessAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {730FB6DD-CF7C-426B-A03F-BD166CC9EE24}, 100 + /// + public ShellProperty BusinessAddress + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessAddressCity -- PKEY_Contact_BusinessAddressCity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {402B5934-EC5A-48C3-93E6-85E86A2D934E}, 100 + /// + public ShellProperty BusinessAddressCity + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessAddressCity; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessAddressCountry -- PKEY_Contact_BusinessAddressCountry + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {B0B87314-FCF6-4FEB-8DFF-A50DA6AF561C}, 100 + /// + public ShellProperty BusinessAddressCountry + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessAddressCountry; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessAddressPostalCode -- PKEY_Contact_BusinessAddressPostalCode + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E1D4A09E-D758-4CD1-B6EC-34A8B5A73F80}, 100 + /// + public ShellProperty BusinessAddressPostalCode + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessAddressPostalCode; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessAddressPostOfficeBox -- PKEY_Contact_BusinessAddressPostOfficeBox + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {BC4E71CE-17F9-48D5-BEE9-021DF0EA5409}, 100 + /// + public ShellProperty BusinessAddressPostOfficeBox + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessAddressPostOfficeBox; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessAddressState -- PKEY_Contact_BusinessAddressState + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {446F787F-10C4-41CB-A6C4-4D0343551597}, 100 + /// + public ShellProperty BusinessAddressState + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessAddressState; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessAddressStreet -- PKEY_Contact_BusinessAddressStreet + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DDD1460F-C0BF-4553-8CE4-10433C908FB0}, 100 + /// + public ShellProperty BusinessAddressStreet + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessAddressStreet; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessFaxNumber -- PKEY_Contact_BusinessFaxNumber + /// Description: Business fax number of the contact. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {91EFF6F3-2E27-42CA-933E-7C999FBE310B}, 100 + /// + public ShellProperty BusinessFaxNumber + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessFaxNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessHomePage -- PKEY_Contact_BusinessHomePage + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {56310920-2491-4919-99CE-EADB06FAFDB2}, 100 + /// + public ShellProperty BusinessHomepage + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessHomepage; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.BusinessTelephone -- PKEY_Contact_BusinessTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6A15E5A0-0A1E-4CD7-BB8C-D2F1B0C929BC}, 100 + /// + public ShellProperty BusinessTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.BusinessTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.CallbackTelephone -- PKEY_Contact_CallbackTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {BF53D1C3-49E0-4F7F-8567-5A821D8AC542}, 100 + /// + public ShellProperty CallbackTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.CallbackTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.CarTelephone -- PKEY_Contact_CarTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8FDC6DEA-B929-412B-BA90-397A257465FE}, 100 + /// + public ShellProperty CarTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.CarTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Children -- PKEY_Contact_Children + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D4729704-8EF1-43EF-9024-2BD381187FD5}, 100 + /// + public ShellProperty Children + { + get + { + PropertyKey key = SystemProperties.System.Contact.Children; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.CompanyMainTelephone -- PKEY_Contact_CompanyMainTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8589E481-6040-473D-B171-7FA89C2708ED}, 100 + /// + public ShellProperty CompanyMainTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.CompanyMainTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Department -- PKEY_Contact_Department + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FC9F7306-FF8F-4D49-9FB6-3FFE5C0951EC}, 100 + /// + public ShellProperty Department + { + get + { + PropertyKey key = SystemProperties.System.Contact.Department; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.EmailAddress -- PKEY_Contact_EmailAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F8FA7FA3-D12B-4785-8A4E-691A94F7A3E7}, 100 + /// + public ShellProperty EmailAddress + { + get + { + PropertyKey key = SystemProperties.System.Contact.EmailAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.EmailAddress2 -- PKEY_Contact_EmailAddress2 + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {38965063-EDC8-4268-8491-B7723172CF29}, 100 + /// + public ShellProperty EmailAddress2 + { + get + { + PropertyKey key = SystemProperties.System.Contact.EmailAddress2; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.EmailAddress3 -- PKEY_Contact_EmailAddress3 + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {644D37B4-E1B3-4BAD-B099-7E7C04966ACA}, 100 + /// + public ShellProperty EmailAddress3 + { + get + { + PropertyKey key = SystemProperties.System.Contact.EmailAddress3; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.EmailAddresses -- PKEY_Contact_EmailAddresses + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {84D8F337-981D-44B3-9615-C7596DBA17E3}, 100 + /// + public ShellProperty EmailAddresses + { + get + { + PropertyKey key = SystemProperties.System.Contact.EmailAddresses; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.EmailName -- PKEY_Contact_EmailName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CC6F4F24-6083-4BD4-8754-674D0DE87AB8}, 100 + /// + public ShellProperty EmailName + { + get + { + PropertyKey key = SystemProperties.System.Contact.EmailName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.FileAsName -- PKEY_Contact_FileAsName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F1A24AA7-9CA7-40F6-89EC-97DEF9FFE8DB}, 100 + /// + public ShellProperty FileAsName + { + get + { + PropertyKey key = SystemProperties.System.Contact.FileAsName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.FirstName -- PKEY_Contact_FirstName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {14977844-6B49-4AAD-A714-A4513BF60460}, 100 + /// + public ShellProperty FirstName + { + get + { + PropertyKey key = SystemProperties.System.Contact.FirstName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.FullName -- PKEY_Contact_FullName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {635E9051-50A5-4BA2-B9DB-4ED056C77296}, 100 + /// + public ShellProperty FullName + { + get + { + PropertyKey key = SystemProperties.System.Contact.FullName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Gender -- PKEY_Contact_Gender + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}, 100 + /// + public ShellProperty Gender + { + get + { + PropertyKey key = SystemProperties.System.Contact.Gender; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.GenderValue -- PKEY_Contact_GenderValue + /// Description: + /// Type: UInt16 -- VT_UI2 + /// FormatID: {3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}, 101 + /// + public ShellProperty GenderValue + { + get + { + PropertyKey key = SystemProperties.System.Contact.GenderValue; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Hobbies -- PKEY_Contact_Hobbies + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {5DC2253F-5E11-4ADF-9CFE-910DD01E3E70}, 100 + /// + public ShellProperty Hobbies + { + get + { + PropertyKey key = SystemProperties.System.Contact.Hobbies; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeAddress -- PKEY_Contact_HomeAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {98F98354-617A-46B8-8560-5B1B64BF1F89}, 100 + /// + public ShellProperty HomeAddress + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeAddressCity -- PKEY_Contact_HomeAddressCity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 65 + /// + public ShellProperty HomeAddressCity + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeAddressCity; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeAddressCountry -- PKEY_Contact_HomeAddressCountry + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {08A65AA1-F4C9-43DD-9DDF-A33D8E7EAD85}, 100 + /// + public ShellProperty HomeAddressCountry + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeAddressCountry; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeAddressPostalCode -- PKEY_Contact_HomeAddressPostalCode + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8AFCC170-8A46-4B53-9EEE-90BAE7151E62}, 100 + /// + public ShellProperty HomeAddressPostalCode + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeAddressPostalCode; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeAddressPostOfficeBox -- PKEY_Contact_HomeAddressPostOfficeBox + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7B9F6399-0A3F-4B12-89BD-4ADC51C918AF}, 100 + /// + public ShellProperty HomeAddressPostOfficeBox + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeAddressPostOfficeBox; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeAddressState -- PKEY_Contact_HomeAddressState + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C89A23D0-7D6D-4EB8-87D4-776A82D493E5}, 100 + /// + public ShellProperty HomeAddressState + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeAddressState; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeAddressStreet -- PKEY_Contact_HomeAddressStreet + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0ADEF160-DB3F-4308-9A21-06237B16FA2A}, 100 + /// + public ShellProperty HomeAddressStreet + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeAddressStreet; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeFaxNumber -- PKEY_Contact_HomeFaxNumber + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {660E04D6-81AB-4977-A09F-82313113AB26}, 100 + /// + public ShellProperty HomeFaxNumber + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeFaxNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.HomeTelephone -- PKEY_Contact_HomeTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 20 + /// + public ShellProperty HomeTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.HomeTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.IMAddress -- PKEY_Contact_IMAddress + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D68DBD8A-3374-4B81-9972-3EC30682DB3D}, 100 + /// + public ShellProperty IMAddress + { + get + { + PropertyKey key = SystemProperties.System.Contact.IMAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Initials -- PKEY_Contact_Initials + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F3D8F40D-50CB-44A2-9718-40CB9119495D}, 100 + /// + public ShellProperty Initials + { + get + { + PropertyKey key = SystemProperties.System.Contact.Initials; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.JobTitle -- PKEY_Contact_JobTitle + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 6 + /// + public ShellProperty JobTitle + { + get + { + PropertyKey key = SystemProperties.System.Contact.JobTitle; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Label -- PKEY_Contact_Label + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {97B0AD89-DF49-49CC-834E-660974FD755B}, 100 + /// + public ShellProperty Label + { + get + { + PropertyKey key = SystemProperties.System.Contact.Label; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.LastName -- PKEY_Contact_LastName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8F367200-C270-457C-B1D4-E07C5BCD90C7}, 100 + /// + public ShellProperty LastName + { + get + { + PropertyKey key = SystemProperties.System.Contact.LastName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.MailingAddress -- PKEY_Contact_MailingAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C0AC206A-827E-4650-95AE-77E2BB74FCC9}, 100 + /// + public ShellProperty MailingAddress + { + get + { + PropertyKey key = SystemProperties.System.Contact.MailingAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.MiddleName -- PKEY_Contact_MiddleName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 71 + /// + public ShellProperty MiddleName + { + get + { + PropertyKey key = SystemProperties.System.Contact.MiddleName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.MobileTelephone -- PKEY_Contact_MobileTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 35 + /// + public ShellProperty MobileTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.MobileTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.NickName -- PKEY_Contact_NickName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 74 + /// + public ShellProperty Nickname + { + get + { + PropertyKey key = SystemProperties.System.Contact.Nickname; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.OfficeLocation -- PKEY_Contact_OfficeLocation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 7 + /// + public ShellProperty OfficeLocation + { + get + { + PropertyKey key = SystemProperties.System.Contact.OfficeLocation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.OtherAddress -- PKEY_Contact_OtherAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {508161FA-313B-43D5-83A1-C1ACCF68622C}, 100 + /// + public ShellProperty OtherAddress + { + get + { + PropertyKey key = SystemProperties.System.Contact.OtherAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.OtherAddressCity -- PKEY_Contact_OtherAddressCity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6E682923-7F7B-4F0C-A337-CFCA296687BF}, 100 + /// + public ShellProperty OtherAddressCity + { + get + { + PropertyKey key = SystemProperties.System.Contact.OtherAddressCity; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.OtherAddressCountry -- PKEY_Contact_OtherAddressCountry + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8F167568-0AAE-4322-8ED9-6055B7B0E398}, 100 + /// + public ShellProperty OtherAddressCountry + { + get + { + PropertyKey key = SystemProperties.System.Contact.OtherAddressCountry; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.OtherAddressPostalCode -- PKEY_Contact_OtherAddressPostalCode + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {95C656C1-2ABF-4148-9ED3-9EC602E3B7CD}, 100 + /// + public ShellProperty OtherAddressPostalCode + { + get + { + PropertyKey key = SystemProperties.System.Contact.OtherAddressPostalCode; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.OtherAddressPostOfficeBox -- PKEY_Contact_OtherAddressPostOfficeBox + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8B26EA41-058F-43F6-AECC-4035681CE977}, 100 + /// + public ShellProperty OtherAddressPostOfficeBox + { + get + { + PropertyKey key = SystemProperties.System.Contact.OtherAddressPostOfficeBox; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.OtherAddressState -- PKEY_Contact_OtherAddressState + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {71B377D6-E570-425F-A170-809FAE73E54E}, 100 + /// + public ShellProperty OtherAddressState + { + get + { + PropertyKey key = SystemProperties.System.Contact.OtherAddressState; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.OtherAddressStreet -- PKEY_Contact_OtherAddressStreet + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FF962609-B7D6-4999-862D-95180D529AEA}, 100 + /// + public ShellProperty OtherAddressStreet + { + get + { + PropertyKey key = SystemProperties.System.Contact.OtherAddressStreet; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PagerTelephone -- PKEY_Contact_PagerTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D6304E01-F8F5-4F45-8B15-D024A6296789}, 100 + /// + public ShellProperty PagerTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.PagerTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PersonalTitle -- PKEY_Contact_PersonalTitle + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 69 + /// + public ShellProperty PersonalTitle + { + get + { + PropertyKey key = SystemProperties.System.Contact.PersonalTitle; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PrimaryAddressCity -- PKEY_Contact_PrimaryAddressCity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C8EA94F0-A9E3-4969-A94B-9C62A95324E0}, 100 + /// + public ShellProperty PrimaryAddressCity + { + get + { + PropertyKey key = SystemProperties.System.Contact.PrimaryAddressCity; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PrimaryAddressCountry -- PKEY_Contact_PrimaryAddressCountry + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E53D799D-0F3F-466E-B2FF-74634A3CB7A4}, 100 + /// + public ShellProperty PrimaryAddressCountry + { + get + { + PropertyKey key = SystemProperties.System.Contact.PrimaryAddressCountry; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PrimaryAddressPostalCode -- PKEY_Contact_PrimaryAddressPostalCode + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {18BBD425-ECFD-46EF-B612-7B4A6034EDA0}, 100 + /// + public ShellProperty PrimaryAddressPostalCode + { + get + { + PropertyKey key = SystemProperties.System.Contact.PrimaryAddressPostalCode; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PrimaryAddressPostOfficeBox -- PKEY_Contact_PrimaryAddressPostOfficeBox + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DE5EF3C7-46E1-484E-9999-62C5308394C1}, 100 + /// + public ShellProperty PrimaryAddressPostOfficeBox + { + get + { + PropertyKey key = SystemProperties.System.Contact.PrimaryAddressPostOfficeBox; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PrimaryAddressState -- PKEY_Contact_PrimaryAddressState + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F1176DFE-7138-4640-8B4C-AE375DC70A6D}, 100 + /// + public ShellProperty PrimaryAddressState + { + get + { + PropertyKey key = SystemProperties.System.Contact.PrimaryAddressState; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PrimaryAddressStreet -- PKEY_Contact_PrimaryAddressStreet + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {63C25B20-96BE-488F-8788-C09C407AD812}, 100 + /// + public ShellProperty PrimaryAddressStreet + { + get + { + PropertyKey key = SystemProperties.System.Contact.PrimaryAddressStreet; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PrimaryEmailAddress -- PKEY_Contact_PrimaryEmailAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 48 + /// + public ShellProperty PrimaryEmailAddress + { + get + { + PropertyKey key = SystemProperties.System.Contact.PrimaryEmailAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.PrimaryTelephone -- PKEY_Contact_PrimaryTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 25 + /// + public ShellProperty PrimaryTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.PrimaryTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Profession -- PKEY_Contact_Profession + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7268AF55-1CE4-4F6E-A41F-B6E4EF10E4A9}, 100 + /// + public ShellProperty Profession + { + get + { + PropertyKey key = SystemProperties.System.Contact.Profession; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.SpouseName -- PKEY_Contact_SpouseName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9D2408B6-3167-422B-82B0-F583B7A7CFE3}, 100 + /// + public ShellProperty SpouseName + { + get + { + PropertyKey key = SystemProperties.System.Contact.SpouseName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.Suffix -- PKEY_Contact_Suffix + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 73 + /// + public ShellProperty Suffix + { + get + { + PropertyKey key = SystemProperties.System.Contact.Suffix; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.TelexNumber -- PKEY_Contact_TelexNumber + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C554493C-C1F7-40C1-A76C-EF8C0614003E}, 100 + /// + public ShellProperty TelexNumber + { + get + { + PropertyKey key = SystemProperties.System.Contact.TelexNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.TTYTDDTelephone -- PKEY_Contact_TTYTDDTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {AAF16BAC-2B55-45E6-9F6D-415EB94910DF}, 100 + /// + public ShellProperty TTYTDDTelephone + { + get + { + PropertyKey key = SystemProperties.System.Contact.TTYTDDTelephone; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.WebPage -- PKEY_Contact_WebPage + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 18 + /// + public ShellProperty Webpage + { + get + { + PropertyKey key = SystemProperties.System.Contact.Webpage; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + private PropertyContactJA internalPropertyContactJA; + /// + /// Contact.JA Properties + /// + public PropertyContactJA JA + { + get + { + if (internalPropertyContactJA == null) + { + internalPropertyContactJA = new PropertyContactJA(shellObjectParent); + } + + return internalPropertyContactJA; + } + } + #endregion + } + + /// + /// Contact.JA Properties + /// + public class PropertyContactJA : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertyContactJA(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Contact.JA.CompanyNamePhonetic -- PKEY_Contact_JA_CompanyNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 2 + /// + public ShellProperty CompanyNamePhonetic + { + get + { + PropertyKey key = SystemProperties.System.Contact.JA.CompanyNamePhonetic; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.JA.FirstNamePhonetic -- PKEY_Contact_JA_FirstNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 3 + /// + public ShellProperty FirstNamePhonetic + { + get + { + PropertyKey key = SystemProperties.System.Contact.JA.FirstNamePhonetic; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Contact.JA.LastNamePhonetic -- PKEY_Contact_JA_LastNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 4 + /// + public ShellProperty LastNamePhonetic + { + get + { + PropertyKey key = SystemProperties.System.Contact.JA.LastNamePhonetic; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Device Properties + /// + public class PropertySystemDevice : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemDevice(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Device.PrinterURL -- PKEY_Device_PrinterURL + /// Description: Printer information Printer URL. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0B48F35A-BE6E-4F17-B108-3C4073D1669A}, 15 + /// + public ShellProperty PrinterUrl + { + get + { + PropertyKey key = SystemProperties.System.Device.PrinterUrl; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.DeviceInterface Properties + /// + public class PropertySystemDeviceInterface : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemDeviceInterface(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.DeviceInterface.PrinterDriverDirectory -- PKEY_DeviceInterface_PrinterDriverDirectory + /// Description: Printer information Printer Driver Directory. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {847C66DE-B8D6-4AF9-ABC3-6F4F926BC039}, 14 + /// + public ShellProperty PrinterDriverDirectory + { + get + { + PropertyKey key = SystemProperties.System.DeviceInterface.PrinterDriverDirectory; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DeviceInterface.PrinterDriverName -- PKEY_DeviceInterface_PrinterDriverName + /// Description: Printer information Driver Name. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {AFC47170-14F5-498C-8F30-B0D19BE449C6}, 11 + /// + public ShellProperty PrinterDriverName + { + get + { + PropertyKey key = SystemProperties.System.DeviceInterface.PrinterDriverName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DeviceInterface.PrinterName -- PKEY_DeviceInterface_PrinterName + /// Description: Printer information Printer Name. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0A7B84EF-0C27-463F-84EF-06C5070001BE}, 10 + /// + public ShellProperty PrinterName + { + get + { + PropertyKey key = SystemProperties.System.DeviceInterface.PrinterName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DeviceInterface.PrinterPortName -- PKEY_DeviceInterface_PrinterPortName + /// Description: Printer information Port Name. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {EEC7B761-6F94-41B1-949F-C729720DD13C}, 12 + /// + public ShellProperty PrinterPortName + { + get + { + PropertyKey key = SystemProperties.System.DeviceInterface.PrinterPortName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Devices Properties + /// + public class PropertySystemDevices : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemDevices(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Devices.BatteryLife -- PKEY_Devices_BatteryLife + /// Description: Remaining battery life of the device as an integer between 0 and 100 percent. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 10 + /// + public ShellProperty BatteryLife + { + get + { + PropertyKey key = SystemProperties.System.Devices.BatteryLife; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.BatteryPlusCharging -- PKEY_Devices_BatteryPlusCharging + /// Description: Remaining battery life of the device as an integer between 0 and 100 percent and the device's charging state. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 22 + /// + public ShellProperty BatteryPlusCharging + { + get + { + PropertyKey key = SystemProperties.System.Devices.BatteryPlusCharging; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.BatteryPlusChargingText -- PKEY_Devices_BatteryPlusChargingText + /// Description: Remaining battery life of the device and the device's charging state as a string. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 23 + /// + public ShellProperty BatteryPlusChargingText + { + get + { + PropertyKey key = SystemProperties.System.Devices.BatteryPlusChargingText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Category -- PKEY_Devices_Category_Desc_Singular + /// Description: Singular form of device category. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 91 + /// + public ShellProperty Category + { + get + { + PropertyKey key = SystemProperties.System.Devices.Category; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.CategoryGroup -- PKEY_Devices_CategoryGroup_Desc + /// Description: Plural form of device category. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 94 + /// + public ShellProperty CategoryGroup + { + get + { + PropertyKey key = SystemProperties.System.Devices.CategoryGroup; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.CategoryPlural -- PKEY_Devices_Category_Desc_Plural + /// Description: Plural form of device category. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 92 + /// + public ShellProperty CategoryPlural + { + get + { + PropertyKey key = SystemProperties.System.Devices.CategoryPlural; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.ChargingState -- PKEY_Devices_ChargingState + /// Description: Boolean value representing if the device is currently charging. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 11 + /// + public ShellProperty ChargingState + { + get + { + PropertyKey key = SystemProperties.System.Devices.ChargingState; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Connected -- PKEY_Devices_IsConnected + /// Description: Device connection state. If VARIANT_TRUE, indicates the device is currently connected to the computer. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 55 + /// + public ShellProperty Connected + { + get + { + PropertyKey key = SystemProperties.System.Devices.Connected; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.ContainerId -- PKEY_Devices_ContainerId + /// Description: Device container ID. + /// + /// Type: Guid -- VT_CLSID + /// FormatID: {8C7ED206-3F8A-4827-B3AB-AE9E1FAEFC6C}, 2 + /// + public ShellProperty ContainerId + { + get + { + PropertyKey key = SystemProperties.System.Devices.ContainerId; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.DefaultTooltip -- PKEY_Devices_DefaultTooltip + /// Description: Tooltip for default state + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 153 + /// + public ShellProperty DefaultTooltip + { + get + { + PropertyKey key = SystemProperties.System.Devices.DefaultTooltip; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.DeviceDescription1 -- PKEY_Devices_DeviceDescription1 + /// Description: First line of descriptive text about the device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 81 + /// + public ShellProperty DeviceDescription1 + { + get + { + PropertyKey key = SystemProperties.System.Devices.DeviceDescription1; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.DeviceDescription2 -- PKEY_Devices_DeviceDescription2 + /// Description: Second line of descriptive text about the device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 82 + /// + public ShellProperty DeviceDescription2 + { + get + { + PropertyKey key = SystemProperties.System.Devices.DeviceDescription2; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.DiscoveryMethod -- PKEY_Devices_DiscoveryMethod + /// Description: Device discovery method. This indicates on what transport or physical connection the device is discovered. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 52 + /// + public ShellProperty DiscoveryMethod + { + get + { + PropertyKey key = SystemProperties.System.Devices.DiscoveryMethod; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.FriendlyName -- PKEY_Devices_FriendlyName + /// Description: Device friendly name. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 12288 + /// + public ShellProperty FriendlyName + { + get + { + PropertyKey key = SystemProperties.System.Devices.FriendlyName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.FunctionPaths -- PKEY_Devices_FunctionPaths + /// Description: Available functions for this device. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 3 + /// + public ShellProperty FunctionPaths + { + get + { + PropertyKey key = SystemProperties.System.Devices.FunctionPaths; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.InterfacePaths -- PKEY_Devices_InterfacePaths + /// Description: Available interfaces for this device. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 2 + /// + public ShellProperty InterfacePaths + { + get + { + PropertyKey key = SystemProperties.System.Devices.InterfacePaths; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.IsDefault -- PKEY_Devices_IsDefaultDevice + /// Description: If VARIANT_TRUE, the device is not working properly. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 86 + /// + public ShellProperty IsDefault + { + get + { + PropertyKey key = SystemProperties.System.Devices.IsDefault; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.IsNetworkConnected -- PKEY_Devices_IsNetworkDevice + /// Description: If VARIANT_TRUE, the device is not working properly. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 85 + /// + public ShellProperty IsNetworkConnected + { + get + { + PropertyKey key = SystemProperties.System.Devices.IsNetworkConnected; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.IsShared -- PKEY_Devices_IsSharedDevice + /// Description: If VARIANT_TRUE, the device is not working properly. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 84 + /// + public ShellProperty IsShared + { + get + { + PropertyKey key = SystemProperties.System.Devices.IsShared; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.IsSoftwareInstalling -- PKEY_Devices_IsSoftwareInstalling + /// Description: If VARIANT_TRUE, the device installer is currently installing software. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {83DA6326-97A6-4088-9453-A1923F573B29}, 9 + /// + public ShellProperty IsSoftwareInstalling + { + get + { + PropertyKey key = SystemProperties.System.Devices.IsSoftwareInstalling; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.LaunchDeviceStageFromExplorer -- PKEY_Devices_LaunchDeviceStageFromExplorer + /// Description: Indicates whether to launch Device Stage or not + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 77 + /// + public ShellProperty LaunchDeviceStageFromExplorer + { + get + { + PropertyKey key = SystemProperties.System.Devices.LaunchDeviceStageFromExplorer; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.LocalMachine -- PKEY_Devices_IsLocalMachine + /// Description: If VARIANT_TRUE, the device in question is actually the computer. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 70 + /// + public ShellProperty LocalMachine + { + get + { + PropertyKey key = SystemProperties.System.Devices.LocalMachine; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Manufacturer -- PKEY_Devices_Manufacturer + /// Description: Device manufacturer. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8192 + /// + public ShellProperty Manufacturer + { + get + { + PropertyKey key = SystemProperties.System.Devices.Manufacturer; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.MissedCalls -- PKEY_Devices_MissedCalls + /// Description: Number of missed calls on the device. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 5 + /// + public ShellProperty MissedCalls + { + get + { + PropertyKey key = SystemProperties.System.Devices.MissedCalls; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.ModelName -- PKEY_Devices_ModelName + /// Description: Model name of the device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8194 + /// + public ShellProperty ModelName + { + get + { + PropertyKey key = SystemProperties.System.Devices.ModelName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.ModelNumber -- PKEY_Devices_ModelNumber + /// Description: Model number of the device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8195 + /// + public ShellProperty ModelNumber + { + get + { + PropertyKey key = SystemProperties.System.Devices.ModelNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.NetworkedTooltip -- PKEY_Devices_NetworkedTooltip + /// Description: Tooltip for connection state + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 152 + /// + public ShellProperty NetworkedTooltip + { + get + { + PropertyKey key = SystemProperties.System.Devices.NetworkedTooltip; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.NetworkName -- PKEY_Devices_NetworkName + /// Description: Name of the device's network. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 7 + /// + public ShellProperty NetworkName + { + get + { + PropertyKey key = SystemProperties.System.Devices.NetworkName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.NetworkType -- PKEY_Devices_NetworkType + /// Description: String representing the type of the device's network. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 8 + /// + public ShellProperty NetworkType + { + get + { + PropertyKey key = SystemProperties.System.Devices.NetworkType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.NewPictures -- PKEY_Devices_NewPictures + /// Description: Number of new pictures on the device. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 4 + /// + public ShellProperty NewPictures + { + get + { + PropertyKey key = SystemProperties.System.Devices.NewPictures; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Notification -- PKEY_Devices_Notification + /// Description: Device Notification Property. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {06704B0C-E830-4C81-9178-91E4E95A80A0}, 3 + /// + public ShellProperty Notification + { + get + { + PropertyKey key = SystemProperties.System.Devices.Notification; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.NotificationStore -- PKEY_Devices_NotificationStore + /// Description: Device Notification Store. + /// + /// Type: Object -- VT_UNKNOWN + /// FormatID: {06704B0C-E830-4C81-9178-91E4E95A80A0}, 2 + /// + public ShellProperty NotificationStore + { + get + { + PropertyKey key = SystemProperties.System.Devices.NotificationStore; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.NotWorkingProperly -- PKEY_Devices_IsNotWorkingProperly + /// Description: If VARIANT_TRUE, the device is not working properly. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 83 + /// + public ShellProperty NotWorkingProperly + { + get + { + PropertyKey key = SystemProperties.System.Devices.NotWorkingProperly; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Paired -- PKEY_Devices_IsPaired + /// Description: Device paired state. If VARIANT_TRUE, indicates the device is not paired with the computer. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 56 + /// + public ShellProperty Paired + { + get + { + PropertyKey key = SystemProperties.System.Devices.Paired; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.PrimaryCategory -- PKEY_Devices_PrimaryCategory + /// Description: Primary category group for this device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 10 + /// + public ShellProperty PrimaryCategory + { + get + { + PropertyKey key = SystemProperties.System.Devices.PrimaryCategory; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Roaming -- PKEY_Devices_Roaming + /// Description: Status indicator used to indicate if the device is roaming. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 9 + /// + public ShellProperty Roaming + { + get + { + PropertyKey key = SystemProperties.System.Devices.Roaming; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.SafeRemovalRequired -- PKEY_Devices_SafeRemovalRequired + /// Description: Indicates if a device requires safe removal or not + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {AFD97640-86A3-4210-B67C-289C41AABE55}, 2 + /// + public ShellProperty SafeRemovalRequired + { + get + { + PropertyKey key = SystemProperties.System.Devices.SafeRemovalRequired; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.SharedTooltip -- PKEY_Devices_SharedTooltip + /// Description: Tooltip for sharing state + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 151 + /// + public ShellProperty SharedTooltip + { + get + { + PropertyKey key = SystemProperties.System.Devices.SharedTooltip; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.SignalStrength -- PKEY_Devices_SignalStrength + /// Description: Device signal strength. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 2 + /// + public ShellProperty SignalStrength + { + get + { + PropertyKey key = SystemProperties.System.Devices.SignalStrength; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Status1 -- PKEY_Devices_Status1 + /// Description: 1st line of device status. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 257 + /// + public ShellProperty Status1 + { + get + { + PropertyKey key = SystemProperties.System.Devices.Status1; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Status2 -- PKEY_Devices_Status2 + /// Description: 2nd line of device status. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 258 + /// + public ShellProperty Status2 + { + get + { + PropertyKey key = SystemProperties.System.Devices.Status2; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.StorageCapacity -- PKEY_Devices_StorageCapacity + /// Description: Total storage capacity of the device. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 12 + /// + public ShellProperty StorageCapacity + { + get + { + PropertyKey key = SystemProperties.System.Devices.StorageCapacity; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.StorageFreeSpace -- PKEY_Devices_StorageFreeSpace + /// Description: Total free space of the storage of the device. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 13 + /// + public ShellProperty StorageFreeSpace + { + get + { + PropertyKey key = SystemProperties.System.Devices.StorageFreeSpace; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.StorageFreeSpacePercent -- PKEY_Devices_StorageFreeSpacePercent + /// Description: Total free space of the storage of the device as a percentage. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 14 + /// + public ShellProperty StorageFreeSpacePercent + { + get + { + PropertyKey key = SystemProperties.System.Devices.StorageFreeSpacePercent; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.TextMessages -- PKEY_Devices_TextMessages + /// Description: Number of unread text messages on the device. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 3 + /// + public ShellProperty TextMessages + { + get + { + PropertyKey key = SystemProperties.System.Devices.TextMessages; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Voicemail -- PKEY_Devices_Voicemail + /// Description: Status indicator used to indicate if the device has voicemail. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 6 + /// + public ShellProperty Voicemail + { + get + { + PropertyKey key = SystemProperties.System.Devices.Voicemail; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + private PropertyDevicesNotifications internalPropertyDevicesNotifications; + /// + /// Devices.Notifications Properties + /// + public PropertyDevicesNotifications Notifications + { + get + { + if (internalPropertyDevicesNotifications == null) + { + internalPropertyDevicesNotifications = new PropertyDevicesNotifications(shellObjectParent); + } + + return internalPropertyDevicesNotifications; + } + } + #endregion + } + + /// + /// Devices.Notifications Properties + /// + public class PropertyDevicesNotifications : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertyDevicesNotifications(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Devices.Notifications.LowBattery -- PKEY_Devices_Notification_LowBattery + /// Description: Device Low Battery Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {C4C07F2B-8524-4E66-AE3A-A6235F103BEB}, 2 + /// + public ShellProperty LowBattery + { + get + { + PropertyKey key = SystemProperties.System.Devices.Notifications.LowBattery; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Notifications.MissedCall -- PKEY_Devices_Notification_MissedCall + /// Description: Device Missed Call Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {6614EF48-4EFE-4424-9EDA-C79F404EDF3E}, 2 + /// + public ShellProperty MissedCall + { + get + { + PropertyKey key = SystemProperties.System.Devices.Notifications.MissedCall; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Notifications.NewMessage -- PKEY_Devices_Notification_NewMessage + /// Description: Device New Message Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {2BE9260A-2012-4742-A555-F41B638B7DCB}, 2 + /// + public ShellProperty NewMessage + { + get + { + PropertyKey key = SystemProperties.System.Devices.Notifications.NewMessage; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Notifications.NewVoicemail -- PKEY_Devices_Notification_NewVoicemail + /// Description: Device Voicemail Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {59569556-0A08-4212-95B9-FAE2AD6413DB}, 2 + /// + public ShellProperty NewVoicemail + { + get + { + PropertyKey key = SystemProperties.System.Devices.Notifications.NewVoicemail; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Notifications.StorageFull -- PKEY_Devices_Notification_StorageFull + /// Description: Device Storage Full Notification. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 2 + /// + public ShellProperty StorageFull + { + get + { + PropertyKey key = SystemProperties.System.Devices.Notifications.StorageFull; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Devices.Notifications.StorageFullLinkText -- PKEY_Devices_Notification_StorageFullLinkText + /// Description: Link Text for the Device Storage Full Notification. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 3 + /// + public ShellProperty StorageFullLinkText + { + get + { + PropertyKey key = SystemProperties.System.Devices.Notifications.StorageFullLinkText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Document Properties + /// + public class PropertySystemDocument : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemDocument(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Document.ByteCount -- PKEY_Document_ByteCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 4 (PIDDSI_BYTECOUNT) + /// + public ShellProperty ByteCount + { + get + { + PropertyKey key = SystemProperties.System.Document.ByteCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.CharacterCount -- PKEY_Document_CharacterCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 16 (PIDSI_CHARCOUNT) + /// + public ShellProperty CharacterCount + { + get + { + PropertyKey key = SystemProperties.System.Document.CharacterCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.ClientID -- PKEY_Document_ClientID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {276D7BB0-5B34-4FB0-AA4B-158ED12A1809}, 100 + /// + public ShellProperty ClientID + { + get + { + PropertyKey key = SystemProperties.System.Document.ClientID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.Contributor -- PKEY_Document_Contributor + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {F334115E-DA1B-4509-9B3D-119504DC7ABB}, 100 + /// + public ShellProperty Contributor + { + get + { + PropertyKey key = SystemProperties.System.Document.Contributor; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.DateCreated -- PKEY_Document_DateCreated + /// Description: This property is stored in the document, not obtained from the file system. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 12 (PIDSI_CREATE_DTM) + /// + public ShellProperty DateCreated + { + get + { + PropertyKey key = SystemProperties.System.Document.DateCreated; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.DatePrinted -- PKEY_Document_DatePrinted + /// Description: Legacy name: "DocLastPrinted". + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 11 (PIDSI_LASTPRINTED) + /// + public ShellProperty DatePrinted + { + get + { + PropertyKey key = SystemProperties.System.Document.DatePrinted; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.DateSaved -- PKEY_Document_DateSaved + /// Description: Legacy name: "DocLastSavedTm". + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 13 (PIDSI_LASTSAVE_DTM) + /// + public ShellProperty DateSaved + { + get + { + PropertyKey key = SystemProperties.System.Document.DateSaved; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.Division -- PKEY_Document_Division + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {1E005EE6-BF27-428B-B01C-79676ACD2870}, 100 + /// + public ShellProperty Division + { + get + { + PropertyKey key = SystemProperties.System.Document.Division; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.DocumentID -- PKEY_Document_DocumentID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E08805C8-E395-40DF-80D2-54F0D6C43154}, 100 + /// + public ShellProperty DocumentID + { + get + { + PropertyKey key = SystemProperties.System.Document.DocumentID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.HiddenSlideCount -- PKEY_Document_HiddenSlideCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 9 (PIDDSI_HIDDENCOUNT) + /// + public ShellProperty HiddenSlideCount + { + get + { + PropertyKey key = SystemProperties.System.Document.HiddenSlideCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.LastAuthor -- PKEY_Document_LastAuthor + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 8 (PIDSI_LASTAUTHOR) + /// + public ShellProperty LastAuthor + { + get + { + PropertyKey key = SystemProperties.System.Document.LastAuthor; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.LineCount -- PKEY_Document_LineCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 5 (PIDDSI_LINECOUNT) + /// + public ShellProperty LineCount + { + get + { + PropertyKey key = SystemProperties.System.Document.LineCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.Manager -- PKEY_Document_Manager + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 14 (PIDDSI_MANAGER) + /// + public ShellProperty Manager + { + get + { + PropertyKey key = SystemProperties.System.Document.Manager; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.MultimediaClipCount -- PKEY_Document_MultimediaClipCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 10 (PIDDSI_MMCLIPCOUNT) + /// + public ShellProperty MultimediaClipCount + { + get + { + PropertyKey key = SystemProperties.System.Document.MultimediaClipCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.NoteCount -- PKEY_Document_NoteCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 8 (PIDDSI_NOTECOUNT) + /// + public ShellProperty NoteCount + { + get + { + PropertyKey key = SystemProperties.System.Document.NoteCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.PageCount -- PKEY_Document_PageCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 14 (PIDSI_PAGECOUNT) + /// + public ShellProperty PageCount + { + get + { + PropertyKey key = SystemProperties.System.Document.PageCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.ParagraphCount -- PKEY_Document_ParagraphCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 6 (PIDDSI_PARCOUNT) + /// + public ShellProperty ParagraphCount + { + get + { + PropertyKey key = SystemProperties.System.Document.ParagraphCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.PresentationFormat -- PKEY_Document_PresentationFormat + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 3 (PIDDSI_PRESFORMAT) + /// + public ShellProperty PresentationFormat + { + get + { + PropertyKey key = SystemProperties.System.Document.PresentationFormat; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.RevisionNumber -- PKEY_Document_RevisionNumber + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 9 (PIDSI_REVNUMBER) + /// + public ShellProperty RevisionNumber + { + get + { + PropertyKey key = SystemProperties.System.Document.RevisionNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.Security -- PKEY_Document_Security + /// Description: Access control information, from SummaryInfo propset + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 19 + /// + public ShellProperty Security + { + get + { + PropertyKey key = SystemProperties.System.Document.Security; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.SlideCount -- PKEY_Document_SlideCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 7 (PIDDSI_SLIDECOUNT) + /// + public ShellProperty SlideCount + { + get + { + PropertyKey key = SystemProperties.System.Document.SlideCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.Template -- PKEY_Document_Template + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 7 (PIDSI_TEMPLATE) + /// + public ShellProperty Template + { + get + { + PropertyKey key = SystemProperties.System.Document.Template; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.TotalEditingTime -- PKEY_Document_TotalEditingTime + /// Description: 100ns units, not milliseconds. VT_FILETIME for IPropertySetStorage handlers (legacy) + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 10 (PIDSI_EDITTIME) + /// + public ShellProperty TotalEditingTime + { + get + { + PropertyKey key = SystemProperties.System.Document.TotalEditingTime; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.Version -- PKEY_Document_Version + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 29 + /// + public ShellProperty Version + { + get + { + PropertyKey key = SystemProperties.System.Document.Version; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Document.WordCount -- PKEY_Document_WordCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 15 (PIDSI_WORDCOUNT) + /// + public ShellProperty WordCount + { + get + { + PropertyKey key = SystemProperties.System.Document.WordCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.DRM Properties + /// + public class PropertySystemDRM : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemDRM(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.DRM.DatePlayExpires -- PKEY_DRM_DatePlayExpires + /// Description: Indicates when play expires for digital rights management. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 6 (PIDDRSI_PLAYEXPIRES) + /// + public ShellProperty DatePlayExpires + { + get + { + PropertyKey key = SystemProperties.System.DRM.DatePlayExpires; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DRM.DatePlayStarts -- PKEY_DRM_DatePlayStarts + /// Description: Indicates when play starts for digital rights management. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 5 (PIDDRSI_PLAYSTARTS) + /// + public ShellProperty DatePlayStarts + { + get + { + PropertyKey key = SystemProperties.System.DRM.DatePlayStarts; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DRM.Description -- PKEY_DRM_Description + /// Description: Displays the description for digital rights management. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 3 (PIDDRSI_DESCRIPTION) + /// + public ShellProperty Description + { + get + { + PropertyKey key = SystemProperties.System.DRM.Description; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DRM.IsProtected -- PKEY_DRM_IsProtected + /// Description: + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 2 (PIDDRSI_PROTECTED) + /// + public ShellProperty IsProtected + { + get + { + PropertyKey key = SystemProperties.System.DRM.IsProtected; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.DRM.PlayCount -- PKEY_DRM_PlayCount + /// Description: Indicates the play count for digital rights management. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 4 (PIDDRSI_PLAYCOUNT) + /// + public ShellProperty PlayCount + { + get + { + PropertyKey key = SystemProperties.System.DRM.PlayCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.GPS Properties + /// + public class PropertySystemGPS : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemGPS(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.GPS.Altitude -- PKEY_GPS_Altitude + /// Description: Indicates the altitude based on the reference in PKEY_GPS_AltitudeRef. Calculated from PKEY_GPS_AltitudeNumerator and + ///PKEY_GPS_AltitudeDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {827EDB4F-5B73-44A7-891D-FDFFABEA35CA}, 100 + /// + public ShellProperty Altitude + { + get + { + PropertyKey key = SystemProperties.System.GPS.Altitude; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.AltitudeDenominator -- PKEY_GPS_AltitudeDenominator + /// Description: Denominator of PKEY_GPS_Altitude + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {78342DCB-E358-4145-AE9A-6BFE4E0F9F51}, 100 + /// + public ShellProperty AltitudeDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.AltitudeDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.AltitudeNumerator -- PKEY_GPS_AltitudeNumerator + /// Description: Numerator of PKEY_GPS_Altitude + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {2DAD1EB7-816D-40D3-9EC3-C9773BE2AADE}, 100 + /// + public ShellProperty AltitudeNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.AltitudeNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.AltitudeRef -- PKEY_GPS_AltitudeRef + /// Description: Indicates the reference for the altitude property. (eg: above sea level, below sea level, absolute value) + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {46AC629D-75EA-4515-867F-6DC4321C5844}, 100 + /// + public ShellProperty AltitudeRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.AltitudeRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.AreaInformation -- PKEY_GPS_AreaInformation + /// Description: Represents the name of the GPS area + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {972E333E-AC7E-49F1-8ADF-A70D07A9BCAB}, 100 + /// + public ShellProperty AreaInformation + { + get + { + PropertyKey key = SystemProperties.System.GPS.AreaInformation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.Date -- PKEY_GPS_Date + /// Description: Date and time of the GPS record + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {3602C812-0F3B-45F0-85AD-603468D69423}, 100 + /// + public ShellProperty Date + { + get + { + PropertyKey key = SystemProperties.System.GPS.Date; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestBearing -- PKEY_GPS_DestBearing + /// Description: Indicates the bearing to the destination point. Calculated from PKEY_GPS_DestBearingNumerator and + ///PKEY_GPS_DestBearingDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {C66D4B3C-E888-47CC-B99F-9DCA3EE34DEA}, 100 + /// + public ShellProperty DestinationBearing + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationBearing; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestBearingDenominator -- PKEY_GPS_DestBearingDenominator + /// Description: Denominator of PKEY_GPS_DestBearing + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7ABCF4F8-7C3F-4988-AC91-8D2C2E97ECA5}, 100 + /// + public ShellProperty DestinationBearingDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationBearingDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestBearingNumerator -- PKEY_GPS_DestBearingNumerator + /// Description: Numerator of PKEY_GPS_DestBearing + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {BA3B1DA9-86EE-4B5D-A2A4-A271A429F0CF}, 100 + /// + public ShellProperty DestinationBearingNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationBearingNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestBearingRef -- PKEY_GPS_DestBearingRef + /// Description: Indicates the reference used for the giving the bearing to the destination point. (eg: true direction, magnetic direction) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9AB84393-2A0F-4B75-BB22-7279786977CB}, 100 + /// + public ShellProperty DestinationBearingRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationBearingRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestDistance -- PKEY_GPS_DestDistance + /// Description: Indicates the distance to the destination point. Calculated from PKEY_GPS_DestDistanceNumerator and + ///PKEY_GPS_DestDistanceDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {A93EAE04-6804-4F24-AC81-09B266452118}, 100 + /// + public ShellProperty DestinationDistance + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationDistance; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestDistanceDenominator -- PKEY_GPS_DestDistanceDenominator + /// Description: Denominator of PKEY_GPS_DestDistance + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {9BC2C99B-AC71-4127-9D1C-2596D0D7DCB7}, 100 + /// + public ShellProperty DestinationDistanceDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationDistanceDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestDistanceNumerator -- PKEY_GPS_DestDistanceNumerator + /// Description: Numerator of PKEY_GPS_DestDistance + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {2BDA47DA-08C6-4FE1-80BC-A72FC517C5D0}, 100 + /// + public ShellProperty DestinationDistanceNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationDistanceNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestDistanceRef -- PKEY_GPS_DestDistanceRef + /// Description: Indicates the unit used to express the distance to the destination. (eg: kilometers, miles, knots) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {ED4DF2D3-8695-450B-856F-F5C1C53ACB66}, 100 + /// + public ShellProperty DestinationDistanceRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationDistanceRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestLatitude -- PKEY_GPS_DestLatitude + /// Description: Indicates the latitude of the destination point. This is an array of three values. Index 0 is the degrees, index 1 + ///is the minutes, index 2 is the seconds. Each is calculated from the values in PKEY_GPS_DestLatitudeNumerator and + ///PKEY_GPS_DestLatitudeDenominator. + /// + /// Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8) + /// FormatID: {9D1D7CC5-5C39-451C-86B3-928E2D18CC47}, 100 + /// + public ShellProperty DestinationLatitude + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationLatitude; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestLatitudeDenominator -- PKEY_GPS_DestLatitudeDenominator + /// Description: Denominator of PKEY_GPS_DestLatitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {3A372292-7FCA-49A7-99D5-E47BB2D4E7AB}, 100 + /// + public ShellProperty DestinationLatitudeDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationLatitudeDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestLatitudeNumerator -- PKEY_GPS_DestLatitudeNumerator + /// Description: Numerator of PKEY_GPS_DestLatitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {ECF4B6F6-D5A6-433C-BB92-4076650FC890}, 100 + /// + public ShellProperty DestinationLatitudeNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationLatitudeNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestLatitudeRef -- PKEY_GPS_DestLatitudeRef + /// Description: Indicates whether the latitude destination point is north or south latitude + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CEA820B9-CE61-4885-A128-005D9087C192}, 100 + /// + public ShellProperty DestinationLatitudeRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationLatitudeRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestLongitude -- PKEY_GPS_DestLongitude + /// Description: Indicates the latitude of the destination point. This is an array of three values. Index 0 is the degrees, index 1 + ///is the minutes, index 2 is the seconds. Each is calculated from the values in PKEY_GPS_DestLongitudeNumerator and + ///PKEY_GPS_DestLongitudeDenominator. + /// + /// Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8) + /// FormatID: {47A96261-CB4C-4807-8AD3-40B9D9DBC6BC}, 100 + /// + public ShellProperty DestinationLongitude + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationLongitude; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestLongitudeDenominator -- PKEY_GPS_DestLongitudeDenominator + /// Description: Denominator of PKEY_GPS_DestLongitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {425D69E5-48AD-4900-8D80-6EB6B8D0AC86}, 100 + /// + public ShellProperty DestinationLongitudeDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationLongitudeDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestLongitudeNumerator -- PKEY_GPS_DestLongitudeNumerator + /// Description: Numerator of PKEY_GPS_DestLongitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {A3250282-FB6D-48D5-9A89-DBCACE75CCCF}, 100 + /// + public ShellProperty DestinationLongitudeNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationLongitudeNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DestLongitudeRef -- PKEY_GPS_DestLongitudeRef + /// Description: Indicates whether the longitude destination point is east or west longitude + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {182C1EA6-7C1C-4083-AB4B-AC6C9F4ED128}, 100 + /// + public ShellProperty DestinationLongitudeRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.DestinationLongitudeRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.Differential -- PKEY_GPS_Differential + /// Description: Indicates whether differential correction was applied to the GPS receiver + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {AAF4EE25-BD3B-4DD7-BFC4-47F77BB00F6D}, 100 + /// + public ShellProperty Differential + { + get + { + PropertyKey key = SystemProperties.System.GPS.Differential; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DOP -- PKEY_GPS_DOP + /// Description: Indicates the GPS DOP (data degree of precision). Calculated from PKEY_GPS_DOPNumerator and PKEY_GPS_DOPDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {0CF8FB02-1837-42F1-A697-A7017AA289B9}, 100 + /// + public ShellProperty DOP + { + get + { + PropertyKey key = SystemProperties.System.GPS.DOP; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DOPDenominator -- PKEY_GPS_DOPDenominator + /// Description: Denominator of PKEY_GPS_DOP + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {A0BE94C5-50BA-487B-BD35-0654BE8881ED}, 100 + /// + public ShellProperty DOPDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DOPDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.DOPNumerator -- PKEY_GPS_DOPNumerator + /// Description: Numerator of PKEY_GPS_DOP + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {47166B16-364F-4AA0-9F31-E2AB3DF449C3}, 100 + /// + public ShellProperty DOPNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.DOPNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.ImgDirection -- PKEY_GPS_ImgDirection + /// Description: Indicates direction of the image when it was captured. Calculated from PKEY_GPS_ImgDirectionNumerator and + ///PKEY_GPS_ImgDirectionDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {16473C91-D017-4ED9-BA4D-B6BAA55DBCF8}, 100 + /// + public ShellProperty ImageDirection + { + get + { + PropertyKey key = SystemProperties.System.GPS.ImageDirection; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.ImgDirectionDenominator -- PKEY_GPS_ImgDirectionDenominator + /// Description: Denominator of PKEY_GPS_ImgDirection + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {10B24595-41A2-4E20-93C2-5761C1395F32}, 100 + /// + public ShellProperty ImageDirectionDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.ImageDirectionDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.ImgDirectionNumerator -- PKEY_GPS_ImgDirectionNumerator + /// Description: Numerator of PKEY_GPS_ImgDirection + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {DC5877C7-225F-45F7-BAC7-E81334B6130A}, 100 + /// + public ShellProperty ImageDirectionNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.ImageDirectionNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.ImgDirectionRef -- PKEY_GPS_ImgDirectionRef + /// Description: Indicates reference for giving the direction of the image when it was captured. (eg: true direction, magnetic direction) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A4AAA5B7-1AD0-445F-811A-0F8F6E67F6B5}, 100 + /// + public ShellProperty ImageDirectionRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.ImageDirectionRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.Latitude -- PKEY_GPS_Latitude + /// Description: Indicates the latitude. This is an array of three values. Index 0 is the degrees, index 1 is the minutes, index 2 + ///is the seconds. Each is calculated from the values in PKEY_GPS_LatitudeNumerator and PKEY_GPS_LatitudeDenominator. + /// + /// Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8) + /// FormatID: {8727CFFF-4868-4EC6-AD5B-81B98521D1AB}, 100 + /// + public ShellProperty Latitude + { + get + { + PropertyKey key = SystemProperties.System.GPS.Latitude; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.LatitudeDenominator -- PKEY_GPS_LatitudeDenominator + /// Description: Denominator of PKEY_GPS_Latitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {16E634EE-2BFF-497B-BD8A-4341AD39EEB9}, 100 + /// + public ShellProperty LatitudeDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.LatitudeDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.LatitudeNumerator -- PKEY_GPS_LatitudeNumerator + /// Description: Numerator of PKEY_GPS_Latitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {7DDAAAD1-CCC8-41AE-B750-B2CB8031AEA2}, 100 + /// + public ShellProperty LatitudeNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.LatitudeNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.LatitudeRef -- PKEY_GPS_LatitudeRef + /// Description: Indicates whether latitude is north or south latitude + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {029C0252-5B86-46C7-ACA0-2769FFC8E3D4}, 100 + /// + public ShellProperty LatitudeRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.LatitudeRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.Longitude -- PKEY_GPS_Longitude + /// Description: Indicates the longitude. This is an array of three values. Index 0 is the degrees, index 1 is the minutes, index 2 + ///is the seconds. Each is calculated from the values in PKEY_GPS_LongitudeNumerator and PKEY_GPS_LongitudeDenominator. + /// + /// Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8) + /// FormatID: {C4C4DBB2-B593-466B-BBDA-D03D27D5E43A}, 100 + /// + public ShellProperty Longitude + { + get + { + PropertyKey key = SystemProperties.System.GPS.Longitude; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.LongitudeDenominator -- PKEY_GPS_LongitudeDenominator + /// Description: Denominator of PKEY_GPS_Longitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {BE6E176C-4534-4D2C-ACE5-31DEDAC1606B}, 100 + /// + public ShellProperty LongitudeDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.LongitudeDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.LongitudeNumerator -- PKEY_GPS_LongitudeNumerator + /// Description: Numerator of PKEY_GPS_Longitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {02B0F689-A914-4E45-821D-1DDA452ED2C4}, 100 + /// + public ShellProperty LongitudeNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.LongitudeNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.LongitudeRef -- PKEY_GPS_LongitudeRef + /// Description: Indicates whether longitude is east or west longitude + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {33DCF22B-28D5-464C-8035-1EE9EFD25278}, 100 + /// + public ShellProperty LongitudeRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.LongitudeRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.MapDatum -- PKEY_GPS_MapDatum + /// Description: Indicates the geodetic survey data used by the GPS receiver + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {2CA2DAE6-EDDC-407D-BEF1-773942ABFA95}, 100 + /// + public ShellProperty MapDatum + { + get + { + PropertyKey key = SystemProperties.System.GPS.MapDatum; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.MeasureMode -- PKEY_GPS_MeasureMode + /// Description: Indicates the GPS measurement mode. (eg: 2-dimensional, 3-dimensional) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A015ED5D-AAEA-4D58-8A86-3C586920EA0B}, 100 + /// + public ShellProperty MeasureMode + { + get + { + PropertyKey key = SystemProperties.System.GPS.MeasureMode; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.ProcessingMethod -- PKEY_GPS_ProcessingMethod + /// Description: Indicates the name of the method used for location finding + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {59D49E61-840F-4AA9-A939-E2099B7F6399}, 100 + /// + public ShellProperty ProcessingMethod + { + get + { + PropertyKey key = SystemProperties.System.GPS.ProcessingMethod; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.Satellites -- PKEY_GPS_Satellites + /// Description: Indicates the GPS satellites used for measurements + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {467EE575-1F25-4557-AD4E-B8B58B0D9C15}, 100 + /// + public ShellProperty Satellites + { + get + { + PropertyKey key = SystemProperties.System.GPS.Satellites; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.Speed -- PKEY_GPS_Speed + /// Description: Indicates the speed of the GPS receiver movement. Calculated from PKEY_GPS_SpeedNumerator and + ///PKEY_GPS_SpeedDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {DA5D0862-6E76-4E1B-BABD-70021BD25494}, 100 + /// + public ShellProperty Speed + { + get + { + PropertyKey key = SystemProperties.System.GPS.Speed; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.SpeedDenominator -- PKEY_GPS_SpeedDenominator + /// Description: Denominator of PKEY_GPS_Speed + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7D122D5A-AE5E-4335-8841-D71E7CE72F53}, 100 + /// + public ShellProperty SpeedDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.SpeedDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.SpeedNumerator -- PKEY_GPS_SpeedNumerator + /// Description: Numerator of PKEY_GPS_Speed + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {ACC9CE3D-C213-4942-8B48-6D0820F21C6D}, 100 + /// + public ShellProperty SpeedNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.SpeedNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.SpeedRef -- PKEY_GPS_SpeedRef + /// Description: Indicates the unit used to express the speed of the GPS receiver movement. (eg: kilometers per hour, + ///miles per hour, knots). + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {ECF7F4C9-544F-4D6D-9D98-8AD79ADAF453}, 100 + /// + public ShellProperty SpeedRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.SpeedRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.Status -- PKEY_GPS_Status + /// Description: Indicates the status of the GPS receiver when the image was recorded. (eg: measurement in progress, + ///measurement interoperability). + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {125491F4-818F-46B2-91B5-D537753617B2}, 100 + /// + public ShellProperty Status + { + get + { + PropertyKey key = SystemProperties.System.GPS.Status; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.Track -- PKEY_GPS_Track + /// Description: Indicates the direction of the GPS receiver movement. Calculated from PKEY_GPS_TrackNumerator and + ///PKEY_GPS_TrackDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {76C09943-7C33-49E3-9E7E-CDBA872CFADA}, 100 + /// + public ShellProperty Track + { + get + { + PropertyKey key = SystemProperties.System.GPS.Track; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.TrackDenominator -- PKEY_GPS_TrackDenominator + /// Description: Denominator of PKEY_GPS_Track + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {C8D1920C-01F6-40C0-AC86-2F3A4AD00770}, 100 + /// + public ShellProperty TrackDenominator + { + get + { + PropertyKey key = SystemProperties.System.GPS.TrackDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.TrackNumerator -- PKEY_GPS_TrackNumerator + /// Description: Numerator of PKEY_GPS_Track + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {702926F4-44A6-43E1-AE71-45627116893B}, 100 + /// + public ShellProperty TrackNumerator + { + get + { + PropertyKey key = SystemProperties.System.GPS.TrackNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.TrackRef -- PKEY_GPS_TrackRef + /// Description: Indicates reference for the direction of the GPS receiver movement. (eg: true direction, magnetic direction) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {35DBE6FE-44C3-4400-AAAE-D2C799C407E8}, 100 + /// + public ShellProperty TrackRef + { + get + { + PropertyKey key = SystemProperties.System.GPS.TrackRef; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.GPS.VersionID -- PKEY_GPS_VersionID + /// Description: Indicates the version of the GPS information + /// + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: {22704DA4-C6B2-4A99-8E56-F16DF8C92599}, 100 + /// + public ShellProperty VersionID + { + get + { + PropertyKey key = SystemProperties.System.GPS.VersionID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Identity Properties + /// + public class PropertySystemIdentity : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemIdentity(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Identity.Blob -- PKEY_Identity_Blob + /// Description: Blob used to import/export identities + /// + /// Type: Blob -- VT_BLOB + /// FormatID: {8C3B93A4-BAED-1A83-9A32-102EE313F6EB}, 100 + /// + public ShellProperty Blob + { + get + { + PropertyKey key = SystemProperties.System.Identity.Blob; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Identity.DisplayName -- PKEY_Identity_DisplayName + /// Description: Display Name + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7D683FC9-D155-45A8-BB1F-89D19BCB792F}, 100 + /// + public ShellProperty DisplayName + { + get + { + PropertyKey key = SystemProperties.System.Identity.DisplayName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Identity.IsMeIdentity -- PKEY_Identity_IsMeIdentity + /// Description: Is it Me Identity + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {A4108708-09DF-4377-9DFC-6D99986D5A67}, 100 + /// + public ShellProperty IsMeIdentity + { + get + { + PropertyKey key = SystemProperties.System.Identity.IsMeIdentity; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Identity.PrimaryEmailAddress -- PKEY_Identity_PrimaryEmailAddress + /// Description: Primary Email Address + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FCC16823-BAED-4F24-9B32-A0982117F7FA}, 100 + /// + public ShellProperty PrimaryEmailAddress + { + get + { + PropertyKey key = SystemProperties.System.Identity.PrimaryEmailAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Identity.ProviderID -- PKEY_Identity_ProviderID + /// Description: Provider ID + /// + /// Type: Guid -- VT_CLSID + /// FormatID: {74A7DE49-FA11-4D3D-A006-DB7E08675916}, 100 + /// + public ShellProperty ProviderID + { + get + { + PropertyKey key = SystemProperties.System.Identity.ProviderID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Identity.UniqueID -- PKEY_Identity_UniqueID + /// Description: Unique ID + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E55FC3B0-2B60-4220-918E-B21E8BF16016}, 100 + /// + public ShellProperty UniqueID + { + get + { + PropertyKey key = SystemProperties.System.Identity.UniqueID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Identity.UserName -- PKEY_Identity_UserName + /// Description: Identity User Name + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C4322503-78CA-49C6-9ACC-A68E2AFD7B6B}, 100 + /// + public ShellProperty UserName + { + get + { + PropertyKey key = SystemProperties.System.Identity.UserName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.IdentityProvider Properties + /// + public class PropertySystemIdentityProvider : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemIdentityProvider(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.IdentityProvider.Name -- PKEY_IdentityProvider_Name + /// Description: Identity Provider Name + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {B96EFF7B-35CA-4A35-8607-29E3A54C46EA}, 100 + /// + public ShellProperty Name + { + get + { + PropertyKey key = SystemProperties.System.IdentityProvider.Name; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.IdentityProvider.Picture -- PKEY_IdentityProvider_Picture + /// Description: Picture for the Identity Provider + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {2425166F-5642-4864-992F-98FD98F294C3}, 100 + /// + public ShellProperty Picture + { + get + { + PropertyKey key = SystemProperties.System.IdentityProvider.Picture; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Image Properties + /// + public class PropertySystemImage : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemImage(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Image.BitDepth -- PKEY_Image_BitDepth + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 7 (PIDISI_BITDEPTH) + /// + public ShellProperty BitDepth + { + get + { + PropertyKey key = SystemProperties.System.Image.BitDepth; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.ColorSpace -- PKEY_Image_ColorSpace + /// Description: PropertyTagExifColorSpace + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 40961 + /// + public ShellProperty ColorSpace + { + get + { + PropertyKey key = SystemProperties.System.Image.ColorSpace; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.CompressedBitsPerPixel -- PKEY_Image_CompressedBitsPerPixel + /// Description: Calculated from PKEY_Image_CompressedBitsPerPixelNumerator and PKEY_Image_CompressedBitsPerPixelDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {364B6FA9-37AB-482A-BE2B-AE02F60D4318}, 100 + /// + public ShellProperty CompressedBitsPerPixel + { + get + { + PropertyKey key = SystemProperties.System.Image.CompressedBitsPerPixel; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.CompressedBitsPerPixelDenominator -- PKEY_Image_CompressedBitsPerPixelDenominator + /// Description: Denominator of PKEY_Image_CompressedBitsPerPixel. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {1F8844E1-24AD-4508-9DFD-5326A415CE02}, 100 + /// + public ShellProperty CompressedBitsPerPixelDenominator + { + get + { + PropertyKey key = SystemProperties.System.Image.CompressedBitsPerPixelDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.CompressedBitsPerPixelNumerator -- PKEY_Image_CompressedBitsPerPixelNumerator + /// Description: Numerator of PKEY_Image_CompressedBitsPerPixel. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {D21A7148-D32C-4624-8900-277210F79C0F}, 100 + /// + public ShellProperty CompressedBitsPerPixelNumerator + { + get + { + PropertyKey key = SystemProperties.System.Image.CompressedBitsPerPixelNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.Compression -- PKEY_Image_Compression + /// Description: Indicates the image compression level. PropertyTagCompression. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 259 + /// + public ShellProperty Compression + { + get + { + PropertyKey key = SystemProperties.System.Image.Compression; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.CompressionText -- PKEY_Image_CompressionText + /// Description: This is the user-friendly form of System.Image.Compression. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {3F08E66F-2F44-4BB9-A682-AC35D2562322}, 100 + /// + public ShellProperty CompressionText + { + get + { + PropertyKey key = SystemProperties.System.Image.CompressionText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.Dimensions -- PKEY_Image_Dimensions + /// Description: Indicates the dimensions of the image. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 13 (PIDISI_DIMENSIONS) + /// + public ShellProperty Dimensions + { + get + { + PropertyKey key = SystemProperties.System.Image.Dimensions; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.HorizontalResolution -- PKEY_Image_HorizontalResolution + /// Description: + /// + /// Type: Double -- VT_R8 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 5 (PIDISI_RESOLUTIONX) + /// + public ShellProperty HorizontalResolution + { + get + { + PropertyKey key = SystemProperties.System.Image.HorizontalResolution; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.HorizontalSize -- PKEY_Image_HorizontalSize + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 3 (PIDISI_CX) + /// + public ShellProperty HorizontalSize + { + get + { + PropertyKey key = SystemProperties.System.Image.HorizontalSize; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.ImageID -- PKEY_Image_ImageID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {10DABE05-32AA-4C29-BF1A-63E2D220587F}, 100 + /// + public ShellProperty ImageID + { + get + { + PropertyKey key = SystemProperties.System.Image.ImageID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.ResolutionUnit -- PKEY_Image_ResolutionUnit + /// Description: + /// Type: Int16 -- VT_I2 + /// FormatID: {19B51FA6-1F92-4A5C-AB48-7DF0ABD67444}, 100 + /// + public ShellProperty ResolutionUnit + { + get + { + PropertyKey key = SystemProperties.System.Image.ResolutionUnit; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.VerticalResolution -- PKEY_Image_VerticalResolution + /// Description: + /// + /// Type: Double -- VT_R8 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 6 (PIDISI_RESOLUTIONY) + /// + public ShellProperty VerticalResolution + { + get + { + PropertyKey key = SystemProperties.System.Image.VerticalResolution; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Image.VerticalSize -- PKEY_Image_VerticalSize + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 4 (PIDISI_CY) + /// + public ShellProperty VerticalSize + { + get + { + PropertyKey key = SystemProperties.System.Image.VerticalSize; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Journal Properties + /// + public class PropertySystemJournal : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemJournal(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Journal.Contacts -- PKEY_Journal_Contacts + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {DEA7C82C-1D89-4A66-9427-A4E3DEBABCB1}, 100 + /// + public ShellProperty Contacts + { + get + { + PropertyKey key = SystemProperties.System.Journal.Contacts; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Journal.EntryType -- PKEY_Journal_EntryType + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {95BEB1FC-326D-4644-B396-CD3ED90E6DDF}, 100 + /// + public ShellProperty EntryType + { + get + { + PropertyKey key = SystemProperties.System.Journal.EntryType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.LayoutPattern Properties + /// + public class PropertySystemLayoutPattern : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemLayoutPattern(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.LayoutPattern.ContentViewModeForBrowse -- PKEY_LayoutPattern_ContentViewModeForBrowse + /// Description: Specifies the layout pattern that the content view mode should apply for this item in the context of browsing. + ///Register the regvalue under the name of "ContentViewModeLayoutPatternForBrowse". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 500 + /// + public ShellProperty ContentViewModeForBrowse + { + get + { + PropertyKey key = SystemProperties.System.LayoutPattern.ContentViewModeForBrowse; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.LayoutPattern.ContentViewModeForSearch -- PKEY_LayoutPattern_ContentViewModeForSearch + /// Description: Specifies the layout pattern that the content view mode should apply for this item in the context of searching. + ///Register the regvalue under the name of "ContentViewModeLayoutPatternForSearch". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 501 + /// + public ShellProperty ContentViewModeForSearch + { + get + { + PropertyKey key = SystemProperties.System.LayoutPattern.ContentViewModeForSearch; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Link Properties + /// + public class PropertySystemLink : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemLink(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Link.Arguments -- PKEY_Link_Arguments + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {436F2667-14E2-4FEB-B30A-146C53B5B674}, 100 + /// + public ShellProperty Arguments + { + get + { + PropertyKey key = SystemProperties.System.Link.Arguments; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.Comment -- PKEY_Link_Comment + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 5 + /// + public ShellProperty Comment + { + get + { + PropertyKey key = SystemProperties.System.Link.Comment; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.DateVisited -- PKEY_Link_DateVisited + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 23 (PKEYs relating to URLs. Used by IE History.) + /// + public ShellProperty DateVisited + { + get + { + PropertyKey key = SystemProperties.System.Link.DateVisited; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.Description -- PKEY_Link_Description + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 21 (PKEYs relating to URLs. Used by IE History.) + /// + public ShellProperty Description + { + get + { + PropertyKey key = SystemProperties.System.Link.Description; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.Status -- PKEY_Link_Status + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 3 (PID_LINK_TARGET_TYPE) + /// + public ShellProperty Status + { + get + { + PropertyKey key = SystemProperties.System.Link.Status; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.TargetExtension -- PKEY_Link_TargetExtension + /// Description: The file extension of the link target. See System.File.Extension + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {7A7D76F4-B630-4BD7-95FF-37CC51A975C9}, 2 + /// + public ShellProperty TargetExtension + { + get + { + PropertyKey key = SystemProperties.System.Link.TargetExtension; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.TargetParsingPath -- PKEY_Link_TargetParsingPath + /// Description: This is the shell namespace path to the target of the link item. This path may be passed to + ///SHParseDisplayName to parse the path to the correct shell folder. + /// + ///If the target item is a file, the value is identical to System.ItemPathDisplay. + /// + ///If the target item cannot be accessed through the shell namespace, this value is VT_EMPTY. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 2 (PID_LINK_TARGET) + /// + public ShellProperty TargetParsingPath + { + get + { + PropertyKey key = SystemProperties.System.Link.TargetParsingPath; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.TargetSFGAOFlags -- PKEY_Link_TargetSFGAOFlags + /// Description: IShellFolder::GetAttributesOf flags for the target of a link, with SFGAO_PKEYSFGAOMASK + ///attributes masked out. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 8 + /// + public ShellProperty TargetSFGAOFlags + { + get + { + PropertyKey key = SystemProperties.System.Link.TargetSFGAOFlags; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.TargetSFGAOFlagsStrings -- PKEY_Link_TargetSFGAOFlagsStrings + /// Description: Expresses the SFGAO flags of a link as string values and is used as a query optimization. See + ///PKEY_Shell_SFGAOFlagsStrings for possible values of this. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D6942081-D53B-443D-AD47-5E059D9CD27A}, 3 + /// + public ShellProperty TargetSFGAOFlagsStrings + { + get + { + PropertyKey key = SystemProperties.System.Link.TargetSFGAOFlagsStrings; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Link.TargetUrl -- PKEY_Link_TargetUrl + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 2 (PKEYs relating to URLs. Used by IE History.) + /// + public ShellProperty TargetUrl + { + get + { + PropertyKey key = SystemProperties.System.Link.TargetUrl; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Media Properties + /// + public class PropertySystemMedia : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemMedia(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Media.AuthorUrl -- PKEY_Media_AuthorUrl + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 32 (PIDMSI_AUTHOR_URL) + /// + public ShellProperty AuthorUrl + { + get + { + PropertyKey key = SystemProperties.System.Media.AuthorUrl; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.AverageLevel -- PKEY_Media_AverageLevel + /// Description: + /// Type: UInt32 -- VT_UI4 + /// FormatID: {09EDD5B6-B301-43C5-9990-D00302EFFD46}, 100 + /// + public ShellProperty AverageLevel + { + get + { + PropertyKey key = SystemProperties.System.Media.AverageLevel; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.ClassPrimaryID -- PKEY_Media_ClassPrimaryID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 13 (PIDMSI_CLASS_PRIMARY_ID) + /// + public ShellProperty ClassPrimaryID + { + get + { + PropertyKey key = SystemProperties.System.Media.ClassPrimaryID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.ClassSecondaryID -- PKEY_Media_ClassSecondaryID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 14 (PIDMSI_CLASS_SECONDARY_ID) + /// + public ShellProperty ClassSecondaryID + { + get + { + PropertyKey key = SystemProperties.System.Media.ClassSecondaryID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.CollectionGroupID -- PKEY_Media_CollectionGroupID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 24 (PIDMSI_COLLECTION_GROUP_ID) + /// + public ShellProperty CollectionGroupID + { + get + { + PropertyKey key = SystemProperties.System.Media.CollectionGroupID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.CollectionID -- PKEY_Media_CollectionID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 25 (PIDMSI_COLLECTION_ID) + /// + public ShellProperty CollectionID + { + get + { + PropertyKey key = SystemProperties.System.Media.CollectionID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.ContentDistributor -- PKEY_Media_ContentDistributor + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 18 (PIDMSI_CONTENTDISTRIBUTOR) + /// + public ShellProperty ContentDistributor + { + get + { + PropertyKey key = SystemProperties.System.Media.ContentDistributor; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.ContentID -- PKEY_Media_ContentID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 26 (PIDMSI_CONTENT_ID) + /// + public ShellProperty ContentID + { + get + { + PropertyKey key = SystemProperties.System.Media.ContentID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.CreatorApplication -- PKEY_Media_CreatorApplication + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 27 (PIDMSI_TOOL_NAME) + /// + public ShellProperty CreatorApplication + { + get + { + PropertyKey key = SystemProperties.System.Media.CreatorApplication; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.CreatorApplicationVersion -- PKEY_Media_CreatorApplicationVersion + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 28 (PIDMSI_TOOL_VERSION) + /// + public ShellProperty CreatorApplicationVersion + { + get + { + PropertyKey key = SystemProperties.System.Media.CreatorApplicationVersion; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.DateEncoded -- PKEY_Media_DateEncoded + /// Description: DateTime is in UTC (in the doc, not file system). + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {2E4B640D-5019-46D8-8881-55414CC5CAA0}, 100 + /// + public ShellProperty DateEncoded + { + get + { + PropertyKey key = SystemProperties.System.Media.DateEncoded; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.DateReleased -- PKEY_Media_DateReleased + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DE41CC29-6971-4290-B472-F59F2E2F31E2}, 100 + /// + public ShellProperty DateReleased + { + get + { + PropertyKey key = SystemProperties.System.Media.DateReleased; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.Duration -- PKEY_Media_Duration + /// Description: 100ns units, not milliseconds + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 3 (PIDASI_TIMELENGTH) + /// + public ShellProperty Duration + { + get + { + PropertyKey key = SystemProperties.System.Media.Duration; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.DVDID -- PKEY_Media_DVDID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 15 (PIDMSI_DVDID) + /// + public ShellProperty DVDID + { + get + { + PropertyKey key = SystemProperties.System.Media.DVDID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.EncodedBy -- PKEY_Media_EncodedBy + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 36 (PIDMSI_ENCODED_BY) + /// + public ShellProperty EncodedBy + { + get + { + PropertyKey key = SystemProperties.System.Media.EncodedBy; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.EncodingSettings -- PKEY_Media_EncodingSettings + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 37 (PIDMSI_ENCODING_SETTINGS) + /// + public ShellProperty EncodingSettings + { + get + { + PropertyKey key = SystemProperties.System.Media.EncodingSettings; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.FrameCount -- PKEY_Media_FrameCount + /// Description: Indicates the frame count for the image. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 12 (PIDISI_FRAMECOUNT) + /// + public ShellProperty FrameCount + { + get + { + PropertyKey key = SystemProperties.System.Media.FrameCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.MCDI -- PKEY_Media_MCDI + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 16 (PIDMSI_MCDI) + /// + public ShellProperty MCDI + { + get + { + PropertyKey key = SystemProperties.System.Media.MCDI; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.MetadataContentProvider -- PKEY_Media_MetadataContentProvider + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 17 (PIDMSI_PROVIDER) + /// + public ShellProperty MetadataContentProvider + { + get + { + PropertyKey key = SystemProperties.System.Media.MetadataContentProvider; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.Producer -- PKEY_Media_Producer + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 22 (PIDMSI_PRODUCER) + /// + public ShellProperty Producer + { + get + { + PropertyKey key = SystemProperties.System.Media.Producer; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.PromotionUrl -- PKEY_Media_PromotionUrl + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 33 (PIDMSI_PROMOTION_URL) + /// + public ShellProperty PromotionUrl + { + get + { + PropertyKey key = SystemProperties.System.Media.PromotionUrl; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.ProtectionType -- PKEY_Media_ProtectionType + /// Description: If media is protected, how is it protected? + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 38 + /// + public ShellProperty ProtectionType + { + get + { + PropertyKey key = SystemProperties.System.Media.ProtectionType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.ProviderRating -- PKEY_Media_ProviderRating + /// Description: Rating (0 - 99) supplied by metadata provider + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 39 + /// + public ShellProperty ProviderRating + { + get + { + PropertyKey key = SystemProperties.System.Media.ProviderRating; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.ProviderStyle -- PKEY_Media_ProviderStyle + /// Description: Style of music or video, supplied by metadata provider + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 40 + /// + public ShellProperty ProviderStyle + { + get + { + PropertyKey key = SystemProperties.System.Media.ProviderStyle; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.Publisher -- PKEY_Media_Publisher + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 30 (PIDMSI_PUBLISHER) + /// + public ShellProperty Publisher + { + get + { + PropertyKey key = SystemProperties.System.Media.Publisher; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.SubscriptionContentId -- PKEY_Media_SubscriptionContentId + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9AEBAE7A-9644-487D-A92C-657585ED751A}, 100 + /// + public ShellProperty SubscriptionContentId + { + get + { + PropertyKey key = SystemProperties.System.Media.SubscriptionContentId; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.SubTitle -- PKEY_Media_SubTitle + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 38 (PIDSI_MUSIC_SUB_TITLE) + /// + public ShellProperty Subtitle + { + get + { + PropertyKey key = SystemProperties.System.Media.Subtitle; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.UniqueFileIdentifier -- PKEY_Media_UniqueFileIdentifier + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 35 (PIDMSI_UNIQUE_FILE_IDENTIFIER) + /// + public ShellProperty UniqueFileIdentifier + { + get + { + PropertyKey key = SystemProperties.System.Media.UniqueFileIdentifier; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.UserNoAutoInfo -- PKEY_Media_UserNoAutoInfo + /// Description: If true, do NOT alter this file's metadata. Set by user. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 41 + /// + public ShellProperty UserNoAutoInfo + { + get + { + PropertyKey key = SystemProperties.System.Media.UserNoAutoInfo; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.UserWebUrl -- PKEY_Media_UserWebUrl + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 34 (PIDMSI_USER_WEB_URL) + /// + public ShellProperty UserWebUrl + { + get + { + PropertyKey key = SystemProperties.System.Media.UserWebUrl; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.Writer -- PKEY_Media_Writer + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 23 (PIDMSI_WRITER) + /// + public ShellProperty Writer + { + get + { + PropertyKey key = SystemProperties.System.Media.Writer; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Media.Year -- PKEY_Media_Year + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 5 (PIDSI_MUSIC_YEAR) + /// + public ShellProperty Year + { + get + { + PropertyKey key = SystemProperties.System.Media.Year; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Message Properties + /// + public class PropertySystemMessage : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemMessage(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Message.AttachmentContents -- PKEY_Message_AttachmentContents + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {3143BF7C-80A8-4854-8880-E2E40189BDD0}, 100 + /// + public ShellProperty AttachmentContents + { + get + { + PropertyKey key = SystemProperties.System.Message.AttachmentContents; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.AttachmentNames -- PKEY_Message_AttachmentNames + /// Description: The names of the attachments in a message + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 21 + /// + public ShellProperty AttachmentNames + { + get + { + PropertyKey key = SystemProperties.System.Message.AttachmentNames; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.BccAddress -- PKEY_Message_BccAddress + /// Description: Addresses in Bcc: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 2 + /// + public ShellProperty BccAddress + { + get + { + PropertyKey key = SystemProperties.System.Message.BccAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.BccName -- PKEY_Message_BccName + /// Description: person names in Bcc: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 3 + /// + public ShellProperty BccName + { + get + { + PropertyKey key = SystemProperties.System.Message.BccName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.CcAddress -- PKEY_Message_CcAddress + /// Description: Addresses in Cc: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 4 + /// + public ShellProperty CcAddress + { + get + { + PropertyKey key = SystemProperties.System.Message.CcAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.CcName -- PKEY_Message_CcName + /// Description: person names in Cc: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 5 + /// + public ShellProperty CcName + { + get + { + PropertyKey key = SystemProperties.System.Message.CcName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.ConversationID -- PKEY_Message_ConversationID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DC8F80BD-AF1E-4289-85B6-3DFC1B493992}, 100 + /// + public ShellProperty ConversationID + { + get + { + PropertyKey key = SystemProperties.System.Message.ConversationID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.ConversationIndex -- PKEY_Message_ConversationIndex + /// Description: + /// + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: {DC8F80BD-AF1E-4289-85B6-3DFC1B493992}, 101 + /// + public ShellProperty ConversationIndex + { + get + { + PropertyKey key = SystemProperties.System.Message.ConversationIndex; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.DateReceived -- PKEY_Message_DateReceived + /// Description: Date and Time communication was received + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 20 + /// + public ShellProperty DateReceived + { + get + { + PropertyKey key = SystemProperties.System.Message.DateReceived; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.DateSent -- PKEY_Message_DateSent + /// Description: Date and Time communication was sent + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 19 + /// + public ShellProperty DateSent + { + get + { + PropertyKey key = SystemProperties.System.Message.DateSent; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.Flags -- PKEY_Message_Flags + /// Description: These are flags associated with email messages to know if a read receipt is pending, etc. + ///The values stored here by Outlook are defined for PR_MESSAGE_FLAGS on MSDN. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {A82D9EE7-CA67-4312-965E-226BCEA85023}, 100 + /// + public ShellProperty Flags + { + get + { + PropertyKey key = SystemProperties.System.Message.Flags; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.FromAddress -- PKEY_Message_FromAddress + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 13 + /// + public ShellProperty FromAddress + { + get + { + PropertyKey key = SystemProperties.System.Message.FromAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.FromName -- PKEY_Message_FromName + /// Description: Address in from field as person name + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 14 + /// + public ShellProperty FromName + { + get + { + PropertyKey key = SystemProperties.System.Message.FromName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.HasAttachments -- PKEY_Message_HasAttachments + /// Description: + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}, 8 + /// + public ShellProperty HasAttachments + { + get + { + PropertyKey key = SystemProperties.System.Message.HasAttachments; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.IsFwdOrReply -- PKEY_Message_IsFwdOrReply + /// Description: + /// Type: Int32 -- VT_I4 + /// FormatID: {9A9BC088-4F6D-469E-9919-E705412040F9}, 100 + /// + public ShellProperty IsFwdOrReply + { + get + { + PropertyKey key = SystemProperties.System.Message.IsFwdOrReply; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.MessageClass -- PKEY_Message_MessageClass + /// Description: What type of outlook msg this is (meeting, task, mail, etc.) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CD9ED458-08CE-418F-A70E-F912C7BB9C5C}, 103 + /// + public ShellProperty MessageClass + { + get + { + PropertyKey key = SystemProperties.System.Message.MessageClass; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.ProofInProgress -- PKEY_Message_ProofInProgress + /// Description: This property will be true if the message junk email proofing is still in progress. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {9098F33C-9A7D-48A8-8DE5-2E1227A64E91}, 100 + /// + public ShellProperty ProofInProgress + { + get + { + PropertyKey key = SystemProperties.System.Message.ProofInProgress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.SenderAddress -- PKEY_Message_SenderAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0BE1C8E7-1981-4676-AE14-FDD78F05A6E7}, 100 + /// + public ShellProperty SenderAddress + { + get + { + PropertyKey key = SystemProperties.System.Message.SenderAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.SenderName -- PKEY_Message_SenderName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0DA41CFA-D224-4A18-AE2F-596158DB4B3A}, 100 + /// + public ShellProperty SenderName + { + get + { + PropertyKey key = SystemProperties.System.Message.SenderName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.Store -- PKEY_Message_Store + /// Description: The store (aka protocol handler) FILE, MAIL, OUTLOOKEXPRESS + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 15 + /// + public ShellProperty Store + { + get + { + PropertyKey key = SystemProperties.System.Message.Store; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.ToAddress -- PKEY_Message_ToAddress + /// Description: Addresses in To: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 16 + /// + public ShellProperty ToAddress + { + get + { + PropertyKey key = SystemProperties.System.Message.ToAddress; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.ToDoFlags -- PKEY_Message_ToDoFlags + /// Description: Flags associated with a message flagged to know if it's still active, if it was custom flagged, etc. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {1F856A9F-6900-4ABA-9505-2D5F1B4D66CB}, 100 + /// + public ShellProperty ToDoFlags + { + get + { + PropertyKey key = SystemProperties.System.Message.ToDoFlags; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.ToDoTitle -- PKEY_Message_ToDoTitle + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {BCCC8A3C-8CEF-42E5-9B1C-C69079398BC7}, 100 + /// + public ShellProperty ToDoTitle + { + get + { + PropertyKey key = SystemProperties.System.Message.ToDoTitle; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Message.ToName -- PKEY_Message_ToName + /// Description: Person names in To: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 17 + /// + public ShellProperty ToName + { + get + { + PropertyKey key = SystemProperties.System.Message.ToName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Music Properties + /// + public class PropertySystemMusic : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemMusic(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Music.AlbumArtist -- PKEY_Music_AlbumArtist + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 13 (PIDSI_MUSIC_ALBUM_ARTIST) + /// + public ShellProperty AlbumArtist + { + get + { + PropertyKey key = SystemProperties.System.Music.AlbumArtist; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.AlbumID -- PKEY_Music_AlbumID + /// Description: Concatenation of System.Music.AlbumArtist and System.Music.AlbumTitle, suitable for indexing and display. + ///Used to differentiate albums with the same title from different artists. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 100 + /// + public ShellProperty AlbumID + { + get + { + PropertyKey key = SystemProperties.System.Music.AlbumID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.AlbumTitle -- PKEY_Music_AlbumTitle + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 4 (PIDSI_MUSIC_ALBUM) + /// + public ShellProperty AlbumTitle + { + get + { + PropertyKey key = SystemProperties.System.Music.AlbumTitle; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.Artist -- PKEY_Music_Artist + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 2 (PIDSI_MUSIC_ARTIST) + /// + public ShellProperty Artist + { + get + { + PropertyKey key = SystemProperties.System.Music.Artist; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.BeatsPerMinute -- PKEY_Music_BeatsPerMinute + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 35 (PIDSI_MUSIC_BEATS_PER_MINUTE) + /// + public ShellProperty BeatsPerMinute + { + get + { + PropertyKey key = SystemProperties.System.Music.BeatsPerMinute; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.Composer -- PKEY_Music_Composer + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 19 (PIDMSI_COMPOSER) + /// + public ShellProperty Composer + { + get + { + PropertyKey key = SystemProperties.System.Music.Composer; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.Conductor -- PKEY_Music_Conductor + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 36 (PIDSI_MUSIC_CONDUCTOR) + /// + public ShellProperty Conductor + { + get + { + PropertyKey key = SystemProperties.System.Music.Conductor; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.ContentGroupDescription -- PKEY_Music_ContentGroupDescription + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 33 (PIDSI_MUSIC_CONTENT_GROUP_DESCRIPTION) + /// + public ShellProperty ContentGroupDescription + { + get + { + PropertyKey key = SystemProperties.System.Music.ContentGroupDescription; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.DisplayArtist -- PKEY_Music_DisplayArtist + /// Description: This property returns the best representation of Album Artist for a given music file + ///based upon AlbumArtist, ContributingArtist and compilation info. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FD122953-FA93-4EF7-92C3-04C946B2F7C8}, 100 + /// + public ShellProperty DisplayArtist + { + get + { + PropertyKey key = SystemProperties.System.Music.DisplayArtist; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.Genre -- PKEY_Music_Genre + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 11 (PIDSI_MUSIC_GENRE) + /// + public ShellProperty Genre + { + get + { + PropertyKey key = SystemProperties.System.Music.Genre; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.InitialKey -- PKEY_Music_InitialKey + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 34 (PIDSI_MUSIC_INITIAL_KEY) + /// + public ShellProperty InitialKey + { + get + { + PropertyKey key = SystemProperties.System.Music.InitialKey; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.IsCompilation -- PKEY_Music_IsCompilation + /// Description: Indicates whether the file is part of a compilation. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {C449D5CB-9EA4-4809-82E8-AF9D59DED6D1}, 100 + /// + public ShellProperty IsCompilation + { + get + { + PropertyKey key = SystemProperties.System.Music.IsCompilation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.Lyrics -- PKEY_Music_Lyrics + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 12 (PIDSI_MUSIC_LYRICS) + /// + public ShellProperty Lyrics + { + get + { + PropertyKey key = SystemProperties.System.Music.Lyrics; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.Mood -- PKEY_Music_Mood + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 39 (PIDSI_MUSIC_MOOD) + /// + public ShellProperty Mood + { + get + { + PropertyKey key = SystemProperties.System.Music.Mood; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.PartOfSet -- PKEY_Music_PartOfSet + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 37 (PIDSI_MUSIC_PART_OF_SET) + /// + public ShellProperty PartOfSet + { + get + { + PropertyKey key = SystemProperties.System.Music.PartOfSet; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.Period -- PKEY_Music_Period + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 31 (PIDMSI_PERIOD) + /// + public ShellProperty Period + { + get + { + PropertyKey key = SystemProperties.System.Music.Period; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.SynchronizedLyrics -- PKEY_Music_SynchronizedLyrics + /// Description: + /// Type: Blob -- VT_BLOB + /// FormatID: {6B223B6A-162E-4AA9-B39F-05D678FC6D77}, 100 + /// + public ShellProperty SynchronizedLyrics + { + get + { + PropertyKey key = SystemProperties.System.Music.SynchronizedLyrics; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Music.TrackNumber -- PKEY_Music_TrackNumber + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 7 (PIDSI_MUSIC_TRACK) + /// + public ShellProperty TrackNumber + { + get + { + PropertyKey key = SystemProperties.System.Music.TrackNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Note Properties + /// + public class PropertySystemNote : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemNote(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Note.Color -- PKEY_Note_Color + /// Description: + /// Type: UInt16 -- VT_UI2 + /// FormatID: {4776CAFA-BCE4-4CB1-A23E-265E76D8EB11}, 100 + /// + public ShellProperty Color + { + get + { + PropertyKey key = SystemProperties.System.Note.Color; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Note.ColorText -- PKEY_Note_ColorText + /// Description: This is the user-friendly form of System.Note.Color. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {46B4E8DE-CDB2-440D-885C-1658EB65B914}, 100 + /// + public ShellProperty ColorText + { + get + { + PropertyKey key = SystemProperties.System.Note.ColorText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Photo Properties + /// + public class PropertySystemPhoto : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemPhoto(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Photo.Aperture -- PKEY_Photo_Aperture + /// Description: PropertyTagExifAperture. Calculated from PKEY_Photo_ApertureNumerator and PKEY_Photo_ApertureDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37378 + /// + public ShellProperty Aperture + { + get + { + PropertyKey key = SystemProperties.System.Photo.Aperture; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ApertureDenominator -- PKEY_Photo_ApertureDenominator + /// Description: Denominator of PKEY_Photo_Aperture + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {E1A9A38B-6685-46BD-875E-570DC7AD7320}, 100 + /// + public ShellProperty ApertureDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ApertureDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ApertureNumerator -- PKEY_Photo_ApertureNumerator + /// Description: Numerator of PKEY_Photo_Aperture + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {0337ECEC-39FB-4581-A0BD-4C4CC51E9914}, 100 + /// + public ShellProperty ApertureNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ApertureNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.Brightness -- PKEY_Photo_Brightness + /// Description: This is the brightness of the photo. + /// + ///Calculated from PKEY_Photo_BrightnessNumerator and PKEY_Photo_BrightnessDenominator. + /// + ///The units are "APEX", normally in the range of -99.99 to 99.99. If the numerator of + ///the recorded value is FFFFFFFF.H, "Unknown" should be indicated. + /// + /// Type: Double -- VT_R8 + /// FormatID: {1A701BF6-478C-4361-83AB-3701BB053C58}, 100 (PropertyTagExifBrightness) + /// + public ShellProperty Brightness + { + get + { + PropertyKey key = SystemProperties.System.Photo.Brightness; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.BrightnessDenominator -- PKEY_Photo_BrightnessDenominator + /// Description: Denominator of PKEY_Photo_Brightness + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {6EBE6946-2321-440A-90F0-C043EFD32476}, 100 + /// + public ShellProperty BrightnessDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.BrightnessDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.BrightnessNumerator -- PKEY_Photo_BrightnessNumerator + /// Description: Numerator of PKEY_Photo_Brightness + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {9E7D118F-B314-45A0-8CFB-D654B917C9E9}, 100 + /// + public ShellProperty BrightnessNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.BrightnessNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.CameraManufacturer -- PKEY_Photo_CameraManufacturer + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 271 (PropertyTagEquipMake) + /// + public ShellProperty CameraManufacturer + { + get + { + PropertyKey key = SystemProperties.System.Photo.CameraManufacturer; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.CameraModel -- PKEY_Photo_CameraModel + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 272 (PropertyTagEquipModel) + /// + public ShellProperty CameraModel + { + get + { + PropertyKey key = SystemProperties.System.Photo.CameraModel; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.CameraSerialNumber -- PKEY_Photo_CameraSerialNumber + /// Description: Serial number of camera that produced this photo + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 273 + /// + public ShellProperty CameraSerialNumber + { + get + { + PropertyKey key = SystemProperties.System.Photo.CameraSerialNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.Contrast -- PKEY_Photo_Contrast + /// Description: This indicates the direction of contrast processing applied by the camera + ///when the image was shot. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {2A785BA9-8D23-4DED-82E6-60A350C86A10}, 100 + /// + public ShellProperty Contrast + { + get + { + PropertyKey key = SystemProperties.System.Photo.Contrast; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ContrastText -- PKEY_Photo_ContrastText + /// Description: This is the user-friendly form of System.Photo.Contrast. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {59DDE9F2-5253-40EA-9A8B-479E96C6249A}, 100 + /// + public ShellProperty ContrastText + { + get + { + PropertyKey key = SystemProperties.System.Photo.ContrastText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.DateTaken -- PKEY_Photo_DateTaken + /// Description: PropertyTagExifDTOrig + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 36867 + /// + public ShellProperty DateTaken + { + get + { + PropertyKey key = SystemProperties.System.Photo.DateTaken; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.DigitalZoom -- PKEY_Photo_DigitalZoom + /// Description: PropertyTagExifDigitalZoom. Calculated from PKEY_Photo_DigitalZoomNumerator and PKEY_Photo_DigitalZoomDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {F85BF840-A925-4BC2-B0C4-8E36B598679E}, 100 + /// + public ShellProperty DigitalZoom + { + get + { + PropertyKey key = SystemProperties.System.Photo.DigitalZoom; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.DigitalZoomDenominator -- PKEY_Photo_DigitalZoomDenominator + /// Description: Denominator of PKEY_Photo_DigitalZoom + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {745BAF0E-E5C1-4CFB-8A1B-D031A0A52393}, 100 + /// + public ShellProperty DigitalZoomDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.DigitalZoomDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.DigitalZoomNumerator -- PKEY_Photo_DigitalZoomNumerator + /// Description: Numerator of PKEY_Photo_DigitalZoom + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {16CBB924-6500-473B-A5BE-F1599BCBE413}, 100 + /// + public ShellProperty DigitalZoomNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.DigitalZoomNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.Event -- PKEY_Photo_Event + /// Description: The event at which the photo was taken + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 18248 + /// + public ShellProperty Event + { + get + { + PropertyKey key = SystemProperties.System.Photo.Event; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.EXIFVersion -- PKEY_Photo_EXIFVersion + /// Description: The EXIF version. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D35F743A-EB2E-47F2-A286-844132CB1427}, 100 + /// + public ShellProperty EXIFVersion + { + get + { + PropertyKey key = SystemProperties.System.Photo.EXIFVersion; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureBias -- PKEY_Photo_ExposureBias + /// Description: PropertyTagExifExposureBias. Calculated from PKEY_Photo_ExposureBiasNumerator and PKEY_Photo_ExposureBiasDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37380 + /// + public ShellProperty ExposureBias + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureBias; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureBiasDenominator -- PKEY_Photo_ExposureBiasDenominator + /// Description: Denominator of PKEY_Photo_ExposureBias + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {AB205E50-04B7-461C-A18C-2F233836E627}, 100 + /// + public ShellProperty ExposureBiasDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureBiasDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureBiasNumerator -- PKEY_Photo_ExposureBiasNumerator + /// Description: Numerator of PKEY_Photo_ExposureBias + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {738BF284-1D87-420B-92CF-5834BF6EF9ED}, 100 + /// + public ShellProperty ExposureBiasNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureBiasNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureIndex -- PKEY_Photo_ExposureIndex + /// Description: PropertyTagExifExposureIndex. Calculated from PKEY_Photo_ExposureIndexNumerator and PKEY_Photo_ExposureIndexDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {967B5AF8-995A-46ED-9E11-35B3C5B9782D}, 100 + /// + public ShellProperty ExposureIndex + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureIndex; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureIndexDenominator -- PKEY_Photo_ExposureIndexDenominator + /// Description: Denominator of PKEY_Photo_ExposureIndex + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {93112F89-C28B-492F-8A9D-4BE2062CEE8A}, 100 + /// + public ShellProperty ExposureIndexDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureIndexDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureIndexNumerator -- PKEY_Photo_ExposureIndexNumerator + /// Description: Numerator of PKEY_Photo_ExposureIndex + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {CDEDCF30-8919-44DF-8F4C-4EB2FFDB8D89}, 100 + /// + public ShellProperty ExposureIndexNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureIndexNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureProgram -- PKEY_Photo_ExposureProgram + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 34850 (PropertyTagExifExposureProg) + /// + public ShellProperty ExposureProgram + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureProgram; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureProgramText -- PKEY_Photo_ExposureProgramText + /// Description: This is the user-friendly form of System.Photo.ExposureProgram. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FEC690B7-5F30-4646-AE47-4CAAFBA884A3}, 100 + /// + public ShellProperty ExposureProgramText + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureProgramText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureTime -- PKEY_Photo_ExposureTime + /// Description: PropertyTagExifExposureTime. Calculated from PKEY_Photo_ExposureTimeNumerator and PKEY_Photo_ExposureTimeDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 33434 + /// + public ShellProperty ExposureTime + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureTime; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureTimeDenominator -- PKEY_Photo_ExposureTimeDenominator + /// Description: Denominator of PKEY_Photo_ExposureTime + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {55E98597-AD16-42E0-B624-21599A199838}, 100 + /// + public ShellProperty ExposureTimeDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureTimeDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ExposureTimeNumerator -- PKEY_Photo_ExposureTimeNumerator + /// Description: Numerator of PKEY_Photo_ExposureTime + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {257E44E2-9031-4323-AC38-85C552871B2E}, 100 + /// + public ShellProperty ExposureTimeNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ExposureTimeNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.Flash -- PKEY_Photo_Flash + /// Description: PropertyTagExifFlash + /// + /// Type: Byte -- VT_UI1 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37385 + /// + public ShellProperty Flash + { + get + { + PropertyKey key = SystemProperties.System.Photo.Flash; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FlashEnergy -- PKEY_Photo_FlashEnergy + /// Description: PropertyTagExifFlashEnergy. Calculated from PKEY_Photo_FlashEnergyNumerator and PKEY_Photo_FlashEnergyDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 41483 + /// + public ShellProperty FlashEnergy + { + get + { + PropertyKey key = SystemProperties.System.Photo.FlashEnergy; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FlashEnergyDenominator -- PKEY_Photo_FlashEnergyDenominator + /// Description: Denominator of PKEY_Photo_FlashEnergy + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {D7B61C70-6323-49CD-A5FC-C84277162C97}, 100 + /// + public ShellProperty FlashEnergyDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FlashEnergyDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FlashEnergyNumerator -- PKEY_Photo_FlashEnergyNumerator + /// Description: Numerator of PKEY_Photo_FlashEnergy + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {FCAD3D3D-0858-400F-AAA3-2F66CCE2A6BC}, 100 + /// + public ShellProperty FlashEnergyNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FlashEnergyNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FlashManufacturer -- PKEY_Photo_FlashManufacturer + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {AABAF6C9-E0C5-4719-8585-57B103E584FE}, 100 + /// + public ShellProperty FlashManufacturer + { + get + { + PropertyKey key = SystemProperties.System.Photo.FlashManufacturer; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FlashModel -- PKEY_Photo_FlashModel + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FE83BB35-4D1A-42E2-916B-06F3E1AF719E}, 100 + /// + public ShellProperty FlashModel + { + get + { + PropertyKey key = SystemProperties.System.Photo.FlashModel; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FlashText -- PKEY_Photo_FlashText + /// Description: This is the user-friendly form of System.Photo.Flash. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6B8B68F6-200B-47EA-8D25-D8050F57339F}, 100 + /// + public ShellProperty FlashText + { + get + { + PropertyKey key = SystemProperties.System.Photo.FlashText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FNumber -- PKEY_Photo_FNumber + /// Description: PropertyTagExifFNumber. Calculated from PKEY_Photo_FNumberNumerator and PKEY_Photo_FNumberDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 33437 + /// + public ShellProperty FNumber + { + get + { + PropertyKey key = SystemProperties.System.Photo.FNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FNumberDenominator -- PKEY_Photo_FNumberDenominator + /// Description: Denominator of PKEY_Photo_FNumber + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {E92A2496-223B-4463-A4E3-30EABBA79D80}, 100 + /// + public ShellProperty FNumberDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FNumberDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FNumberNumerator -- PKEY_Photo_FNumberNumerator + /// Description: Numerator of PKEY_Photo_FNumber + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {1B97738A-FDFC-462F-9D93-1957E08BE90C}, 100 + /// + public ShellProperty FNumberNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FNumberNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalLength -- PKEY_Photo_FocalLength + /// Description: PropertyTagExifFocalLength. Calculated from PKEY_Photo_FocalLengthNumerator and PKEY_Photo_FocalLengthDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37386 + /// + public ShellProperty FocalLength + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalLength; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalLengthDenominator -- PKEY_Photo_FocalLengthDenominator + /// Description: Denominator of PKEY_Photo_FocalLength + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {305BC615-DCA1-44A5-9FD4-10C0BA79412E}, 100 + /// + public ShellProperty FocalLengthDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalLengthDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalLengthInFilm -- PKEY_Photo_FocalLengthInFilm + /// Description: + /// Type: UInt16 -- VT_UI2 + /// FormatID: {A0E74609-B84D-4F49-B860-462BD9971F98}, 100 + /// + public ShellProperty FocalLengthInFilm + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalLengthInFilm; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalLengthNumerator -- PKEY_Photo_FocalLengthNumerator + /// Description: Numerator of PKEY_Photo_FocalLength + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {776B6B3B-1E3D-4B0C-9A0E-8FBAF2A8492A}, 100 + /// + public ShellProperty FocalLengthNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalLengthNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalPlaneXResolution -- PKEY_Photo_FocalPlaneXResolution + /// Description: PropertyTagExifFocalXRes. Calculated from PKEY_Photo_FocalPlaneXResolutionNumerator and + ///PKEY_Photo_FocalPlaneXResolutionDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {CFC08D97-C6F7-4484-89DD-EBEF4356FE76}, 100 + /// + public ShellProperty FocalPlaneXResolution + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalPlaneXResolution; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalPlaneXResolutionDenominator -- PKEY_Photo_FocalPlaneXResolutionDenominator + /// Description: Denominator of PKEY_Photo_FocalPlaneXResolution + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {0933F3F5-4786-4F46-A8E8-D64DD37FA521}, 100 + /// + public ShellProperty FocalPlaneXResolutionDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalPlaneXResolutionDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalPlaneXResolutionNumerator -- PKEY_Photo_FocalPlaneXResolutionNumerator + /// Description: Numerator of PKEY_Photo_FocalPlaneXResolution + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {DCCB10AF-B4E2-4B88-95F9-031B4D5AB490}, 100 + /// + public ShellProperty FocalPlaneXResolutionNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalPlaneXResolutionNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalPlaneYResolution -- PKEY_Photo_FocalPlaneYResolution + /// Description: PropertyTagExifFocalYRes. Calculated from PKEY_Photo_FocalPlaneYResolutionNumerator and + ///PKEY_Photo_FocalPlaneYResolutionDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {4FFFE4D0-914F-4AC4-8D6F-C9C61DE169B1}, 100 + /// + public ShellProperty FocalPlaneYResolution + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalPlaneYResolution; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalPlaneYResolutionDenominator -- PKEY_Photo_FocalPlaneYResolutionDenominator + /// Description: Denominator of PKEY_Photo_FocalPlaneYResolution + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {1D6179A6-A876-4031-B013-3347B2B64DC8}, 100 + /// + public ShellProperty FocalPlaneYResolutionDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalPlaneYResolutionDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.FocalPlaneYResolutionNumerator -- PKEY_Photo_FocalPlaneYResolutionNumerator + /// Description: Numerator of PKEY_Photo_FocalPlaneYResolution + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {A2E541C5-4440-4BA8-867E-75CFC06828CD}, 100 + /// + public ShellProperty FocalPlaneYResolutionNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.FocalPlaneYResolutionNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.GainControl -- PKEY_Photo_GainControl + /// Description: This indicates the degree of overall image gain adjustment. + /// + ///Calculated from PKEY_Photo_GainControlNumerator and PKEY_Photo_GainControlDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {FA304789-00C7-4D80-904A-1E4DCC7265AA}, 100 (PropertyTagExifGainControl) + /// + public ShellProperty GainControl + { + get + { + PropertyKey key = SystemProperties.System.Photo.GainControl; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.GainControlDenominator -- PKEY_Photo_GainControlDenominator + /// Description: Denominator of PKEY_Photo_GainControl + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {42864DFD-9DA4-4F77-BDED-4AAD7B256735}, 100 + /// + public ShellProperty GainControlDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.GainControlDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.GainControlNumerator -- PKEY_Photo_GainControlNumerator + /// Description: Numerator of PKEY_Photo_GainControl + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {8E8ECF7C-B7B8-4EB8-A63F-0EE715C96F9E}, 100 + /// + public ShellProperty GainControlNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.GainControlNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.GainControlText -- PKEY_Photo_GainControlText + /// Description: This is the user-friendly form of System.Photo.GainControl. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C06238B2-0BF9-4279-A723-25856715CB9D}, 100 + /// + public ShellProperty GainControlText + { + get + { + PropertyKey key = SystemProperties.System.Photo.GainControlText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ISOSpeed -- PKEY_Photo_ISOSpeed + /// Description: PropertyTagExifISOSpeed + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 34855 + /// + public ShellProperty ISOSpeed + { + get + { + PropertyKey key = SystemProperties.System.Photo.ISOSpeed; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.LensManufacturer -- PKEY_Photo_LensManufacturer + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E6DDCAF7-29C5-4F0A-9A68-D19412EC7090}, 100 + /// + public ShellProperty LensManufacturer + { + get + { + PropertyKey key = SystemProperties.System.Photo.LensManufacturer; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.LensModel -- PKEY_Photo_LensModel + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E1277516-2B5F-4869-89B1-2E585BD38B7A}, 100 + /// + public ShellProperty LensModel + { + get + { + PropertyKey key = SystemProperties.System.Photo.LensModel; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.LightSource -- PKEY_Photo_LightSource + /// Description: PropertyTagExifLightSource + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37384 + /// + public ShellProperty LightSource + { + get + { + PropertyKey key = SystemProperties.System.Photo.LightSource; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.MakerNote -- PKEY_Photo_MakerNote + /// Description: + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: {FA303353-B659-4052-85E9-BCAC79549B84}, 100 + /// + public ShellProperty MakerNote + { + get + { + PropertyKey key = SystemProperties.System.Photo.MakerNote; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.MakerNoteOffset -- PKEY_Photo_MakerNoteOffset + /// Description: + /// Type: UInt64 -- VT_UI8 + /// FormatID: {813F4124-34E6-4D17-AB3E-6B1F3C2247A1}, 100 + /// + public ShellProperty MakerNoteOffset + { + get + { + PropertyKey key = SystemProperties.System.Photo.MakerNoteOffset; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.MaxAperture -- PKEY_Photo_MaxAperture + /// Description: Calculated from PKEY_Photo_MaxApertureNumerator and PKEY_Photo_MaxApertureDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {08F6D7C2-E3F2-44FC-AF1E-5AA5C81A2D3E}, 100 + /// + public ShellProperty MaxAperture + { + get + { + PropertyKey key = SystemProperties.System.Photo.MaxAperture; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.MaxApertureDenominator -- PKEY_Photo_MaxApertureDenominator + /// Description: Denominator of PKEY_Photo_MaxAperture + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {C77724D4-601F-46C5-9B89-C53F93BCEB77}, 100 + /// + public ShellProperty MaxApertureDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.MaxApertureDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.MaxApertureNumerator -- PKEY_Photo_MaxApertureNumerator + /// Description: Numerator of PKEY_Photo_MaxAperture + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {C107E191-A459-44C5-9AE6-B952AD4B906D}, 100 + /// + public ShellProperty MaxApertureNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.MaxApertureNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.MeteringMode -- PKEY_Photo_MeteringMode + /// Description: PropertyTagExifMeteringMode + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37383 + /// + public ShellProperty MeteringMode + { + get + { + PropertyKey key = SystemProperties.System.Photo.MeteringMode; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.MeteringModeText -- PKEY_Photo_MeteringModeText + /// Description: This is the user-friendly form of System.Photo.MeteringMode. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F628FD8C-7BA8-465A-A65B-C5AA79263A9E}, 100 + /// + public ShellProperty MeteringModeText + { + get + { + PropertyKey key = SystemProperties.System.Photo.MeteringModeText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.Orientation -- PKEY_Photo_Orientation + /// Description: This is the image orientation viewed in terms of rows and columns. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 274 (PropertyTagOrientation) + /// + public ShellProperty Orientation + { + get + { + PropertyKey key = SystemProperties.System.Photo.Orientation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.OrientationText -- PKEY_Photo_OrientationText + /// Description: This is the user-friendly form of System.Photo.Orientation. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A9EA193C-C511-498A-A06B-58E2776DCC28}, 100 + /// + public ShellProperty OrientationText + { + get + { + PropertyKey key = SystemProperties.System.Photo.OrientationText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.PeopleNames -- PKEY_Photo_PeopleNames + /// Description: The people tags on an image. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: {E8309B6E-084C-49B4-B1FC-90A80331B638}, 100 + /// + public ShellProperty PeopleNames + { + get + { + PropertyKey key = SystemProperties.System.Photo.PeopleNames; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.PhotometricInterpretation -- PKEY_Photo_PhotometricInterpretation + /// Description: This is the pixel composition. In JPEG compressed data, a JPEG marker is used + ///instead of this property. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {341796F1-1DF9-4B1C-A564-91BDEFA43877}, 100 + /// + public ShellProperty PhotometricInterpretation + { + get + { + PropertyKey key = SystemProperties.System.Photo.PhotometricInterpretation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.PhotometricInterpretationText -- PKEY_Photo_PhotometricInterpretationText + /// Description: This is the user-friendly form of System.Photo.PhotometricInterpretation. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {821437D6-9EAB-4765-A589-3B1CBBD22A61}, 100 + /// + public ShellProperty PhotometricInterpretationText + { + get + { + PropertyKey key = SystemProperties.System.Photo.PhotometricInterpretationText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ProgramMode -- PKEY_Photo_ProgramMode + /// Description: This is the class of the program used by the camera to set exposure when the + ///picture is taken. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {6D217F6D-3F6A-4825-B470-5F03CA2FBE9B}, 100 + /// + public ShellProperty ProgramMode + { + get + { + PropertyKey key = SystemProperties.System.Photo.ProgramMode; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ProgramModeText -- PKEY_Photo_ProgramModeText + /// Description: This is the user-friendly form of System.Photo.ProgramMode. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7FE3AA27-2648-42F3-89B0-454E5CB150C3}, 100 + /// + public ShellProperty ProgramModeText + { + get + { + PropertyKey key = SystemProperties.System.Photo.ProgramModeText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.RelatedSoundFile -- PKEY_Photo_RelatedSoundFile + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {318A6B45-087F-4DC2-B8CC-05359551FC9E}, 100 + /// + public ShellProperty RelatedSoundFile + { + get + { + PropertyKey key = SystemProperties.System.Photo.RelatedSoundFile; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.Saturation -- PKEY_Photo_Saturation + /// Description: This indicates the direction of saturation processing applied by the camera when + ///the image was shot. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {49237325-A95A-4F67-B211-816B2D45D2E0}, 100 + /// + public ShellProperty Saturation + { + get + { + PropertyKey key = SystemProperties.System.Photo.Saturation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.SaturationText -- PKEY_Photo_SaturationText + /// Description: This is the user-friendly form of System.Photo.Saturation. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {61478C08-B600-4A84-BBE4-E99C45F0A072}, 100 + /// + public ShellProperty SaturationText + { + get + { + PropertyKey key = SystemProperties.System.Photo.SaturationText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.Sharpness -- PKEY_Photo_Sharpness + /// Description: This indicates the direction of sharpness processing applied by the camera when + ///the image was shot. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {FC6976DB-8349-4970-AE97-B3C5316A08F0}, 100 + /// + public ShellProperty Sharpness + { + get + { + PropertyKey key = SystemProperties.System.Photo.Sharpness; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.SharpnessText -- PKEY_Photo_SharpnessText + /// Description: This is the user-friendly form of System.Photo.Sharpness. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {51EC3F47-DD50-421D-8769-334F50424B1E}, 100 + /// + public ShellProperty SharpnessText + { + get + { + PropertyKey key = SystemProperties.System.Photo.SharpnessText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ShutterSpeed -- PKEY_Photo_ShutterSpeed + /// Description: PropertyTagExifShutterSpeed. Calculated from PKEY_Photo_ShutterSpeedNumerator and PKEY_Photo_ShutterSpeedDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37377 + /// + public ShellProperty ShutterSpeed + { + get + { + PropertyKey key = SystemProperties.System.Photo.ShutterSpeed; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ShutterSpeedDenominator -- PKEY_Photo_ShutterSpeedDenominator + /// Description: Denominator of PKEY_Photo_ShutterSpeed + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {E13D8975-81C7-4948-AE3F-37CAE11E8FF7}, 100 + /// + public ShellProperty ShutterSpeedDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ShutterSpeedDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.ShutterSpeedNumerator -- PKEY_Photo_ShutterSpeedNumerator + /// Description: Numerator of PKEY_Photo_ShutterSpeed + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {16EA4042-D6F4-4BCA-8349-7C78D30FB333}, 100 + /// + public ShellProperty ShutterSpeedNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.ShutterSpeedNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.SubjectDistance -- PKEY_Photo_SubjectDistance + /// Description: PropertyTagExifSubjectDist. Calculated from PKEY_Photo_SubjectDistanceNumerator and PKEY_Photo_SubjectDistanceDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37382 + /// + public ShellProperty SubjectDistance + { + get + { + PropertyKey key = SystemProperties.System.Photo.SubjectDistance; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.SubjectDistanceDenominator -- PKEY_Photo_SubjectDistanceDenominator + /// Description: Denominator of PKEY_Photo_SubjectDistance + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {0C840A88-B043-466D-9766-D4B26DA3FA77}, 100 + /// + public ShellProperty SubjectDistanceDenominator + { + get + { + PropertyKey key = SystemProperties.System.Photo.SubjectDistanceDenominator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.SubjectDistanceNumerator -- PKEY_Photo_SubjectDistanceNumerator + /// Description: Numerator of PKEY_Photo_SubjectDistance + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {8AF4961C-F526-43E5-AA81-DB768219178D}, 100 + /// + public ShellProperty SubjectDistanceNumerator + { + get + { + PropertyKey key = SystemProperties.System.Photo.SubjectDistanceNumerator; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.TagViewAggregate -- PKEY_Photo_TagViewAggregate + /// Description: A read-only aggregation of tag-like properties for use in building views. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: {B812F15D-C2D8-4BBF-BACD-79744346113F}, 100 + /// + public ShellProperty TagViewAggregate + { + get + { + PropertyKey key = SystemProperties.System.Photo.TagViewAggregate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.TranscodedForSync -- PKEY_Photo_TranscodedForSync + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {9A8EBB75-6458-4E82-BACB-35C0095B03BB}, 100 + /// + public ShellProperty TranscodedForSync + { + get + { + PropertyKey key = SystemProperties.System.Photo.TranscodedForSync; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.WhiteBalance -- PKEY_Photo_WhiteBalance + /// Description: This indicates the white balance mode set when the image was shot. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {EE3D3D8A-5381-4CFA-B13B-AAF66B5F4EC9}, 100 + /// + public ShellProperty WhiteBalance + { + get + { + PropertyKey key = SystemProperties.System.Photo.WhiteBalance; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Photo.WhiteBalanceText -- PKEY_Photo_WhiteBalanceText + /// Description: This is the user-friendly form of System.Photo.WhiteBalance. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6336B95E-C7A7-426D-86FD-7AE3D39C84B4}, 100 + /// + public ShellProperty WhiteBalanceText + { + get + { + PropertyKey key = SystemProperties.System.Photo.WhiteBalanceText; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.PropGroup Properties + /// + public class PropertySystemPropGroup : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemPropGroup(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.PropGroup.Advanced -- PKEY_PropGroup_Advanced + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {900A403B-097B-4B95-8AE2-071FDAEEB118}, 100 + /// + public ShellProperty Advanced + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Advanced; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Audio -- PKEY_PropGroup_Audio + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {2804D469-788F-48AA-8570-71B9C187E138}, 100 + /// + public ShellProperty Audio + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Audio; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Calendar -- PKEY_PropGroup_Calendar + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {9973D2B5-BFD8-438A-BA94-5349B293181A}, 100 + /// + public ShellProperty Calendar + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Calendar; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Camera -- PKEY_PropGroup_Camera + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {DE00DE32-547E-4981-AD4B-542F2E9007D8}, 100 + /// + public ShellProperty Camera + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Camera; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Contact -- PKEY_PropGroup_Contact + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {DF975FD3-250A-4004-858F-34E29A3E37AA}, 100 + /// + public ShellProperty Contact + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Contact; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Content -- PKEY_PropGroup_Content + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {D0DAB0BA-368A-4050-A882-6C010FD19A4F}, 100 + /// + public ShellProperty Content + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Content; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Description -- PKEY_PropGroup_Description + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {8969B275-9475-4E00-A887-FF93B8B41E44}, 100 + /// + public ShellProperty Description + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Description; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.FileSystem -- PKEY_PropGroup_FileSystem + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {E3A7D2C1-80FC-4B40-8F34-30EA111BDC2E}, 100 + /// + public ShellProperty FileSystem + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.FileSystem; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.General -- PKEY_PropGroup_General + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {CC301630-B192-4C22-B372-9F4C6D338E07}, 100 + /// + public ShellProperty General + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.General; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.GPS -- PKEY_PropGroup_GPS + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {F3713ADA-90E3-4E11-AAE5-FDC17685B9BE}, 100 + /// + public ShellProperty GPS + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.GPS; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Image -- PKEY_PropGroup_Image + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {E3690A87-0FA8-4A2A-9A9F-FCE8827055AC}, 100 + /// + public ShellProperty Image + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Image; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Media -- PKEY_PropGroup_Media + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {61872CF7-6B5E-4B4B-AC2D-59DA84459248}, 100 + /// + public ShellProperty Media + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Media; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.MediaAdvanced -- PKEY_PropGroup_MediaAdvanced + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {8859A284-DE7E-4642-99BA-D431D044B1EC}, 100 + /// + public ShellProperty MediaAdvanced + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.MediaAdvanced; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Message -- PKEY_PropGroup_Message + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {7FD7259D-16B4-4135-9F97-7C96ECD2FA9E}, 100 + /// + public ShellProperty Message + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Message; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Music -- PKEY_PropGroup_Music + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {68DD6094-7216-40F1-A029-43FE7127043F}, 100 + /// + public ShellProperty Music + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Music; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Origin -- PKEY_PropGroup_Origin + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {2598D2FB-5569-4367-95DF-5CD3A177E1A5}, 100 + /// + public ShellProperty Origin + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Origin; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.PhotoAdvanced -- PKEY_PropGroup_PhotoAdvanced + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {0CB2BF5A-9EE7-4A86-8222-F01E07FDADAF}, 100 + /// + public ShellProperty PhotoAdvanced + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.PhotoAdvanced; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.RecordedTV -- PKEY_PropGroup_RecordedTV + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {E7B33238-6584-4170-A5C0-AC25EFD9DA56}, 100 + /// + public ShellProperty RecordedTV + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.RecordedTV; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropGroup.Video -- PKEY_PropGroup_Video + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {BEBE0920-7671-4C54-A3EB-49FDDFC191EE}, 100 + /// + public ShellProperty Video + { + get + { + PropertyKey key = SystemProperties.System.PropGroup.Video; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.PropList Properties + /// + public class PropertySystemPropList : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemPropList(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.PropList.ConflictPrompt -- PKEY_PropList_ConflictPrompt + /// Description: The list of properties to show in the file operation conflict resolution dialog. Properties with empty + ///values will not be displayed. Register under the regvalue of "ConflictPrompt". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 11 + /// + public ShellProperty ConflictPrompt + { + get + { + PropertyKey key = SystemProperties.System.PropList.ConflictPrompt; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.ContentViewModeForBrowse -- PKEY_PropList_ContentViewModeForBrowse + /// Description: The list of properties to show in the content view mode of an item in the context of browsing. + ///Register the regvalue under the name of "ContentViewModeForBrowse". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 13 + /// + public ShellProperty ContentViewModeForBrowse + { + get + { + PropertyKey key = SystemProperties.System.PropList.ContentViewModeForBrowse; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.ContentViewModeForSearch -- PKEY_PropList_ContentViewModeForSearch + /// Description: The list of properties to show in the content view mode of an item in the context of searching. + ///Register the regvalue under the name of "ContentViewModeForSearch". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 14 + /// + public ShellProperty ContentViewModeForSearch + { + get + { + PropertyKey key = SystemProperties.System.PropList.ContentViewModeForSearch; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.ExtendedTileInfo -- PKEY_PropList_ExtendedTileInfo + /// Description: The list of properties to show in the listview on extended tiles. Register under the regvalue of + ///"ExtendedTileInfo". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 9 + /// + public ShellProperty ExtendedTileInfo + { + get + { + PropertyKey key = SystemProperties.System.PropList.ExtendedTileInfo; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.FileOperationPrompt -- PKEY_PropList_FileOperationPrompt + /// Description: The list of properties to show in the file operation confirmation dialog. Properties with empty values + ///will not be displayed. If this list is not specified, then the InfoTip property list is used instead. + ///Register under the regvalue of "FileOperationPrompt". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 10 + /// + public ShellProperty FileOperationPrompt + { + get + { + PropertyKey key = SystemProperties.System.PropList.FileOperationPrompt; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.FullDetails -- PKEY_PropList_FullDetails + /// Description: The list of all the properties to show in the details page. Property groups can be included in this list + ///in order to more easily organize the UI. Register under the regvalue of "FullDetails". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 2 + /// + public ShellProperty FullDetails + { + get + { + PropertyKey key = SystemProperties.System.PropList.FullDetails; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.InfoTip -- PKEY_PropList_InfoTip + /// Description: The list of properties to show in the infotip. Properties with empty values will not be displayed. Register + ///under the regvalue of "InfoTip". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 4 (PID_PROPLIST_INFOTIP) + /// + public ShellProperty InfoTip + { + get + { + PropertyKey key = SystemProperties.System.PropList.InfoTip; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.NonPersonal -- PKEY_PropList_NonPersonal + /// Description: The list of properties that are considered 'non-personal'. When told to remove all non-personal properties + ///from a given file, the system will leave these particular properties untouched. Register under the regvalue + ///of "NonPersonal". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {49D1091F-082E-493F-B23F-D2308AA9668C}, 100 + /// + public ShellProperty NonPersonal + { + get + { + PropertyKey key = SystemProperties.System.PropList.NonPersonal; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.PreviewDetails -- PKEY_PropList_PreviewDetails + /// Description: The list of properties to display in the preview pane. Register under the regvalue of "PreviewDetails". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 8 + /// + public ShellProperty PreviewDetails + { + get + { + PropertyKey key = SystemProperties.System.PropList.PreviewDetails; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.PreviewTitle -- PKEY_PropList_PreviewTitle + /// Description: The one or two properties to display in the preview pane title section. The optional second property is + ///displayed as a subtitle. Register under the regvalue of "PreviewTitle". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 6 + /// + public ShellProperty PreviewTitle + { + get + { + PropertyKey key = SystemProperties.System.PropList.PreviewTitle; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.QuickTip -- PKEY_PropList_QuickTip + /// Description: The list of properties to show in the infotip when the item is on a slow network. Properties with empty + ///values will not be displayed. Register under the regvalue of "QuickTip". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 5 (PID_PROPLIST_QUICKTIP) + /// + public ShellProperty QuickTip + { + get + { + PropertyKey key = SystemProperties.System.PropList.QuickTip; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.TileInfo -- PKEY_PropList_TileInfo + /// Description: The list of properties to show in the listview on tiles. Register under the regvalue of "TileInfo". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 3 (PID_PROPLIST_TILEINFO) + /// + public ShellProperty TileInfo + { + get + { + PropertyKey key = SystemProperties.System.PropList.TileInfo; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.PropList.XPDetailsPanel -- PKEY_PropList_XPDetailsPanel + /// Description: The list of properties to display in the XP webview details panel. Obsolete. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_WebView) {F2275480-F782-4291-BD94-F13693513AEC}, 0 (PID_DISPLAY_PROPERTIES) + /// + public ShellProperty XPDetailsPanel + { + get + { + PropertyKey key = SystemProperties.System.PropList.XPDetailsPanel; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.RecordedTV Properties + /// + public class PropertySystemRecordedTV : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemRecordedTV(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.RecordedTV.ChannelNumber -- PKEY_RecordedTV_ChannelNumber + /// Description: Example: 42 + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 7 + /// + public ShellProperty ChannelNumber + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.ChannelNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.Credits -- PKEY_RecordedTV_Credits + /// Description: Example: "Don Messick/Frank Welker/Casey Kasem/Heather North/Nicole Jaffe;;;" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 4 + /// + public ShellProperty Credits + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.Credits; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.DateContentExpires -- PKEY_RecordedTV_DateContentExpires + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 15 + /// + public ShellProperty DateContentExpires + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.DateContentExpires; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.EpisodeName -- PKEY_RecordedTV_EpisodeName + /// Description: Example: "Nowhere to Hyde" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 2 + /// + public ShellProperty EpisodeName + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.EpisodeName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.IsATSCContent -- PKEY_RecordedTV_IsATSCContent + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 16 + /// + public ShellProperty IsATSCContent + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.IsATSCContent; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.IsClosedCaptioningAvailable -- PKEY_RecordedTV_IsClosedCaptioningAvailable + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 12 + /// + public ShellProperty IsClosedCaptioningAvailable + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.IsClosedCaptioningAvailable; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.IsDTVContent -- PKEY_RecordedTV_IsDTVContent + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 17 + /// + public ShellProperty IsDTVContent + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.IsDTVContent; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.IsHDContent -- PKEY_RecordedTV_IsHDContent + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 18 + /// + public ShellProperty IsHDContent + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.IsHDContent; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.IsRepeatBroadcast -- PKEY_RecordedTV_IsRepeatBroadcast + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 13 + /// + public ShellProperty IsRepeatBroadcast + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.IsRepeatBroadcast; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.IsSAP -- PKEY_RecordedTV_IsSAP + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 14 + /// + public ShellProperty IsSAP + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.IsSAP; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.NetworkAffiliation -- PKEY_RecordedTV_NetworkAffiliation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {2C53C813-FB63-4E22-A1AB-0B331CA1E273}, 100 + /// + public ShellProperty NetworkAffiliation + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.NetworkAffiliation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.OriginalBroadcastDate -- PKEY_RecordedTV_OriginalBroadcastDate + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {4684FE97-8765-4842-9C13-F006447B178C}, 100 + /// + public ShellProperty OriginalBroadcastDate + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.OriginalBroadcastDate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.ProgramDescription -- PKEY_RecordedTV_ProgramDescription + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 3 + /// + public ShellProperty ProgramDescription + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.ProgramDescription; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.RecordingTime -- PKEY_RecordedTV_RecordingTime + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {A5477F61-7A82-4ECA-9DDE-98B69B2479B3}, 100 + /// + public ShellProperty RecordingTime + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.RecordingTime; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.StationCallSign -- PKEY_RecordedTV_StationCallSign + /// Description: Example: "TOONP" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 5 + /// + public ShellProperty StationCallSign + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.StationCallSign; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.RecordedTV.StationName -- PKEY_RecordedTV_StationName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {1B5439E7-EBA1-4AF8-BDD7-7AF1D4549493}, 100 + /// + public ShellProperty StationName + { + get + { + PropertyKey key = SystemProperties.System.RecordedTV.StationName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Search Properties + /// + public class PropertySystemSearch : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemSearch(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Search.AutoSummary -- PKEY_Search_AutoSummary + /// Description: General Summary of the document. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 2 + /// + public ShellProperty AutoSummary + { + get + { + PropertyKey key = SystemProperties.System.Search.AutoSummary; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.ContainerHash -- PKEY_Search_ContainerHash + /// Description: Hash code used to identify attachments to be deleted based on a common container url + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {BCEEE283-35DF-4D53-826A-F36A3EEFC6BE}, 100 + /// + public ShellProperty ContainerHash + { + get + { + PropertyKey key = SystemProperties.System.Search.ContainerHash; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.Contents -- PKEY_Search_Contents + /// Description: The contents of the item. This property is for query restrictions only; it cannot be retrieved in a + ///query result. The Indexing Service friendly name is 'contents'. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 19 (PID_STG_CONTENTS) + /// + public ShellProperty Contents + { + get + { + PropertyKey key = SystemProperties.System.Search.Contents; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.EntryID -- PKEY_Search_EntryID + /// Description: The entry ID for an item within a given catalog in the Windows Search Index. + ///This value may be recycled, and therefore is not considered unique over time. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 5 (PROPID_QUERY_WORKID) + /// + public ShellProperty EntryID + { + get + { + PropertyKey key = SystemProperties.System.Search.EntryID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.ExtendedProperties -- PKEY_Search_ExtendedProperties + /// Description: + /// Type: Blob -- VT_BLOB + /// FormatID: {7B03B546-FA4F-4A52-A2FE-03D5311E5865}, 100 + /// + public ShellProperty ExtendedProperties + { + get + { + PropertyKey key = SystemProperties.System.Search.ExtendedProperties; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.GatherTime -- PKEY_Search_GatherTime + /// Description: The Datetime that the Windows Search Gatherer process last pushed properties of this document to the Windows Search Gatherer Plugins. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {0B63E350-9CCC-11D0-BCDB-00805FCCCE04}, 8 + /// + public ShellProperty GatherTime + { + get + { + PropertyKey key = SystemProperties.System.Search.GatherTime; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.HitCount -- PKEY_Search_HitCount + /// Description: When using CONTAINS over the Windows Search Index, this is the number of matches of the term. + ///If there are multiple CONTAINS, an AND computes the min number of hits and an OR the max number of hits. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 4 (PROPID_QUERY_HITCOUNT) + /// + public ShellProperty HitCount + { + get + { + PropertyKey key = SystemProperties.System.Search.HitCount; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.IsClosedDirectory -- PKEY_Search_IsClosedDirectory + /// Description: If this property is emitted with a value of TRUE, then it indicates that this URL's last modified time applies to all of it's children, and if this URL is deleted then all of it's children are deleted as well. For example, this would be emitted as TRUE when emitting the URL of an email so that all attachments are tied to the last modified time of that email. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 23 + /// + public ShellProperty IsClosedDirectory + { + get + { + PropertyKey key = SystemProperties.System.Search.IsClosedDirectory; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.IsFullyContained -- PKEY_Search_IsFullyContained + /// Description: Any child URL of a URL which has System.Search.IsClosedDirectory=TRUE must emit System.Search.IsFullyContained=TRUE. This ensures that the URL is not deleted at the end of a crawl because it hasn't been visited (which is the normal mechanism for detecting deletes). For example an email attachment would emit this property + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 24 + /// + public ShellProperty IsFullyContained + { + get + { + PropertyKey key = SystemProperties.System.Search.IsFullyContained; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.QueryFocusedSummary -- PKEY_Search_QueryFocusedSummary + /// Description: Query Focused Summary of the document. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 3 + /// + public ShellProperty QueryFocusedSummary + { + get + { + PropertyKey key = SystemProperties.System.Search.QueryFocusedSummary; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.QueryFocusedSummaryWithFallback -- PKEY_Search_QueryFocusedSummaryWithFallback + /// Description: Query Focused Summary of the document, if none is available it returns the AutoSummary. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 4 + /// + public ShellProperty QueryFocusedSummaryWithFallback + { + get + { + PropertyKey key = SystemProperties.System.Search.QueryFocusedSummaryWithFallback; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.Rank -- PKEY_Search_Rank + /// Description: Relevance rank of row. Ranges from 0-1000. Larger numbers = better matches. Query-time only. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 3 (PROPID_QUERY_RANK) + /// + public ShellProperty Rank + { + get + { + PropertyKey key = SystemProperties.System.Search.Rank; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.Store -- PKEY_Search_Store + /// Description: The identifier for the protocol handler that produced this item. (E.g. MAPI, CSC, FILE etc.) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A06992B3-8CAF-4ED7-A547-B259E32AC9FC}, 100 + /// + public ShellProperty Store + { + get + { + PropertyKey key = SystemProperties.System.Search.Store; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.UrlToIndex -- PKEY_Search_UrlToIndex + /// Description: This property should be emitted by a container IFilter for each child URL within the container. The children will eventually be crawled by the indexer if they are within scope. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 2 + /// + public ShellProperty UrlToIndex + { + get + { + PropertyKey key = SystemProperties.System.Search.UrlToIndex; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Search.UrlToIndexWithModificationTime -- PKEY_Search_UrlToIndexWithModificationTime + /// Description: This property is the same as System.Search.UrlToIndex except that it includes the time the URL was last modified. This is an optimization for the indexer as it doesn't have to call back into the protocol handler to ask for this information to determine if the content needs to be indexed again. The property is a vector with two elements, a VT_LPWSTR with the URL and a VT_FILETIME for the last modified time. + /// + /// Type: Multivalue Any -- VT_VECTOR | VT_NULL (For variants: VT_ARRAY | VT_NULL) + /// FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 12 + /// + public ShellProperty UrlToIndexWithModificationTime + { + get + { + PropertyKey key = SystemProperties.System.Search.UrlToIndexWithModificationTime; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Shell Properties + /// + public class PropertySystemShell : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemShell(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Shell.OmitFromView -- PKEY_Shell_OmitFromView + /// Description: Set this to a string value of 'True' to omit this item from shell views + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DE35258C-C695-4CBC-B982-38B0AD24CED0}, 2 + /// + public ShellProperty OmitFromView + { + get + { + PropertyKey key = SystemProperties.System.Shell.OmitFromView; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Shell.SFGAOFlagsStrings -- PKEY_Shell_SFGAOFlagsStrings + /// Description: Expresses the SFGAO flags as string values and is used as a query optimization. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D6942081-D53B-443D-AD47-5E059D9CD27A}, 2 + /// + public ShellProperty SFGAOFlagsStrings + { + get + { + PropertyKey key = SystemProperties.System.Shell.SFGAOFlagsStrings; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Software Properties + /// + public class PropertySystemSoftware : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemSoftware(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Software.DateLastUsed -- PKEY_Software_DateLastUsed + /// Description: + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {841E4F90-FF59-4D16-8947-E81BBFFAB36D}, 16 + /// + public ShellProperty DateLastUsed + { + get + { + PropertyKey key = SystemProperties.System.Software.DateLastUsed; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Software.ProductName -- PKEY_Software_ProductName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 7 + /// + public ShellProperty ProductName + { + get + { + PropertyKey key = SystemProperties.System.Software.ProductName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Sync Properties + /// + public class PropertySystemSync : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemSync(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Sync.Comments -- PKEY_Sync_Comments + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 13 + /// + public ShellProperty Comments + { + get + { + PropertyKey key = SystemProperties.System.Sync.Comments; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.ConflictDescription -- PKEY_Sync_ConflictDescription + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 4 + /// + public ShellProperty ConflictDescription + { + get + { + PropertyKey key = SystemProperties.System.Sync.ConflictDescription; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.ConflictFirstLocation -- PKEY_Sync_ConflictFirstLocation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 6 + /// + public ShellProperty ConflictFirstLocation + { + get + { + PropertyKey key = SystemProperties.System.Sync.ConflictFirstLocation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.ConflictSecondLocation -- PKEY_Sync_ConflictSecondLocation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 7 + /// + public ShellProperty ConflictSecondLocation + { + get + { + PropertyKey key = SystemProperties.System.Sync.ConflictSecondLocation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.HandlerCollectionID -- PKEY_Sync_HandlerCollectionID + /// Description: + /// Type: Guid -- VT_CLSID + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 2 + /// + public ShellProperty HandlerCollectionID + { + get + { + PropertyKey key = SystemProperties.System.Sync.HandlerCollectionID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.HandlerID -- PKEY_Sync_HandlerID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 3 + /// + public ShellProperty HandlerID + { + get + { + PropertyKey key = SystemProperties.System.Sync.HandlerID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.HandlerName -- PKEY_Sync_HandlerName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 2 + /// + public ShellProperty HandlerName + { + get + { + PropertyKey key = SystemProperties.System.Sync.HandlerName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.HandlerType -- PKEY_Sync_HandlerType + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 8 + /// + public ShellProperty HandlerType + { + get + { + PropertyKey key = SystemProperties.System.Sync.HandlerType; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.HandlerTypeLabel -- PKEY_Sync_HandlerTypeLabel + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 9 + /// + public ShellProperty HandlerTypeLabel + { + get + { + PropertyKey key = SystemProperties.System.Sync.HandlerTypeLabel; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.ItemID -- PKEY_Sync_ItemID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 6 + /// + public ShellProperty ItemID + { + get + { + PropertyKey key = SystemProperties.System.Sync.ItemID; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.ItemName -- PKEY_Sync_ItemName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 3 + /// + public ShellProperty ItemName + { + get + { + PropertyKey key = SystemProperties.System.Sync.ItemName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.ProgressPercentage -- PKEY_Sync_ProgressPercentage + /// Description: An integer value between 0 and 100 representing the percentage completed. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 23 + /// + public ShellProperty ProgressPercentage + { + get + { + PropertyKey key = SystemProperties.System.Sync.ProgressPercentage; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.State -- PKEY_Sync_State + /// Description: Sync state. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 24 + /// + public ShellProperty State + { + get + { + PropertyKey key = SystemProperties.System.Sync.State; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Sync.Status -- PKEY_Sync_Status + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 10 + /// + public ShellProperty Status + { + get + { + PropertyKey key = SystemProperties.System.Sync.Status; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Task Properties + /// + public class PropertySystemTask : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemTask(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Task.BillingInformation -- PKEY_Task_BillingInformation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D37D52C6-261C-4303-82B3-08B926AC6F12}, 100 + /// + public ShellProperty BillingInformation + { + get + { + PropertyKey key = SystemProperties.System.Task.BillingInformation; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Task.CompletionStatus -- PKEY_Task_CompletionStatus + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {084D8A0A-E6D5-40DE-BF1F-C8820E7C877C}, 100 + /// + public ShellProperty CompletionStatus + { + get + { + PropertyKey key = SystemProperties.System.Task.CompletionStatus; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Task.Owner -- PKEY_Task_Owner + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {08C7CC5F-60F2-4494-AD75-55E3E0B5ADD0}, 100 + /// + public ShellProperty Owner + { + get + { + PropertyKey key = SystemProperties.System.Task.Owner; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Video Properties + /// + public class PropertySystemVideo : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemVideo(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Video.Compression -- PKEY_Video_Compression + /// Description: Indicates the level of compression for the video stream. "Compression". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 10 (PIDVSI_COMPRESSION) + /// + public ShellProperty Compression + { + get + { + PropertyKey key = SystemProperties.System.Video.Compression; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.Director -- PKEY_Video_Director + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 20 (PIDMSI_DIRECTOR) + /// + public ShellProperty Director + { + get + { + PropertyKey key = SystemProperties.System.Video.Director; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.EncodingBitrate -- PKEY_Video_EncodingBitrate + /// Description: Indicates the data rate in "bits per second" for the video stream. "DataRate". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 8 (PIDVSI_DATA_RATE) + /// + public ShellProperty EncodingBitrate + { + get + { + PropertyKey key = SystemProperties.System.Video.EncodingBitrate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.FourCC -- PKEY_Video_FourCC + /// Description: Indicates the 4CC for the video stream. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 44 + /// + public ShellProperty FourCC + { + get + { + PropertyKey key = SystemProperties.System.Video.FourCC; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.FrameHeight -- PKEY_Video_FrameHeight + /// Description: Indicates the frame height for the video stream. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 4 + /// + public ShellProperty FrameHeight + { + get + { + PropertyKey key = SystemProperties.System.Video.FrameHeight; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.FrameRate -- PKEY_Video_FrameRate + /// Description: Indicates the frame rate in "frames per millisecond" for the video stream. "FrameRate". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 6 (PIDVSI_FRAME_RATE) + /// + public ShellProperty FrameRate + { + get + { + PropertyKey key = SystemProperties.System.Video.FrameRate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.FrameWidth -- PKEY_Video_FrameWidth + /// Description: Indicates the frame width for the video stream. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 3 + /// + public ShellProperty FrameWidth + { + get + { + PropertyKey key = SystemProperties.System.Video.FrameWidth; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.HorizontalAspectRatio -- PKEY_Video_HorizontalAspectRatio + /// Description: Indicates the horizontal portion of the aspect ratio. The X portion of XX:YY, + ///like 16:9. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 42 + /// + public ShellProperty HorizontalAspectRatio + { + get + { + PropertyKey key = SystemProperties.System.Video.HorizontalAspectRatio; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.SampleSize -- PKEY_Video_SampleSize + /// Description: Indicates the sample size in bits for the video stream. "SampleSize". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 9 (PIDVSI_SAMPLE_SIZE) + /// + public ShellProperty SampleSize + { + get + { + PropertyKey key = SystemProperties.System.Video.SampleSize; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.StreamName -- PKEY_Video_StreamName + /// Description: Indicates the name for the video stream. "StreamName". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 2 (PIDVSI_STREAM_NAME) + /// + public ShellProperty StreamName + { + get + { + PropertyKey key = SystemProperties.System.Video.StreamName; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.StreamNumber -- PKEY_Video_StreamNumber + /// Description: "Stream Number". + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 11 (PIDVSI_STREAM_NUMBER) + /// + public ShellProperty StreamNumber + { + get + { + PropertyKey key = SystemProperties.System.Video.StreamNumber; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.TotalBitrate -- PKEY_Video_TotalBitrate + /// Description: Indicates the total data rate in "bits per second" for all video and audio streams. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 43 (PIDVSI_TOTAL_BITRATE) + /// + public ShellProperty TotalBitrate + { + get + { + PropertyKey key = SystemProperties.System.Video.TotalBitrate; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.TranscodedForSync -- PKEY_Video_TranscodedForSync + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 46 + /// + public ShellProperty TranscodedForSync + { + get + { + PropertyKey key = SystemProperties.System.Video.TranscodedForSync; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Video.VerticalAspectRatio -- PKEY_Video_VerticalAspectRatio + /// Description: Indicates the vertical portion of the aspect ratio. The Y portion of + ///XX:YY, like 16:9. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 45 + /// + public ShellProperty VerticalAspectRatio + { + get + { + PropertyKey key = SystemProperties.System.Video.VerticalAspectRatio; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + + /// + /// System.Volume Properties + /// + public class PropertySystemVolume : PropertyStoreItems + { + + + private ShellObject shellObjectParent; + private Hashtable hashtable = new Hashtable(); + + internal PropertySystemVolume(ShellObject parent) + { + shellObjectParent = parent; + } + + #region Properties + + /// + /// Name: System.Volume.FileSystem -- PKEY_Volume_FileSystem + /// Description: Indicates the filesystem of the volume. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 4 (PID_VOLUME_FILESYSTEM) (Filesystem Volume Properties) + /// + public ShellProperty FileSystem + { + get + { + PropertyKey key = SystemProperties.System.Volume.FileSystem; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Volume.IsMappedDrive -- PKEY_Volume_IsMappedDrive + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {149C0B69-2C2D-48FC-808F-D318D78C4636}, 2 + /// + public ShellProperty IsMappedDrive + { + get + { + PropertyKey key = SystemProperties.System.Volume.IsMappedDrive; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + + /// + /// Name: System.Volume.IsRoot -- PKEY_Volume_IsRoot + /// Description: + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 10 (Filesystem Volume Properties) + /// + public ShellProperty IsRoot + { + get + { + PropertyKey key = SystemProperties.System.Volume.IsRoot; + + if (!hashtable.ContainsKey(key)) + { + hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty(key)); + } + + return hashtable[key] as ShellProperty; + } + } + #endregion + + + #region sub-namespaces + #endregion + } + } +} diff --git a/Shell/PropertySystem/SystemProperties.cs b/Shell/PropertySystem/SystemProperties.cs new file mode 100644 index 0000000..2174940 --- /dev/null +++ b/Shell/PropertySystem/SystemProperties.cs @@ -0,0 +1,12306 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + + + /// + /// Provides easy access to all the system properties (property keys and their descriptions) + /// + public static class SystemProperties + { + + /// + /// Returns the property description for a given property key. + /// + /// Property key of the property whose description is required. + /// Property Description for a given property key + public static ShellPropertyDescription GetPropertyDescription(PropertyKey propertyKey) + { + return ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propertyKey); + } + + + /// + /// Gets the property description for a given property's canonical name. + /// + /// Canonical name of the property whose description is required. + /// Property Description for a given property key + public static ShellPropertyDescription GetPropertyDescription(string canonicalName) + { + PropertyKey propKey; + + int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(canonicalName, out propKey); + + if (!CoreErrorHelper.Succeeded(result)) + { + throw new ArgumentException(LocalizedMessages.ShellInvalidCanonicalName, Marshal.GetExceptionForHR(result)); + } + return ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey); + } + + /// + /// System Properties + /// + public static class System + { + + + #region Properties + + /// + /// Name: System.AcquisitionID -- PKEY_AcquisitionID + /// Description: Hash to determine acquisition session. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {65A98875-3C80-40AB-ABBC-EFDAF77DBEE2}, 100 + /// + public static PropertyKey AcquisitionID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{65A98875-3C80-40AB-ABBC-EFDAF77DBEE2}"), 100); + return key; + } + } + + /// + /// Name: System.ApplicationName -- PKEY_ApplicationName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 18 (PIDSI_APPNAME) + /// + public static PropertyKey ApplicationName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 18); + + return key; + } + } + + /// + /// Name: System.Author -- PKEY_Author + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 4 (PIDSI_AUTHOR) + /// + public static PropertyKey Author + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 4); + + return key; + } + } + + /// + /// Name: System.Capacity -- PKEY_Capacity + /// Description: The amount of total space in bytes. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 3 (PID_VOLUME_CAPACITY) (Filesystem Volume Properties) + /// + public static PropertyKey Capacity + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 3); + + return key; + } + } + + /// + /// Name: System.Category -- PKEY_Category + /// Description: Legacy code treats this as VT_LPSTR. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 2 (PIDDSI_CATEGORY) + /// + public static PropertyKey Category + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 2); + + return key; + } + } + + /// + /// Name: System.Comment -- PKEY_Comment + /// Description: Comments. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 6 (PIDSI_COMMENTS) + /// + public static PropertyKey Comment + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 6); + + return key; + } + } + + /// + /// Name: System.Company -- PKEY_Company + /// Description: The company or publisher. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 15 (PIDDSI_COMPANY) + /// + public static PropertyKey Company + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 15); + + return key; + } + } + + /// + /// Name: System.ComputerName -- PKEY_ComputerName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 5 (PID_COMPUTERNAME) + /// + public static PropertyKey ComputerName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 5); + + return key; + } + } + + /// + /// Name: System.ContainedItems -- PKEY_ContainedItems + /// Description: The list of type of items, this item contains. For example, this item contains urls, attachments etc. + ///This is represented as a vector array of GUIDs where each GUID represents certain type. + /// + /// Type: Multivalue Guid -- VT_VECTOR | VT_CLSID (For variants: VT_ARRAY | VT_CLSID) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 29 + /// + public static PropertyKey ContainedItems + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 29); + + return key; + } + } + + /// + /// Name: System.ContentStatus -- PKEY_ContentStatus + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 27 + /// + public static PropertyKey ContentStatus + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 27); + + return key; + } + } + + /// + /// Name: System.ContentType -- PKEY_ContentType + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 26 + /// + public static PropertyKey ContentType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 26); + + return key; + } + } + + /// + /// Name: System.Copyright -- PKEY_Copyright + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 11 (PIDMSI_COPYRIGHT) + /// + public static PropertyKey Copyright + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 11); + + return key; + } + } + + /// + /// Name: System.DateAccessed -- PKEY_DateAccessed + /// Description: The time of the last access to the item. The Indexing Service friendly name is 'access'. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 16 (PID_STG_ACCESSTIME) + /// + public static PropertyKey DateAccessed + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 16); + + return key; + } + } + + /// + /// Name: System.DateAcquired -- PKEY_DateAcquired + /// Description: The time the file entered the system via acquisition. This is not the same as System.DateImported. + ///Examples are when pictures are acquired from a camera, or when music is purchased online. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {2CBAA8F5-D81F-47CA-B17A-F8D822300131}, 100 + /// + public static PropertyKey DateAcquired + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2CBAA8F5-D81F-47CA-B17A-F8D822300131}"), 100); + + return key; + } + } + + /// + /// Name: System.DateArchived -- PKEY_DateArchived + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {43F8D7B7-A444-4F87-9383-52271C9B915C}, 100 + /// + public static PropertyKey DateArchived + { + get + { + PropertyKey key = new PropertyKey(new Guid("{43F8D7B7-A444-4F87-9383-52271C9B915C}"), 100); + + return key; + } + } + + /// + /// Name: System.DateCompleted -- PKEY_DateCompleted + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {72FAB781-ACDA-43E5-B155-B2434F85E678}, 100 + /// + public static PropertyKey DateCompleted + { + get + { + PropertyKey key = new PropertyKey(new Guid("{72FAB781-ACDA-43E5-B155-B2434F85E678}"), 100); + + return key; + } + } + + /// + /// Name: System.DateCreated -- PKEY_DateCreated + /// Description: The date and time the item was created. The Indexing Service friendly name is 'create'. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 15 (PID_STG_CREATETIME) + /// + public static PropertyKey DateCreated + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 15); + + return key; + } + } + + /// + /// Name: System.DateImported -- PKEY_DateImported + /// Description: The time the file is imported into a separate database. This is not the same as System.DateAcquired. (Eg, 2003:05:22 13:55:04) + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 18258 + /// + public static PropertyKey DateImported + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 18258); + + return key; + } + } + + /// + /// Name: System.DateModified -- PKEY_DateModified + /// Description: The date and time of the last write to the item. The Indexing Service friendly name is 'write'. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 14 (PID_STG_WRITETIME) + /// + public static PropertyKey DateModified + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 14); + + return key; + } + } + + /// + /// Name: System.DescriptionID -- PKEY_DescriptionID + /// Description: The contents of a SHDESCRIPTIONID structure as a buffer of bytes. + /// + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 2 (PID_DESCRIPTIONID) + /// + public static PropertyKey DescriptionID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 2); + + return key; + } + } + + /// + /// Name: System.DueDate -- PKEY_DueDate + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {3F8472B5-E0AF-4DB2-8071-C53FE76AE7CE}, 100 + /// + public static PropertyKey DueDate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{3F8472B5-E0AF-4DB2-8071-C53FE76AE7CE}"), 100); + + return key; + } + } + + /// + /// Name: System.EndDate -- PKEY_EndDate + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {C75FAA05-96FD-49E7-9CB4-9F601082D553}, 100 + /// + public static PropertyKey EndDate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C75FAA05-96FD-49E7-9CB4-9F601082D553}"), 100); + + return key; + } + } + + /// + /// Name: System.FileAllocationSize -- PKEY_FileAllocationSize + /// Description: + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 18 (PID_STG_ALLOCSIZE) + /// + public static PropertyKey FileAllocationSize + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 18); + + return key; + } + } + + /// + /// Name: System.FileAttributes -- PKEY_FileAttributes + /// Description: This is the WIN32_FIND_DATA dwFileAttributes for the file-based item. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 13 (PID_STG_ATTRIBUTES) + /// + public static PropertyKey FileAttributes + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 13); + + return key; + } + } + + /// + /// Name: System.FileCount -- PKEY_FileCount + /// Description: + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 12 + /// + public static PropertyKey FileCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 12); + + return key; + } + } + + /// + /// Name: System.FileDescription -- PKEY_FileDescription + /// Description: This is a user-friendly description of the file. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 3 (PIDVSI_FileDescription) + /// + public static PropertyKey FileDescription + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 3); + + return key; + } + } + + /// + /// Name: System.FileExtension -- PKEY_FileExtension + /// Description: This is the file extension of the file based item, including the leading period. + /// + ///If System.FileName is VT_EMPTY, then this property should be too. Otherwise, it should be derived + ///appropriately by the data source from System.FileName. If System.FileName does not have a file + ///extension, this value should be VT_EMPTY. + /// + ///To obtain the type of any item (including an item that is not a file), use System.ItemType. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" ".txt" + /// "\\server\share\mydir\goodnews.doc" ".doc" + /// "\\server\share\numbers.xls" ".xls" + /// "\\server\share\folder" VT_EMPTY + /// "c:\foo\MyFolder" VT_EMPTY + /// [desktop] VT_EMPTY + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E4F10A3C-49E6-405D-8288-A23BD4EEAA6C}, 100 + /// + public static PropertyKey FileExtension + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E4F10A3C-49E6-405D-8288-A23BD4EEAA6C}"), 100); + + return key; + } + } + + /// + /// Name: System.FileFRN -- PKEY_FileFRN + /// Description: This is the unique file ID, also known as the File Reference Number. For a given file, this is the same value + ///as is found in the structure variable FILE_ID_BOTH_DIR_INFO.FileId, via GetFileInformationByHandleEx(). + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 21 (PID_STG_FRN) + /// + public static PropertyKey FileFRN + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 21); + + return key; + } + } + + /// + /// Name: System.FileName -- PKEY_FileName + /// Description: This is the file name (including extension) of the file. + /// + ///It is possible that the item might not exist on a filesystem (ie, it may not be opened + ///using CreateFile). Nonetheless, if the item is represented as a file from the logical sense + ///(and its name follows standard Win32 file-naming syntax), then the data source should emit this property. + /// + ///If an item is not a file, then the value for this property is VT_EMPTY. See + ///System.ItemNameDisplay. + /// + ///This has the same value as System.ParsingName for items that are provided by the Shell's file folder. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "hello.txt" + /// "\\server\share\mydir\goodnews.doc" "goodnews.doc" + /// "\\server\share\numbers.xls" "numbers.xls" + /// "c:\foo\MyFolder" "MyFolder" + /// (email message) VT_EMPTY + /// (song on portable device) "song.wma" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {41CF5AE0-F75A-4806-BD87-59C7D9248EB9}, 100 + /// + public static PropertyKey FileName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{41CF5AE0-F75A-4806-BD87-59C7D9248EB9}"), 100); + + return key; + } + } + + /// + /// Name: System.FileOwner -- PKEY_FileOwner + /// Description: This is the owner of the file, according to the file system. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Misc) {9B174B34-40FF-11D2-A27E-00C04FC30871}, 4 (PID_MISC_OWNER) + /// + public static PropertyKey FileOwner + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9B174B34-40FF-11D2-A27E-00C04FC30871}"), 4); + + return key; + } + } + + /// + /// Name: System.FileVersion -- PKEY_FileVersion + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 4 (PIDVSI_FileVersion) + /// + public static PropertyKey FileVersion + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 4); + + return key; + } + } + + /// + /// Name: System.FindData -- PKEY_FindData + /// Description: WIN32_FIND_DATAW in buffer of bytes. + /// + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 0 (PID_FINDDATA) + /// + public static PropertyKey FindData + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 0); + + return key; + } + } + + /// + /// Name: System.FlagColor -- PKEY_FlagColor + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {67DF94DE-0CA7-4D6F-B792-053A3E4F03CF}, 100 + /// + public static PropertyKey FlagColor + { + get + { + PropertyKey key = new PropertyKey(new Guid("{67DF94DE-0CA7-4D6F-B792-053A3E4F03CF}"), 100); + + return key; + } + } + + /// + /// Name: System.FlagColorText -- PKEY_FlagColorText + /// Description: This is the user-friendly form of System.FlagColor. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {45EAE747-8E2A-40AE-8CBF-CA52ABA6152A}, 100 + /// + public static PropertyKey FlagColorText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{45EAE747-8E2A-40AE-8CBF-CA52ABA6152A}"), 100); + + return key; + } + } + + /// + /// Name: System.FlagStatus -- PKEY_FlagStatus + /// Description: Status of Flag. Values: (0=none 1=white 2=Red). cdoPR_FLAG_STATUS + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 12 + /// + public static PropertyKey FlagStatus + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 12); + + return key; + } + } + + /// + /// Name: System.FlagStatusText -- PKEY_FlagStatusText + /// Description: This is the user-friendly form of System.FlagStatus. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DC54FD2E-189D-4871-AA01-08C2F57A4ABC}, 100 + /// + public static PropertyKey FlagStatusText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DC54FD2E-189D-4871-AA01-08C2F57A4ABC}"), 100); + + return key; + } + } + + /// + /// Name: System.FreeSpace -- PKEY_FreeSpace + /// Description: The amount of free space in bytes. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 2 (PID_VOLUME_FREE) (Filesystem Volume Properties) + /// + public static PropertyKey FreeSpace + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 2); + + return key; + } + } + + /// + /// Name: System.FullText -- PKEY_FullText + /// Description: This PKEY is used to specify search terms that should be applied as broadly as possible, + ///across all valid properties for the data source(s) being searched. It should not be + ///emitted from a data source. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {1E3EE840-BC2B-476C-8237-2ACD1A839B22}, 6 + /// + public static PropertyKey FullText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1E3EE840-BC2B-476C-8237-2ACD1A839B22}"), 6); + + return key; + } + } + + /// + /// Name: System.Identity -- PKEY_Identity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A26F4AFC-7346-4299-BE47-EB1AE613139F}, 100 + /// + public static PropertyKey IdentityProperty + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A26F4AFC-7346-4299-BE47-EB1AE613139F}"), 100); + + return key; + } + } + + /// + /// Name: System.ImageParsingName -- PKEY_ImageParsingName + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D7750EE0-C6A4-48EC-B53E-B87B52E6D073}, 100 + /// + public static PropertyKey ImageParsingName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D7750EE0-C6A4-48EC-B53E-B87B52E6D073}"), 100); + + return key; + } + } + + /// + /// Name: System.Importance -- PKEY_Importance + /// Description: + /// Type: Int32 -- VT_I4 + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 11 + /// + public static PropertyKey Importance + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 11); + + return key; + } + } + + /// + /// Name: System.ImportanceText -- PKEY_ImportanceText + /// Description: This is the user-friendly form of System.Importance. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A3B29791-7713-4E1D-BB40-17DB85F01831}, 100 + /// + public static PropertyKey ImportanceText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A3B29791-7713-4E1D-BB40-17DB85F01831}"), 100); + + return key; + } + } + + /// + /// Name: System.InfoTipText -- PKEY_InfoTipText + /// Description: The text (with formatted property values) to show in the infotip. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 17 + /// + public static PropertyKey InfoTipText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 17); + + return key; + } + } + + /// + /// Name: System.InternalName -- PKEY_InternalName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 5 (PIDVSI_InternalName) + /// + public static PropertyKey InternalName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 5); + + return key; + } + } + + /// + /// Name: System.IsAttachment -- PKEY_IsAttachment + /// Description: Identifies if this item is an attachment. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {F23F425C-71A1-4FA8-922F-678EA4A60408}, 100 + /// + public static PropertyKey IsAttachment + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F23F425C-71A1-4FA8-922F-678EA4A60408}"), 100); + + return key; + } + } + + /// + /// Name: System.IsDefaultNonOwnerSaveLocation -- PKEY_IsDefaultNonOwnerSaveLocation + /// Description: Identifies the default save location for a library for non-owners of the library + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 5 + /// + public static PropertyKey IsDefaultNonOwnerSaveLocation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 5); + + return key; + } + } + + /// + /// Name: System.IsDefaultSaveLocation -- PKEY_IsDefaultSaveLocation + /// Description: Identifies the default save location for a library for the owner of the library + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 3 + /// + public static PropertyKey IsDefaultSaveLocation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 3); + + return key; + } + } + + /// + /// Name: System.IsDeleted -- PKEY_IsDeleted + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {5CDA5FC8-33EE-4FF3-9094-AE7BD8868C4D}, 100 + /// + public static PropertyKey IsDeleted + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5CDA5FC8-33EE-4FF3-9094-AE7BD8868C4D}"), 100); + + return key; + } + } + + /// + /// Name: System.IsEncrypted -- PKEY_IsEncrypted + /// Description: Is the item encrypted? + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {90E5E14E-648B-4826-B2AA-ACAF790E3513}, 10 + /// + public static PropertyKey IsEncrypted + { + get + { + PropertyKey key = new PropertyKey(new Guid("{90E5E14E-648B-4826-B2AA-ACAF790E3513}"), 10); + + return key; + } + } + + /// + /// Name: System.IsFlagged -- PKEY_IsFlagged + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {5DA84765-E3FF-4278-86B0-A27967FBDD03}, 100 + /// + public static PropertyKey IsFlagged + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5DA84765-E3FF-4278-86B0-A27967FBDD03}"), 100); + + return key; + } + } + + /// + /// Name: System.IsFlaggedComplete -- PKEY_IsFlaggedComplete + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {A6F360D2-55F9-48DE-B909-620E090A647C}, 100 + /// + public static PropertyKey IsFlaggedComplete + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A6F360D2-55F9-48DE-B909-620E090A647C}"), 100); + + return key; + } + } + + /// + /// Name: System.IsIncomplete -- PKEY_IsIncomplete + /// Description: Identifies if the message was not completely received for some error condition. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {346C8BD1-2E6A-4C45-89A4-61B78E8E700F}, 100 + /// + public static PropertyKey IsIncomplete + { + get + { + PropertyKey key = new PropertyKey(new Guid("{346C8BD1-2E6A-4C45-89A4-61B78E8E700F}"), 100); + + return key; + } + } + + /// + /// Name: System.IsLocationSupported -- PKEY_IsLocationSupported + /// Description: A bool value to know if a location is supported (locally indexable, or remotely indexed). + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 8 + /// + public static PropertyKey IsLocationSupported + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 8); + + return key; + } + } + + /// + /// Name: System.IsPinnedToNameSpaceTree -- PKEY_IsPinnedToNameSpaceTree + /// Description: A bool value to know if a shell folder is pinned to the navigation pane + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 2 + /// + public static PropertyKey IsPinnedToNamespaceTree + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 2); + + return key; + } + } + + /// + /// Name: System.IsRead -- PKEY_IsRead + /// Description: Has the item been read? + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 10 + /// + public static PropertyKey IsRead + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 10); + + return key; + } + } + + /// + /// Name: System.IsSearchOnlyItem -- PKEY_IsSearchOnlyItem + /// Description: Identifies if a location or a library is search only + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 4 + /// + public static PropertyKey IsSearchOnlyItem + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 4); + + return key; + } + } + + /// + /// Name: System.IsSendToTarget -- PKEY_IsSendToTarget + /// Description: Provided by certain shell folders. Return TRUE if the folder is a valid Send To target. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 33 + /// + public static PropertyKey IsSendToTarget + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 33); + + return key; + } + } + + /// + /// Name: System.IsShared -- PKEY_IsShared + /// Description: Is this item shared? This only checks for ACLs that are not inherited. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 100 + /// + public static PropertyKey IsShared + { + get + { + PropertyKey key = new PropertyKey(new Guid("{EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}"), 100); + + return key; + } + } + + /// + /// Name: System.ItemAuthors -- PKEY_ItemAuthors + /// Description: This is the generic list of authors associated with an item. + /// + ///For example, the artist name for a track is the item author. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D0A04F0A-462A-48A4-BB2F-3706E88DBD7D}, 100 + /// + public static PropertyKey ItemAuthors + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D0A04F0A-462A-48A4-BB2F-3706E88DBD7D}"), 100); + + return key; + } + } + + /// + /// Name: System.ItemClassType -- PKEY_ItemClassType + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {048658AD-2DB8-41A4-BBB6-AC1EF1207EB1}, 100 + /// + public static PropertyKey ItemClassType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{048658AD-2DB8-41A4-BBB6-AC1EF1207EB1}"), 100); + + return key; + } + } + + /// + /// Name: System.ItemDate -- PKEY_ItemDate + /// Description: This is the main date for an item. The date of interest. + /// + ///For example, for photos this maps to System.Photo.DateTaken. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {F7DB74B4-4287-4103-AFBA-F1B13DCD75CF}, 100 + /// + public static PropertyKey ItemDate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F7DB74B4-4287-4103-AFBA-F1B13DCD75CF}"), 100); + + return key; + } + } + + /// + /// Name: System.ItemFolderNameDisplay -- PKEY_ItemFolderNameDisplay + /// Description: This is the user-friendly display name of the parent folder of an item. + /// + ///If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it + ///should be derived appropriately by the data source from System.ItemFolderPathDisplay. + /// + ///If the folder is a file folder, the value will be localized if a localized name is available. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "bar" + /// "\\server\share\mydir\goodnews.doc" "mydir" + /// "\\server\share\numbers.xls" "share" + /// "c:\foo\MyFolder" "foo" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 2 (PID_STG_DIRECTORY) + /// + public static PropertyKey ItemFolderNameDisplay + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 2); + + return key; + } + } + + /// + /// Name: System.ItemFolderPathDisplay -- PKEY_ItemFolderPathDisplay + /// Description: This is the user-friendly display path of the parent folder of an item. + /// + ///If System.ItemPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it should + ///be derived appropriately by the data source from System.ItemPathDisplay. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "c:\foo\bar" + /// "\\server\share\mydir\goodnews.doc" "\\server\share\mydir" + /// "\\server\share\numbers.xls" "\\server\share" + /// "c:\foo\MyFolder" "c:\foo" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 6 + /// + public static PropertyKey ItemFolderPathDisplay + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 6); + + return key; + } + } + + /// + /// Name: System.ItemFolderPathDisplayNarrow -- PKEY_ItemFolderPathDisplayNarrow + /// Description: This is the user-friendly display path of the parent folder of an item. The format of the string + ///should be tailored such that the folder name comes first, to optimize for a narrow viewing column. + /// + ///If the folder is a file folder, the value includes localized names if they are present. + /// + ///If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it should + ///be derived appropriately by the data source from System.ItemFolderPathDisplay. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "bar (c:\foo)" + /// "\\server\share\mydir\goodnews.doc" "mydir (\\server\share)" + /// "\\server\share\numbers.xls" "share (\\server)" + /// "c:\foo\MyFolder" "foo (c:\)" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox (/Mailbox Account)" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DABD30ED-0043-4789-A7F8-D013A4736622}, 100 + /// + public static PropertyKey ItemFolderPathDisplayNarrow + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DABD30ED-0043-4789-A7F8-D013A4736622}"), 100); + + return key; + } + } + + /// + /// Name: System.ItemName -- PKEY_ItemName + /// Description: This is the base-name of the System.ItemNameDisplay. + /// + ///If the item is a file this property + ///includes the extension in all cases, and will be localized if a localized name is available. + /// + ///If the item is a message, then the value of this property does not include the forwarding or + ///reply prefixes (see System.ItemNamePrefix). + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6B8DA074-3B5C-43BC-886F-0A2CDCE00B6F}, 100 + /// + public static PropertyKey ItemName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6B8DA074-3B5C-43BC-886F-0A2CDCE00B6F}"), 100); + + return key; + } + } + + /// + /// Name: System.ItemNameDisplay -- PKEY_ItemNameDisplay + /// Description: This is the display name in "most complete" form. This is the best effort unique representation + ///of the name of an item that makes sense for end users to read. It is the concatentation of + ///System.ItemNamePrefix and System.ItemName. + /// + ///If the item is a file this property + ///includes the extension in all cases, and will be localized if a localized name is available. + /// + ///There are acceptable cases when System.FileName is not VT_EMPTY, yet the value of this property + ///is completely different. Email messages are a key example. If the item is an email message, + ///the item name is likely the subject. In that case, the value must be the concatenation of the + ///System.ItemNamePrefix and System.ItemName. Since the value of System.ItemNamePrefix excludes + ///any trailing whitespace, the concatenation must include a whitespace when generating System.ItemNameDisplay. + /// + ///Note that this property is not guaranteed to be unique, but the idea is to promote the most likely + ///candidate that can be unique and also makes sense for end users. For example, for documents, you + ///might think about using System.Title as the System.ItemNameDisplay, but in practice the title of + ///the documents may not be useful or unique enough to be of value as the sole System.ItemNameDisplay. + ///Instead, providing the value of System.FileName as the value of System.ItemNameDisplay is a better + ///candidate. In Windows Mail, the emails are stored in the file system as .eml files and the + ///System.FileName for those files are not human-friendly as they contain GUIDs. In this example, + ///promoting System.Subject as System.ItemNameDisplay makes more sense. + /// + ///Compatibility notes: + /// + ///Shell folder implementations on Vista: use PKEY_ItemNameDisplay for the name column when + ///you want Explorer to call ISF::GetDisplayNameOf(SHGDN_NORMAL) to get the value of the name. Use + ///another PKEY (like PKEY_ItemName) when you want Explorer to call either the folder's property store or + ///ISF2::GetDetailsEx in order to get the value of the name. + /// + ///Shell folder implementations on XP: the first column needs to be the name column, and Explorer + ///will call ISF::GetDisplayNameOf to get the value of the name. The PKEY/SCID does not matter. + /// + ///Example values: + /// + /// File: "hello.txt" + /// Message: "Re: Let's talk about Tom's argyle socks!" + /// Device folder: "song.wma" + /// Folder: "Documents" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 10 (PID_STG_NAME) + /// + public static PropertyKey ItemNameDisplay + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 10); + + return key; + } + } + + /// + /// Name: System.ItemNamePrefix -- PKEY_ItemNamePrefix + /// Description: This is the prefix of an item, used for email messages. + ///where the subject begins with "Re:" which is the prefix. + /// + ///If the item is a file, then the value of this property is VT_EMPTY. + /// + ///If the item is a message, then the value of this property is the forwarding or reply + ///prefixes (including delimiting colon, but no whitespace), or VT_EMPTY if there is no prefix. + /// + ///Example values: + /// + ///System.ItemNamePrefix System.ItemName System.ItemNameDisplay + ///--------------------- ------------------- ---------------------- + ///VT_EMPTY "Great day" "Great day" + ///"Re:" "Great day" "Re: Great day" + ///"Fwd: " "Monthly budget" "Fwd: Monthly budget" + ///VT_EMPTY "accounts.xls" "accounts.xls" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D7313FF1-A77A-401C-8C99-3DBDD68ADD36}, 100 + /// + public static PropertyKey ItemNamePrefix + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D7313FF1-A77A-401C-8C99-3DBDD68ADD36}"), 100); + + return key; + } + } + + /// + /// Name: System.ItemParticipants -- PKEY_ItemParticipants + /// Description: This is the generic list of people associated with an item and who contributed + ///to the item. + /// + ///For example, this is the combination of people in the To list, Cc list and + ///sender of an email message. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D4D0AA16-9948-41A4-AA85-D97FF9646993}, 100 + /// + public static PropertyKey ItemParticipants + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D4D0AA16-9948-41A4-AA85-D97FF9646993}"), 100); + + return key; + } + } + + /// + /// Name: System.ItemPathDisplay -- PKEY_ItemPathDisplay + /// Description: This is the user-friendly display path to the item. + /// + ///If the item is a file or folder this property + ///includes the extension in all cases, and will be localized if a localized name is available. + /// + ///For other items,this is the user-friendly equivalent, assuming the item exists in hierarchical storage. + /// + ///Unlike System.ItemUrl, this property value does not include the URL scheme. + /// + ///To parse an item path, use System.ItemUrl or System.ParsingPath. To reference shell + ///namespace items using shell APIs, use System.ParsingPath. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "c:\foo\bar\hello.txt" + /// "\\server\share\mydir\goodnews.doc" "\\server\share\mydir\goodnews.doc" + /// "\\server\share\numbers.xls" "\\server\share\numbers.xls" + /// "c:\foo\MyFolder" "c:\foo\MyFolder" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox/'Re: Hello!'" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 7 + /// + public static PropertyKey ItemPathDisplay + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 7); + + return key; + } + } + + /// + /// Name: System.ItemPathDisplayNarrow -- PKEY_ItemPathDisplayNarrow + /// Description: This is the user-friendly display path to the item. The format of the string should be + ///tailored such that the name comes first, to optimize for a narrow viewing column. + /// + ///If the item is a file, the value excludes the file extension, and includes localized names if they are present. + ///If the item is a message, the value includes the System.ItemNamePrefix. + /// + ///To parse an item path, use System.ItemUrl or System.ParsingPath. + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "hello (c:\foo\bar)" + /// "\\server\share\mydir\goodnews.doc" "goodnews (\\server\share\mydir)" + /// "\\server\share\folder" "folder (\\server\share)" + /// "c:\foo\MyFolder" "MyFolder (c:\foo)" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "Re: Hello! (/Mailbox Account/Inbox)" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 8 + /// + public static PropertyKey ItemPathDisplayNarrow + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 8); + + return key; + } + } + + /// + /// Name: System.ItemType -- PKEY_ItemType + /// Description: This is the canonical type of the item and is intended to be programmatically + ///parsed. + /// + ///If there is no canonical type, the value is VT_EMPTY. + /// + ///If the item is a file (ie, System.FileName is not VT_EMPTY), the value is the same as + ///System.FileExtension. + /// + ///Use System.ItemTypeText when you want to display the type to end users in a view. (If + /// the item is a file, passing the System.ItemType value to PSFormatForDisplay will + /// result in the same value as System.ItemTypeText.) + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" ".txt" + /// "\\server\share\mydir\goodnews.doc" ".doc" + /// "\\server\share\folder" "Directory" + /// "c:\foo\MyFolder" "Directory" + /// [desktop] "Folder" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "MAPI/IPM.Message" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 11 + /// + public static PropertyKey ItemType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 11); + + return key; + } + } + + /// + /// Name: System.ItemTypeText -- PKEY_ItemTypeText + /// Description: This is the user friendly type name of the item. This is not intended to be + ///programmatically parsed. + /// + ///If System.ItemType is VT_EMPTY, the value of this property is also VT_EMPTY. + /// + ///If the item is a file, the value of this property is the same as if you passed the + ///file's System.ItemType value to PSFormatForDisplay. + /// + ///This property should not be confused with System.Kind, where System.Kind is a high-level + ///user friendly kind name. For example, for a document, System.Kind = "Document" and + ///System.Item.Type = ".doc" and System.Item.TypeText = "Microsoft Word Document" + /// + ///Example values: + /// + /// If the path is... The property value is... + /// ----------------- ------------------------ + /// "c:\foo\bar\hello.txt" "Text File" + /// "\\server\share\mydir\goodnews.doc" "Microsoft Word Document" + /// "\\server\share\folder" "File Folder" + /// "c:\foo\MyFolder" "File Folder" + /// "/Mailbox Account/Inbox/'Re: Hello!'" "Outlook E-Mail Message" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 4 (PID_STG_STORAGETYPE) + /// + public static PropertyKey ItemTypeText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 4); + + return key; + } + } + + /// + /// Name: System.ItemUrl -- PKEY_ItemUrl + /// Description: This always represents a well formed URL that points to the item. + /// + ///To reference shell namespace items using shell APIs, use System.ParsingPath. + /// + ///Example values: + /// + /// Files: "file:///c:/foo/bar/hello.txt" + /// "csc://{GUID}/..." + /// Messages: "mapi://..." + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 9 (DISPID_QUERY_VIRTUALPATH) + /// + public static PropertyKey ItemUrl + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49691C90-7E17-101A-A91C-08002B2ECDA9}"), 9); + + return key; + } + } + + /// + /// Name: System.Keywords -- PKEY_Keywords + /// Description: The keywords for the item. Also referred to as tags. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 5 (PIDSI_KEYWORDS) + /// + public static PropertyKey Keywords + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 5); + + return key; + } + } + + /// + /// Name: System.Kind -- PKEY_Kind + /// Description: System.Kind is used to map extensions to various .Search folders. + ///Extensions are mapped to Kinds at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap + ///The list of kinds is not extensible. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {1E3EE840-BC2B-476C-8237-2ACD1A839B22}, 3 + /// + public static PropertyKey Kind + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1E3EE840-BC2B-476C-8237-2ACD1A839B22}"), 3); + + return key; + } + } + + /// + /// Name: System.KindText -- PKEY_KindText + /// Description: This is the user-friendly form of System.Kind. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F04BEF95-C585-4197-A2B7-DF46FDC9EE6D}, 100 + /// + public static PropertyKey KindText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F04BEF95-C585-4197-A2B7-DF46FDC9EE6D}"), 100); + + return key; + } + } + + /// + /// Name: System.Language -- PKEY_Language + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 28 + /// + public static PropertyKey Language + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 28); + + return key; + } + } + + /// + /// Name: System.MileageInformation -- PKEY_MileageInformation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FDF84370-031A-4ADD-9E91-0D775F1C6605}, 100 + /// + public static PropertyKey MileageInformation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FDF84370-031A-4ADD-9E91-0D775F1C6605}"), 100); + + return key; + } + } + + /// + /// Name: System.MIMEType -- PKEY_MIMEType + /// Description: The MIME type. Eg, for EML files: 'message/rfc822'. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0B63E350-9CCC-11D0-BCDB-00805FCCCE04}, 5 + /// + public static PropertyKey MIMEType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0B63E350-9CCC-11D0-BCDB-00805FCCCE04}"), 5); + + return key; + } + } + + /// + /// Name: System.NamespaceCLSID -- PKEY_NamespaceCLSID + /// Description: The CLSID of the name space extension for an item, the object that implements IShellFolder for this item + /// + /// Type: Guid -- VT_CLSID + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 6 + /// + public static PropertyKey NamespaceClsid + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 6); + + return key; + } + } + + /// + /// Name: System.Null -- PKEY_Null + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {00000000-0000-0000-0000-000000000000}, 0 + /// + public static PropertyKey Null + { + get + { + PropertyKey key = new PropertyKey(new Guid("{00000000-0000-0000-0000-000000000000}"), 0); + + return key; + } + } + + /// + /// Name: System.OfflineAvailability -- PKEY_OfflineAvailability + /// Description: + /// Type: UInt32 -- VT_UI4 + /// FormatID: {A94688B6-7D9F-4570-A648-E3DFC0AB2B3F}, 100 + /// + public static PropertyKey OfflineAvailability + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A94688B6-7D9F-4570-A648-E3DFC0AB2B3F}"), 100); + + return key; + } + } + + /// + /// Name: System.OfflineStatus -- PKEY_OfflineStatus + /// Description: + /// Type: UInt32 -- VT_UI4 + /// FormatID: {6D24888F-4718-4BDA-AFED-EA0FB4386CD8}, 100 + /// + public static PropertyKey OfflineStatus + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D24888F-4718-4BDA-AFED-EA0FB4386CD8}"), 100); + + return key; + } + } + + /// + /// Name: System.OriginalFileName -- PKEY_OriginalFileName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 6 + /// + public static PropertyKey OriginalFileName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 6); + + return key; + } + } + + /// + /// Name: System.OwnerSID -- PKEY_OwnerSID + /// Description: SID of the user that owns the library. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 6 + /// + public static PropertyKey OwnerSid + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 6); + + return key; + } + } + + /// + /// Name: System.ParentalRating -- PKEY_ParentalRating + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 21 (PIDMSI_PARENTAL_RATING) + /// + public static PropertyKey ParentalRating + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 21); + + return key; + } + } + + /// + /// Name: System.ParentalRatingReason -- PKEY_ParentalRatingReason + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {10984E0A-F9F2-4321-B7EF-BAF195AF4319}, 100 + /// + public static PropertyKey ParentalRatingReason + { + get + { + PropertyKey key = new PropertyKey(new Guid("{10984E0A-F9F2-4321-B7EF-BAF195AF4319}"), 100); + + return key; + } + } + + /// + /// Name: System.ParentalRatingsOrganization -- PKEY_ParentalRatingsOrganization + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A7FE0840-1344-46F0-8D37-52ED712A4BF9}, 100 + /// + public static PropertyKey ParentalRatingsOrganization + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A7FE0840-1344-46F0-8D37-52ED712A4BF9}"), 100); + + return key; + } + } + + /// + /// Name: System.ParsingBindContext -- PKEY_ParsingBindContext + /// Description: used to get the IBindCtx for an item for parsing + /// + /// Type: Any -- VT_NULL Legacy code may treat this as VT_UNKNOWN. + /// FormatID: {DFB9A04D-362F-4CA3-B30B-0254B17B5B84}, 100 + /// + public static PropertyKey ParsingBindContext + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DFB9A04D-362F-4CA3-B30B-0254B17B5B84}"), 100); + + return key; + } + } + + /// + /// Name: System.ParsingName -- PKEY_ParsingName + /// Description: The shell namespace name of an item relative to a parent folder. This name may be passed to + ///IShellFolder::ParseDisplayName() of the parent shell folder. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 24 + /// + public static PropertyKey ParsingName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 24); + + return key; + } + } + + /// + /// Name: System.ParsingPath -- PKEY_ParsingPath + /// Description: This is the shell namespace path to the item. This path may be passed to + ///SHParseDisplayName to parse the path to the correct shell folder. + /// + ///If the item is a file, the value is identical to System.ItemPathDisplay. + /// + ///If the item cannot be accessed through the shell namespace, this value is VT_EMPTY. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 30 + /// + public static PropertyKey ParsingPath + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 30); + + return key; + } + } + + /// + /// Name: System.PerceivedType -- PKEY_PerceivedType + /// Description: The perceived type of a shell item, based upon its canonical type. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 9 + /// + public static PropertyKey PerceivedType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 9); + + return key; + } + } + + /// + /// Name: System.PercentFull -- PKEY_PercentFull + /// Description: The amount filled as a percentage, multiplied by 100 (ie, the valid range is 0 through 100). + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 5 (Filesystem Volume Properties) + /// + public static PropertyKey PercentFull + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 5); + + return key; + } + } + + /// + /// Name: System.Priority -- PKEY_Priority + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}, 5 + /// + public static PropertyKey Priority + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}"), 5); + + return key; + } + } + + /// + /// Name: System.PriorityText -- PKEY_PriorityText + /// Description: This is the user-friendly form of System.Priority. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D98BE98B-B86B-4095-BF52-9D23B2E0A752}, 100 + /// + public static PropertyKey PriorityText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D98BE98B-B86B-4095-BF52-9D23B2E0A752}"), 100); + + return key; + } + } + + /// + /// Name: System.Project -- PKEY_Project + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {39A7F922-477C-48DE-8BC8-B28441E342E3}, 100 + /// + public static PropertyKey Project + { + get + { + PropertyKey key = new PropertyKey(new Guid("{39A7F922-477C-48DE-8BC8-B28441E342E3}"), 100); + + return key; + } + } + + /// + /// Name: System.ProviderItemID -- PKEY_ProviderItemID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F21D9941-81F0-471A-ADEE-4E74B49217ED}, 100 + /// + public static PropertyKey ProviderItemID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F21D9941-81F0-471A-ADEE-4E74B49217ED}"), 100); + + return key; + } + } + + /// + /// Name: System.Rating -- PKEY_Rating + /// Description: Indicates the users preference rating of an item on a scale of 1-99 (1-12 = One Star, + ///13-37 = Two Stars, 38-62 = Three Stars, 63-87 = Four Stars, 88-99 = Five Stars). + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 9 (PIDMSI_RATING) + /// + public static PropertyKey Rating + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 9); + + return key; + } + } + + /// + /// Name: System.RatingText -- PKEY_RatingText + /// Description: This is the user-friendly form of System.Rating. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {90197CA7-FD8F-4E8C-9DA3-B57E1E609295}, 100 + /// + public static PropertyKey RatingText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{90197CA7-FD8F-4E8C-9DA3-B57E1E609295}"), 100); + + return key; + } + } + + /// + /// Name: System.Sensitivity -- PKEY_Sensitivity + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {F8D3F6AC-4874-42CB-BE59-AB454B30716A}, 100 + /// + public static PropertyKey Sensitivity + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F8D3F6AC-4874-42CB-BE59-AB454B30716A}"), 100); + + return key; + } + } + + /// + /// Name: System.SensitivityText -- PKEY_SensitivityText + /// Description: This is the user-friendly form of System.Sensitivity. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D0C7F054-3F72-4725-8527-129A577CB269}, 100 + /// + public static PropertyKey SensitivityText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D0C7F054-3F72-4725-8527-129A577CB269}"), 100); + + return key; + } + } + + /// + /// Name: System.SFGAOFlags -- PKEY_SFGAOFlags + /// Description: IShellFolder::GetAttributesOf flags, with SFGAO_PKEYSFGAOMASK attributes masked out. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 25 + /// + [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags")] + public static PropertyKey SFGAOFlags + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 25); + + return key; + } + } + + /// + /// Name: System.SharedWith -- PKEY_SharedWith + /// Description: Who is the item shared with? + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 200 + /// + public static PropertyKey SharedWith + { + get + { + PropertyKey key = new PropertyKey(new Guid("{EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}"), 200); + + return key; + } + } + + /// + /// Name: System.ShareUserRating -- PKEY_ShareUserRating + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 12 (PIDMSI_SHARE_USER_RATING) + /// + public static PropertyKey ShareUserRating + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 12); + + return key; + } + } + + /// + /// Name: System.SharingStatus -- PKEY_SharingStatus + /// Description: What is the item's sharing status (not shared, shared, everyone (homegroup or everyone), or private)? + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 300 + /// + public static PropertyKey SharingStatus + { + get + { + PropertyKey key = new PropertyKey(new Guid("{EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}"), 300); + + return key; + } + } + + /// + /// Name: System.SimpleRating -- PKEY_SimpleRating + /// Description: Indicates the users preference rating of an item on a scale of 0-5 (0=unrated, 1=One Star, 2=Two Stars, 3=Three Stars, + ///4=Four Stars, 5=Five Stars) + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {A09F084E-AD41-489F-8076-AA5BE3082BCA}, 100 + /// + public static PropertyKey SimpleRating + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A09F084E-AD41-489F-8076-AA5BE3082BCA}"), 100); + + return key; + } + } + + /// + /// Name: System.Size -- PKEY_Size + /// Description: + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 12 (PID_STG_SIZE) + /// + public static PropertyKey Size + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 12); + + return key; + } + } + + /// + /// Name: System.SoftwareUsed -- PKEY_SoftwareUsed + /// Description: PropertyTagSoftwareUsed + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 305 + /// + public static PropertyKey SoftwareUsed + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 305); + + return key; + } + } + + /// + /// Name: System.SourceItem -- PKEY_SourceItem + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {668CDFA5-7A1B-4323-AE4B-E527393A1D81}, 100 + /// + public static PropertyKey SourceItem + { + get + { + PropertyKey key = new PropertyKey(new Guid("{668CDFA5-7A1B-4323-AE4B-E527393A1D81}"), 100); + + return key; + } + } + + /// + /// Name: System.StartDate -- PKEY_StartDate + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {48FD6EC8-8A12-4CDF-A03E-4EC5A511EDDE}, 100 + /// + public static PropertyKey StartDate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{48FD6EC8-8A12-4CDF-A03E-4EC5A511EDDE}"), 100); + + return key; + } + } + + /// + /// Name: System.Status -- PKEY_Status + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_IntSite) {000214A1-0000-0000-C000-000000000046}, 9 + /// + public static PropertyKey Status + { + get + { + PropertyKey key = new PropertyKey(new Guid("{000214A1-0000-0000-C000-000000000046}"), 9); + + return key; + } + } + + /// + /// Name: System.Subject -- PKEY_Subject + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 3 (PIDSI_SUBJECT) + /// + public static PropertyKey Subject + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 3); + + return key; + } + } + + /// + /// Name: System.Thumbnail -- PKEY_Thumbnail + /// Description: A data that represents the thumbnail in VT_CF format. + /// + /// Type: Clipboard -- VT_CF + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 17 (PIDSI_THUMBNAIL) + /// + public static PropertyKey Thumbnail + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 17); + + return key; + } + } + + /// + /// Name: System.ThumbnailCacheId -- PKEY_ThumbnailCacheId + /// Description: Unique value that can be used as a key to cache thumbnails. The value changes when the name, volume, or data modified + ///of an item changes. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {446D16B1-8DAD-4870-A748-402EA43D788C}, 100 + /// + public static PropertyKey ThumbnailCacheId + { + get + { + PropertyKey key = new PropertyKey(new Guid("{446D16B1-8DAD-4870-A748-402EA43D788C}"), 100); + + return key; + } + } + + /// + /// Name: System.ThumbnailStream -- PKEY_ThumbnailStream + /// Description: Data that represents the thumbnail in VT_STREAM format that GDI+/WindowsCodecs supports (jpg, png, etc). + /// + /// Type: Stream -- VT_STREAM + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 27 + /// + public static PropertyKey ThumbnailStream + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 27); + + return key; + } + } + + /// + /// Name: System.Title -- PKEY_Title + /// Description: Title of item. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 2 (PIDSI_TITLE) + /// + public static PropertyKey Title + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 2); + + return key; + } + } + + /// + /// Name: System.TotalFileSize -- PKEY_TotalFileSize + /// Description: + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 14 + /// + public static PropertyKey TotalFileSize + { + get + { + PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 14); + + return key; + } + } + + /// + /// Name: System.Trademarks -- PKEY_Trademarks + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 9 (PIDVSI_Trademarks) + /// + public static PropertyKey Trademarks + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 9); + + return key; + } + } + #endregion + + + #region sub-classes + + /// + /// AppUserModel Properties + /// + public static class AppUserModel + { + + + #region Properties + + /// + /// Name: System.AppUserModel.ExcludeFromShowInNewInstall -- PKEY_AppUserModel_ExcludeFromShowInNewInstall + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 8 + /// + public static PropertyKey ExcludeFromShowInNewInstall + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 8); + + return key; + } + } + + /// + /// Name: System.AppUserModel.ID -- PKEY_AppUserModel_ID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 5 + /// + public static PropertyKey ID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 5); + + return key; + } + } + + /// + /// Name: System.AppUserModel.IsDestListSeparator -- PKEY_AppUserModel_IsDestListSeparator + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 6 + /// + public static PropertyKey IsDestinationListSeparator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 6); + + return key; + } + } + + /// + /// Name: System.AppUserModel.PreventPinning -- PKEY_AppUserModel_PreventPinning + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 9 + /// + public static PropertyKey PreventPinning + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 9); + + return key; + } + } + + /// + /// Name: System.AppUserModel.RelaunchCommand -- PKEY_AppUserModel_RelaunchCommand + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 2 + /// + public static PropertyKey RelaunchCommand + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 2); + + return key; + } + } + + /// + /// Name: System.AppUserModel.RelaunchDisplayNameResource -- PKEY_AppUserModel_RelaunchDisplayNameResource + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 4 + /// + public static PropertyKey RelaunchDisplayNameResource + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 4); + + return key; + } + } + + /// + /// Name: System.AppUserModel.RelaunchIconResource -- PKEY_AppUserModel_RelaunchIconResource + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 3 + /// + public static PropertyKey RelaunchIconResource + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 3); + + return key; + } + } + #endregion + + } + + /// + /// Audio Properties + /// + public static class Audio + { + + + #region Properties + + /// + /// Name: System.Audio.ChannelCount -- PKEY_Audio_ChannelCount + /// Description: Indicates the channel count for the audio file. Values: 1 (mono), 2 (stereo). + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 7 (PIDASI_CHANNEL_COUNT) + /// + public static PropertyKey ChannelCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 7); + + return key; + } + } + + /// + /// Name: System.Audio.Compression -- PKEY_Audio_Compression + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 10 (PIDASI_COMPRESSION) + /// + public static PropertyKey Compression + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 10); + + return key; + } + } + + /// + /// Name: System.Audio.EncodingBitrate -- PKEY_Audio_EncodingBitrate + /// Description: Indicates the average data rate in Hz for the audio file in "bits per second". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 4 (PIDASI_AVG_DATA_RATE) + /// + public static PropertyKey EncodingBitrate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 4); + + return key; + } + } + + /// + /// Name: System.Audio.Format -- PKEY_Audio_Format + /// Description: Indicates the format of the audio file. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_BSTR. + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 2 (PIDASI_FORMAT) + /// + public static PropertyKey Format + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 2); + + return key; + } + } + + /// + /// Name: System.Audio.IsVariableBitRate -- PKEY_Audio_IsVariableBitRate + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {E6822FEE-8C17-4D62-823C-8E9CFCBD1D5C}, 100 + /// + public static PropertyKey IsVariableBitrate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E6822FEE-8C17-4D62-823C-8E9CFCBD1D5C}"), 100); + + return key; + } + } + + /// + /// Name: System.Audio.PeakValue -- PKEY_Audio_PeakValue + /// Description: + /// Type: UInt32 -- VT_UI4 + /// FormatID: {2579E5D0-1116-4084-BD9A-9B4F7CB4DF5E}, 100 + /// + public static PropertyKey PeakValue + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2579E5D0-1116-4084-BD9A-9B4F7CB4DF5E}"), 100); + + return key; + } + } + + /// + /// Name: System.Audio.SampleRate -- PKEY_Audio_SampleRate + /// Description: Indicates the audio sample rate for the audio file in "samples per second". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 5 (PIDASI_SAMPLE_RATE) + /// + public static PropertyKey SampleRate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 5); + + return key; + } + } + + /// + /// Name: System.Audio.SampleSize -- PKEY_Audio_SampleSize + /// Description: Indicates the audio sample size for the audio file in "bits per sample". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 6 (PIDASI_SAMPLE_SIZE) + /// + public static PropertyKey SampleSize + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 6); + + return key; + } + } + + /// + /// Name: System.Audio.StreamName -- PKEY_Audio_StreamName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 9 (PIDASI_STREAM_NAME) + /// + public static PropertyKey StreamName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 9); + + return key; + } + } + + /// + /// Name: System.Audio.StreamNumber -- PKEY_Audio_StreamNumber + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 8 (PIDASI_STREAM_NUMBER) + /// + public static PropertyKey StreamNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 8); + + return key; + } + } + #endregion + + + + } + + /// + /// Calendar Properties + /// + public static class Calendar + { + + + #region Properties + + /// + /// Name: System.Calendar.Duration -- PKEY_Calendar_Duration + /// Description: The duration as specified in a string. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {293CA35A-09AA-4DD2-B180-1FE245728A52}, 100 + /// + public static PropertyKey Duration + { + get + { + PropertyKey key = new PropertyKey(new Guid("{293CA35A-09AA-4DD2-B180-1FE245728A52}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.IsOnline -- PKEY_Calendar_IsOnline + /// Description: Identifies if the event is an online event. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {BFEE9149-E3E2-49A7-A862-C05988145CEC}, 100 + /// + public static PropertyKey IsOnline + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BFEE9149-E3E2-49A7-A862-C05988145CEC}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.IsRecurring -- PKEY_Calendar_IsRecurring + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {315B9C8D-80A9-4EF9-AE16-8E746DA51D70}, 100 + /// + public static PropertyKey IsRecurring + { + get + { + PropertyKey key = new PropertyKey(new Guid("{315B9C8D-80A9-4EF9-AE16-8E746DA51D70}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.Location -- PKEY_Calendar_Location + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F6272D18-CECC-40B1-B26A-3911717AA7BD}, 100 + /// + public static PropertyKey Location + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F6272D18-CECC-40B1-B26A-3911717AA7BD}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.OptionalAttendeeAddresses -- PKEY_Calendar_OptionalAttendeeAddresses + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D55BAE5A-3892-417A-A649-C6AC5AAAEAB3}, 100 + /// + public static PropertyKey OptionalAttendeeAddresses + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D55BAE5A-3892-417A-A649-C6AC5AAAEAB3}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.OptionalAttendeeNames -- PKEY_Calendar_OptionalAttendeeNames + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {09429607-582D-437F-84C3-DE93A2B24C3C}, 100 + /// + public static PropertyKey OptionalAttendeeNames + { + get + { + PropertyKey key = new PropertyKey(new Guid("{09429607-582D-437F-84C3-DE93A2B24C3C}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.OrganizerAddress -- PKEY_Calendar_OrganizerAddress + /// Description: Address of the organizer organizing the event. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {744C8242-4DF5-456C-AB9E-014EFB9021E3}, 100 + /// + public static PropertyKey OrganizerAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{744C8242-4DF5-456C-AB9E-014EFB9021E3}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.OrganizerName -- PKEY_Calendar_OrganizerName + /// Description: Name of the organizer organizing the event. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {AAA660F9-9865-458E-B484-01BC7FE3973E}, 100 + /// + public static PropertyKey OrganizerName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AAA660F9-9865-458E-B484-01BC7FE3973E}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.ReminderTime -- PKEY_Calendar_ReminderTime + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {72FC5BA4-24F9-4011-9F3F-ADD27AFAD818}, 100 + /// + public static PropertyKey ReminderTime + { + get + { + PropertyKey key = new PropertyKey(new Guid("{72FC5BA4-24F9-4011-9F3F-ADD27AFAD818}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.RequiredAttendeeAddresses -- PKEY_Calendar_RequiredAttendeeAddresses + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {0BA7D6C3-568D-4159-AB91-781A91FB71E5}, 100 + /// + public static PropertyKey RequiredAttendeeAddresses + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0BA7D6C3-568D-4159-AB91-781A91FB71E5}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.RequiredAttendeeNames -- PKEY_Calendar_RequiredAttendeeNames + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {B33AF30B-F552-4584-936C-CB93E5CDA29F}, 100 + /// + public static PropertyKey RequiredAttendeeNames + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B33AF30B-F552-4584-936C-CB93E5CDA29F}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.Resources -- PKEY_Calendar_Resources + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {00F58A38-C54B-4C40-8696-97235980EAE1}, 100 + /// + public static PropertyKey Resources + { + get + { + PropertyKey key = new PropertyKey(new Guid("{00F58A38-C54B-4C40-8696-97235980EAE1}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.ResponseStatus -- PKEY_Calendar_ResponseStatus + /// Description: This property stores the status of the user responses to meetings in her calendar. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {188C1F91-3C40-4132-9EC5-D8B03B72A8A2}, 100 + /// + public static PropertyKey ResponseStatus + { + get + { + PropertyKey key = new PropertyKey(new Guid("{188C1F91-3C40-4132-9EC5-D8B03B72A8A2}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.ShowTimeAs -- PKEY_Calendar_ShowTimeAs + /// Description: + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {5BF396D4-5EB2-466F-BDE9-2FB3F2361D6E}, 100 + /// + public static PropertyKey ShowTimeAs + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5BF396D4-5EB2-466F-BDE9-2FB3F2361D6E}"), 100); + + return key; + } + } + + /// + /// Name: System.Calendar.ShowTimeAsText -- PKEY_Calendar_ShowTimeAsText + /// Description: This is the user-friendly form of System.Calendar.ShowTimeAs. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {53DA57CF-62C0-45C4-81DE-7610BCEFD7F5}, 100 + /// + public static PropertyKey ShowTimeAsText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{53DA57CF-62C0-45C4-81DE-7610BCEFD7F5}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// Communication Properties + /// + public static class Communication + { + + + #region Properties + + /// + /// Name: System.Communication.AccountName -- PKEY_Communication_AccountName + /// Description: Account Name + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 9 + /// + public static PropertyKey AccountName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 9); + + return key; + } + } + + /// + /// Name: System.Communication.DateItemExpires -- PKEY_Communication_DateItemExpires + /// Description: Date the item expires due to the retention policy. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {428040AC-A177-4C8A-9760-F6F761227F9A}, 100 + /// + public static PropertyKey DateItemExpires + { + get + { + PropertyKey key = new PropertyKey(new Guid("{428040AC-A177-4C8A-9760-F6F761227F9A}"), 100); + + return key; + } + } + + /// + /// Name: System.Communication.FollowupIconIndex -- PKEY_Communication_FollowupIconIndex + /// Description: This is the icon index used on messages marked for followup. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {83A6347E-6FE4-4F40-BA9C-C4865240D1F4}, 100 + /// + public static PropertyKey FollowUpIconIndex + { + get + { + PropertyKey key = new PropertyKey(new Guid("{83A6347E-6FE4-4F40-BA9C-C4865240D1F4}"), 100); + + return key; + } + } + + /// + /// Name: System.Communication.HeaderItem -- PKEY_Communication_HeaderItem + /// Description: This property will be true if the item is a header item which means the item hasn't been fully downloaded. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {C9C34F84-2241-4401-B607-BD20ED75AE7F}, 100 + /// + public static PropertyKey HeaderItem + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9C34F84-2241-4401-B607-BD20ED75AE7F}"), 100); + + return key; + } + } + + /// + /// Name: System.Communication.PolicyTag -- PKEY_Communication_PolicyTag + /// Description: This a string used to identify the retention policy applied to the item. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {EC0B4191-AB0B-4C66-90B6-C6637CDEBBAB}, 100 + /// + public static PropertyKey PolicyTag + { + get + { + PropertyKey key = new PropertyKey(new Guid("{EC0B4191-AB0B-4C66-90B6-C6637CDEBBAB}"), 100); + + return key; + } + } + + /// + /// Name: System.Communication.SecurityFlags -- PKEY_Communication_SecurityFlags + /// Description: Security flags associated with the item to know if the item is encrypted, signed or DRM enabled. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {8619A4B6-9F4D-4429-8C0F-B996CA59E335}, 100 + /// + public static PropertyKey SecurityFlags + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8619A4B6-9F4D-4429-8C0F-B996CA59E335}"), 100); + + return key; + } + } + + /// + /// Name: System.Communication.Suffix -- PKEY_Communication_Suffix + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {807B653A-9E91-43EF-8F97-11CE04EE20C5}, 100 + /// + public static PropertyKey Suffix + { + get + { + PropertyKey key = new PropertyKey(new Guid("{807B653A-9E91-43EF-8F97-11CE04EE20C5}"), 100); + + return key; + } + } + + /// + /// Name: System.Communication.TaskStatus -- PKEY_Communication_TaskStatus + /// Description: + /// Type: UInt16 -- VT_UI2 + /// FormatID: {BE1A72C6-9A1D-46B7-AFE7-AFAF8CEF4999}, 100 + /// + public static PropertyKey TaskStatus + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BE1A72C6-9A1D-46B7-AFE7-AFAF8CEF4999}"), 100); + + return key; + } + } + + /// + /// Name: System.Communication.TaskStatusText -- PKEY_Communication_TaskStatusText + /// Description: This is the user-friendly form of System.Communication.TaskStatus. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A6744477-C237-475B-A075-54F34498292A}, 100 + /// + public static PropertyKey TaskStatusText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A6744477-C237-475B-A075-54F34498292A}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// Computer Properties + /// + public static class Computer + { + + + #region Properties + + /// + /// Name: System.Computer.DecoratedFreeSpace -- PKEY_Computer_DecoratedFreeSpace + /// Description: Free space and total space: "%s free of %s" + /// + /// Type: Multivalue UInt64 -- VT_VECTOR | VT_UI8 (For variants: VT_ARRAY | VT_UI8) + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 7 (Filesystem Volume Properties) + /// + public static PropertyKey DecoratedFreeSpace + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 7); + + return key; + } + } + #endregion + + + + } + + /// + /// Contact Properties + /// + public static class Contact + { + + + #region Properties + + /// + /// Name: System.Contact.Anniversary -- PKEY_Contact_Anniversary + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {9AD5BADB-CEA7-4470-A03D-B84E51B9949E}, 100 + /// + public static PropertyKey Anniversary + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9AD5BADB-CEA7-4470-A03D-B84E51B9949E}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.AssistantName -- PKEY_Contact_AssistantName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CD102C9C-5540-4A88-A6F6-64E4981C8CD1}, 100 + /// + public static PropertyKey AssistantName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CD102C9C-5540-4A88-A6F6-64E4981C8CD1}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.AssistantTelephone -- PKEY_Contact_AssistantTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9A93244D-A7AD-4FF8-9B99-45EE4CC09AF6}, 100 + /// + public static PropertyKey AssistantTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9A93244D-A7AD-4FF8-9B99-45EE4CC09AF6}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.Birthday -- PKEY_Contact_Birthday + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 47 + /// + public static PropertyKey Birthday + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 47); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessAddress -- PKEY_Contact_BusinessAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {730FB6DD-CF7C-426B-A03F-BD166CC9EE24}, 100 + /// + public static PropertyKey BusinessAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{730FB6DD-CF7C-426B-A03F-BD166CC9EE24}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessAddressCity -- PKEY_Contact_BusinessAddressCity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {402B5934-EC5A-48C3-93E6-85E86A2D934E}, 100 + /// + public static PropertyKey BusinessAddressCity + { + get + { + PropertyKey key = new PropertyKey(new Guid("{402B5934-EC5A-48C3-93E6-85E86A2D934E}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessAddressCountry -- PKEY_Contact_BusinessAddressCountry + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {B0B87314-FCF6-4FEB-8DFF-A50DA6AF561C}, 100 + /// + public static PropertyKey BusinessAddressCountry + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B0B87314-FCF6-4FEB-8DFF-A50DA6AF561C}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessAddressPostalCode -- PKEY_Contact_BusinessAddressPostalCode + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E1D4A09E-D758-4CD1-B6EC-34A8B5A73F80}, 100 + /// + public static PropertyKey BusinessAddressPostalCode + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E1D4A09E-D758-4CD1-B6EC-34A8B5A73F80}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessAddressPostOfficeBox -- PKEY_Contact_BusinessAddressPostOfficeBox + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {BC4E71CE-17F9-48D5-BEE9-021DF0EA5409}, 100 + /// + public static PropertyKey BusinessAddressPostOfficeBox + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BC4E71CE-17F9-48D5-BEE9-021DF0EA5409}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessAddressState -- PKEY_Contact_BusinessAddressState + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {446F787F-10C4-41CB-A6C4-4D0343551597}, 100 + /// + public static PropertyKey BusinessAddressState + { + get + { + PropertyKey key = new PropertyKey(new Guid("{446F787F-10C4-41CB-A6C4-4D0343551597}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessAddressStreet -- PKEY_Contact_BusinessAddressStreet + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DDD1460F-C0BF-4553-8CE4-10433C908FB0}, 100 + /// + public static PropertyKey BusinessAddressStreet + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DDD1460F-C0BF-4553-8CE4-10433C908FB0}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessFaxNumber -- PKEY_Contact_BusinessFaxNumber + /// Description: Business fax number of the contact. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {91EFF6F3-2E27-42CA-933E-7C999FBE310B}, 100 + /// + public static PropertyKey BusinessFaxNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{91EFF6F3-2E27-42CA-933E-7C999FBE310B}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessHomePage -- PKEY_Contact_BusinessHomePage + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {56310920-2491-4919-99CE-EADB06FAFDB2}, 100 + /// + public static PropertyKey BusinessHomepage + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56310920-2491-4919-99CE-EADB06FAFDB2}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.BusinessTelephone -- PKEY_Contact_BusinessTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6A15E5A0-0A1E-4CD7-BB8C-D2F1B0C929BC}, 100 + /// + public static PropertyKey BusinessTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6A15E5A0-0A1E-4CD7-BB8C-D2F1B0C929BC}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.CallbackTelephone -- PKEY_Contact_CallbackTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {BF53D1C3-49E0-4F7F-8567-5A821D8AC542}, 100 + /// + public static PropertyKey CallbackTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BF53D1C3-49E0-4F7F-8567-5A821D8AC542}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.CarTelephone -- PKEY_Contact_CarTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8FDC6DEA-B929-412B-BA90-397A257465FE}, 100 + /// + public static PropertyKey CarTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8FDC6DEA-B929-412B-BA90-397A257465FE}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.Children -- PKEY_Contact_Children + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D4729704-8EF1-43EF-9024-2BD381187FD5}, 100 + /// + public static PropertyKey Children + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D4729704-8EF1-43EF-9024-2BD381187FD5}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.CompanyMainTelephone -- PKEY_Contact_CompanyMainTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8589E481-6040-473D-B171-7FA89C2708ED}, 100 + /// + public static PropertyKey CompanyMainTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8589E481-6040-473D-B171-7FA89C2708ED}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.Department -- PKEY_Contact_Department + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FC9F7306-FF8F-4D49-9FB6-3FFE5C0951EC}, 100 + /// + public static PropertyKey Department + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FC9F7306-FF8F-4D49-9FB6-3FFE5C0951EC}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.EmailAddress -- PKEY_Contact_EmailAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F8FA7FA3-D12B-4785-8A4E-691A94F7A3E7}, 100 + /// + public static PropertyKey EmailAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F8FA7FA3-D12B-4785-8A4E-691A94F7A3E7}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.EmailAddress2 -- PKEY_Contact_EmailAddress2 + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {38965063-EDC8-4268-8491-B7723172CF29}, 100 + /// + public static PropertyKey EmailAddress2 + { + get + { + PropertyKey key = new PropertyKey(new Guid("{38965063-EDC8-4268-8491-B7723172CF29}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.EmailAddress3 -- PKEY_Contact_EmailAddress3 + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {644D37B4-E1B3-4BAD-B099-7E7C04966ACA}, 100 + /// + public static PropertyKey EmailAddress3 + { + get + { + PropertyKey key = new PropertyKey(new Guid("{644D37B4-E1B3-4BAD-B099-7E7C04966ACA}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.EmailAddresses -- PKEY_Contact_EmailAddresses + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {84D8F337-981D-44B3-9615-C7596DBA17E3}, 100 + /// + public static PropertyKey EmailAddresses + { + get + { + PropertyKey key = new PropertyKey(new Guid("{84D8F337-981D-44B3-9615-C7596DBA17E3}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.EmailName -- PKEY_Contact_EmailName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CC6F4F24-6083-4BD4-8754-674D0DE87AB8}, 100 + /// + public static PropertyKey EmailName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CC6F4F24-6083-4BD4-8754-674D0DE87AB8}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.FileAsName -- PKEY_Contact_FileAsName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F1A24AA7-9CA7-40F6-89EC-97DEF9FFE8DB}, 100 + /// + public static PropertyKey FileAsName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F1A24AA7-9CA7-40F6-89EC-97DEF9FFE8DB}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.FirstName -- PKEY_Contact_FirstName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {14977844-6B49-4AAD-A714-A4513BF60460}, 100 + /// + public static PropertyKey FirstName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14977844-6B49-4AAD-A714-A4513BF60460}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.FullName -- PKEY_Contact_FullName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {635E9051-50A5-4BA2-B9DB-4ED056C77296}, 100 + /// + public static PropertyKey FullName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{635E9051-50A5-4BA2-B9DB-4ED056C77296}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.Gender -- PKEY_Contact_Gender + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}, 100 + /// + public static PropertyKey Gender + { + get + { + PropertyKey key = new PropertyKey(new Guid("{3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.GenderValue -- PKEY_Contact_GenderValue + /// Description: + /// Type: UInt16 -- VT_UI2 + /// FormatID: {3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}, 101 + /// + public static PropertyKey GenderValue + { + get + { + PropertyKey key = new PropertyKey(new Guid("{3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}"), 101); + + return key; + } + } + + /// + /// Name: System.Contact.Hobbies -- PKEY_Contact_Hobbies + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {5DC2253F-5E11-4ADF-9CFE-910DD01E3E70}, 100 + /// + public static PropertyKey Hobbies + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5DC2253F-5E11-4ADF-9CFE-910DD01E3E70}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.HomeAddress -- PKEY_Contact_HomeAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {98F98354-617A-46B8-8560-5B1B64BF1F89}, 100 + /// + public static PropertyKey HomeAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{98F98354-617A-46B8-8560-5B1B64BF1F89}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.HomeAddressCity -- PKEY_Contact_HomeAddressCity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 65 + /// + public static PropertyKey HomeAddressCity + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 65); + + return key; + } + } + + /// + /// Name: System.Contact.HomeAddressCountry -- PKEY_Contact_HomeAddressCountry + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {08A65AA1-F4C9-43DD-9DDF-A33D8E7EAD85}, 100 + /// + public static PropertyKey HomeAddressCountry + { + get + { + PropertyKey key = new PropertyKey(new Guid("{08A65AA1-F4C9-43DD-9DDF-A33D8E7EAD85}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.HomeAddressPostalCode -- PKEY_Contact_HomeAddressPostalCode + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8AFCC170-8A46-4B53-9EEE-90BAE7151E62}, 100 + /// + public static PropertyKey HomeAddressPostalCode + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8AFCC170-8A46-4B53-9EEE-90BAE7151E62}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.HomeAddressPostOfficeBox -- PKEY_Contact_HomeAddressPostOfficeBox + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7B9F6399-0A3F-4B12-89BD-4ADC51C918AF}, 100 + /// + public static PropertyKey HomeAddressPostOfficeBox + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7B9F6399-0A3F-4B12-89BD-4ADC51C918AF}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.HomeAddressState -- PKEY_Contact_HomeAddressState + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C89A23D0-7D6D-4EB8-87D4-776A82D493E5}, 100 + /// + public static PropertyKey HomeAddressState + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C89A23D0-7D6D-4EB8-87D4-776A82D493E5}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.HomeAddressStreet -- PKEY_Contact_HomeAddressStreet + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0ADEF160-DB3F-4308-9A21-06237B16FA2A}, 100 + /// + public static PropertyKey HomeAddressStreet + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0ADEF160-DB3F-4308-9A21-06237B16FA2A}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.HomeFaxNumber -- PKEY_Contact_HomeFaxNumber + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {660E04D6-81AB-4977-A09F-82313113AB26}, 100 + /// + public static PropertyKey HomeFaxNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{660E04D6-81AB-4977-A09F-82313113AB26}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.HomeTelephone -- PKEY_Contact_HomeTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 20 + /// + public static PropertyKey HomeTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 20); + + return key; + } + } + + /// + /// Name: System.Contact.IMAddress -- PKEY_Contact_IMAddress + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D68DBD8A-3374-4B81-9972-3EC30682DB3D}, 100 + /// + public static PropertyKey IMAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D68DBD8A-3374-4B81-9972-3EC30682DB3D}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.Initials -- PKEY_Contact_Initials + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F3D8F40D-50CB-44A2-9718-40CB9119495D}, 100 + /// + public static PropertyKey Initials + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F3D8F40D-50CB-44A2-9718-40CB9119495D}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.JobTitle -- PKEY_Contact_JobTitle + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 6 + /// + public static PropertyKey JobTitle + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 6); + + return key; + } + } + + /// + /// Name: System.Contact.Label -- PKEY_Contact_Label + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {97B0AD89-DF49-49CC-834E-660974FD755B}, 100 + /// + public static PropertyKey Label + { + get + { + PropertyKey key = new PropertyKey(new Guid("{97B0AD89-DF49-49CC-834E-660974FD755B}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.LastName -- PKEY_Contact_LastName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8F367200-C270-457C-B1D4-E07C5BCD90C7}, 100 + /// + public static PropertyKey LastName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8F367200-C270-457C-B1D4-E07C5BCD90C7}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.MailingAddress -- PKEY_Contact_MailingAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C0AC206A-827E-4650-95AE-77E2BB74FCC9}, 100 + /// + public static PropertyKey MailingAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C0AC206A-827E-4650-95AE-77E2BB74FCC9}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.MiddleName -- PKEY_Contact_MiddleName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 71 + /// + public static PropertyKey MiddleName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 71); + + return key; + } + } + + /// + /// Name: System.Contact.MobileTelephone -- PKEY_Contact_MobileTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 35 + /// + public static PropertyKey MobileTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 35); + + return key; + } + } + + /// + /// Name: System.Contact.NickName -- PKEY_Contact_NickName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 74 + /// + public static PropertyKey Nickname + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 74); + + return key; + } + } + + /// + /// Name: System.Contact.OfficeLocation -- PKEY_Contact_OfficeLocation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 7 + /// + public static PropertyKey OfficeLocation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 7); + + return key; + } + } + + /// + /// Name: System.Contact.OtherAddress -- PKEY_Contact_OtherAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {508161FA-313B-43D5-83A1-C1ACCF68622C}, 100 + /// + public static PropertyKey OtherAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{508161FA-313B-43D5-83A1-C1ACCF68622C}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.OtherAddressCity -- PKEY_Contact_OtherAddressCity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6E682923-7F7B-4F0C-A337-CFCA296687BF}, 100 + /// + public static PropertyKey OtherAddressCity + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6E682923-7F7B-4F0C-A337-CFCA296687BF}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.OtherAddressCountry -- PKEY_Contact_OtherAddressCountry + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8F167568-0AAE-4322-8ED9-6055B7B0E398}, 100 + /// + public static PropertyKey OtherAddressCountry + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8F167568-0AAE-4322-8ED9-6055B7B0E398}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.OtherAddressPostalCode -- PKEY_Contact_OtherAddressPostalCode + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {95C656C1-2ABF-4148-9ED3-9EC602E3B7CD}, 100 + /// + public static PropertyKey OtherAddressPostalCode + { + get + { + PropertyKey key = new PropertyKey(new Guid("{95C656C1-2ABF-4148-9ED3-9EC602E3B7CD}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.OtherAddressPostOfficeBox -- PKEY_Contact_OtherAddressPostOfficeBox + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {8B26EA41-058F-43F6-AECC-4035681CE977}, 100 + /// + public static PropertyKey OtherAddressPostOfficeBox + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8B26EA41-058F-43F6-AECC-4035681CE977}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.OtherAddressState -- PKEY_Contact_OtherAddressState + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {71B377D6-E570-425F-A170-809FAE73E54E}, 100 + /// + public static PropertyKey OtherAddressState + { + get + { + PropertyKey key = new PropertyKey(new Guid("{71B377D6-E570-425F-A170-809FAE73E54E}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.OtherAddressStreet -- PKEY_Contact_OtherAddressStreet + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FF962609-B7D6-4999-862D-95180D529AEA}, 100 + /// + public static PropertyKey OtherAddressStreet + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FF962609-B7D6-4999-862D-95180D529AEA}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.PagerTelephone -- PKEY_Contact_PagerTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D6304E01-F8F5-4F45-8B15-D024A6296789}, 100 + /// + public static PropertyKey PagerTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D6304E01-F8F5-4F45-8B15-D024A6296789}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.PersonalTitle -- PKEY_Contact_PersonalTitle + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 69 + /// + public static PropertyKey PersonalTitle + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 69); + + return key; + } + } + + /// + /// Name: System.Contact.PrimaryAddressCity -- PKEY_Contact_PrimaryAddressCity + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C8EA94F0-A9E3-4969-A94B-9C62A95324E0}, 100 + /// + public static PropertyKey PrimaryAddressCity + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C8EA94F0-A9E3-4969-A94B-9C62A95324E0}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.PrimaryAddressCountry -- PKEY_Contact_PrimaryAddressCountry + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E53D799D-0F3F-466E-B2FF-74634A3CB7A4}, 100 + /// + public static PropertyKey PrimaryAddressCountry + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E53D799D-0F3F-466E-B2FF-74634A3CB7A4}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.PrimaryAddressPostalCode -- PKEY_Contact_PrimaryAddressPostalCode + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {18BBD425-ECFD-46EF-B612-7B4A6034EDA0}, 100 + /// + public static PropertyKey PrimaryAddressPostalCode + { + get + { + PropertyKey key = new PropertyKey(new Guid("{18BBD425-ECFD-46EF-B612-7B4A6034EDA0}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.PrimaryAddressPostOfficeBox -- PKEY_Contact_PrimaryAddressPostOfficeBox + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DE5EF3C7-46E1-484E-9999-62C5308394C1}, 100 + /// + public static PropertyKey PrimaryAddressPostOfficeBox + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DE5EF3C7-46E1-484E-9999-62C5308394C1}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.PrimaryAddressState -- PKEY_Contact_PrimaryAddressState + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F1176DFE-7138-4640-8B4C-AE375DC70A6D}, 100 + /// + public static PropertyKey PrimaryAddressState + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F1176DFE-7138-4640-8B4C-AE375DC70A6D}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.PrimaryAddressStreet -- PKEY_Contact_PrimaryAddressStreet + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {63C25B20-96BE-488F-8788-C09C407AD812}, 100 + /// + public static PropertyKey PrimaryAddressStreet + { + get + { + PropertyKey key = new PropertyKey(new Guid("{63C25B20-96BE-488F-8788-C09C407AD812}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.PrimaryEmailAddress -- PKEY_Contact_PrimaryEmailAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 48 + /// + public static PropertyKey PrimaryEmailAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 48); + + return key; + } + } + + /// + /// Name: System.Contact.PrimaryTelephone -- PKEY_Contact_PrimaryTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 25 + /// + public static PropertyKey PrimaryTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 25); + + return key; + } + } + + /// + /// Name: System.Contact.Profession -- PKEY_Contact_Profession + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7268AF55-1CE4-4F6E-A41F-B6E4EF10E4A9}, 100 + /// + public static PropertyKey Profession + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7268AF55-1CE4-4F6E-A41F-B6E4EF10E4A9}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.SpouseName -- PKEY_Contact_SpouseName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9D2408B6-3167-422B-82B0-F583B7A7CFE3}, 100 + /// + public static PropertyKey SpouseName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9D2408B6-3167-422B-82B0-F583B7A7CFE3}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.Suffix -- PKEY_Contact_Suffix + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 73 + /// + public static PropertyKey Suffix + { + get + { + PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 73); + + return key; + } + } + + /// + /// Name: System.Contact.TelexNumber -- PKEY_Contact_TelexNumber + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C554493C-C1F7-40C1-A76C-EF8C0614003E}, 100 + /// + public static PropertyKey TelexNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C554493C-C1F7-40C1-A76C-EF8C0614003E}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.TTYTDDTelephone -- PKEY_Contact_TTYTDDTelephone + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {AAF16BAC-2B55-45E6-9F6D-415EB94910DF}, 100 + /// + public static PropertyKey TTYTDDTelephone + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AAF16BAC-2B55-45E6-9F6D-415EB94910DF}"), 100); + + return key; + } + } + + /// + /// Name: System.Contact.WebPage -- PKEY_Contact_WebPage + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 18 + /// + public static PropertyKey Webpage + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 18); + + return key; + } + } + #endregion + + + #region sub-classes + + /// + /// JA Properties + /// + public static class JA + { + + + #region Properties + + /// + /// Name: System.Contact.JA.CompanyNamePhonetic -- PKEY_Contact_JA_CompanyNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 2 + /// + public static PropertyKey CompanyNamePhonetic + { + get + { + PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 2); + + return key; + } + } + + /// + /// Name: System.Contact.JA.FirstNamePhonetic -- PKEY_Contact_JA_FirstNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 3 + /// + public static PropertyKey FirstNamePhonetic + { + get + { + PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 3); + + return key; + } + } + + /// + /// Name: System.Contact.JA.LastNamePhonetic -- PKEY_Contact_JA_LastNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 4 + /// + public static PropertyKey LastNamePhonetic + { + get + { + PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 4); + + return key; + } + } + #endregion + + } + #endregion + } + + /// + /// JA Properties + /// + public static class JA + { + + + #region Properties + + /// + /// Name: System.Contact.JA.CompanyNamePhonetic -- PKEY_Contact_JA_CompanyNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 2 + /// + public static PropertyKey CompanyNamePhonetic + { + get + { + PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 2); + + return key; + } + } + + /// + /// Name: System.Contact.JA.FirstNamePhonetic -- PKEY_Contact_JA_FirstNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 3 + /// + public static PropertyKey FirstNamePhonetic + { + get + { + PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 3); + + return key; + } + } + + /// + /// Name: System.Contact.JA.LastNamePhonetic -- PKEY_Contact_JA_LastNamePhonetic + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 4 + /// + public static PropertyKey LastNamePhonetic + { + get + { + PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 4); + + return key; + } + } + #endregion + + + + } + + /// + /// Device Properties + /// + public static class Device + { + + + #region Properties + + /// + /// Name: System.Device.PrinterURL -- PKEY_Device_PrinterURL + /// Description: Printer information Printer URL. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0B48F35A-BE6E-4F17-B108-3C4073D1669A}, 15 + /// + public static PropertyKey PrinterUrl + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0B48F35A-BE6E-4F17-B108-3C4073D1669A}"), 15); + + return key; + } + } + #endregion + + + + } + + /// + /// DeviceInterface Properties + /// + public static class DeviceInterface + { + + + #region Properties + + /// + /// Name: System.DeviceInterface.PrinterDriverDirectory -- PKEY_DeviceInterface_PrinterDriverDirectory + /// Description: Printer information Printer Driver Directory. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {847C66DE-B8D6-4AF9-ABC3-6F4F926BC039}, 14 + /// + public static PropertyKey PrinterDriverDirectory + { + get + { + PropertyKey key = new PropertyKey(new Guid("{847C66DE-B8D6-4AF9-ABC3-6F4F926BC039}"), 14); + + return key; + } + } + + /// + /// Name: System.DeviceInterface.PrinterDriverName -- PKEY_DeviceInterface_PrinterDriverName + /// Description: Printer information Driver Name. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {AFC47170-14F5-498C-8F30-B0D19BE449C6}, 11 + /// + public static PropertyKey PrinterDriverName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AFC47170-14F5-498C-8F30-B0D19BE449C6}"), 11); + + return key; + } + } + + /// + /// Name: System.DeviceInterface.PrinterName -- PKEY_DeviceInterface_PrinterName + /// Description: Printer information Printer Name. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0A7B84EF-0C27-463F-84EF-06C5070001BE}, 10 + /// + public static PropertyKey PrinterName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0A7B84EF-0C27-463F-84EF-06C5070001BE}"), 10); + + return key; + } + } + + /// + /// Name: System.DeviceInterface.PrinterPortName -- PKEY_DeviceInterface_PrinterPortName + /// Description: Printer information Port Name. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {EEC7B761-6F94-41B1-949F-C729720DD13C}, 12 + /// + public static PropertyKey PrinterPortName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{EEC7B761-6F94-41B1-949F-C729720DD13C}"), 12); + + return key; + } + } + #endregion + + + + } + + /// + /// Devices Properties + /// + public static class Devices + { + + + #region Properties + + /// + /// Name: System.Devices.BatteryLife -- PKEY_Devices_BatteryLife + /// Description: Remaining battery life of the device as an integer between 0 and 100 percent. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 10 + /// + public static PropertyKey BatteryLife + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 10); + + return key; + } + } + + /// + /// Name: System.Devices.BatteryPlusCharging -- PKEY_Devices_BatteryPlusCharging + /// Description: Remaining battery life of the device as an integer between 0 and 100 percent and the device's charging state. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 22 + /// + public static PropertyKey BatteryPlusCharging + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 22); + + return key; + } + } + + /// + /// Name: System.Devices.BatteryPlusChargingText -- PKEY_Devices_BatteryPlusChargingText + /// Description: Remaining battery life of the device and the device's charging state as a string. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 23 + /// + public static PropertyKey BatteryPlusChargingText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 23); + + return key; + } + } + + /// + /// Name: System.Devices.Category -- PKEY_Devices_Category_Desc_Singular + /// Description: Singular form of device category. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 91 + /// + public static PropertyKey Category + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 91); + + return key; + } + } + + /// + /// Name: System.Devices.CategoryGroup -- PKEY_Devices_CategoryGroup_Desc + /// Description: Plural form of device category. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 94 + /// + public static PropertyKey CategoryGroup + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 94); + + return key; + } + } + + /// + /// Name: System.Devices.CategoryPlural -- PKEY_Devices_Category_Desc_Plural + /// Description: Plural form of device category. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 92 + /// + public static PropertyKey CategoryPlural + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 92); + + return key; + } + } + + /// + /// Name: System.Devices.ChargingState -- PKEY_Devices_ChargingState + /// Description: Boolean value representing if the device is currently charging. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 11 + /// + public static PropertyKey ChargingState + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 11); + + return key; + } + } + + /// + /// Name: System.Devices.Connected -- PKEY_Devices_IsConnected + /// Description: Device connection state. If VARIANT_TRUE, indicates the device is currently connected to the computer. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 55 + /// + public static PropertyKey Connected + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 55); + + return key; + } + } + + /// + /// Name: System.Devices.ContainerId -- PKEY_Devices_ContainerId + /// Description: Device container ID. + /// + /// Type: Guid -- VT_CLSID + /// FormatID: {8C7ED206-3F8A-4827-B3AB-AE9E1FAEFC6C}, 2 + /// + public static PropertyKey ContainerId + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8C7ED206-3F8A-4827-B3AB-AE9E1FAEFC6C}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.DefaultTooltip -- PKEY_Devices_DefaultTooltip + /// Description: Tooltip for default state + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 153 + /// + public static PropertyKey DefaultTooltip + { + get + { + PropertyKey key = new PropertyKey(new Guid("{880F70A2-6082-47AC-8AAB-A739D1A300C3}"), 153); + + return key; + } + } + + /// + /// Name: System.Devices.DeviceDescription1 -- PKEY_Devices_DeviceDescription1 + /// Description: First line of descriptive text about the device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 81 + /// + public static PropertyKey DeviceDescription1 + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 81); + + return key; + } + } + + /// + /// Name: System.Devices.DeviceDescription2 -- PKEY_Devices_DeviceDescription2 + /// Description: Second line of descriptive text about the device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 82 + /// + public static PropertyKey DeviceDescription2 + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 82); + + return key; + } + } + + /// + /// Name: System.Devices.DiscoveryMethod -- PKEY_Devices_DiscoveryMethod + /// Description: Device discovery method. This indicates on what transport or physical connection the device is discovered. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 52 + /// + public static PropertyKey DiscoveryMethod + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 52); + + return key; + } + } + + /// + /// Name: System.Devices.FriendlyName -- PKEY_Devices_FriendlyName + /// Description: Device friendly name. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 12288 + /// + public static PropertyKey FriendlyName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{656A3BB3-ECC0-43FD-8477-4AE0404A96CD}"), 12288); + + return key; + } + } + + /// + /// Name: System.Devices.FunctionPaths -- PKEY_Devices_FunctionPaths + /// Description: Available functions for this device. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 3 + /// + public static PropertyKey FunctionPaths + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 3); + + return key; + } + } + + /// + /// Name: System.Devices.InterfacePaths -- PKEY_Devices_InterfacePaths + /// Description: Available interfaces for this device. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 2 + /// + public static PropertyKey InterfacePaths + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.IsDefault -- PKEY_Devices_IsDefaultDevice + /// Description: If VARIANT_TRUE, the device is not working properly. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 86 + /// + public static PropertyKey IsDefault + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 86); + + return key; + } + } + + /// + /// Name: System.Devices.IsNetworkConnected -- PKEY_Devices_IsNetworkDevice + /// Description: If VARIANT_TRUE, the device is not working properly. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 85 + /// + public static PropertyKey IsNetworkConnected + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 85); + + return key; + } + } + + /// + /// Name: System.Devices.IsShared -- PKEY_Devices_IsSharedDevice + /// Description: If VARIANT_TRUE, the device is not working properly. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 84 + /// + public static PropertyKey IsShared + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 84); + + return key; + } + } + + /// + /// Name: System.Devices.IsSoftwareInstalling -- PKEY_Devices_IsSoftwareInstalling + /// Description: If VARIANT_TRUE, the device installer is currently installing software. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {83DA6326-97A6-4088-9453-A1923F573B29}, 9 + /// + public static PropertyKey IsSoftwareInstalling + { + get + { + PropertyKey key = new PropertyKey(new Guid("{83DA6326-97A6-4088-9453-A1923F573B29}"), 9); + + return key; + } + } + + /// + /// Name: System.Devices.LaunchDeviceStageFromExplorer -- PKEY_Devices_LaunchDeviceStageFromExplorer + /// Description: Indicates whether to launch Device Stage or not + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 77 + /// + public static PropertyKey LaunchDeviceStageFromExplorer + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 77); + + return key; + } + } + + /// + /// Name: System.Devices.LocalMachine -- PKEY_Devices_IsLocalMachine + /// Description: If VARIANT_TRUE, the device in question is actually the computer. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 70 + /// + public static PropertyKey LocalMachine + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 70); + + return key; + } + } + + /// + /// Name: System.Devices.Manufacturer -- PKEY_Devices_Manufacturer + /// Description: Device manufacturer. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8192 + /// + public static PropertyKey Manufacturer + { + get + { + PropertyKey key = new PropertyKey(new Guid("{656A3BB3-ECC0-43FD-8477-4AE0404A96CD}"), 8192); + + return key; + } + } + + /// + /// Name: System.Devices.MissedCalls -- PKEY_Devices_MissedCalls + /// Description: Number of missed calls on the device. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 5 + /// + public static PropertyKey MissedCalls + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 5); + + return key; + } + } + + /// + /// Name: System.Devices.ModelName -- PKEY_Devices_ModelName + /// Description: Model name of the device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8194 + /// + public static PropertyKey ModelName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{656A3BB3-ECC0-43FD-8477-4AE0404A96CD}"), 8194); + + return key; + } + } + + /// + /// Name: System.Devices.ModelNumber -- PKEY_Devices_ModelNumber + /// Description: Model number of the device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8195 + /// + public static PropertyKey ModelNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{656A3BB3-ECC0-43FD-8477-4AE0404A96CD}"), 8195); + + return key; + } + } + + /// + /// Name: System.Devices.NetworkedTooltip -- PKEY_Devices_NetworkedTooltip + /// Description: Tooltip for connection state + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 152 + /// + public static PropertyKey NetworkedTooltip + { + get + { + PropertyKey key = new PropertyKey(new Guid("{880F70A2-6082-47AC-8AAB-A739D1A300C3}"), 152); + + return key; + } + } + + /// + /// Name: System.Devices.NetworkName -- PKEY_Devices_NetworkName + /// Description: Name of the device's network. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 7 + /// + public static PropertyKey NetworkName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 7); + + return key; + } + } + + /// + /// Name: System.Devices.NetworkType -- PKEY_Devices_NetworkType + /// Description: String representing the type of the device's network. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 8 + /// + public static PropertyKey NetworkType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 8); + + return key; + } + } + + /// + /// Name: System.Devices.NewPictures -- PKEY_Devices_NewPictures + /// Description: Number of new pictures on the device. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 4 + /// + public static PropertyKey NewPictures + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 4); + + return key; + } + } + + /// + /// Name: System.Devices.Notification -- PKEY_Devices_Notification + /// Description: Device Notification Property. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {06704B0C-E830-4C81-9178-91E4E95A80A0}, 3 + /// + public static PropertyKey Notification + { + get + { + PropertyKey key = new PropertyKey(new Guid("{06704B0C-E830-4C81-9178-91E4E95A80A0}"), 3); + + return key; + } + } + + /// + /// Name: System.Devices.NotificationStore -- PKEY_Devices_NotificationStore + /// Description: Device Notification Store. + /// + /// Type: Object -- VT_UNKNOWN + /// FormatID: {06704B0C-E830-4C81-9178-91E4E95A80A0}, 2 + /// + public static PropertyKey NotificationStore + { + get + { + PropertyKey key = new PropertyKey(new Guid("{06704B0C-E830-4C81-9178-91E4E95A80A0}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.NotWorkingProperly -- PKEY_Devices_IsNotWorkingProperly + /// Description: If VARIANT_TRUE, the device is not working properly. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 83 + /// + public static PropertyKey NotWorkingProperly + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 83); + + return key; + } + } + + /// + /// Name: System.Devices.Paired -- PKEY_Devices_IsPaired + /// Description: Device paired state. If VARIANT_TRUE, indicates the device is not paired with the computer. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 56 + /// + public static PropertyKey Paired + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 56); + + return key; + } + } + + /// + /// Name: System.Devices.PrimaryCategory -- PKEY_Devices_PrimaryCategory + /// Description: Primary category group for this device. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 10 + /// + public static PropertyKey PrimaryCategory + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 10); + + return key; + } + } + + /// + /// Name: System.Devices.Roaming -- PKEY_Devices_Roaming + /// Description: Status indicator used to indicate if the device is roaming. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 9 + /// + public static PropertyKey Roaming + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 9); + + return key; + } + } + + /// + /// Name: System.Devices.SafeRemovalRequired -- PKEY_Devices_SafeRemovalRequired + /// Description: Indicates if a device requires safe removal or not + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {AFD97640-86A3-4210-B67C-289C41AABE55}, 2 + /// + public static PropertyKey SafeRemovalRequired + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AFD97640-86A3-4210-B67C-289C41AABE55}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.SharedTooltip -- PKEY_Devices_SharedTooltip + /// Description: Tooltip for sharing state + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 151 + /// + public static PropertyKey SharedTooltip + { + get + { + PropertyKey key = new PropertyKey(new Guid("{880F70A2-6082-47AC-8AAB-A739D1A300C3}"), 151); + + return key; + } + } + + /// + /// Name: System.Devices.SignalStrength -- PKEY_Devices_SignalStrength + /// Description: Device signal strength. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 2 + /// + public static PropertyKey SignalStrength + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Status1 -- PKEY_Devices_Status1 + /// Description: 1st line of device status. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 257 + /// + public static PropertyKey Status1 + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 257); + + return key; + } + } + + /// + /// Name: System.Devices.Status2 -- PKEY_Devices_Status2 + /// Description: 2nd line of device status. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 258 + /// + public static PropertyKey Status2 + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 258); + + return key; + } + } + + /// + /// Name: System.Devices.StorageCapacity -- PKEY_Devices_StorageCapacity + /// Description: Total storage capacity of the device. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 12 + /// + public static PropertyKey StorageCapacity + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 12); + + return key; + } + } + + /// + /// Name: System.Devices.StorageFreeSpace -- PKEY_Devices_StorageFreeSpace + /// Description: Total free space of the storage of the device. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 13 + /// + public static PropertyKey StorageFreeSpace + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 13); + + return key; + } + } + + /// + /// Name: System.Devices.StorageFreeSpacePercent -- PKEY_Devices_StorageFreeSpacePercent + /// Description: Total free space of the storage of the device as a percentage. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 14 + /// + public static PropertyKey StorageFreeSpacePercent + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 14); + + return key; + } + } + + /// + /// Name: System.Devices.TextMessages -- PKEY_Devices_TextMessages + /// Description: Number of unread text messages on the device. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 3 + /// + public static PropertyKey TextMessages + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 3); + + return key; + } + } + + /// + /// Name: System.Devices.Voicemail -- PKEY_Devices_Voicemail + /// Description: Status indicator used to indicate if the device has voicemail. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 6 + /// + public static PropertyKey Voicemail + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 6); + + return key; + } + } + #endregion + + + #region sub-classes + + /// + /// Notifications Properties + /// + public static class Notifications + { + + + #region Properties + + /// + /// Name: System.Devices.Notifications.LowBattery -- PKEY_Devices_Notification_LowBattery + /// Description: Device Low Battery Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {C4C07F2B-8524-4E66-AE3A-A6235F103BEB}, 2 + /// + public static PropertyKey LowBattery + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C4C07F2B-8524-4E66-AE3A-A6235F103BEB}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.MissedCall -- PKEY_Devices_Notification_MissedCall + /// Description: Device Missed Call Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {6614EF48-4EFE-4424-9EDA-C79F404EDF3E}, 2 + /// + public static PropertyKey MissedCall + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6614EF48-4EFE-4424-9EDA-C79F404EDF3E}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.NewMessage -- PKEY_Devices_Notification_NewMessage + /// Description: Device New Message Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {2BE9260A-2012-4742-A555-F41B638B7DCB}, 2 + /// + public static PropertyKey NewMessage + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2BE9260A-2012-4742-A555-F41B638B7DCB}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.NewVoicemail -- PKEY_Devices_Notification_NewVoicemail + /// Description: Device Voicemail Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {59569556-0A08-4212-95B9-FAE2AD6413DB}, 2 + /// + public static PropertyKey NewVoicemail + { + get + { + PropertyKey key = new PropertyKey(new Guid("{59569556-0A08-4212-95B9-FAE2AD6413DB}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.StorageFull -- PKEY_Devices_Notification_StorageFull + /// Description: Device Storage Full Notification. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 2 + /// + public static PropertyKey StorageFull + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.StorageFullLinkText -- PKEY_Devices_Notification_StorageFullLinkText + /// Description: Link Text for the Device Storage Full Notification. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 3 + /// + public static PropertyKey StorageFullLinkText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}"), 3); + + return key; + } + } + #endregion + + + + } + #endregion + } + + /// + /// Notifications Properties + /// + public static class Notifications + { + + + #region Properties + + /// + /// Name: System.Devices.Notifications.LowBattery -- PKEY_Devices_Notification_LowBattery + /// Description: Device Low Battery Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {C4C07F2B-8524-4E66-AE3A-A6235F103BEB}, 2 + /// + public static PropertyKey LowBattery + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C4C07F2B-8524-4E66-AE3A-A6235F103BEB}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.MissedCall -- PKEY_Devices_Notification_MissedCall + /// Description: Device Missed Call Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {6614EF48-4EFE-4424-9EDA-C79F404EDF3E}, 2 + /// + public static PropertyKey MissedCall + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6614EF48-4EFE-4424-9EDA-C79F404EDF3E}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.NewMessage -- PKEY_Devices_Notification_NewMessage + /// Description: Device New Message Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {2BE9260A-2012-4742-A555-F41B638B7DCB}, 2 + /// + public static PropertyKey NewMessage + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2BE9260A-2012-4742-A555-F41B638B7DCB}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.NewVoicemail -- PKEY_Devices_Notification_NewVoicemail + /// Description: Device Voicemail Notification. + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {59569556-0A08-4212-95B9-FAE2AD6413DB}, 2 + /// + public static PropertyKey NewVoicemail + { + get + { + PropertyKey key = new PropertyKey(new Guid("{59569556-0A08-4212-95B9-FAE2AD6413DB}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.StorageFull -- PKEY_Devices_Notification_StorageFull + /// Description: Device Storage Full Notification. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 2 + /// + public static PropertyKey StorageFull + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}"), 2); + + return key; + } + } + + /// + /// Name: System.Devices.Notifications.StorageFullLinkText -- PKEY_Devices_Notification_StorageFullLinkText + /// Description: Link Text for the Device Storage Full Notification. + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 3 + /// + public static PropertyKey StorageFullLinkText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}"), 3); + + return key; + } + } + #endregion + + + + } + + /// + /// Document Properties + /// + public static class Document + { + + + #region Properties + + /// + /// Name: System.Document.ByteCount -- PKEY_Document_ByteCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 4 (PIDDSI_BYTECOUNT) + /// + public static PropertyKey ByteCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 4); + + return key; + } + } + + /// + /// Name: System.Document.CharacterCount -- PKEY_Document_CharacterCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 16 (PIDSI_CHARCOUNT) + /// + public static PropertyKey CharacterCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 16); + + return key; + } + } + + /// + /// Name: System.Document.ClientID -- PKEY_Document_ClientID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {276D7BB0-5B34-4FB0-AA4B-158ED12A1809}, 100 + /// + public static PropertyKey ClientID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{276D7BB0-5B34-4FB0-AA4B-158ED12A1809}"), 100); + + return key; + } + } + + /// + /// Name: System.Document.Contributor -- PKEY_Document_Contributor + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {F334115E-DA1B-4509-9B3D-119504DC7ABB}, 100 + /// + public static PropertyKey Contributor + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F334115E-DA1B-4509-9B3D-119504DC7ABB}"), 100); + + return key; + } + } + + /// + /// Name: System.Document.DateCreated -- PKEY_Document_DateCreated + /// Description: This property is stored in the document, not obtained from the file system. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 12 (PIDSI_CREATE_DTM) + /// + public static PropertyKey DateCreated + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 12); + + return key; + } + } + + /// + /// Name: System.Document.DatePrinted -- PKEY_Document_DatePrinted + /// Description: Legacy name: "DocLastPrinted". + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 11 (PIDSI_LASTPRINTED) + /// + public static PropertyKey DatePrinted + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 11); + + return key; + } + } + + /// + /// Name: System.Document.DateSaved -- PKEY_Document_DateSaved + /// Description: Legacy name: "DocLastSavedTm". + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 13 (PIDSI_LASTSAVE_DTM) + /// + public static PropertyKey DateSaved + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 13); + + return key; + } + } + + /// + /// Name: System.Document.Division -- PKEY_Document_Division + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {1E005EE6-BF27-428B-B01C-79676ACD2870}, 100 + /// + public static PropertyKey Division + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1E005EE6-BF27-428B-B01C-79676ACD2870}"), 100); + + return key; + } + } + + /// + /// Name: System.Document.DocumentID -- PKEY_Document_DocumentID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E08805C8-E395-40DF-80D2-54F0D6C43154}, 100 + /// + public static PropertyKey DocumentID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E08805C8-E395-40DF-80D2-54F0D6C43154}"), 100); + + return key; + } + } + + /// + /// Name: System.Document.HiddenSlideCount -- PKEY_Document_HiddenSlideCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 9 (PIDDSI_HIDDENCOUNT) + /// + public static PropertyKey HiddenSlideCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 9); + + return key; + } + } + + /// + /// Name: System.Document.LastAuthor -- PKEY_Document_LastAuthor + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 8 (PIDSI_LASTAUTHOR) + /// + public static PropertyKey LastAuthor + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 8); + + return key; + } + } + + /// + /// Name: System.Document.LineCount -- PKEY_Document_LineCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 5 (PIDDSI_LINECOUNT) + /// + public static PropertyKey LineCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 5); + + return key; + } + } + + /// + /// Name: System.Document.Manager -- PKEY_Document_Manager + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 14 (PIDDSI_MANAGER) + /// + public static PropertyKey Manager + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 14); + + return key; + } + } + + /// + /// Name: System.Document.MultimediaClipCount -- PKEY_Document_MultimediaClipCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 10 (PIDDSI_MMCLIPCOUNT) + /// + public static PropertyKey MultimediaClipCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 10); + + return key; + } + } + + /// + /// Name: System.Document.NoteCount -- PKEY_Document_NoteCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 8 (PIDDSI_NOTECOUNT) + /// + public static PropertyKey NoteCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 8); + + return key; + } + } + + /// + /// Name: System.Document.PageCount -- PKEY_Document_PageCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 14 (PIDSI_PAGECOUNT) + /// + public static PropertyKey PageCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 14); + + return key; + } + } + + /// + /// Name: System.Document.ParagraphCount -- PKEY_Document_ParagraphCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 6 (PIDDSI_PARCOUNT) + /// + public static PropertyKey ParagraphCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 6); + + return key; + } + } + + /// + /// Name: System.Document.PresentationFormat -- PKEY_Document_PresentationFormat + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 3 (PIDDSI_PRESFORMAT) + /// + public static PropertyKey PresentationFormat + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 3); + + return key; + } + } + + /// + /// Name: System.Document.RevisionNumber -- PKEY_Document_RevisionNumber + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 9 (PIDSI_REVNUMBER) + /// + public static PropertyKey RevisionNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 9); + + return key; + } + } + + /// + /// Name: System.Document.Security -- PKEY_Document_Security + /// Description: Access control information, from SummaryInfo propset + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 19 + /// + public static PropertyKey Security + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 19); + + return key; + } + } + + /// + /// Name: System.Document.SlideCount -- PKEY_Document_SlideCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 7 (PIDDSI_SLIDECOUNT) + /// + public static PropertyKey SlideCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 7); + + return key; + } + } + + /// + /// Name: System.Document.Template -- PKEY_Document_Template + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 7 (PIDSI_TEMPLATE) + /// + public static PropertyKey Template + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 7); + + return key; + } + } + + /// + /// Name: System.Document.TotalEditingTime -- PKEY_Document_TotalEditingTime + /// Description: 100ns units, not milliseconds. VT_FILETIME for IPropertySetStorage handlers (legacy) + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 10 (PIDSI_EDITTIME) + /// + public static PropertyKey TotalEditingTime + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 10); + + return key; + } + } + + /// + /// Name: System.Document.Version -- PKEY_Document_Version + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 29 + /// + public static PropertyKey Version + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 29); + + return key; + } + } + + /// + /// Name: System.Document.WordCount -- PKEY_Document_WordCount + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 15 (PIDSI_WORDCOUNT) + /// + public static PropertyKey WordCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 15); + + return key; + } + } + #endregion + + + + } + + /// + /// DRM Properties + /// + public static class DRM + { + + + #region Properties + + /// + /// Name: System.DRM.DatePlayExpires -- PKEY_DRM_DatePlayExpires + /// Description: Indicates when play expires for digital rights management. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 6 (PIDDRSI_PLAYEXPIRES) + /// + public static PropertyKey DatePlayExpires + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 6); + + return key; + } + } + + /// + /// Name: System.DRM.DatePlayStarts -- PKEY_DRM_DatePlayStarts + /// Description: Indicates when play starts for digital rights management. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 5 (PIDDRSI_PLAYSTARTS) + /// + public static PropertyKey DatePlayStarts + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 5); + + return key; + } + } + + /// + /// Name: System.DRM.Description -- PKEY_DRM_Description + /// Description: Displays the description for digital rights management. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 3 (PIDDRSI_DESCRIPTION) + /// + public static PropertyKey Description + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 3); + + return key; + } + } + + /// + /// Name: System.DRM.IsProtected -- PKEY_DRM_IsProtected + /// Description: + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 2 (PIDDRSI_PROTECTED) + /// + public static PropertyKey IsProtected + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 2); + + return key; + } + } + + /// + /// Name: System.DRM.PlayCount -- PKEY_DRM_PlayCount + /// Description: Indicates the play count for digital rights management. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 4 (PIDDRSI_PLAYCOUNT) + /// + public static PropertyKey PlayCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 4); + + return key; + } + } + #endregion + + + + } + + /// + /// GPS Properties + /// + public static class GPS + { + + + #region Properties + + /// + /// Name: System.GPS.Altitude -- PKEY_GPS_Altitude + /// Description: Indicates the altitude based on the reference in PKEY_GPS_AltitudeRef. Calculated from PKEY_GPS_AltitudeNumerator and + ///PKEY_GPS_AltitudeDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {827EDB4F-5B73-44A7-891D-FDFFABEA35CA}, 100 + /// + public static PropertyKey Altitude + { + get + { + PropertyKey key = new PropertyKey(new Guid("{827EDB4F-5B73-44A7-891D-FDFFABEA35CA}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.AltitudeDenominator -- PKEY_GPS_AltitudeDenominator + /// Description: Denominator of PKEY_GPS_Altitude + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {78342DCB-E358-4145-AE9A-6BFE4E0F9F51}, 100 + /// + public static PropertyKey AltitudeDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{78342DCB-E358-4145-AE9A-6BFE4E0F9F51}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.AltitudeNumerator -- PKEY_GPS_AltitudeNumerator + /// Description: Numerator of PKEY_GPS_Altitude + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {2DAD1EB7-816D-40D3-9EC3-C9773BE2AADE}, 100 + /// + public static PropertyKey AltitudeNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2DAD1EB7-816D-40D3-9EC3-C9773BE2AADE}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.AltitudeRef -- PKEY_GPS_AltitudeRef + /// Description: Indicates the reference for the altitude property. (eg: above sea level, below sea level, absolute value) + /// + /// Type: Byte -- VT_UI1 + /// FormatID: {46AC629D-75EA-4515-867F-6DC4321C5844}, 100 + /// + public static PropertyKey AltitudeRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{46AC629D-75EA-4515-867F-6DC4321C5844}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.AreaInformation -- PKEY_GPS_AreaInformation + /// Description: Represents the name of the GPS area + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {972E333E-AC7E-49F1-8ADF-A70D07A9BCAB}, 100 + /// + public static PropertyKey AreaInformation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{972E333E-AC7E-49F1-8ADF-A70D07A9BCAB}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.Date -- PKEY_GPS_Date + /// Description: Date and time of the GPS record + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {3602C812-0F3B-45F0-85AD-603468D69423}, 100 + /// + public static PropertyKey Date + { + get + { + PropertyKey key = new PropertyKey(new Guid("{3602C812-0F3B-45F0-85AD-603468D69423}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestBearing -- PKEY_GPS_DestBearing + /// Description: Indicates the bearing to the destination point. Calculated from PKEY_GPS_DestBearingNumerator and + ///PKEY_GPS_DestBearingDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {C66D4B3C-E888-47CC-B99F-9DCA3EE34DEA}, 100 + /// + public static PropertyKey DestinationBearing + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C66D4B3C-E888-47CC-B99F-9DCA3EE34DEA}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestBearingDenominator -- PKEY_GPS_DestBearingDenominator + /// Description: Denominator of PKEY_GPS_DestBearing + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7ABCF4F8-7C3F-4988-AC91-8D2C2E97ECA5}, 100 + /// + public static PropertyKey DestinationBearingDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7ABCF4F8-7C3F-4988-AC91-8D2C2E97ECA5}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestBearingNumerator -- PKEY_GPS_DestBearingNumerator + /// Description: Numerator of PKEY_GPS_DestBearing + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {BA3B1DA9-86EE-4B5D-A2A4-A271A429F0CF}, 100 + /// + public static PropertyKey DestinationBearingNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BA3B1DA9-86EE-4B5D-A2A4-A271A429F0CF}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestBearingRef -- PKEY_GPS_DestBearingRef + /// Description: Indicates the reference used for the giving the bearing to the destination point. (eg: true direction, magnetic direction) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9AB84393-2A0F-4B75-BB22-7279786977CB}, 100 + /// + public static PropertyKey DestinationBearingRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9AB84393-2A0F-4B75-BB22-7279786977CB}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestDistance -- PKEY_GPS_DestDistance + /// Description: Indicates the distance to the destination point. Calculated from PKEY_GPS_DestDistanceNumerator and + ///PKEY_GPS_DestDistanceDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {A93EAE04-6804-4F24-AC81-09B266452118}, 100 + /// + public static PropertyKey DestinationDistance + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A93EAE04-6804-4F24-AC81-09B266452118}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestDistanceDenominator -- PKEY_GPS_DestDistanceDenominator + /// Description: Denominator of PKEY_GPS_DestDistance + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {9BC2C99B-AC71-4127-9D1C-2596D0D7DCB7}, 100 + /// + public static PropertyKey DestinationDistanceDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9BC2C99B-AC71-4127-9D1C-2596D0D7DCB7}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestDistanceNumerator -- PKEY_GPS_DestDistanceNumerator + /// Description: Numerator of PKEY_GPS_DestDistance + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {2BDA47DA-08C6-4FE1-80BC-A72FC517C5D0}, 100 + /// + public static PropertyKey DestinationDistanceNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2BDA47DA-08C6-4FE1-80BC-A72FC517C5D0}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestDistanceRef -- PKEY_GPS_DestDistanceRef + /// Description: Indicates the unit used to express the distance to the destination. (eg: kilometers, miles, knots) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {ED4DF2D3-8695-450B-856F-F5C1C53ACB66}, 100 + /// + public static PropertyKey DestinationDistanceRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{ED4DF2D3-8695-450B-856F-F5C1C53ACB66}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestLatitude -- PKEY_GPS_DestLatitude + /// Description: Indicates the latitude of the destination point. This is an array of three values. Index 0 is the degrees, index 1 + ///is the minutes, index 2 is the seconds. Each is calculated from the values in PKEY_GPS_DestLatitudeNumerator and + ///PKEY_GPS_DestLatitudeDenominator. + /// + /// Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8) + /// FormatID: {9D1D7CC5-5C39-451C-86B3-928E2D18CC47}, 100 + /// + public static PropertyKey DestinationLatitude + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9D1D7CC5-5C39-451C-86B3-928E2D18CC47}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestLatitudeDenominator -- PKEY_GPS_DestLatitudeDenominator + /// Description: Denominator of PKEY_GPS_DestLatitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {3A372292-7FCA-49A7-99D5-E47BB2D4E7AB}, 100 + /// + public static PropertyKey DestinationLatitudeDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{3A372292-7FCA-49A7-99D5-E47BB2D4E7AB}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestLatitudeNumerator -- PKEY_GPS_DestLatitudeNumerator + /// Description: Numerator of PKEY_GPS_DestLatitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {ECF4B6F6-D5A6-433C-BB92-4076650FC890}, 100 + /// + public static PropertyKey DestinationLatitudeNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{ECF4B6F6-D5A6-433C-BB92-4076650FC890}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestLatitudeRef -- PKEY_GPS_DestLatitudeRef + /// Description: Indicates whether the latitude destination point is north or south latitude + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CEA820B9-CE61-4885-A128-005D9087C192}, 100 + /// + public static PropertyKey DestinationLatitudeRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CEA820B9-CE61-4885-A128-005D9087C192}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestLongitude -- PKEY_GPS_DestLongitude + /// Description: Indicates the latitude of the destination point. This is an array of three values. Index 0 is the degrees, index 1 + ///is the minutes, index 2 is the seconds. Each is calculated from the values in PKEY_GPS_DestLongitudeNumerator and + ///PKEY_GPS_DestLongitudeDenominator. + /// + /// Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8) + /// FormatID: {47A96261-CB4C-4807-8AD3-40B9D9DBC6BC}, 100 + /// + public static PropertyKey DestinationLongitude + { + get + { + PropertyKey key = new PropertyKey(new Guid("{47A96261-CB4C-4807-8AD3-40B9D9DBC6BC}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestLongitudeDenominator -- PKEY_GPS_DestLongitudeDenominator + /// Description: Denominator of PKEY_GPS_DestLongitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {425D69E5-48AD-4900-8D80-6EB6B8D0AC86}, 100 + /// + public static PropertyKey DestinationLongitudeDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{425D69E5-48AD-4900-8D80-6EB6B8D0AC86}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestLongitudeNumerator -- PKEY_GPS_DestLongitudeNumerator + /// Description: Numerator of PKEY_GPS_DestLongitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {A3250282-FB6D-48D5-9A89-DBCACE75CCCF}, 100 + /// + public static PropertyKey DestinationLongitudeNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A3250282-FB6D-48D5-9A89-DBCACE75CCCF}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DestLongitudeRef -- PKEY_GPS_DestLongitudeRef + /// Description: Indicates whether the longitude destination point is east or west longitude + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {182C1EA6-7C1C-4083-AB4B-AC6C9F4ED128}, 100 + /// + public static PropertyKey DestinationLongitudeRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{182C1EA6-7C1C-4083-AB4B-AC6C9F4ED128}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.Differential -- PKEY_GPS_Differential + /// Description: Indicates whether differential correction was applied to the GPS receiver + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {AAF4EE25-BD3B-4DD7-BFC4-47F77BB00F6D}, 100 + /// + public static PropertyKey Differential + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AAF4EE25-BD3B-4DD7-BFC4-47F77BB00F6D}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DOP -- PKEY_GPS_DOP + /// Description: Indicates the GPS DOP (data degree of precision). Calculated from PKEY_GPS_DOPNumerator and PKEY_GPS_DOPDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {0CF8FB02-1837-42F1-A697-A7017AA289B9}, 100 + /// + public static PropertyKey DOP + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0CF8FB02-1837-42F1-A697-A7017AA289B9}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DOPDenominator -- PKEY_GPS_DOPDenominator + /// Description: Denominator of PKEY_GPS_DOP + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {A0BE94C5-50BA-487B-BD35-0654BE8881ED}, 100 + /// + public static PropertyKey DOPDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A0BE94C5-50BA-487B-BD35-0654BE8881ED}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.DOPNumerator -- PKEY_GPS_DOPNumerator + /// Description: Numerator of PKEY_GPS_DOP + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {47166B16-364F-4AA0-9F31-E2AB3DF449C3}, 100 + /// + public static PropertyKey DOPNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{47166B16-364F-4AA0-9F31-E2AB3DF449C3}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.ImgDirection -- PKEY_GPS_ImgDirection + /// Description: Indicates direction of the image when it was captured. Calculated from PKEY_GPS_ImgDirectionNumerator and + ///PKEY_GPS_ImgDirectionDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {16473C91-D017-4ED9-BA4D-B6BAA55DBCF8}, 100 + /// + public static PropertyKey ImageDirection + { + get + { + PropertyKey key = new PropertyKey(new Guid("{16473C91-D017-4ED9-BA4D-B6BAA55DBCF8}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.ImgDirectionDenominator -- PKEY_GPS_ImgDirectionDenominator + /// Description: Denominator of PKEY_GPS_ImgDirection + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {10B24595-41A2-4E20-93C2-5761C1395F32}, 100 + /// + public static PropertyKey ImageDirectionDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{10B24595-41A2-4E20-93C2-5761C1395F32}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.ImgDirectionNumerator -- PKEY_GPS_ImgDirectionNumerator + /// Description: Numerator of PKEY_GPS_ImgDirection + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {DC5877C7-225F-45F7-BAC7-E81334B6130A}, 100 + /// + public static PropertyKey ImageDirectionNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DC5877C7-225F-45F7-BAC7-E81334B6130A}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.ImgDirectionRef -- PKEY_GPS_ImgDirectionRef + /// Description: Indicates reference for giving the direction of the image when it was captured. (eg: true direction, magnetic direction) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A4AAA5B7-1AD0-445F-811A-0F8F6E67F6B5}, 100 + /// + public static PropertyKey ImageDirectionRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A4AAA5B7-1AD0-445F-811A-0F8F6E67F6B5}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.Latitude -- PKEY_GPS_Latitude + /// Description: Indicates the latitude. This is an array of three values. Index 0 is the degrees, index 1 is the minutes, index 2 + ///is the seconds. Each is calculated from the values in PKEY_GPS_LatitudeNumerator and PKEY_GPS_LatitudeDenominator. + /// + /// Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8) + /// FormatID: {8727CFFF-4868-4EC6-AD5B-81B98521D1AB}, 100 + /// + public static PropertyKey Latitude + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8727CFFF-4868-4EC6-AD5B-81B98521D1AB}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.LatitudeDenominator -- PKEY_GPS_LatitudeDenominator + /// Description: Denominator of PKEY_GPS_Latitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {16E634EE-2BFF-497B-BD8A-4341AD39EEB9}, 100 + /// + public static PropertyKey LatitudeDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{16E634EE-2BFF-497B-BD8A-4341AD39EEB9}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.LatitudeNumerator -- PKEY_GPS_LatitudeNumerator + /// Description: Numerator of PKEY_GPS_Latitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {7DDAAAD1-CCC8-41AE-B750-B2CB8031AEA2}, 100 + /// + public static PropertyKey LatitudeNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7DDAAAD1-CCC8-41AE-B750-B2CB8031AEA2}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.LatitudeRef -- PKEY_GPS_LatitudeRef + /// Description: Indicates whether latitude is north or south latitude + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {029C0252-5B86-46C7-ACA0-2769FFC8E3D4}, 100 + /// + public static PropertyKey LatitudeRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{029C0252-5B86-46C7-ACA0-2769FFC8E3D4}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.Longitude -- PKEY_GPS_Longitude + /// Description: Indicates the longitude. This is an array of three values. Index 0 is the degrees, index 1 is the minutes, index 2 + ///is the seconds. Each is calculated from the values in PKEY_GPS_LongitudeNumerator and PKEY_GPS_LongitudeDenominator. + /// + /// Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8) + /// FormatID: {C4C4DBB2-B593-466B-BBDA-D03D27D5E43A}, 100 + /// + public static PropertyKey Longitude + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C4C4DBB2-B593-466B-BBDA-D03D27D5E43A}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.LongitudeDenominator -- PKEY_GPS_LongitudeDenominator + /// Description: Denominator of PKEY_GPS_Longitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {BE6E176C-4534-4D2C-ACE5-31DEDAC1606B}, 100 + /// + public static PropertyKey LongitudeDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BE6E176C-4534-4D2C-ACE5-31DEDAC1606B}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.LongitudeNumerator -- PKEY_GPS_LongitudeNumerator + /// Description: Numerator of PKEY_GPS_Longitude + /// + /// Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4) + /// FormatID: {02B0F689-A914-4E45-821D-1DDA452ED2C4}, 100 + /// + public static PropertyKey LongitudeNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{02B0F689-A914-4E45-821D-1DDA452ED2C4}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.LongitudeRef -- PKEY_GPS_LongitudeRef + /// Description: Indicates whether longitude is east or west longitude + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {33DCF22B-28D5-464C-8035-1EE9EFD25278}, 100 + /// + public static PropertyKey LongitudeRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{33DCF22B-28D5-464C-8035-1EE9EFD25278}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.MapDatum -- PKEY_GPS_MapDatum + /// Description: Indicates the geodetic survey data used by the GPS receiver + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {2CA2DAE6-EDDC-407D-BEF1-773942ABFA95}, 100 + /// + public static PropertyKey MapDatum + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2CA2DAE6-EDDC-407D-BEF1-773942ABFA95}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.MeasureMode -- PKEY_GPS_MeasureMode + /// Description: Indicates the GPS measurement mode. (eg: 2-dimensional, 3-dimensional) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A015ED5D-AAEA-4D58-8A86-3C586920EA0B}, 100 + /// + public static PropertyKey MeasureMode + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A015ED5D-AAEA-4D58-8A86-3C586920EA0B}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.ProcessingMethod -- PKEY_GPS_ProcessingMethod + /// Description: Indicates the name of the method used for location finding + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {59D49E61-840F-4AA9-A939-E2099B7F6399}, 100 + /// + public static PropertyKey ProcessingMethod + { + get + { + PropertyKey key = new PropertyKey(new Guid("{59D49E61-840F-4AA9-A939-E2099B7F6399}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.Satellites -- PKEY_GPS_Satellites + /// Description: Indicates the GPS satellites used for measurements + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {467EE575-1F25-4557-AD4E-B8B58B0D9C15}, 100 + /// + public static PropertyKey Satellites + { + get + { + PropertyKey key = new PropertyKey(new Guid("{467EE575-1F25-4557-AD4E-B8B58B0D9C15}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.Speed -- PKEY_GPS_Speed + /// Description: Indicates the speed of the GPS receiver movement. Calculated from PKEY_GPS_SpeedNumerator and + ///PKEY_GPS_SpeedDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {DA5D0862-6E76-4E1B-BABD-70021BD25494}, 100 + /// + public static PropertyKey Speed + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DA5D0862-6E76-4E1B-BABD-70021BD25494}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.SpeedDenominator -- PKEY_GPS_SpeedDenominator + /// Description: Denominator of PKEY_GPS_Speed + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7D122D5A-AE5E-4335-8841-D71E7CE72F53}, 100 + /// + public static PropertyKey SpeedDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7D122D5A-AE5E-4335-8841-D71E7CE72F53}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.SpeedNumerator -- PKEY_GPS_SpeedNumerator + /// Description: Numerator of PKEY_GPS_Speed + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {ACC9CE3D-C213-4942-8B48-6D0820F21C6D}, 100 + /// + public static PropertyKey SpeedNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{ACC9CE3D-C213-4942-8B48-6D0820F21C6D}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.SpeedRef -- PKEY_GPS_SpeedRef + /// Description: Indicates the unit used to express the speed of the GPS receiver movement. (eg: kilometers per hour, + ///miles per hour, knots). + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {ECF7F4C9-544F-4D6D-9D98-8AD79ADAF453}, 100 + /// + public static PropertyKey SpeedRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{ECF7F4C9-544F-4D6D-9D98-8AD79ADAF453}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.Status -- PKEY_GPS_Status + /// Description: Indicates the status of the GPS receiver when the image was recorded. (eg: measurement in progress, + ///measurement interoperability). + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {125491F4-818F-46B2-91B5-D537753617B2}, 100 + /// + public static PropertyKey Status + { + get + { + PropertyKey key = new PropertyKey(new Guid("{125491F4-818F-46B2-91B5-D537753617B2}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.Track -- PKEY_GPS_Track + /// Description: Indicates the direction of the GPS receiver movement. Calculated from PKEY_GPS_TrackNumerator and + ///PKEY_GPS_TrackDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {76C09943-7C33-49E3-9E7E-CDBA872CFADA}, 100 + /// + public static PropertyKey Track + { + get + { + PropertyKey key = new PropertyKey(new Guid("{76C09943-7C33-49E3-9E7E-CDBA872CFADA}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.TrackDenominator -- PKEY_GPS_TrackDenominator + /// Description: Denominator of PKEY_GPS_Track + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {C8D1920C-01F6-40C0-AC86-2F3A4AD00770}, 100 + /// + public static PropertyKey TrackDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C8D1920C-01F6-40C0-AC86-2F3A4AD00770}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.TrackNumerator -- PKEY_GPS_TrackNumerator + /// Description: Numerator of PKEY_GPS_Track + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {702926F4-44A6-43E1-AE71-45627116893B}, 100 + /// + public static PropertyKey TrackNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{702926F4-44A6-43E1-AE71-45627116893B}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.TrackRef -- PKEY_GPS_TrackRef + /// Description: Indicates reference for the direction of the GPS receiver movement. (eg: true direction, magnetic direction) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {35DBE6FE-44C3-4400-AAAE-D2C799C407E8}, 100 + /// + public static PropertyKey TrackRef + { + get + { + PropertyKey key = new PropertyKey(new Guid("{35DBE6FE-44C3-4400-AAAE-D2C799C407E8}"), 100); + + return key; + } + } + + /// + /// Name: System.GPS.VersionID -- PKEY_GPS_VersionID + /// Description: Indicates the version of the GPS information + /// + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: {22704DA4-C6B2-4A99-8E56-F16DF8C92599}, 100 + /// + public static PropertyKey VersionID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{22704DA4-C6B2-4A99-8E56-F16DF8C92599}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// Identity Properties + /// + public static class Identity + { + + + #region Properties + + /// + /// Name: System.Identity.Blob -- PKEY_Identity_Blob + /// Description: Blob used to import/export identities + /// + /// Type: Blob -- VT_BLOB + /// FormatID: {8C3B93A4-BAED-1A83-9A32-102EE313F6EB}, 100 + /// + public static PropertyKey Blob + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8C3B93A4-BAED-1A83-9A32-102EE313F6EB}"), 100); + + return key; + } + } + + /// + /// Name: System.Identity.DisplayName -- PKEY_Identity_DisplayName + /// Description: Display Name + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7D683FC9-D155-45A8-BB1F-89D19BCB792F}, 100 + /// + public static PropertyKey DisplayName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7D683FC9-D155-45A8-BB1F-89D19BCB792F}"), 100); + + return key; + } + } + + /// + /// Name: System.Identity.IsMeIdentity -- PKEY_Identity_IsMeIdentity + /// Description: Is it Me Identity + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {A4108708-09DF-4377-9DFC-6D99986D5A67}, 100 + /// + public static PropertyKey IsMeIdentity + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A4108708-09DF-4377-9DFC-6D99986D5A67}"), 100); + + return key; + } + } + + /// + /// Name: System.Identity.PrimaryEmailAddress -- PKEY_Identity_PrimaryEmailAddress + /// Description: Primary Email Address + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FCC16823-BAED-4F24-9B32-A0982117F7FA}, 100 + /// + public static PropertyKey PrimaryEmailAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FCC16823-BAED-4F24-9B32-A0982117F7FA}"), 100); + + return key; + } + } + + /// + /// Name: System.Identity.ProviderID -- PKEY_Identity_ProviderID + /// Description: Provider ID + /// + /// Type: Guid -- VT_CLSID + /// FormatID: {74A7DE49-FA11-4D3D-A006-DB7E08675916}, 100 + /// + public static PropertyKey ProviderID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{74A7DE49-FA11-4D3D-A006-DB7E08675916}"), 100); + + return key; + } + } + + /// + /// Name: System.Identity.UniqueID -- PKEY_Identity_UniqueID + /// Description: Unique ID + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E55FC3B0-2B60-4220-918E-B21E8BF16016}, 100 + /// + public static PropertyKey UniqueID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E55FC3B0-2B60-4220-918E-B21E8BF16016}"), 100); + + return key; + } + } + + /// + /// Name: System.Identity.UserName -- PKEY_Identity_UserName + /// Description: Identity User Name + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C4322503-78CA-49C6-9ACC-A68E2AFD7B6B}, 100 + /// + public static PropertyKey UserName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C4322503-78CA-49C6-9ACC-A68E2AFD7B6B}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// IdentityProvider Properties + /// + public static class IdentityProvider + { + + + #region Properties + + /// + /// Name: System.IdentityProvider.Name -- PKEY_IdentityProvider_Name + /// Description: Identity Provider Name + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {B96EFF7B-35CA-4A35-8607-29E3A54C46EA}, 100 + /// + public static PropertyKey Name + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B96EFF7B-35CA-4A35-8607-29E3A54C46EA}"), 100); + + return key; + } + } + + /// + /// Name: System.IdentityProvider.Picture -- PKEY_IdentityProvider_Picture + /// Description: Picture for the Identity Provider + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {2425166F-5642-4864-992F-98FD98F294C3}, 100 + /// + public static PropertyKey Picture + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2425166F-5642-4864-992F-98FD98F294C3}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// Image Properties + /// + public static class Image + { + + + #region Properties + + /// + /// Name: System.Image.BitDepth -- PKEY_Image_BitDepth + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 7 (PIDISI_BITDEPTH) + /// + public static PropertyKey BitDepth + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 7); + + return key; + } + } + + /// + /// Name: System.Image.ColorSpace -- PKEY_Image_ColorSpace + /// Description: PropertyTagExifColorSpace + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 40961 + /// + public static PropertyKey ColorSpace + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 40961); + + return key; + } + } + + /// + /// Name: System.Image.CompressedBitsPerPixel -- PKEY_Image_CompressedBitsPerPixel + /// Description: Calculated from PKEY_Image_CompressedBitsPerPixelNumerator and PKEY_Image_CompressedBitsPerPixelDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {364B6FA9-37AB-482A-BE2B-AE02F60D4318}, 100 + /// + public static PropertyKey CompressedBitsPerPixel + { + get + { + PropertyKey key = new PropertyKey(new Guid("{364B6FA9-37AB-482A-BE2B-AE02F60D4318}"), 100); + + return key; + } + } + + /// + /// Name: System.Image.CompressedBitsPerPixelDenominator -- PKEY_Image_CompressedBitsPerPixelDenominator + /// Description: Denominator of PKEY_Image_CompressedBitsPerPixel. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {1F8844E1-24AD-4508-9DFD-5326A415CE02}, 100 + /// + public static PropertyKey CompressedBitsPerPixelDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1F8844E1-24AD-4508-9DFD-5326A415CE02}"), 100); + + return key; + } + } + + /// + /// Name: System.Image.CompressedBitsPerPixelNumerator -- PKEY_Image_CompressedBitsPerPixelNumerator + /// Description: Numerator of PKEY_Image_CompressedBitsPerPixel. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {D21A7148-D32C-4624-8900-277210F79C0F}, 100 + /// + public static PropertyKey CompressedBitsPerPixelNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D21A7148-D32C-4624-8900-277210F79C0F}"), 100); + + return key; + } + } + + /// + /// Name: System.Image.Compression -- PKEY_Image_Compression + /// Description: Indicates the image compression level. PropertyTagCompression. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 259 + /// + public static PropertyKey Compression + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 259); + + return key; + } + } + + /// + /// Name: System.Image.CompressionText -- PKEY_Image_CompressionText + /// Description: This is the user-friendly form of System.Image.Compression. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {3F08E66F-2F44-4BB9-A682-AC35D2562322}, 100 + /// + public static PropertyKey CompressionText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{3F08E66F-2F44-4BB9-A682-AC35D2562322}"), 100); + + return key; + } + } + + /// + /// Name: System.Image.Dimensions -- PKEY_Image_Dimensions + /// Description: Indicates the dimensions of the image. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 13 (PIDISI_DIMENSIONS) + /// + public static PropertyKey Dimensions + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 13); + + return key; + } + } + + /// + /// Name: System.Image.HorizontalResolution -- PKEY_Image_HorizontalResolution + /// Description: + /// + /// Type: Double -- VT_R8 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 5 (PIDISI_RESOLUTIONX) + /// + public static PropertyKey HorizontalResolution + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 5); + + return key; + } + } + + /// + /// Name: System.Image.HorizontalSize -- PKEY_Image_HorizontalSize + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 3 (PIDISI_CX) + /// + public static PropertyKey HorizontalSize + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 3); + + return key; + } + } + + /// + /// Name: System.Image.ImageID -- PKEY_Image_ImageID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {10DABE05-32AA-4C29-BF1A-63E2D220587F}, 100 + /// + public static PropertyKey ImageID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{10DABE05-32AA-4C29-BF1A-63E2D220587F}"), 100); + + return key; + } + } + + /// + /// Name: System.Image.ResolutionUnit -- PKEY_Image_ResolutionUnit + /// Description: + /// Type: Int16 -- VT_I2 + /// FormatID: {19B51FA6-1F92-4A5C-AB48-7DF0ABD67444}, 100 + /// + public static PropertyKey ResolutionUnit + { + get + { + PropertyKey key = new PropertyKey(new Guid("{19B51FA6-1F92-4A5C-AB48-7DF0ABD67444}"), 100); + + return key; + } + } + + /// + /// Name: System.Image.VerticalResolution -- PKEY_Image_VerticalResolution + /// Description: + /// + /// Type: Double -- VT_R8 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 6 (PIDISI_RESOLUTIONY) + /// + public static PropertyKey VerticalResolution + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 6); + + return key; + } + } + + /// + /// Name: System.Image.VerticalSize -- PKEY_Image_VerticalSize + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 4 (PIDISI_CY) + /// + public static PropertyKey VerticalSize + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 4); + + return key; + } + } + #endregion + + + + } + + /// + /// Journal Properties + /// + public static class Journal + { + + + #region Properties + + /// + /// Name: System.Journal.Contacts -- PKEY_Journal_Contacts + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {DEA7C82C-1D89-4A66-9427-A4E3DEBABCB1}, 100 + /// + public static PropertyKey Contacts + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DEA7C82C-1D89-4A66-9427-A4E3DEBABCB1}"), 100); + + return key; + } + } + + /// + /// Name: System.Journal.EntryType -- PKEY_Journal_EntryType + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {95BEB1FC-326D-4644-B396-CD3ED90E6DDF}, 100 + /// + public static PropertyKey EntryType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{95BEB1FC-326D-4644-B396-CD3ED90E6DDF}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// LayoutPattern Properties + /// + public static class LayoutPattern + { + + + #region Properties + + /// + /// Name: System.LayoutPattern.ContentViewModeForBrowse -- PKEY_LayoutPattern_ContentViewModeForBrowse + /// Description: Specifies the layout pattern that the content view mode should apply for this item in the context of browsing. + ///Register the regvalue under the name of "ContentViewModeLayoutPatternForBrowse". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 500 + /// + public static PropertyKey ContentViewModeForBrowse + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 500); + + return key; + } + } + + /// + /// Name: System.LayoutPattern.ContentViewModeForSearch -- PKEY_LayoutPattern_ContentViewModeForSearch + /// Description: Specifies the layout pattern that the content view mode should apply for this item in the context of searching. + ///Register the regvalue under the name of "ContentViewModeLayoutPatternForSearch". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 501 + /// + public static PropertyKey ContentViewModeForSearch + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 501); + + return key; + } + } + #endregion + + + + } + + /// + /// Link Properties + /// + public static class Link + { + + + #region Properties + + /// + /// Name: System.Link.Arguments -- PKEY_Link_Arguments + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {436F2667-14E2-4FEB-B30A-146C53B5B674}, 100 + /// + public static PropertyKey Arguments + { + get + { + PropertyKey key = new PropertyKey(new Guid("{436F2667-14E2-4FEB-B30A-146C53B5B674}"), 100); + + return key; + } + } + + /// + /// Name: System.Link.Comment -- PKEY_Link_Comment + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 5 + /// + public static PropertyKey Comment + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}"), 5); + + return key; + } + } + + /// + /// Name: System.Link.DateVisited -- PKEY_Link_DateVisited + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 23 (PKEYs relating to URLs. Used by IE History.) + /// + public static PropertyKey DateVisited + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5CBF2787-48CF-4208-B90E-EE5E5D420294}"), 23); + + return key; + } + } + + /// + /// Name: System.Link.Description -- PKEY_Link_Description + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 21 (PKEYs relating to URLs. Used by IE History.) + /// + public static PropertyKey Description + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5CBF2787-48CF-4208-B90E-EE5E5D420294}"), 21); + + return key; + } + } + + /// + /// Name: System.Link.Status -- PKEY_Link_Status + /// Description: + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 3 (PID_LINK_TARGET_TYPE) + /// + public static PropertyKey Status + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}"), 3); + + return key; + } + } + + /// + /// Name: System.Link.TargetExtension -- PKEY_Link_TargetExtension + /// Description: The file extension of the link target. See System.File.Extension + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {7A7D76F4-B630-4BD7-95FF-37CC51A975C9}, 2 + /// + public static PropertyKey TargetExtension + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7A7D76F4-B630-4BD7-95FF-37CC51A975C9}"), 2); + + return key; + } + } + + /// + /// Name: System.Link.TargetParsingPath -- PKEY_Link_TargetParsingPath + /// Description: This is the shell namespace path to the target of the link item. This path may be passed to + ///SHParseDisplayName to parse the path to the correct shell folder. + /// + ///If the target item is a file, the value is identical to System.ItemPathDisplay. + /// + ///If the target item cannot be accessed through the shell namespace, this value is VT_EMPTY. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 2 (PID_LINK_TARGET) + /// + public static PropertyKey TargetParsingPath + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}"), 2); + + return key; + } + } + + /// + /// Name: System.Link.TargetSFGAOFlags -- PKEY_Link_TargetSFGAOFlags + /// Description: IShellFolder::GetAttributesOf flags for the target of a link, with SFGAO_PKEYSFGAOMASK + ///attributes masked out. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 8 + /// + public static PropertyKey TargetSFGAOFlags + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}"), 8); + + return key; + } + } + + /// + /// Name: System.Link.TargetSFGAOFlagsStrings -- PKEY_Link_TargetSFGAOFlagsStrings + /// Description: Expresses the SFGAO flags of a link as string values and is used as a query optimization. See + ///PKEY_Shell_SFGAOFlagsStrings for possible values of this. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D6942081-D53B-443D-AD47-5E059D9CD27A}, 3 + /// + public static PropertyKey TargetSFGAOFlagsStrings + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D6942081-D53B-443D-AD47-5E059D9CD27A}"), 3); + + return key; + } + } + + /// + /// Name: System.Link.TargetUrl -- PKEY_Link_TargetUrl + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 2 (PKEYs relating to URLs. Used by IE History.) + /// + public static PropertyKey TargetUrl + { + get + { + PropertyKey key = new PropertyKey(new Guid("{5CBF2787-48CF-4208-B90E-EE5E5D420294}"), 2); + + return key; + } + } + #endregion + + + + } + + /// + /// Media Properties + /// + public static class Media + { + + + #region Properties + + /// + /// Name: System.Media.AuthorUrl -- PKEY_Media_AuthorUrl + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 32 (PIDMSI_AUTHOR_URL) + /// + public static PropertyKey AuthorUrl + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 32); + + return key; + } + } + + /// + /// Name: System.Media.AverageLevel -- PKEY_Media_AverageLevel + /// Description: + /// Type: UInt32 -- VT_UI4 + /// FormatID: {09EDD5B6-B301-43C5-9990-D00302EFFD46}, 100 + /// + public static PropertyKey AverageLevel + { + get + { + PropertyKey key = new PropertyKey(new Guid("{09EDD5B6-B301-43C5-9990-D00302EFFD46}"), 100); + + return key; + } + } + + /// + /// Name: System.Media.ClassPrimaryID -- PKEY_Media_ClassPrimaryID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 13 (PIDMSI_CLASS_PRIMARY_ID) + /// + public static PropertyKey ClassPrimaryID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 13); + + return key; + } + } + + /// + /// Name: System.Media.ClassSecondaryID -- PKEY_Media_ClassSecondaryID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 14 (PIDMSI_CLASS_SECONDARY_ID) + /// + public static PropertyKey ClassSecondaryID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 14); + + return key; + } + } + + /// + /// Name: System.Media.CollectionGroupID -- PKEY_Media_CollectionGroupID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 24 (PIDMSI_COLLECTION_GROUP_ID) + /// + public static PropertyKey CollectionGroupID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 24); + + return key; + } + } + + /// + /// Name: System.Media.CollectionID -- PKEY_Media_CollectionID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 25 (PIDMSI_COLLECTION_ID) + /// + public static PropertyKey CollectionID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 25); + + return key; + } + } + + /// + /// Name: System.Media.ContentDistributor -- PKEY_Media_ContentDistributor + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 18 (PIDMSI_CONTENTDISTRIBUTOR) + /// + public static PropertyKey ContentDistributor + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 18); + + return key; + } + } + + /// + /// Name: System.Media.ContentID -- PKEY_Media_ContentID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 26 (PIDMSI_CONTENT_ID) + /// + public static PropertyKey ContentID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 26); + + return key; + } + } + + /// + /// Name: System.Media.CreatorApplication -- PKEY_Media_CreatorApplication + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 27 (PIDMSI_TOOL_NAME) + /// + public static PropertyKey CreatorApplication + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 27); + + return key; + } + } + + /// + /// Name: System.Media.CreatorApplicationVersion -- PKEY_Media_CreatorApplicationVersion + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 28 (PIDMSI_TOOL_VERSION) + /// + public static PropertyKey CreatorApplicationVersion + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 28); + + return key; + } + } + + /// + /// Name: System.Media.DateEncoded -- PKEY_Media_DateEncoded + /// Description: DateTime is in UTC (in the doc, not file system). + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {2E4B640D-5019-46D8-8881-55414CC5CAA0}, 100 + /// + public static PropertyKey DateEncoded + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2E4B640D-5019-46D8-8881-55414CC5CAA0}"), 100); + + return key; + } + } + + /// + /// Name: System.Media.DateReleased -- PKEY_Media_DateReleased + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DE41CC29-6971-4290-B472-F59F2E2F31E2}, 100 + /// + public static PropertyKey DateReleased + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DE41CC29-6971-4290-B472-F59F2E2F31E2}"), 100); + + return key; + } + } + + /// + /// Name: System.Media.Duration -- PKEY_Media_Duration + /// Description: 100ns units, not milliseconds + /// + /// Type: UInt64 -- VT_UI8 + /// FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 3 (PIDASI_TIMELENGTH) + /// + public static PropertyKey Duration + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 3); + + return key; + } + } + + /// + /// Name: System.Media.DVDID -- PKEY_Media_DVDID + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 15 (PIDMSI_DVDID) + /// + public static PropertyKey DVDID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 15); + + return key; + } + } + + /// + /// Name: System.Media.EncodedBy -- PKEY_Media_EncodedBy + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 36 (PIDMSI_ENCODED_BY) + /// + public static PropertyKey EncodedBy + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 36); + + return key; + } + } + + /// + /// Name: System.Media.EncodingSettings -- PKEY_Media_EncodingSettings + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 37 (PIDMSI_ENCODING_SETTINGS) + /// + public static PropertyKey EncodingSettings + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 37); + + return key; + } + } + + /// + /// Name: System.Media.FrameCount -- PKEY_Media_FrameCount + /// Description: Indicates the frame count for the image. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 12 (PIDISI_FRAMECOUNT) + /// + public static PropertyKey FrameCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 12); + + return key; + } + } + + /// + /// Name: System.Media.MCDI -- PKEY_Media_MCDI + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 16 (PIDMSI_MCDI) + /// + public static PropertyKey MCDI + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 16); + + return key; + } + } + + /// + /// Name: System.Media.MetadataContentProvider -- PKEY_Media_MetadataContentProvider + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 17 (PIDMSI_PROVIDER) + /// + public static PropertyKey MetadataContentProvider + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 17); + + return key; + } + } + + /// + /// Name: System.Media.Producer -- PKEY_Media_Producer + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 22 (PIDMSI_PRODUCER) + /// + public static PropertyKey Producer + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 22); + + return key; + } + } + + /// + /// Name: System.Media.PromotionUrl -- PKEY_Media_PromotionUrl + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 33 (PIDMSI_PROMOTION_URL) + /// + public static PropertyKey PromotionUrl + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 33); + + return key; + } + } + + /// + /// Name: System.Media.ProtectionType -- PKEY_Media_ProtectionType + /// Description: If media is protected, how is it protected? + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 38 + /// + public static PropertyKey ProtectionType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 38); + + return key; + } + } + + /// + /// Name: System.Media.ProviderRating -- PKEY_Media_ProviderRating + /// Description: Rating (0 - 99) supplied by metadata provider + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 39 + /// + public static PropertyKey ProviderRating + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 39); + + return key; + } + } + + /// + /// Name: System.Media.ProviderStyle -- PKEY_Media_ProviderStyle + /// Description: Style of music or video, supplied by metadata provider + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 40 + /// + public static PropertyKey ProviderStyle + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 40); + + return key; + } + } + + /// + /// Name: System.Media.Publisher -- PKEY_Media_Publisher + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 30 (PIDMSI_PUBLISHER) + /// + public static PropertyKey Publisher + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 30); + + return key; + } + } + + /// + /// Name: System.Media.SubscriptionContentId -- PKEY_Media_SubscriptionContentId + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {9AEBAE7A-9644-487D-A92C-657585ED751A}, 100 + /// + public static PropertyKey SubscriptionContentId + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9AEBAE7A-9644-487D-A92C-657585ED751A}"), 100); + + return key; + } + } + + /// + /// Name: System.Media.SubTitle -- PKEY_Media_SubTitle + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 38 (PIDSI_MUSIC_SUB_TITLE) + /// + public static PropertyKey Subtitle + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 38); + + return key; + } + } + + /// + /// Name: System.Media.UniqueFileIdentifier -- PKEY_Media_UniqueFileIdentifier + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 35 (PIDMSI_UNIQUE_FILE_IDENTIFIER) + /// + public static PropertyKey UniqueFileIdentifier + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 35); + + return key; + } + } + + /// + /// Name: System.Media.UserNoAutoInfo -- PKEY_Media_UserNoAutoInfo + /// Description: If true, do NOT alter this file's metadata. Set by user. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 41 + /// + public static PropertyKey UserNoAutoInfo + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 41); + + return key; + } + } + + /// + /// Name: System.Media.UserWebUrl -- PKEY_Media_UserWebUrl + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 34 (PIDMSI_USER_WEB_URL) + /// + public static PropertyKey UserWebUrl + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 34); + + return key; + } + } + + /// + /// Name: System.Media.Writer -- PKEY_Media_Writer + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 23 (PIDMSI_WRITER) + /// + public static PropertyKey Writer + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 23); + + return key; + } + } + + /// + /// Name: System.Media.Year -- PKEY_Media_Year + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 5 (PIDSI_MUSIC_YEAR) + /// + public static PropertyKey Year + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 5); + + return key; + } + } + #endregion + + + + } + + /// + /// Message Properties + /// + public static class Message + { + + + #region Properties + + /// + /// Name: System.Message.AttachmentContents -- PKEY_Message_AttachmentContents + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {3143BF7C-80A8-4854-8880-E2E40189BDD0}, 100 + /// + public static PropertyKey AttachmentContents + { + get + { + PropertyKey key = new PropertyKey(new Guid("{3143BF7C-80A8-4854-8880-E2E40189BDD0}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.AttachmentNames -- PKEY_Message_AttachmentNames + /// Description: The names of the attachments in a message + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 21 + /// + public static PropertyKey AttachmentNames + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 21); + + return key; + } + } + + /// + /// Name: System.Message.BccAddress -- PKEY_Message_BccAddress + /// Description: Addresses in Bcc: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 2 + /// + public static PropertyKey BccAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 2); + + return key; + } + } + + /// + /// Name: System.Message.BccName -- PKEY_Message_BccName + /// Description: person names in Bcc: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 3 + /// + public static PropertyKey BccName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 3); + + return key; + } + } + + /// + /// Name: System.Message.CcAddress -- PKEY_Message_CcAddress + /// Description: Addresses in Cc: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 4 + /// + public static PropertyKey CcAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 4); + + return key; + } + } + + /// + /// Name: System.Message.CcName -- PKEY_Message_CcName + /// Description: person names in Cc: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 5 + /// + public static PropertyKey CcName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 5); + + return key; + } + } + + /// + /// Name: System.Message.ConversationID -- PKEY_Message_ConversationID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DC8F80BD-AF1E-4289-85B6-3DFC1B493992}, 100 + /// + public static PropertyKey ConversationID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DC8F80BD-AF1E-4289-85B6-3DFC1B493992}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.ConversationIndex -- PKEY_Message_ConversationIndex + /// Description: + /// + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: {DC8F80BD-AF1E-4289-85B6-3DFC1B493992}, 101 + /// + public static PropertyKey ConversationIndex + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DC8F80BD-AF1E-4289-85B6-3DFC1B493992}"), 101); + + return key; + } + } + + /// + /// Name: System.Message.DateReceived -- PKEY_Message_DateReceived + /// Description: Date and Time communication was received + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 20 + /// + public static PropertyKey DateReceived + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 20); + + return key; + } + } + + /// + /// Name: System.Message.DateSent -- PKEY_Message_DateSent + /// Description: Date and Time communication was sent + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 19 + /// + public static PropertyKey DateSent + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 19); + + return key; + } + } + + /// + /// Name: System.Message.Flags -- PKEY_Message_Flags + /// Description: These are flags associated with email messages to know if a read receipt is pending, etc. + ///The values stored here by Outlook are defined for PR_MESSAGE_FLAGS on MSDN. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {A82D9EE7-CA67-4312-965E-226BCEA85023}, 100 + /// + public static PropertyKey Flags + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A82D9EE7-CA67-4312-965E-226BCEA85023}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.FromAddress -- PKEY_Message_FromAddress + /// Description: + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 13 + /// + public static PropertyKey FromAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 13); + + return key; + } + } + + /// + /// Name: System.Message.FromName -- PKEY_Message_FromName + /// Description: Address in from field as person name + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 14 + /// + public static PropertyKey FromName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 14); + + return key; + } + } + + /// + /// Name: System.Message.HasAttachments -- PKEY_Message_HasAttachments + /// Description: + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}, 8 + /// + public static PropertyKey HasAttachments + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}"), 8); + + return key; + } + } + + /// + /// Name: System.Message.IsFwdOrReply -- PKEY_Message_IsFwdOrReply + /// Description: + /// Type: Int32 -- VT_I4 + /// FormatID: {9A9BC088-4F6D-469E-9919-E705412040F9}, 100 + /// + public static PropertyKey IsFwdOrReply + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9A9BC088-4F6D-469E-9919-E705412040F9}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.MessageClass -- PKEY_Message_MessageClass + /// Description: What type of outlook msg this is (meeting, task, mail, etc.) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CD9ED458-08CE-418F-A70E-F912C7BB9C5C}, 103 + /// + public static PropertyKey MessageClass + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CD9ED458-08CE-418F-A70E-F912C7BB9C5C}"), 103); + + return key; + } + } + + /// + /// Name: System.Message.ProofInProgress -- PKEY_Message_ProofInProgress + /// Description: This property will be true if the message junk email proofing is still in progress. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {9098F33C-9A7D-48A8-8DE5-2E1227A64E91}, 100 + /// + public static PropertyKey ProofInProgress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9098F33C-9A7D-48A8-8DE5-2E1227A64E91}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.SenderAddress -- PKEY_Message_SenderAddress + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0BE1C8E7-1981-4676-AE14-FDD78F05A6E7}, 100 + /// + public static PropertyKey SenderAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0BE1C8E7-1981-4676-AE14-FDD78F05A6E7}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.SenderName -- PKEY_Message_SenderName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0DA41CFA-D224-4A18-AE2F-596158DB4B3A}, 100 + /// + public static PropertyKey SenderName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0DA41CFA-D224-4A18-AE2F-596158DB4B3A}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.Store -- PKEY_Message_Store + /// Description: The store (aka protocol handler) FILE, MAIL, OUTLOOKEXPRESS + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 15 + /// + public static PropertyKey Store + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 15); + + return key; + } + } + + /// + /// Name: System.Message.ToAddress -- PKEY_Message_ToAddress + /// Description: Addresses in To: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 16 + /// + public static PropertyKey ToAddress + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 16); + + return key; + } + } + + /// + /// Name: System.Message.ToDoFlags -- PKEY_Message_ToDoFlags + /// Description: Flags associated with a message flagged to know if it's still active, if it was custom flagged, etc. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {1F856A9F-6900-4ABA-9505-2D5F1B4D66CB}, 100 + /// + public static PropertyKey ToDoFlags + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1F856A9F-6900-4ABA-9505-2D5F1B4D66CB}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.ToDoTitle -- PKEY_Message_ToDoTitle + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {BCCC8A3C-8CEF-42E5-9B1C-C69079398BC7}, 100 + /// + public static PropertyKey ToDoTitle + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BCCC8A3C-8CEF-42E5-9B1C-C69079398BC7}"), 100); + + return key; + } + } + + /// + /// Name: System.Message.ToName -- PKEY_Message_ToName + /// Description: Person names in To: field + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 17 + /// + public static PropertyKey ToName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 17); + + return key; + } + } + #endregion + + + + } + + /// + /// Music Properties + /// + public static class Music + { + + + #region Properties + + /// + /// Name: System.Music.AlbumArtist -- PKEY_Music_AlbumArtist + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 13 (PIDSI_MUSIC_ALBUM_ARTIST) + /// + public static PropertyKey AlbumArtist + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 13); + + return key; + } + } + + /// + /// Name: System.Music.AlbumID -- PKEY_Music_AlbumID + /// Description: Concatenation of System.Music.AlbumArtist and System.Music.AlbumTitle, suitable for indexing and display. + ///Used to differentiate albums with the same title from different artists. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 100 + /// + public static PropertyKey AlbumID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 100); + + return key; + } + } + + /// + /// Name: System.Music.AlbumTitle -- PKEY_Music_AlbumTitle + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 4 (PIDSI_MUSIC_ALBUM) + /// + public static PropertyKey AlbumTitle + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 4); + + return key; + } + } + + /// + /// Name: System.Music.Artist -- PKEY_Music_Artist + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 2 (PIDSI_MUSIC_ARTIST) + /// + public static PropertyKey Artist + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 2); + + return key; + } + } + + /// + /// Name: System.Music.BeatsPerMinute -- PKEY_Music_BeatsPerMinute + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 35 (PIDSI_MUSIC_BEATS_PER_MINUTE) + /// + public static PropertyKey BeatsPerMinute + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 35); + + return key; + } + } + + /// + /// Name: System.Music.Composer -- PKEY_Music_Composer + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 19 (PIDMSI_COMPOSER) + /// + public static PropertyKey Composer + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 19); + + return key; + } + } + + /// + /// Name: System.Music.Conductor -- PKEY_Music_Conductor + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 36 (PIDSI_MUSIC_CONDUCTOR) + /// + public static PropertyKey Conductor + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 36); + + return key; + } + } + + /// + /// Name: System.Music.ContentGroupDescription -- PKEY_Music_ContentGroupDescription + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 33 (PIDSI_MUSIC_CONTENT_GROUP_DESCRIPTION) + /// + public static PropertyKey ContentGroupDescription + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 33); + + return key; + } + } + + /// + /// Name: System.Music.DisplayArtist -- PKEY_Music_DisplayArtist + /// Description: This property returns the best representation of Album Artist for a given music file + ///based upon AlbumArtist, ContributingArtist and compilation info. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FD122953-FA93-4EF7-92C3-04C946B2F7C8}, 100 + /// + public static PropertyKey DisplayArtist + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FD122953-FA93-4EF7-92C3-04C946B2F7C8}"), 100); + + return key; + } + } + + /// + /// Name: System.Music.Genre -- PKEY_Music_Genre + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 11 (PIDSI_MUSIC_GENRE) + /// + public static PropertyKey Genre + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 11); + + return key; + } + } + + /// + /// Name: System.Music.InitialKey -- PKEY_Music_InitialKey + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 34 (PIDSI_MUSIC_INITIAL_KEY) + /// + public static PropertyKey InitialKey + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 34); + + return key; + } + } + + /// + /// Name: System.Music.IsCompilation -- PKEY_Music_IsCompilation + /// Description: Indicates whether the file is part of a compilation. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {C449D5CB-9EA4-4809-82E8-AF9D59DED6D1}, 100 + /// + public static PropertyKey IsCompilation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C449D5CB-9EA4-4809-82E8-AF9D59DED6D1}"), 100); + + return key; + } + } + + /// + /// Name: System.Music.Lyrics -- PKEY_Music_Lyrics + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 12 (PIDSI_MUSIC_LYRICS) + /// + public static PropertyKey Lyrics + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 12); + + return key; + } + } + + /// + /// Name: System.Music.Mood -- PKEY_Music_Mood + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 39 (PIDSI_MUSIC_MOOD) + /// + public static PropertyKey Mood + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 39); + + return key; + } + } + + /// + /// Name: System.Music.PartOfSet -- PKEY_Music_PartOfSet + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 37 (PIDSI_MUSIC_PART_OF_SET) + /// + public static PropertyKey PartOfSet + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 37); + + return key; + } + } + + /// + /// Name: System.Music.Period -- PKEY_Music_Period + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 31 (PIDMSI_PERIOD) + /// + public static PropertyKey Period + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 31); + + return key; + } + } + + /// + /// Name: System.Music.SynchronizedLyrics -- PKEY_Music_SynchronizedLyrics + /// Description: + /// Type: Blob -- VT_BLOB + /// FormatID: {6B223B6A-162E-4AA9-B39F-05D678FC6D77}, 100 + /// + public static PropertyKey SynchronizedLyrics + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6B223B6A-162E-4AA9-B39F-05D678FC6D77}"), 100); + + return key; + } + } + + /// + /// Name: System.Music.TrackNumber -- PKEY_Music_TrackNumber + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 7 (PIDSI_MUSIC_TRACK) + /// + public static PropertyKey TrackNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 7); + + return key; + } + } + #endregion + + + + } + + /// + /// Note Properties + /// + public static class Note + { + + + #region Properties + + /// + /// Name: System.Note.Color -- PKEY_Note_Color + /// Description: + /// Type: UInt16 -- VT_UI2 + /// FormatID: {4776CAFA-BCE4-4CB1-A23E-265E76D8EB11}, 100 + /// + public static PropertyKey Color + { + get + { + PropertyKey key = new PropertyKey(new Guid("{4776CAFA-BCE4-4CB1-A23E-265E76D8EB11}"), 100); + + return key; + } + } + + /// + /// Name: System.Note.ColorText -- PKEY_Note_ColorText + /// Description: This is the user-friendly form of System.Note.Color. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {46B4E8DE-CDB2-440D-885C-1658EB65B914}, 100 + /// + public static PropertyKey ColorText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{46B4E8DE-CDB2-440D-885C-1658EB65B914}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// Photo Properties + /// + public static class Photo + { + + + #region Properties + + /// + /// Name: System.Photo.Aperture -- PKEY_Photo_Aperture + /// Description: PropertyTagExifAperture. Calculated from PKEY_Photo_ApertureNumerator and PKEY_Photo_ApertureDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37378 + /// + public static PropertyKey Aperture + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37378); + + return key; + } + } + + /// + /// Name: System.Photo.ApertureDenominator -- PKEY_Photo_ApertureDenominator + /// Description: Denominator of PKEY_Photo_Aperture + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {E1A9A38B-6685-46BD-875E-570DC7AD7320}, 100 + /// + public static PropertyKey ApertureDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E1A9A38B-6685-46BD-875E-570DC7AD7320}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ApertureNumerator -- PKEY_Photo_ApertureNumerator + /// Description: Numerator of PKEY_Photo_Aperture + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {0337ECEC-39FB-4581-A0BD-4C4CC51E9914}, 100 + /// + public static PropertyKey ApertureNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0337ECEC-39FB-4581-A0BD-4C4CC51E9914}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.Brightness -- PKEY_Photo_Brightness + /// Description: This is the brightness of the photo. + /// + ///Calculated from PKEY_Photo_BrightnessNumerator and PKEY_Photo_BrightnessDenominator. + /// + ///The units are "APEX", normally in the range of -99.99 to 99.99. If the numerator of + ///the recorded value is FFFFFFFF.H, "Unknown" should be indicated. + /// + /// Type: Double -- VT_R8 + /// FormatID: {1A701BF6-478C-4361-83AB-3701BB053C58}, 100 (PropertyTagExifBrightness) + /// + public static PropertyKey Brightness + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1A701BF6-478C-4361-83AB-3701BB053C58}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.BrightnessDenominator -- PKEY_Photo_BrightnessDenominator + /// Description: Denominator of PKEY_Photo_Brightness + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {6EBE6946-2321-440A-90F0-C043EFD32476}, 100 + /// + public static PropertyKey BrightnessDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6EBE6946-2321-440A-90F0-C043EFD32476}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.BrightnessNumerator -- PKEY_Photo_BrightnessNumerator + /// Description: Numerator of PKEY_Photo_Brightness + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {9E7D118F-B314-45A0-8CFB-D654B917C9E9}, 100 + /// + public static PropertyKey BrightnessNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9E7D118F-B314-45A0-8CFB-D654B917C9E9}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.CameraManufacturer -- PKEY_Photo_CameraManufacturer + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 271 (PropertyTagEquipMake) + /// + public static PropertyKey CameraManufacturer + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 271); + + return key; + } + } + + /// + /// Name: System.Photo.CameraModel -- PKEY_Photo_CameraModel + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 272 (PropertyTagEquipModel) + /// + public static PropertyKey CameraModel + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 272); + + return key; + } + } + + /// + /// Name: System.Photo.CameraSerialNumber -- PKEY_Photo_CameraSerialNumber + /// Description: Serial number of camera that produced this photo + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 273 + /// + public static PropertyKey CameraSerialNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 273); + + return key; + } + } + + /// + /// Name: System.Photo.Contrast -- PKEY_Photo_Contrast + /// Description: This indicates the direction of contrast processing applied by the camera + ///when the image was shot. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {2A785BA9-8D23-4DED-82E6-60A350C86A10}, 100 + /// + public static PropertyKey Contrast + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2A785BA9-8D23-4DED-82E6-60A350C86A10}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ContrastText -- PKEY_Photo_ContrastText + /// Description: This is the user-friendly form of System.Photo.Contrast. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {59DDE9F2-5253-40EA-9A8B-479E96C6249A}, 100 + /// + public static PropertyKey ContrastText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{59DDE9F2-5253-40EA-9A8B-479E96C6249A}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.DateTaken -- PKEY_Photo_DateTaken + /// Description: PropertyTagExifDTOrig + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 36867 + /// + public static PropertyKey DateTaken + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 36867); + + return key; + } + } + + /// + /// Name: System.Photo.DigitalZoom -- PKEY_Photo_DigitalZoom + /// Description: PropertyTagExifDigitalZoom. Calculated from PKEY_Photo_DigitalZoomNumerator and PKEY_Photo_DigitalZoomDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {F85BF840-A925-4BC2-B0C4-8E36B598679E}, 100 + /// + public static PropertyKey DigitalZoom + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F85BF840-A925-4BC2-B0C4-8E36B598679E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.DigitalZoomDenominator -- PKEY_Photo_DigitalZoomDenominator + /// Description: Denominator of PKEY_Photo_DigitalZoom + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {745BAF0E-E5C1-4CFB-8A1B-D031A0A52393}, 100 + /// + public static PropertyKey DigitalZoomDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{745BAF0E-E5C1-4CFB-8A1B-D031A0A52393}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.DigitalZoomNumerator -- PKEY_Photo_DigitalZoomNumerator + /// Description: Numerator of PKEY_Photo_DigitalZoom + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {16CBB924-6500-473B-A5BE-F1599BCBE413}, 100 + /// + public static PropertyKey DigitalZoomNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{16CBB924-6500-473B-A5BE-F1599BCBE413}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.Event -- PKEY_Photo_Event + /// Description: The event at which the photo was taken + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 18248 + /// + public static PropertyKey Event + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 18248); + + return key; + } + } + + /// + /// Name: System.Photo.EXIFVersion -- PKEY_Photo_EXIFVersion + /// Description: The EXIF version. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D35F743A-EB2E-47F2-A286-844132CB1427}, 100 + /// + public static PropertyKey EXIFVersion + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D35F743A-EB2E-47F2-A286-844132CB1427}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureBias -- PKEY_Photo_ExposureBias + /// Description: PropertyTagExifExposureBias. Calculated from PKEY_Photo_ExposureBiasNumerator and PKEY_Photo_ExposureBiasDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37380 + /// + public static PropertyKey ExposureBias + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37380); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureBiasDenominator -- PKEY_Photo_ExposureBiasDenominator + /// Description: Denominator of PKEY_Photo_ExposureBias + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {AB205E50-04B7-461C-A18C-2F233836E627}, 100 + /// + public static PropertyKey ExposureBiasDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AB205E50-04B7-461C-A18C-2F233836E627}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureBiasNumerator -- PKEY_Photo_ExposureBiasNumerator + /// Description: Numerator of PKEY_Photo_ExposureBias + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {738BF284-1D87-420B-92CF-5834BF6EF9ED}, 100 + /// + public static PropertyKey ExposureBiasNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{738BF284-1D87-420B-92CF-5834BF6EF9ED}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureIndex -- PKEY_Photo_ExposureIndex + /// Description: PropertyTagExifExposureIndex. Calculated from PKEY_Photo_ExposureIndexNumerator and PKEY_Photo_ExposureIndexDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {967B5AF8-995A-46ED-9E11-35B3C5B9782D}, 100 + /// + public static PropertyKey ExposureIndex + { + get + { + PropertyKey key = new PropertyKey(new Guid("{967B5AF8-995A-46ED-9E11-35B3C5B9782D}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureIndexDenominator -- PKEY_Photo_ExposureIndexDenominator + /// Description: Denominator of PKEY_Photo_ExposureIndex + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {93112F89-C28B-492F-8A9D-4BE2062CEE8A}, 100 + /// + public static PropertyKey ExposureIndexDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{93112F89-C28B-492F-8A9D-4BE2062CEE8A}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureIndexNumerator -- PKEY_Photo_ExposureIndexNumerator + /// Description: Numerator of PKEY_Photo_ExposureIndex + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {CDEDCF30-8919-44DF-8F4C-4EB2FFDB8D89}, 100 + /// + public static PropertyKey ExposureIndexNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CDEDCF30-8919-44DF-8F4C-4EB2FFDB8D89}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureProgram -- PKEY_Photo_ExposureProgram + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 34850 (PropertyTagExifExposureProg) + /// + public static PropertyKey ExposureProgram + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 34850); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureProgramText -- PKEY_Photo_ExposureProgramText + /// Description: This is the user-friendly form of System.Photo.ExposureProgram. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FEC690B7-5F30-4646-AE47-4CAAFBA884A3}, 100 + /// + public static PropertyKey ExposureProgramText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FEC690B7-5F30-4646-AE47-4CAAFBA884A3}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureTime -- PKEY_Photo_ExposureTime + /// Description: PropertyTagExifExposureTime. Calculated from PKEY_Photo_ExposureTimeNumerator and PKEY_Photo_ExposureTimeDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 33434 + /// + public static PropertyKey ExposureTime + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 33434); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureTimeDenominator -- PKEY_Photo_ExposureTimeDenominator + /// Description: Denominator of PKEY_Photo_ExposureTime + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {55E98597-AD16-42E0-B624-21599A199838}, 100 + /// + public static PropertyKey ExposureTimeDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{55E98597-AD16-42E0-B624-21599A199838}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ExposureTimeNumerator -- PKEY_Photo_ExposureTimeNumerator + /// Description: Numerator of PKEY_Photo_ExposureTime + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {257E44E2-9031-4323-AC38-85C552871B2E}, 100 + /// + public static PropertyKey ExposureTimeNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{257E44E2-9031-4323-AC38-85C552871B2E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.Flash -- PKEY_Photo_Flash + /// Description: PropertyTagExifFlash + /// + /// Type: Byte -- VT_UI1 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37385 + /// + public static PropertyKey Flash + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37385); + + return key; + } + } + + /// + /// Name: System.Photo.FlashEnergy -- PKEY_Photo_FlashEnergy + /// Description: PropertyTagExifFlashEnergy. Calculated from PKEY_Photo_FlashEnergyNumerator and PKEY_Photo_FlashEnergyDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 41483 + /// + public static PropertyKey FlashEnergy + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 41483); + + return key; + } + } + + /// + /// Name: System.Photo.FlashEnergyDenominator -- PKEY_Photo_FlashEnergyDenominator + /// Description: Denominator of PKEY_Photo_FlashEnergy + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {D7B61C70-6323-49CD-A5FC-C84277162C97}, 100 + /// + public static PropertyKey FlashEnergyDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D7B61C70-6323-49CD-A5FC-C84277162C97}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FlashEnergyNumerator -- PKEY_Photo_FlashEnergyNumerator + /// Description: Numerator of PKEY_Photo_FlashEnergy + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {FCAD3D3D-0858-400F-AAA3-2F66CCE2A6BC}, 100 + /// + public static PropertyKey FlashEnergyNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FCAD3D3D-0858-400F-AAA3-2F66CCE2A6BC}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FlashManufacturer -- PKEY_Photo_FlashManufacturer + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {AABAF6C9-E0C5-4719-8585-57B103E584FE}, 100 + /// + public static PropertyKey FlashManufacturer + { + get + { + PropertyKey key = new PropertyKey(new Guid("{AABAF6C9-E0C5-4719-8585-57B103E584FE}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FlashModel -- PKEY_Photo_FlashModel + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {FE83BB35-4D1A-42E2-916B-06F3E1AF719E}, 100 + /// + public static PropertyKey FlashModel + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FE83BB35-4D1A-42E2-916B-06F3E1AF719E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FlashText -- PKEY_Photo_FlashText + /// Description: This is the user-friendly form of System.Photo.Flash. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6B8B68F6-200B-47EA-8D25-D8050F57339F}, 100 + /// + public static PropertyKey FlashText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6B8B68F6-200B-47EA-8D25-D8050F57339F}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FNumber -- PKEY_Photo_FNumber + /// Description: PropertyTagExifFNumber. Calculated from PKEY_Photo_FNumberNumerator and PKEY_Photo_FNumberDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 33437 + /// + public static PropertyKey FNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 33437); + + return key; + } + } + + /// + /// Name: System.Photo.FNumberDenominator -- PKEY_Photo_FNumberDenominator + /// Description: Denominator of PKEY_Photo_FNumber + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {E92A2496-223B-4463-A4E3-30EABBA79D80}, 100 + /// + public static PropertyKey FNumberDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E92A2496-223B-4463-A4E3-30EABBA79D80}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FNumberNumerator -- PKEY_Photo_FNumberNumerator + /// Description: Numerator of PKEY_Photo_FNumber + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {1B97738A-FDFC-462F-9D93-1957E08BE90C}, 100 + /// + public static PropertyKey FNumberNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1B97738A-FDFC-462F-9D93-1957E08BE90C}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalLength -- PKEY_Photo_FocalLength + /// Description: PropertyTagExifFocalLength. Calculated from PKEY_Photo_FocalLengthNumerator and PKEY_Photo_FocalLengthDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37386 + /// + public static PropertyKey FocalLength + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37386); + + return key; + } + } + + /// + /// Name: System.Photo.FocalLengthDenominator -- PKEY_Photo_FocalLengthDenominator + /// Description: Denominator of PKEY_Photo_FocalLength + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {305BC615-DCA1-44A5-9FD4-10C0BA79412E}, 100 + /// + public static PropertyKey FocalLengthDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{305BC615-DCA1-44A5-9FD4-10C0BA79412E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalLengthInFilm -- PKEY_Photo_FocalLengthInFilm + /// Description: + /// Type: UInt16 -- VT_UI2 + /// FormatID: {A0E74609-B84D-4F49-B860-462BD9971F98}, 100 + /// + public static PropertyKey FocalLengthInFilm + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A0E74609-B84D-4F49-B860-462BD9971F98}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalLengthNumerator -- PKEY_Photo_FocalLengthNumerator + /// Description: Numerator of PKEY_Photo_FocalLength + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {776B6B3B-1E3D-4B0C-9A0E-8FBAF2A8492A}, 100 + /// + public static PropertyKey FocalLengthNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{776B6B3B-1E3D-4B0C-9A0E-8FBAF2A8492A}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalPlaneXResolution -- PKEY_Photo_FocalPlaneXResolution + /// Description: PropertyTagExifFocalXRes. Calculated from PKEY_Photo_FocalPlaneXResolutionNumerator and + ///PKEY_Photo_FocalPlaneXResolutionDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {CFC08D97-C6F7-4484-89DD-EBEF4356FE76}, 100 + /// + public static PropertyKey FocalPlaneXResolution + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CFC08D97-C6F7-4484-89DD-EBEF4356FE76}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalPlaneXResolutionDenominator -- PKEY_Photo_FocalPlaneXResolutionDenominator + /// Description: Denominator of PKEY_Photo_FocalPlaneXResolution + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {0933F3F5-4786-4F46-A8E8-D64DD37FA521}, 100 + /// + public static PropertyKey FocalPlaneXResolutionDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0933F3F5-4786-4F46-A8E8-D64DD37FA521}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalPlaneXResolutionNumerator -- PKEY_Photo_FocalPlaneXResolutionNumerator + /// Description: Numerator of PKEY_Photo_FocalPlaneXResolution + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {DCCB10AF-B4E2-4B88-95F9-031B4D5AB490}, 100 + /// + public static PropertyKey FocalPlaneXResolutionNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DCCB10AF-B4E2-4B88-95F9-031B4D5AB490}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalPlaneYResolution -- PKEY_Photo_FocalPlaneYResolution + /// Description: PropertyTagExifFocalYRes. Calculated from PKEY_Photo_FocalPlaneYResolutionNumerator and + ///PKEY_Photo_FocalPlaneYResolutionDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {4FFFE4D0-914F-4AC4-8D6F-C9C61DE169B1}, 100 + /// + public static PropertyKey FocalPlaneYResolution + { + get + { + PropertyKey key = new PropertyKey(new Guid("{4FFFE4D0-914F-4AC4-8D6F-C9C61DE169B1}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalPlaneYResolutionDenominator -- PKEY_Photo_FocalPlaneYResolutionDenominator + /// Description: Denominator of PKEY_Photo_FocalPlaneYResolution + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {1D6179A6-A876-4031-B013-3347B2B64DC8}, 100 + /// + public static PropertyKey FocalPlaneYResolutionDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1D6179A6-A876-4031-B013-3347B2B64DC8}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.FocalPlaneYResolutionNumerator -- PKEY_Photo_FocalPlaneYResolutionNumerator + /// Description: Numerator of PKEY_Photo_FocalPlaneYResolution + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {A2E541C5-4440-4BA8-867E-75CFC06828CD}, 100 + /// + public static PropertyKey FocalPlaneYResolutionNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A2E541C5-4440-4BA8-867E-75CFC06828CD}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.GainControl -- PKEY_Photo_GainControl + /// Description: This indicates the degree of overall image gain adjustment. + /// + ///Calculated from PKEY_Photo_GainControlNumerator and PKEY_Photo_GainControlDenominator. + /// + /// Type: Double -- VT_R8 + /// FormatID: {FA304789-00C7-4D80-904A-1E4DCC7265AA}, 100 (PropertyTagExifGainControl) + /// + public static PropertyKey GainControl + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FA304789-00C7-4D80-904A-1E4DCC7265AA}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.GainControlDenominator -- PKEY_Photo_GainControlDenominator + /// Description: Denominator of PKEY_Photo_GainControl + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {42864DFD-9DA4-4F77-BDED-4AAD7B256735}, 100 + /// + public static PropertyKey GainControlDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{42864DFD-9DA4-4F77-BDED-4AAD7B256735}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.GainControlNumerator -- PKEY_Photo_GainControlNumerator + /// Description: Numerator of PKEY_Photo_GainControl + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {8E8ECF7C-B7B8-4EB8-A63F-0EE715C96F9E}, 100 + /// + public static PropertyKey GainControlNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8E8ECF7C-B7B8-4EB8-A63F-0EE715C96F9E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.GainControlText -- PKEY_Photo_GainControlText + /// Description: This is the user-friendly form of System.Photo.GainControl. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C06238B2-0BF9-4279-A723-25856715CB9D}, 100 + /// + public static PropertyKey GainControlText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C06238B2-0BF9-4279-A723-25856715CB9D}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ISOSpeed -- PKEY_Photo_ISOSpeed + /// Description: PropertyTagExifISOSpeed + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 34855 + /// + public static PropertyKey ISOSpeed + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 34855); + + return key; + } + } + + /// + /// Name: System.Photo.LensManufacturer -- PKEY_Photo_LensManufacturer + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E6DDCAF7-29C5-4F0A-9A68-D19412EC7090}, 100 + /// + public static PropertyKey LensManufacturer + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E6DDCAF7-29C5-4F0A-9A68-D19412EC7090}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.LensModel -- PKEY_Photo_LensModel + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {E1277516-2B5F-4869-89B1-2E585BD38B7A}, 100 + /// + public static PropertyKey LensModel + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E1277516-2B5F-4869-89B1-2E585BD38B7A}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.LightSource -- PKEY_Photo_LightSource + /// Description: PropertyTagExifLightSource + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37384 + /// + public static PropertyKey LightSource + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37384); + + return key; + } + } + + /// + /// Name: System.Photo.MakerNote -- PKEY_Photo_MakerNote + /// Description: + /// Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1) + /// FormatID: {FA303353-B659-4052-85E9-BCAC79549B84}, 100 + /// + public static PropertyKey MakerNote + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FA303353-B659-4052-85E9-BCAC79549B84}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.MakerNoteOffset -- PKEY_Photo_MakerNoteOffset + /// Description: + /// Type: UInt64 -- VT_UI8 + /// FormatID: {813F4124-34E6-4D17-AB3E-6B1F3C2247A1}, 100 + /// + public static PropertyKey MakerNoteOffset + { + get + { + PropertyKey key = new PropertyKey(new Guid("{813F4124-34E6-4D17-AB3E-6B1F3C2247A1}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.MaxAperture -- PKEY_Photo_MaxAperture + /// Description: Calculated from PKEY_Photo_MaxApertureNumerator and PKEY_Photo_MaxApertureDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: {08F6D7C2-E3F2-44FC-AF1E-5AA5C81A2D3E}, 100 + /// + public static PropertyKey MaxAperture + { + get + { + PropertyKey key = new PropertyKey(new Guid("{08F6D7C2-E3F2-44FC-AF1E-5AA5C81A2D3E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.MaxApertureDenominator -- PKEY_Photo_MaxApertureDenominator + /// Description: Denominator of PKEY_Photo_MaxAperture + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {C77724D4-601F-46C5-9B89-C53F93BCEB77}, 100 + /// + public static PropertyKey MaxApertureDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C77724D4-601F-46C5-9B89-C53F93BCEB77}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.MaxApertureNumerator -- PKEY_Photo_MaxApertureNumerator + /// Description: Numerator of PKEY_Photo_MaxAperture + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {C107E191-A459-44C5-9AE6-B952AD4B906D}, 100 + /// + public static PropertyKey MaxApertureNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C107E191-A459-44C5-9AE6-B952AD4B906D}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.MeteringMode -- PKEY_Photo_MeteringMode + /// Description: PropertyTagExifMeteringMode + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37383 + /// + public static PropertyKey MeteringMode + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37383); + + return key; + } + } + + /// + /// Name: System.Photo.MeteringModeText -- PKEY_Photo_MeteringModeText + /// Description: This is the user-friendly form of System.Photo.MeteringMode. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {F628FD8C-7BA8-465A-A65B-C5AA79263A9E}, 100 + /// + public static PropertyKey MeteringModeText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F628FD8C-7BA8-465A-A65B-C5AA79263A9E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.Orientation -- PKEY_Photo_Orientation + /// Description: This is the image orientation viewed in terms of rows and columns. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 274 (PropertyTagOrientation) + /// + public static PropertyKey Orientation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 274); + + return key; + } + } + + /// + /// Name: System.Photo.OrientationText -- PKEY_Photo_OrientationText + /// Description: This is the user-friendly form of System.Photo.Orientation. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A9EA193C-C511-498A-A06B-58E2776DCC28}, 100 + /// + public static PropertyKey OrientationText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A9EA193C-C511-498A-A06B-58E2776DCC28}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.PeopleNames -- PKEY_Photo_PeopleNames + /// Description: The people tags on an image. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: {E8309B6E-084C-49B4-B1FC-90A80331B638}, 100 + /// + public static PropertyKey PeopleNames + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E8309B6E-084C-49B4-B1FC-90A80331B638}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.PhotometricInterpretation -- PKEY_Photo_PhotometricInterpretation + /// Description: This is the pixel composition. In JPEG compressed data, a JPEG marker is used + ///instead of this property. + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: {341796F1-1DF9-4B1C-A564-91BDEFA43877}, 100 + /// + public static PropertyKey PhotometricInterpretation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{341796F1-1DF9-4B1C-A564-91BDEFA43877}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.PhotometricInterpretationText -- PKEY_Photo_PhotometricInterpretationText + /// Description: This is the user-friendly form of System.Photo.PhotometricInterpretation. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {821437D6-9EAB-4765-A589-3B1CBBD22A61}, 100 + /// + public static PropertyKey PhotometricInterpretationText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{821437D6-9EAB-4765-A589-3B1CBBD22A61}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ProgramMode -- PKEY_Photo_ProgramMode + /// Description: This is the class of the program used by the camera to set exposure when the + ///picture is taken. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {6D217F6D-3F6A-4825-B470-5F03CA2FBE9B}, 100 + /// + public static PropertyKey ProgramMode + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D217F6D-3F6A-4825-B470-5F03CA2FBE9B}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ProgramModeText -- PKEY_Photo_ProgramModeText + /// Description: This is the user-friendly form of System.Photo.ProgramMode. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7FE3AA27-2648-42F3-89B0-454E5CB150C3}, 100 + /// + public static PropertyKey ProgramModeText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7FE3AA27-2648-42F3-89B0-454E5CB150C3}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.RelatedSoundFile -- PKEY_Photo_RelatedSoundFile + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {318A6B45-087F-4DC2-B8CC-05359551FC9E}, 100 + /// + public static PropertyKey RelatedSoundFile + { + get + { + PropertyKey key = new PropertyKey(new Guid("{318A6B45-087F-4DC2-B8CC-05359551FC9E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.Saturation -- PKEY_Photo_Saturation + /// Description: This indicates the direction of saturation processing applied by the camera when + ///the image was shot. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {49237325-A95A-4F67-B211-816B2D45D2E0}, 100 + /// + public static PropertyKey Saturation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49237325-A95A-4F67-B211-816B2D45D2E0}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.SaturationText -- PKEY_Photo_SaturationText + /// Description: This is the user-friendly form of System.Photo.Saturation. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {61478C08-B600-4A84-BBE4-E99C45F0A072}, 100 + /// + public static PropertyKey SaturationText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{61478C08-B600-4A84-BBE4-E99C45F0A072}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.Sharpness -- PKEY_Photo_Sharpness + /// Description: This indicates the direction of sharpness processing applied by the camera when + ///the image was shot. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {FC6976DB-8349-4970-AE97-B3C5316A08F0}, 100 + /// + public static PropertyKey Sharpness + { + get + { + PropertyKey key = new PropertyKey(new Guid("{FC6976DB-8349-4970-AE97-B3C5316A08F0}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.SharpnessText -- PKEY_Photo_SharpnessText + /// Description: This is the user-friendly form of System.Photo.Sharpness. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {51EC3F47-DD50-421D-8769-334F50424B1E}, 100 + /// + public static PropertyKey SharpnessText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{51EC3F47-DD50-421D-8769-334F50424B1E}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ShutterSpeed -- PKEY_Photo_ShutterSpeed + /// Description: PropertyTagExifShutterSpeed. Calculated from PKEY_Photo_ShutterSpeedNumerator and PKEY_Photo_ShutterSpeedDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37377 + /// + public static PropertyKey ShutterSpeed + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37377); + + return key; + } + } + + /// + /// Name: System.Photo.ShutterSpeedDenominator -- PKEY_Photo_ShutterSpeedDenominator + /// Description: Denominator of PKEY_Photo_ShutterSpeed + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {E13D8975-81C7-4948-AE3F-37CAE11E8FF7}, 100 + /// + public static PropertyKey ShutterSpeedDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E13D8975-81C7-4948-AE3F-37CAE11E8FF7}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.ShutterSpeedNumerator -- PKEY_Photo_ShutterSpeedNumerator + /// Description: Numerator of PKEY_Photo_ShutterSpeed + /// + /// Type: Int32 -- VT_I4 + /// FormatID: {16EA4042-D6F4-4BCA-8349-7C78D30FB333}, 100 + /// + public static PropertyKey ShutterSpeedNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{16EA4042-D6F4-4BCA-8349-7C78D30FB333}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.SubjectDistance -- PKEY_Photo_SubjectDistance + /// Description: PropertyTagExifSubjectDist. Calculated from PKEY_Photo_SubjectDistanceNumerator and PKEY_Photo_SubjectDistanceDenominator + /// + /// Type: Double -- VT_R8 + /// FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37382 + /// + public static PropertyKey SubjectDistance + { + get + { + PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37382); + + return key; + } + } + + /// + /// Name: System.Photo.SubjectDistanceDenominator -- PKEY_Photo_SubjectDistanceDenominator + /// Description: Denominator of PKEY_Photo_SubjectDistance + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {0C840A88-B043-466D-9766-D4B26DA3FA77}, 100 + /// + public static PropertyKey SubjectDistanceDenominator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0C840A88-B043-466D-9766-D4B26DA3FA77}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.SubjectDistanceNumerator -- PKEY_Photo_SubjectDistanceNumerator + /// Description: Numerator of PKEY_Photo_SubjectDistance + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {8AF4961C-F526-43E5-AA81-DB768219178D}, 100 + /// + public static PropertyKey SubjectDistanceNumerator + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8AF4961C-F526-43E5-AA81-DB768219178D}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.TagViewAggregate -- PKEY_Photo_TagViewAggregate + /// Description: A read-only aggregation of tag-like properties for use in building views. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR. + /// FormatID: {B812F15D-C2D8-4BBF-BACD-79744346113F}, 100 + /// + public static PropertyKey TagViewAggregate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B812F15D-C2D8-4BBF-BACD-79744346113F}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.TranscodedForSync -- PKEY_Photo_TranscodedForSync + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {9A8EBB75-6458-4E82-BACB-35C0095B03BB}, 100 + /// + public static PropertyKey TranscodedForSync + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9A8EBB75-6458-4E82-BACB-35C0095B03BB}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.WhiteBalance -- PKEY_Photo_WhiteBalance + /// Description: This indicates the white balance mode set when the image was shot. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {EE3D3D8A-5381-4CFA-B13B-AAF66B5F4EC9}, 100 + /// + public static PropertyKey WhiteBalance + { + get + { + PropertyKey key = new PropertyKey(new Guid("{EE3D3D8A-5381-4CFA-B13B-AAF66B5F4EC9}"), 100); + + return key; + } + } + + /// + /// Name: System.Photo.WhiteBalanceText -- PKEY_Photo_WhiteBalanceText + /// Description: This is the user-friendly form of System.Photo.WhiteBalance. Not intended to be parsed + ///programmatically. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6336B95E-C7A7-426D-86FD-7AE3D39C84B4}, 100 + /// + public static PropertyKey WhiteBalanceText + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6336B95E-C7A7-426D-86FD-7AE3D39C84B4}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// PropGroup Properties + /// + public static class PropGroup + { + + + #region Properties + + /// + /// Name: System.PropGroup.Advanced -- PKEY_PropGroup_Advanced + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {900A403B-097B-4B95-8AE2-071FDAEEB118}, 100 + /// + public static PropertyKey Advanced + { + get + { + PropertyKey key = new PropertyKey(new Guid("{900A403B-097B-4B95-8AE2-071FDAEEB118}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Audio -- PKEY_PropGroup_Audio + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {2804D469-788F-48AA-8570-71B9C187E138}, 100 + /// + public static PropertyKey Audio + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2804D469-788F-48AA-8570-71B9C187E138}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Calendar -- PKEY_PropGroup_Calendar + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {9973D2B5-BFD8-438A-BA94-5349B293181A}, 100 + /// + public static PropertyKey Calendar + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9973D2B5-BFD8-438A-BA94-5349B293181A}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Camera -- PKEY_PropGroup_Camera + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {DE00DE32-547E-4981-AD4B-542F2E9007D8}, 100 + /// + public static PropertyKey Camera + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DE00DE32-547E-4981-AD4B-542F2E9007D8}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Contact -- PKEY_PropGroup_Contact + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {DF975FD3-250A-4004-858F-34E29A3E37AA}, 100 + /// + public static PropertyKey Contact + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DF975FD3-250A-4004-858F-34E29A3E37AA}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Content -- PKEY_PropGroup_Content + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {D0DAB0BA-368A-4050-A882-6C010FD19A4F}, 100 + /// + public static PropertyKey Content + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D0DAB0BA-368A-4050-A882-6C010FD19A4F}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Description -- PKEY_PropGroup_Description + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {8969B275-9475-4E00-A887-FF93B8B41E44}, 100 + /// + public static PropertyKey Description + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8969B275-9475-4E00-A887-FF93B8B41E44}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.FileSystem -- PKEY_PropGroup_FileSystem + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {E3A7D2C1-80FC-4B40-8F34-30EA111BDC2E}, 100 + /// + public static PropertyKey FileSystem + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3A7D2C1-80FC-4B40-8F34-30EA111BDC2E}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.General -- PKEY_PropGroup_General + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {CC301630-B192-4C22-B372-9F4C6D338E07}, 100 + /// + public static PropertyKey General + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CC301630-B192-4C22-B372-9F4C6D338E07}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.GPS -- PKEY_PropGroup_GPS + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {F3713ADA-90E3-4E11-AAE5-FDC17685B9BE}, 100 + /// + public static PropertyKey GPS + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F3713ADA-90E3-4E11-AAE5-FDC17685B9BE}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Image -- PKEY_PropGroup_Image + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {E3690A87-0FA8-4A2A-9A9F-FCE8827055AC}, 100 + /// + public static PropertyKey Image + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E3690A87-0FA8-4A2A-9A9F-FCE8827055AC}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Media -- PKEY_PropGroup_Media + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {61872CF7-6B5E-4B4B-AC2D-59DA84459248}, 100 + /// + public static PropertyKey Media + { + get + { + PropertyKey key = new PropertyKey(new Guid("{61872CF7-6B5E-4B4B-AC2D-59DA84459248}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.MediaAdvanced -- PKEY_PropGroup_MediaAdvanced + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {8859A284-DE7E-4642-99BA-D431D044B1EC}, 100 + /// + public static PropertyKey MediaAdvanced + { + get + { + PropertyKey key = new PropertyKey(new Guid("{8859A284-DE7E-4642-99BA-D431D044B1EC}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Message -- PKEY_PropGroup_Message + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {7FD7259D-16B4-4135-9F97-7C96ECD2FA9E}, 100 + /// + public static PropertyKey Message + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7FD7259D-16B4-4135-9F97-7C96ECD2FA9E}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Music -- PKEY_PropGroup_Music + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {68DD6094-7216-40F1-A029-43FE7127043F}, 100 + /// + public static PropertyKey Music + { + get + { + PropertyKey key = new PropertyKey(new Guid("{68DD6094-7216-40F1-A029-43FE7127043F}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Origin -- PKEY_PropGroup_Origin + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {2598D2FB-5569-4367-95DF-5CD3A177E1A5}, 100 + /// + public static PropertyKey Origin + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2598D2FB-5569-4367-95DF-5CD3A177E1A5}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.PhotoAdvanced -- PKEY_PropGroup_PhotoAdvanced + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {0CB2BF5A-9EE7-4A86-8222-F01E07FDADAF}, 100 + /// + public static PropertyKey PhotoAdvanced + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0CB2BF5A-9EE7-4A86-8222-F01E07FDADAF}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.RecordedTV -- PKEY_PropGroup_RecordedTV + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {E7B33238-6584-4170-A5C0-AC25EFD9DA56}, 100 + /// + public static PropertyKey RecordedTV + { + get + { + PropertyKey key = new PropertyKey(new Guid("{E7B33238-6584-4170-A5C0-AC25EFD9DA56}"), 100); + + return key; + } + } + + /// + /// Name: System.PropGroup.Video -- PKEY_PropGroup_Video + /// Description: + /// Type: Null -- VT_NULL + /// FormatID: {BEBE0920-7671-4C54-A3EB-49FDDFC191EE}, 100 + /// + public static PropertyKey Video + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BEBE0920-7671-4C54-A3EB-49FDDFC191EE}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// PropList Properties + /// + public static class PropList + { + + + #region Properties + + /// + /// Name: System.PropList.ConflictPrompt -- PKEY_PropList_ConflictPrompt + /// Description: The list of properties to show in the file operation conflict resolution dialog. Properties with empty + ///values will not be displayed. Register under the regvalue of "ConflictPrompt". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 11 + /// + public static PropertyKey ConflictPrompt + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 11); + + return key; + } + } + + /// + /// Name: System.PropList.ContentViewModeForBrowse -- PKEY_PropList_ContentViewModeForBrowse + /// Description: The list of properties to show in the content view mode of an item in the context of browsing. + ///Register the regvalue under the name of "ContentViewModeForBrowse". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 13 + /// + public static PropertyKey ContentViewModeForBrowse + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 13); + + return key; + } + } + + /// + /// Name: System.PropList.ContentViewModeForSearch -- PKEY_PropList_ContentViewModeForSearch + /// Description: The list of properties to show in the content view mode of an item in the context of searching. + ///Register the regvalue under the name of "ContentViewModeForSearch". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 14 + /// + public static PropertyKey ContentViewModeForSearch + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 14); + + return key; + } + } + + /// + /// Name: System.PropList.ExtendedTileInfo -- PKEY_PropList_ExtendedTileInfo + /// Description: The list of properties to show in the listview on extended tiles. Register under the regvalue of + ///"ExtendedTileInfo". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 9 + /// + public static PropertyKey ExtendedTileInfo + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 9); + + return key; + } + } + + /// + /// Name: System.PropList.FileOperationPrompt -- PKEY_PropList_FileOperationPrompt + /// Description: The list of properties to show in the file operation confirmation dialog. Properties with empty values + ///will not be displayed. If this list is not specified, then the InfoTip property list is used instead. + ///Register under the regvalue of "FileOperationPrompt". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 10 + /// + public static PropertyKey FileOperationPrompt + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 10); + + return key; + } + } + + /// + /// Name: System.PropList.FullDetails -- PKEY_PropList_FullDetails + /// Description: The list of all the properties to show in the details page. Property groups can be included in this list + ///in order to more easily organize the UI. Register under the regvalue of "FullDetails". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 2 + /// + public static PropertyKey FullDetails + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 2); + + return key; + } + } + + /// + /// Name: System.PropList.InfoTip -- PKEY_PropList_InfoTip + /// Description: The list of properties to show in the infotip. Properties with empty values will not be displayed. Register + ///under the regvalue of "InfoTip". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 4 (PID_PROPLIST_INFOTIP) + /// + public static PropertyKey InfoTip + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 4); + + return key; + } + } + + /// + /// Name: System.PropList.NonPersonal -- PKEY_PropList_NonPersonal + /// Description: The list of properties that are considered 'non-personal'. When told to remove all non-personal properties + ///from a given file, the system will leave these particular properties untouched. Register under the regvalue + ///of "NonPersonal". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {49D1091F-082E-493F-B23F-D2308AA9668C}, 100 + /// + public static PropertyKey NonPersonal + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49D1091F-082E-493F-B23F-D2308AA9668C}"), 100); + + return key; + } + } + + /// + /// Name: System.PropList.PreviewDetails -- PKEY_PropList_PreviewDetails + /// Description: The list of properties to display in the preview pane. Register under the regvalue of "PreviewDetails". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 8 + /// + public static PropertyKey PreviewDetails + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 8); + + return key; + } + } + + /// + /// Name: System.PropList.PreviewTitle -- PKEY_PropList_PreviewTitle + /// Description: The one or two properties to display in the preview pane title section. The optional second property is + ///displayed as a subtitle. Register under the regvalue of "PreviewTitle". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 6 + /// + public static PropertyKey PreviewTitle + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 6); + + return key; + } + } + + /// + /// Name: System.PropList.QuickTip -- PKEY_PropList_QuickTip + /// Description: The list of properties to show in the infotip when the item is on a slow network. Properties with empty + ///values will not be displayed. Register under the regvalue of "QuickTip". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 5 (PID_PROPLIST_QUICKTIP) + /// + public static PropertyKey QuickTip + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 5); + + return key; + } + } + + /// + /// Name: System.PropList.TileInfo -- PKEY_PropList_TileInfo + /// Description: The list of properties to show in the listview on tiles. Register under the regvalue of "TileInfo". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 3 (PID_PROPLIST_TILEINFO) + /// + public static PropertyKey TileInfo + { + get + { + PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 3); + + return key; + } + } + + /// + /// Name: System.PropList.XPDetailsPanel -- PKEY_PropList_XPDetailsPanel + /// Description: The list of properties to display in the XP webview details panel. Obsolete. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_WebView) {F2275480-F782-4291-BD94-F13693513AEC}, 0 (PID_DISPLAY_PROPERTIES) + /// + public static PropertyKey XPDetailsPanel + { + get + { + PropertyKey key = new PropertyKey(new Guid("{F2275480-F782-4291-BD94-F13693513AEC}"), 0); + + return key; + } + } + #endregion + + + + } + + /// + /// RecordedTV Properties + /// + public static class RecordedTV + { + + + #region Properties + + /// + /// Name: System.RecordedTV.ChannelNumber -- PKEY_RecordedTV_ChannelNumber + /// Description: Example: 42 + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 7 + /// + public static PropertyKey ChannelNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 7); + + return key; + } + } + + /// + /// Name: System.RecordedTV.Credits -- PKEY_RecordedTV_Credits + /// Description: Example: "Don Messick/Frank Welker/Casey Kasem/Heather North/Nicole Jaffe;;;" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 4 + /// + public static PropertyKey Credits + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 4); + + return key; + } + } + + /// + /// Name: System.RecordedTV.DateContentExpires -- PKEY_RecordedTV_DateContentExpires + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 15 + /// + public static PropertyKey DateContentExpires + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 15); + + return key; + } + } + + /// + /// Name: System.RecordedTV.EpisodeName -- PKEY_RecordedTV_EpisodeName + /// Description: Example: "Nowhere to Hyde" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 2 + /// + public static PropertyKey EpisodeName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 2); + + return key; + } + } + + /// + /// Name: System.RecordedTV.IsATSCContent -- PKEY_RecordedTV_IsATSCContent + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 16 + /// + public static PropertyKey IsATSCContent + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 16); + + return key; + } + } + + /// + /// Name: System.RecordedTV.IsClosedCaptioningAvailable -- PKEY_RecordedTV_IsClosedCaptioningAvailable + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 12 + /// + public static PropertyKey IsClosedCaptioningAvailable + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 12); + + return key; + } + } + + /// + /// Name: System.RecordedTV.IsDTVContent -- PKEY_RecordedTV_IsDTVContent + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 17 + /// + public static PropertyKey IsDTVContent + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 17); + + return key; + } + } + + /// + /// Name: System.RecordedTV.IsHDContent -- PKEY_RecordedTV_IsHDContent + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 18 + /// + public static PropertyKey IsHDContent + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 18); + + return key; + } + } + + /// + /// Name: System.RecordedTV.IsRepeatBroadcast -- PKEY_RecordedTV_IsRepeatBroadcast + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 13 + /// + public static PropertyKey IsRepeatBroadcast + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 13); + + return key; + } + } + + /// + /// Name: System.RecordedTV.IsSAP -- PKEY_RecordedTV_IsSAP + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 14 + /// + public static PropertyKey IsSAP + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 14); + + return key; + } + } + + /// + /// Name: System.RecordedTV.NetworkAffiliation -- PKEY_RecordedTV_NetworkAffiliation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {2C53C813-FB63-4E22-A1AB-0B331CA1E273}, 100 + /// + public static PropertyKey NetworkAffiliation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{2C53C813-FB63-4E22-A1AB-0B331CA1E273}"), 100); + + return key; + } + } + + /// + /// Name: System.RecordedTV.OriginalBroadcastDate -- PKEY_RecordedTV_OriginalBroadcastDate + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {4684FE97-8765-4842-9C13-F006447B178C}, 100 + /// + public static PropertyKey OriginalBroadcastDate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{4684FE97-8765-4842-9C13-F006447B178C}"), 100); + + return key; + } + } + + /// + /// Name: System.RecordedTV.ProgramDescription -- PKEY_RecordedTV_ProgramDescription + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 3 + /// + public static PropertyKey ProgramDescription + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 3); + + return key; + } + } + + /// + /// Name: System.RecordedTV.RecordingTime -- PKEY_RecordedTV_RecordingTime + /// Description: + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {A5477F61-7A82-4ECA-9DDE-98B69B2479B3}, 100 + /// + public static PropertyKey RecordingTime + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A5477F61-7A82-4ECA-9DDE-98B69B2479B3}"), 100); + + return key; + } + } + + /// + /// Name: System.RecordedTV.StationCallSign -- PKEY_RecordedTV_StationCallSign + /// Description: Example: "TOONP" + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 5 + /// + public static PropertyKey StationCallSign + { + get + { + PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 5); + + return key; + } + } + + /// + /// Name: System.RecordedTV.StationName -- PKEY_RecordedTV_StationName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {1B5439E7-EBA1-4AF8-BDD7-7AF1D4549493}, 100 + /// + public static PropertyKey StationName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{1B5439E7-EBA1-4AF8-BDD7-7AF1D4549493}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// Search Properties + /// + public static class Search + { + + + #region Properties + + /// + /// Name: System.Search.AutoSummary -- PKEY_Search_AutoSummary + /// Description: General Summary of the document. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 2 + /// + public static PropertyKey AutoSummary + { + get + { + PropertyKey key = new PropertyKey(new Guid("{560C36C0-503A-11CF-BAA1-00004C752A9A}"), 2); + + return key; + } + } + + /// + /// Name: System.Search.ContainerHash -- PKEY_Search_ContainerHash + /// Description: Hash code used to identify attachments to be deleted based on a common container url + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {BCEEE283-35DF-4D53-826A-F36A3EEFC6BE}, 100 + /// + public static PropertyKey ContainerHash + { + get + { + PropertyKey key = new PropertyKey(new Guid("{BCEEE283-35DF-4D53-826A-F36A3EEFC6BE}"), 100); + + return key; + } + } + + /// + /// Name: System.Search.Contents -- PKEY_Search_Contents + /// Description: The contents of the item. This property is for query restrictions only; it cannot be retrieved in a + ///query result. The Indexing Service friendly name is 'contents'. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 19 (PID_STG_CONTENTS) + /// + public static PropertyKey Contents + { + get + { + PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 19); + + return key; + } + } + + /// + /// Name: System.Search.EntryID -- PKEY_Search_EntryID + /// Description: The entry ID for an item within a given catalog in the Windows Search Index. + ///This value may be recycled, and therefore is not considered unique over time. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 5 (PROPID_QUERY_WORKID) + /// + public static PropertyKey EntryID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49691C90-7E17-101A-A91C-08002B2ECDA9}"), 5); + + return key; + } + } + + /// + /// Name: System.Search.ExtendedProperties -- PKEY_Search_ExtendedProperties + /// Description: + /// Type: Blob -- VT_BLOB + /// FormatID: {7B03B546-FA4F-4A52-A2FE-03D5311E5865}, 100 + /// + public static PropertyKey ExtendedProperties + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7B03B546-FA4F-4A52-A2FE-03D5311E5865}"), 100); + + return key; + } + } + + /// + /// Name: System.Search.GatherTime -- PKEY_Search_GatherTime + /// Description: The Datetime that the Windows Search Gatherer process last pushed properties of this document to the Windows Search Gatherer Plugins. + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {0B63E350-9CCC-11D0-BCDB-00805FCCCE04}, 8 + /// + public static PropertyKey GatherTime + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0B63E350-9CCC-11D0-BCDB-00805FCCCE04}"), 8); + + return key; + } + } + + /// + /// Name: System.Search.HitCount -- PKEY_Search_HitCount + /// Description: When using CONTAINS over the Windows Search Index, this is the number of matches of the term. + ///If there are multiple CONTAINS, an AND computes the min number of hits and an OR the max number of hits. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 4 (PROPID_QUERY_HITCOUNT) + /// + public static PropertyKey HitCount + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49691C90-7E17-101A-A91C-08002B2ECDA9}"), 4); + + return key; + } + } + + /// + /// Name: System.Search.IsClosedDirectory -- PKEY_Search_IsClosedDirectory + /// Description: If this property is emitted with a value of TRUE, then it indicates that this URL's last modified time applies to all of it's children, and if this URL is deleted then all of it's children are deleted as well. For example, this would be emitted as TRUE when emitting the URL of an email so that all attachments are tied to the last modified time of that email. + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 23 + /// + public static PropertyKey IsClosedDirectory + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0B63E343-9CCC-11D0-BCDB-00805FCCCE04}"), 23); + + return key; + } + } + + /// + /// Name: System.Search.IsFullyContained -- PKEY_Search_IsFullyContained + /// Description: Any child URL of a URL which has System.Search.IsClosedDirectory=TRUE must emit System.Search.IsFullyContained=TRUE. This ensures that the URL is not deleted at the end of a crawl because it hasn't been visited (which is the normal mechanism for detecting deletes). For example an email attachment would emit this property + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 24 + /// + public static PropertyKey IsFullyContained + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0B63E343-9CCC-11D0-BCDB-00805FCCCE04}"), 24); + + return key; + } + } + + /// + /// Name: System.Search.QueryFocusedSummary -- PKEY_Search_QueryFocusedSummary + /// Description: Query Focused Summary of the document. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 3 + /// + public static PropertyKey QueryFocusedSummary + { + get + { + PropertyKey key = new PropertyKey(new Guid("{560C36C0-503A-11CF-BAA1-00004C752A9A}"), 3); + + return key; + } + } + + /// + /// Name: System.Search.QueryFocusedSummaryWithFallback -- PKEY_Search_QueryFocusedSummaryWithFallback + /// Description: Query Focused Summary of the document, if none is available it returns the AutoSummary. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 4 + /// + public static PropertyKey QueryFocusedSummaryWithFallback + { + get + { + PropertyKey key = new PropertyKey(new Guid("{560C36C0-503A-11CF-BAA1-00004C752A9A}"), 4); + + return key; + } + } + + /// + /// Name: System.Search.Rank -- PKEY_Search_Rank + /// Description: Relevance rank of row. Ranges from 0-1000. Larger numbers = better matches. Query-time only. + /// + /// Type: Int32 -- VT_I4 + /// FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 3 (PROPID_QUERY_RANK) + /// + public static PropertyKey Rank + { + get + { + PropertyKey key = new PropertyKey(new Guid("{49691C90-7E17-101A-A91C-08002B2ECDA9}"), 3); + + return key; + } + } + + /// + /// Name: System.Search.Store -- PKEY_Search_Store + /// Description: The identifier for the protocol handler that produced this item. (E.g. MAPI, CSC, FILE etc.) + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {A06992B3-8CAF-4ED7-A547-B259E32AC9FC}, 100 + /// + public static PropertyKey Store + { + get + { + PropertyKey key = new PropertyKey(new Guid("{A06992B3-8CAF-4ED7-A547-B259E32AC9FC}"), 100); + + return key; + } + } + + /// + /// Name: System.Search.UrlToIndex -- PKEY_Search_UrlToIndex + /// Description: This property should be emitted by a container IFilter for each child URL within the container. The children will eventually be crawled by the indexer if they are within scope. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 2 + /// + public static PropertyKey UrlToIndex + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0B63E343-9CCC-11D0-BCDB-00805FCCCE04}"), 2); + + return key; + } + } + + /// + /// Name: System.Search.UrlToIndexWithModificationTime -- PKEY_Search_UrlToIndexWithModificationTime + /// Description: This property is the same as System.Search.UrlToIndex except that it includes the time the URL was last modified. This is an optimization for the indexer as it doesn't have to call back into the protocol handler to ask for this information to determine if the content needs to be indexed again. The property is a vector with two elements, a VT_LPWSTR with the URL and a VT_FILETIME for the last modified time. + /// + /// Type: Multivalue Any -- VT_VECTOR | VT_NULL (For variants: VT_ARRAY | VT_NULL) + /// FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 12 + /// + public static PropertyKey UrlToIndexWithModificationTime + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0B63E343-9CCC-11D0-BCDB-00805FCCCE04}"), 12); + + return key; + } + } + #endregion + + + + } + + /// + /// Shell Properties + /// + public static class Shell + { + + + #region Properties + + /// + /// Name: System.Shell.OmitFromView -- PKEY_Shell_OmitFromView + /// Description: Set this to a string value of 'True' to omit this item from shell views + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {DE35258C-C695-4CBC-B982-38B0AD24CED0}, 2 + /// + public static PropertyKey OmitFromView + { + get + { + PropertyKey key = new PropertyKey(new Guid("{DE35258C-C695-4CBC-B982-38B0AD24CED0}"), 2); + + return key; + } + } + + /// + /// Name: System.Shell.SFGAOFlagsStrings -- PKEY_Shell_SFGAOFlagsStrings + /// Description: Expresses the SFGAO flags as string values and is used as a query optimization. + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: {D6942081-D53B-443D-AD47-5E059D9CD27A}, 2 + /// + [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags")] + public static PropertyKey SFGAOFlagsStrings + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D6942081-D53B-443D-AD47-5E059D9CD27A}"), 2); + + return key; + } + } + #endregion + + + + } + + /// + /// Software Properties + /// + public static class Software + { + + + #region Properties + + /// + /// Name: System.Software.DateLastUsed -- PKEY_Software_DateLastUsed + /// Description: + /// + /// Type: DateTime -- VT_FILETIME (For variants: VT_DATE) + /// FormatID: {841E4F90-FF59-4D16-8947-E81BBFFAB36D}, 16 + /// + public static PropertyKey DateLastUsed + { + get + { + PropertyKey key = new PropertyKey(new Guid("{841E4F90-FF59-4D16-8947-E81BBFFAB36D}"), 16); + + return key; + } + } + + /// + /// Name: System.Software.ProductName -- PKEY_Software_ProductName + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 7 + /// + public static PropertyKey ProductName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 7); + + return key; + } + } + #endregion + + + + } + + /// + /// Sync Properties + /// + public static class Sync + { + + + #region Properties + + /// + /// Name: System.Sync.Comments -- PKEY_Sync_Comments + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 13 + /// + public static PropertyKey Comments + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 13); + + return key; + } + } + + /// + /// Name: System.Sync.ConflictDescription -- PKEY_Sync_ConflictDescription + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 4 + /// + public static PropertyKey ConflictDescription + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 4); + + return key; + } + } + + /// + /// Name: System.Sync.ConflictFirstLocation -- PKEY_Sync_ConflictFirstLocation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 6 + /// + public static PropertyKey ConflictFirstLocation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 6); + + return key; + } + } + + /// + /// Name: System.Sync.ConflictSecondLocation -- PKEY_Sync_ConflictSecondLocation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 7 + /// + public static PropertyKey ConflictSecondLocation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 7); + + return key; + } + } + + /// + /// Name: System.Sync.HandlerCollectionID -- PKEY_Sync_HandlerCollectionID + /// Description: + /// Type: Guid -- VT_CLSID + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 2 + /// + public static PropertyKey HandlerCollectionID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 2); + + return key; + } + } + + /// + /// Name: System.Sync.HandlerID -- PKEY_Sync_HandlerID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 3 + /// + public static PropertyKey HandlerID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 3); + + return key; + } + } + + /// + /// Name: System.Sync.HandlerName -- PKEY_Sync_HandlerName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 2 + /// + public static PropertyKey HandlerName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 2); + + return key; + } + } + + /// + /// Name: System.Sync.HandlerType -- PKEY_Sync_HandlerType + /// Description: + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 8 + /// + public static PropertyKey HandlerType + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 8); + + return key; + } + } + + /// + /// Name: System.Sync.HandlerTypeLabel -- PKEY_Sync_HandlerTypeLabel + /// Description: + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 9 + /// + public static PropertyKey HandlerTypeLabel + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 9); + + return key; + } + } + + /// + /// Name: System.Sync.ItemID -- PKEY_Sync_ItemID + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 6 + /// + public static PropertyKey ItemID + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 6); + + return key; + } + } + + /// + /// Name: System.Sync.ItemName -- PKEY_Sync_ItemName + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 3 + /// + public static PropertyKey ItemName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 3); + + return key; + } + } + + /// + /// Name: System.Sync.ProgressPercentage -- PKEY_Sync_ProgressPercentage + /// Description: An integer value between 0 and 100 representing the percentage completed. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 23 + /// + public static PropertyKey ProgressPercentage + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 23); + + return key; + } + } + + /// + /// Name: System.Sync.State -- PKEY_Sync_State + /// Description: Sync state. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 24 + /// + public static PropertyKey State + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 24); + + return key; + } + } + + /// + /// Name: System.Sync.Status -- PKEY_Sync_Status + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 10 + /// + public static PropertyKey Status + { + get + { + PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 10); + + return key; + } + } + #endregion + + + + } + + /// + /// Task Properties + /// + public static class Task + { + + + #region Properties + + /// + /// Name: System.Task.BillingInformation -- PKEY_Task_BillingInformation + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {D37D52C6-261C-4303-82B3-08B926AC6F12}, 100 + /// + public static PropertyKey BillingInformation + { + get + { + PropertyKey key = new PropertyKey(new Guid("{D37D52C6-261C-4303-82B3-08B926AC6F12}"), 100); + + return key; + } + } + + /// + /// Name: System.Task.CompletionStatus -- PKEY_Task_CompletionStatus + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {084D8A0A-E6D5-40DE-BF1F-C8820E7C877C}, 100 + /// + public static PropertyKey CompletionStatus + { + get + { + PropertyKey key = new PropertyKey(new Guid("{084D8A0A-E6D5-40DE-BF1F-C8820E7C877C}"), 100); + + return key; + } + } + + /// + /// Name: System.Task.Owner -- PKEY_Task_Owner + /// Description: + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: {08C7CC5F-60F2-4494-AD75-55E3E0B5ADD0}, 100 + /// + public static PropertyKey Owner + { + get + { + PropertyKey key = new PropertyKey(new Guid("{08C7CC5F-60F2-4494-AD75-55E3E0B5ADD0}"), 100); + + return key; + } + } + #endregion + + + + } + + /// + /// Video Properties + /// + public static class Video + { + + + #region Properties + + /// + /// Name: System.Video.Compression -- PKEY_Video_Compression + /// Description: Indicates the level of compression for the video stream. "Compression". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 10 (PIDVSI_COMPRESSION) + /// + public static PropertyKey Compression + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 10); + + return key; + } + } + + /// + /// Name: System.Video.Director -- PKEY_Video_Director + /// Description: + /// + /// Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) + /// FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 20 (PIDMSI_DIRECTOR) + /// + public static PropertyKey Director + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 20); + + return key; + } + } + + /// + /// Name: System.Video.EncodingBitrate -- PKEY_Video_EncodingBitrate + /// Description: Indicates the data rate in "bits per second" for the video stream. "DataRate". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 8 (PIDVSI_DATA_RATE) + /// + public static PropertyKey EncodingBitrate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 8); + + return key; + } + } + + /// + /// Name: System.Video.FourCC -- PKEY_Video_FourCC + /// Description: Indicates the 4CC for the video stream. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 44 + /// + public static PropertyKey FourCC + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 44); + + return key; + } + } + + /// + /// Name: System.Video.FrameHeight -- PKEY_Video_FrameHeight + /// Description: Indicates the frame height for the video stream. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 4 + /// + public static PropertyKey FrameHeight + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 4); + + return key; + } + } + + /// + /// Name: System.Video.FrameRate -- PKEY_Video_FrameRate + /// Description: Indicates the frame rate in "frames per millisecond" for the video stream. "FrameRate". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 6 (PIDVSI_FRAME_RATE) + /// + public static PropertyKey FrameRate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 6); + + return key; + } + } + + /// + /// Name: System.Video.FrameWidth -- PKEY_Video_FrameWidth + /// Description: Indicates the frame width for the video stream. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 3 + /// + public static PropertyKey FrameWidth + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 3); + + return key; + } + } + + /// + /// Name: System.Video.HorizontalAspectRatio -- PKEY_Video_HorizontalAspectRatio + /// Description: Indicates the horizontal portion of the aspect ratio. The X portion of XX:YY, + ///like 16:9. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 42 + /// + public static PropertyKey HorizontalAspectRatio + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 42); + + return key; + } + } + + /// + /// Name: System.Video.SampleSize -- PKEY_Video_SampleSize + /// Description: Indicates the sample size in bits for the video stream. "SampleSize". + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 9 (PIDVSI_SAMPLE_SIZE) + /// + public static PropertyKey SampleSize + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 9); + + return key; + } + } + + /// + /// Name: System.Video.StreamName -- PKEY_Video_StreamName + /// Description: Indicates the name for the video stream. "StreamName". + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 2 (PIDVSI_STREAM_NAME) + /// + public static PropertyKey StreamName + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 2); + + return key; + } + } + + /// + /// Name: System.Video.StreamNumber -- PKEY_Video_StreamNumber + /// Description: "Stream Number". + /// + /// Type: UInt16 -- VT_UI2 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 11 (PIDVSI_STREAM_NUMBER) + /// + public static PropertyKey StreamNumber + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 11); + + return key; + } + } + + /// + /// Name: System.Video.TotalBitrate -- PKEY_Video_TotalBitrate + /// Description: Indicates the total data rate in "bits per second" for all video and audio streams. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 43 (PIDVSI_TOTAL_BITRATE) + /// + public static PropertyKey TotalBitrate + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 43); + + return key; + } + } + + /// + /// Name: System.Video.TranscodedForSync -- PKEY_Video_TranscodedForSync + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 46 + /// + public static PropertyKey TranscodedForSync + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 46); + + return key; + } + } + + /// + /// Name: System.Video.VerticalAspectRatio -- PKEY_Video_VerticalAspectRatio + /// Description: Indicates the vertical portion of the aspect ratio. The Y portion of + ///XX:YY, like 16:9. + /// + /// Type: UInt32 -- VT_UI4 + /// FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 45 + /// + public static PropertyKey VerticalAspectRatio + { + get + { + PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 45); + + return key; + } + } + #endregion + + + + } + + /// + /// Volume Properties + /// + public static class Volume + { + + + #region Properties + + /// + /// Name: System.Volume.FileSystem -- PKEY_Volume_FileSystem + /// Description: Indicates the filesystem of the volume. + /// + /// Type: String -- VT_LPWSTR (For variants: VT_BSTR) + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 4 (PID_VOLUME_FILESYSTEM) (Filesystem Volume Properties) + /// + public static PropertyKey FileSystem + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 4); + + return key; + } + } + + /// + /// Name: System.Volume.IsMappedDrive -- PKEY_Volume_IsMappedDrive + /// Description: + /// Type: Boolean -- VT_BOOL + /// FormatID: {149C0B69-2C2D-48FC-808F-D318D78C4636}, 2 + /// + public static PropertyKey IsMappedDrive + { + get + { + PropertyKey key = new PropertyKey(new Guid("{149C0B69-2C2D-48FC-808F-D318D78C4636}"), 2); + + return key; + } + } + + /// + /// Name: System.Volume.IsRoot -- PKEY_Volume_IsRoot + /// Description: + /// + /// Type: Boolean -- VT_BOOL + /// FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 10 (Filesystem Volume Properties) + /// + public static PropertyKey IsRoot + { + get + { + PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 10); + + return key; + } + } + #endregion + + + + } + #endregion + } + } +} diff --git a/Shell/PropertySystem/WindowProperties.cs b/Shell/PropertySystem/WindowProperties.cs new file mode 100644 index 0000000..7944366 --- /dev/null +++ b/Shell/PropertySystem/WindowProperties.cs @@ -0,0 +1,37 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Windows; +using System.Windows.Interop; +using Microsoft.WindowsAPICodePack.Taskbar; + +namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem +{ + /// + /// Helper class to modify properties for a given window + /// + public static class WindowProperties + { + /// + /// Sets a shell property for a given window + /// + /// The property to set + /// Handle to the window that the property will be set on + /// The value to set for the property + public static void SetWindowProperty(IntPtr windowHandle, PropertyKey propKey, string value) + { + TaskbarNativeMethods.SetWindowProperty(windowHandle, propKey, value); + } + + /// + /// Sets a shell property for a given window + /// + /// The property to set + /// Window that the property will be set on + /// The value to set for the property + public static void SetWindowProperty(Window window, PropertyKey propKey, string value) + { + TaskbarNativeMethods.SetWindowProperty((new WindowInteropHelper(window)).Handle, propKey, value); + } + } +} diff --git a/Shell/Resources/LocalizedMessages.Designer.cs b/Shell/Resources/LocalizedMessages.Designer.cs new file mode 100644 index 0000000..01539c1 --- /dev/null +++ b/Shell/Resources/LocalizedMessages.Designer.cs @@ -0,0 +1,1251 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.WindowsAPICodePack.Shell.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class LocalizedMessages { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal LocalizedMessages() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WindowsAPICodePack.Shell.Resources.LocalizedMessages", typeof(LocalizedMessages).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to AddToMostRecentlyUsedList cannot be changed while dialog is showing.. + /// + internal static string AddToMostRecentlyUsedListCannotBeChanged { + get { + return ResourceManager.GetString("AddToMostRecentlyUsedListCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AlwaysAppendDefaultExtension cannot be changed while dialog is showing.. + /// + internal static string AlwaysAppendDefaultExtensionCannotBeChanged { + get { + return ResourceManager.GetString("AlwaysAppendDefaultExtensionCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Index was outside the bounds of the CommonFileDialogComboBox.. + /// + internal static string ComboBoxIndexOutsideBounds { + get { + return ResourceManager.GetString("ComboBoxIndexOutsideBounds", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File name not available - dialog was canceled.. + /// + internal static string CommonFileDialogCanceled { + get { + return ResourceManager.GetString("CommonFileDialogCanceled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shell item could not be created.. + /// + internal static string CommonFileDialogCannotCreateShellItem { + get { + return ResourceManager.GetString("CommonFileDialogCannotCreateShellItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Handle provided cannot be IntPtr.Zero.. + /// + internal static string CommonFileDialogInvalidHandle { + get { + return ResourceManager.GetString("CommonFileDialogInvalidHandle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple files selected - the FileNames property should be used instead.. + /// + internal static string CommonFileDialogMultipleFiles { + get { + return ResourceManager.GetString("CommonFileDialogMultipleFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple files selected - the Items property should be used instead.. + /// + internal static string CommonFileDialogMultipleItems { + get { + return ResourceManager.GetString("CommonFileDialogMultipleItems", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File name not available - dialog has not closed yet.. + /// + internal static string CommonFileDialogNotClosed { + get { + return ResourceManager.GetString("CommonFileDialogNotClosed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Common File Dialog requires Windows Vista or later.. + /// + internal static string CommonFileDialogRequiresVista { + get { + return ResourceManager.GetString("CommonFileDialogRequiresVista", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Office Files. + /// + internal static string CommonFiltersOffice { + get { + return ResourceManager.GetString("CommonFiltersOffice", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to All Picture Files. + /// + internal static string CommonFiltersPicture { + get { + return ResourceManager.GetString("CommonFiltersPicture", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Text Files. + /// + internal static string CommonFiltersText { + get { + return ResourceManager.GetString("CommonFiltersText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CreatePrompt cannot be changed while dialog is showing.. + /// + internal static string CreatePromptCannotBeChanged { + get { + return ResourceManager.GetString("CreatePromptCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Custom controls cannot be removed from a File dialog once added.. + /// + internal static string DialogControlCollectionCannotRemoveControls { + get { + return ResourceManager.GetString("DialogControlCollectionCannotRemoveControls", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Control name cannot be null or zero length.. + /// + internal static string DialogControlCollectionEmptyName { + get { + return ResourceManager.GetString("DialogControlCollectionEmptyName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CommonFileDialogMenuItem controls can only be added to CommonFileDialogMenu controls.. + /// + internal static string DialogControlCollectionMenuItemControlsCannotBeAdded { + get { + return ResourceManager.GetString("DialogControlCollectionMenuItemControlsCannotBeAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Modifying controls collection while dialog is showing is not supported.. + /// + internal static string DialogControlCollectionModifyingControls { + get { + return ResourceManager.GetString("DialogControlCollectionModifyingControls", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog cannot have more than one control with the same name.. + /// + internal static string DialogControlCollectionMoreThanOneControl { + get { + return ResourceManager.GetString("DialogControlCollectionMoreThanOneControl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dialog control must be removed from current collections first.. + /// + internal static string DialogControlCollectionRemoveControlFirst { + get { + return ResourceManager.GetString("DialogControlCollectionRemoveControlFirst", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to EnsureFileExists cannot be changed while dialog is showing.. + /// + internal static string EnsureFileExistsCannotBeChanged { + get { + return ResourceManager.GetString("EnsureFileExistsCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to EnsurePathExists cannot be changed while dialog is showing.. + /// + internal static string EnsurePathExistsCannotBeChanged { + get { + return ResourceManager.GetString("EnsurePathExistsCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to EnsureReadOnly cannot be changed while dialog is showing.. + /// + internal static string EnsureReadonlyCannotBeChanged { + get { + return ResourceManager.GetString("EnsureReadonlyCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to EnsureValidNames cannot be changed while dialog is showing.. + /// + internal static string EnsureValidNamesCannotBeChanged { + get { + return ResourceManager.GetString("EnsureValidNamesCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Browsing to object failed.. + /// + internal static string ExplorerBrowserBrowseToObjectFailed { + get { + return ResourceManager.GetString("ExplorerBrowserBrowseToObjectFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ExplorerBrowser failed to get current view.. + /// + internal static string ExplorerBrowserFailedToGetView { + get { + return ResourceManager.GetString("ExplorerBrowserFailedToGetView", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to get icon size.. + /// + internal static string ExplorerBrowserIconSize { + get { + return ResourceManager.GetString("ExplorerBrowserIconSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unexpected error retrieving item count.. + /// + internal static string ExplorerBrowserItemCount { + get { + return ResourceManager.GetString("ExplorerBrowserItemCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unexpected error retrieving selected item count.. + /// + internal static string ExplorerBrowserSelectedItemCount { + get { + return ResourceManager.GetString("ExplorerBrowserSelectedItemCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unexpected error retrieving selection.. + /// + internal static string ExplorerBrowserUnexpectedError { + get { + return ResourceManager.GetString("ExplorerBrowserUnexpectedError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unexpected error retrieving view items.. + /// + internal static string ExplorerBrowserViewItems { + get { + return ResourceManager.GetString("ExplorerBrowserViewItems", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The given path does not exist ({0}). + /// + internal static string FilePathNotExist { + get { + return ResourceManager.GetString("FilePathNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Guid does not identify a known folder.. + /// + internal static string FolderIdsUnknownGuid { + get { + return ResourceManager.GetString("FolderIdsUnknownGuid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ControlPanel Category. + /// + internal static string FolderTypeCategory { + get { + return ResourceManager.GetString("FolderTypeCategory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ControlPanel Classic. + /// + internal static string FolderTypeClassic { + get { + return ResourceManager.GetString("FolderTypeClassic", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Communications. + /// + internal static string FolderTypeCommunications { + get { + return ResourceManager.GetString("FolderTypeCommunications", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Compressed Folder. + /// + internal static string FolderTypeCompressedFolder { + get { + return ResourceManager.GetString("FolderTypeCompressedFolder", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Contacts. + /// + internal static string FolderTypeContacts { + get { + return ResourceManager.GetString("FolderTypeContacts", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Documents. + /// + internal static string FolderTypeDocuments { + get { + return ResourceManager.GetString("FolderTypeDocuments", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Games. + /// + internal static string FolderTypeGames { + get { + return ResourceManager.GetString("FolderTypeGames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Generic Library. + /// + internal static string FolderTypeGenericLibrary { + get { + return ResourceManager.GetString("FolderTypeGenericLibrary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid. + /// + internal static string FolderTypeInvalid { + get { + return ResourceManager.GetString("FolderTypeInvalid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Library. + /// + internal static string FolderTypeLibrary { + get { + return ResourceManager.GetString("FolderTypeLibrary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Music. + /// + internal static string FolderTypeMusic { + get { + return ResourceManager.GetString("FolderTypeMusic", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Music Icons. + /// + internal static string FolderTypeMusicIcons { + get { + return ResourceManager.GetString("FolderTypeMusicIcons", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Network Explorer. + /// + internal static string FolderTypeNetworkExplorer { + get { + return ResourceManager.GetString("FolderTypeNetworkExplorer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Not Specified. + /// + internal static string FolderTypeNotSpecified { + get { + return ResourceManager.GetString("FolderTypeNotSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Open Search. + /// + internal static string FolderTypeOpenSearch { + get { + return ResourceManager.GetString("FolderTypeOpenSearch", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Other Users. + /// + internal static string FolderTypeOtherUsers { + get { + return ResourceManager.GetString("FolderTypeOtherUsers", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Pictures. + /// + internal static string FolderTypePictures { + get { + return ResourceManager.GetString("FolderTypePictures", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Printers. + /// + internal static string FolderTypePrinters { + get { + return ResourceManager.GetString("FolderTypePrinters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RecordedTV. + /// + internal static string FolderTypeRecordedTV { + get { + return ResourceManager.GetString("FolderTypeRecordedTV", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RecycleBin. + /// + internal static string FolderTypeRecycleBin { + get { + return ResourceManager.GetString("FolderTypeRecycleBin", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Saved Games. + /// + internal static string FolderTypeSavedGames { + get { + return ResourceManager.GetString("FolderTypeSavedGames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Search Connector. + /// + internal static string FolderTypeSearchConnector { + get { + return ResourceManager.GetString("FolderTypeSearchConnector", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Searches. + /// + internal static string FolderTypeSearches { + get { + return ResourceManager.GetString("FolderTypeSearches", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Generic SearchResults. + /// + internal static string FolderTypeSearchResults { + get { + return ResourceManager.GetString("FolderTypeSearchResults", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Software Explorer. + /// + internal static string FolderTypeSoftwareExplorer { + get { + return ResourceManager.GetString("FolderTypeSoftwareExplorer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User Files. + /// + internal static string FolderTypeUserFiles { + get { + return ResourceManager.GetString("FolderTypeUserFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Users Libraries. + /// + internal static string FolderTypeUserLibraries { + get { + return ResourceManager.GetString("FolderTypeUserLibraries", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Videos. + /// + internal static string FolderTypeVideos { + get { + return ResourceManager.GetString("FolderTypeVideos", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IsExpandedMode cannot be changed while dialog is showing.. + /// + internal static string IsExpandedModeCannotBeChanged { + get { + return ResourceManager.GetString("IsExpandedModeCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Custom categories cannot be added while recent documents tracking is turned off.. + /// + internal static string JumpListCustomCategoriesDisabled { + get { + return ResourceManager.GetString("JumpListCustomCategoriesDisabled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The file type is not registered with this application.. + /// + internal static string JumpListFileTypeNotRegistered { + get { + return ResourceManager.GetString("JumpListFileTypeNotRegistered", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to JumpListLink's path is required and cannot be null.. + /// + internal static string JumpListLinkPathRequired { + get { + return ResourceManager.GetString("JumpListLinkPathRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to JumpListLink's title is required and cannot be null.. + /// + internal static string JumpListLinkTitleRequired { + get { + return ResourceManager.GetString("JumpListLinkTitleRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Negative numbers are not allowed for the ordinal position.. + /// + internal static string JumpListNegativeOrdinalPosition { + get { + return ResourceManager.GetString("JumpListNegativeOrdinalPosition", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Given Known Folder ID is invalid.. + /// + internal static string KnownFolderInvalidGuid { + get { + return ResourceManager.GetString("KnownFolderInvalidGuid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing name is invalid.. + /// + internal static string KnownFolderParsingName { + get { + return ResourceManager.GetString("KnownFolderParsingName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creation of window has failed, view inner exception for details.. + /// + internal static string MessageListenerCannotCreateWindow { + get { + return ResourceManager.GetString("MessageListenerCannotCreateWindow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Window class could not be registered, check inner exception for more details.. + /// + internal static string MessageListenerClassNotRegistered { + get { + return ResourceManager.GetString("MessageListenerClassNotRegistered", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Message filter registration failed.. + /// + internal static string MessageListenerFilterUnableToRegister { + get { + return ResourceManager.GetString("MessageListenerFilterUnableToRegister", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No listener handled of that value is registered.. + /// + internal static string MessageListenerFilterUnknownListenerHandle { + get { + return ResourceManager.GetString("MessageListenerFilterUnknownListenerHandle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot create window on the listener thread because there is no existing window on the listener thread.. + /// + internal static string MessageListenerNoWindowHandle { + get { + return ResourceManager.GetString("MessageListenerNoWindowHandle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NavigateToShortcut cannot be changed while dialog is showing.. + /// + internal static string NavigateToShortcutCannotBeChanged { + get { + return ResourceManager.GetString("NavigateToShortcutCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parent cannot be null.. + /// + internal static string NavigationLogNullParent { + get { + return ResourceManager.GetString("NavigationLogNullParent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The method or operation is not implemented.. + /// + internal static string NotImplementedException { + get { + return ResourceManager.GetString("NotImplementedException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OverwritePrompt cannot be changed while dialog is showing.. + /// + internal static string OverwritePromptCannotBeChanged { + get { + return ResourceManager.GetString("OverwritePromptCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This CanonicalName is not a valid index.. + /// + internal static string PropertyCollectionCanonicalInvalidIndex { + get { + return ResourceManager.GetString("PropertyCollectionCanonicalInvalidIndex", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This PropertyKey is not a valid index.. + /// + internal static string PropertyCollectionInvalidIndex { + get { + return ResourceManager.GetString("PropertyCollectionInvalidIndex", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Argument CanonicalName cannot be null or empty.. + /// + internal static string PropertyCollectionNullCanonicalName { + get { + return ResourceManager.GetString("PropertyCollectionNullCanonicalName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Index was outside the bounds of the CommonFileDialogRadioButtonList.. + /// + internal static string RadioButtonListIndexOutOfBounds { + get { + return ResourceManager.GetString("RadioButtonListIndexOutOfBounds", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RestoreDirectory cannot be changed while dialog is showing.. + /// + internal static string RestoreDirectoryCannotBeChanged { + get { + return ResourceManager.GetString("RestoreDirectoryCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Retrieved a null shell item from dialog.. + /// + internal static string SaveFileNullItem { + get { + return ResourceManager.GetString("SaveFileNullItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Given property key is invalid.. + /// + internal static string SearchConditionFactoryInvalidProperty { + get { + return ResourceManager.GetString("SearchConditionFactoryInvalidProperty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shell Exception has occurred, look at inner exception for information.. + /// + internal static string ShellExceptionDefaultText { + get { + return ResourceManager.GetString("ShellExceptionDefaultText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to GetParsingName has failed.. + /// + internal static string ShellHelperGetParsingNameFailed { + get { + return ResourceManager.GetString("ShellHelperGetParsingNameFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The given CanonicalName is not valid.. + /// + internal static string ShellInvalidCanonicalName { + get { + return ResourceManager.GetString("ShellInvalidCanonicalName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DefaultSaveFolder path not found.. + /// + internal static string ShellLibraryDefaultSaveFolderNotFound { + get { + return ResourceManager.GetString("ShellLibraryDefaultSaveFolderNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to LibraryName cannot be empty.. + /// + internal static string ShellLibraryEmptyName { + get { + return ResourceManager.GetString("ShellLibraryEmptyName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Folder path not found.. + /// + internal static string ShellLibraryFolderNotFound { + get { + return ResourceManager.GetString("ShellLibraryFolderNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid FolderType Guid.. + /// + internal static string ShellLibraryInvalidFolderType { + get { + return ResourceManager.GetString("ShellLibraryInvalidFolderType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The given known folder is not a valid library.. + /// + internal static string ShellLibraryInvalidLibrary { + get { + return ResourceManager.GetString("ShellLibraryInvalidLibrary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Can't get the display name.. + /// + internal static string ShellObjectCannotGetDisplayName { + get { + return ResourceManager.GetString("ShellObjectCannotGetDisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Destination array too small, or invalid arrayIndex.. + /// + internal static string ShellObjectCollectionArrayTooSmall { + get { + return ResourceManager.GetString("ShellObjectCollectionArrayTooSmall", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Must have at least one shell object in the collection.. + /// + internal static string ShellObjectCollectionEmptyCollection { + get { + return ResourceManager.GetString("ShellObjectCollectionEmptyCollection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot insert items into a read only list.. + /// + internal static string ShellObjectCollectionInsertReadOnly { + get { + return ResourceManager.GetString("ShellObjectCollectionInsertReadOnly", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot remove items from a read only list.. + /// + internal static string ShellObjectCollectionRemoveReadOnly { + get { + return ResourceManager.GetString("ShellObjectCollectionRemoveReadOnly", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shell item could not be created.. + /// + internal static string ShellObjectCreationFailed { + get { + return ResourceManager.GetString("ShellObjectCreationFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shell Object creation requires Windows Vista or higher operating system.. + /// + internal static string ShellObjectFactoryPlatformNotSupported { + get { + return ResourceManager.GetString("ShellObjectFactoryPlatformNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to Create Shell Item.. + /// + internal static string ShellObjectFactoryUnableToCreateItem { + get { + return ResourceManager.GetString("ShellObjectFactoryUnableToCreateItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Registration for change notification has failed.. + /// + internal static string ShellObjectWatcherRegisterFailed { + get { + return ResourceManager.GetString("ShellObjectWatcherRegisterFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to change watched events while listening.. + /// + internal static string ShellObjectWatcherUnableToChangeEvents { + get { + return ResourceManager.GetString("ShellObjectWatcherUnableToChangeEvents", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The value on this property cannot be set. To set the property value, use the ShellObject that is associated with this property.. + /// + internal static string ShellPropertyCannotSetProperty { + get { + return ResourceManager.GetString("ShellPropertyCannotSetProperty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No constructor found matching requested argument types.. + /// + internal static string ShellPropertyFactoryConstructorNotFound { + get { + return ResourceManager.GetString("ShellPropertyFactoryConstructorNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to set property.. + /// + internal static string ShellPropertySetValue { + get { + return ResourceManager.GetString("ShellPropertySetValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to get writable property store for this property.. + /// + internal static string ShellPropertyUnableToGetWritableProperty { + get { + return ResourceManager.GetString("ShellPropertyUnableToGetWritableProperty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value had to be truncated in a string or rounded if a numeric value. Set AllowTruncatedValue to true to prevent this exception.. + /// + internal static string ShellPropertyValueTruncated { + get { + return ResourceManager.GetString("ShellPropertyValueTruncated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This Property is available on Windows 7 only.. + /// + internal static string ShellPropertyWindows7 { + get { + return ResourceManager.GetString("ShellPropertyWindows7", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This property only accepts a value of type \"{0}\".. + /// + internal static string ShellPropertyWrongType { + get { + return ResourceManager.GetString("ShellPropertyWrongType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to set list of sort columns.. + /// + internal static string ShellSearchFolderUnableToSetSortColumns { + get { + return ResourceManager.GetString("ShellSearchFolderUnableToSetSortColumns", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to set visible columns.. + /// + internal static string ShellSearchFolderUnableToSetVisibleColumns { + get { + return ResourceManager.GetString("ShellSearchFolderUnableToSetVisibleColumns", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CurrentSize (width or height) cannot be greater than the maximum size: {0}.. + /// + internal static string ShellThumbnailCurrentSizeRange { + get { + return ResourceManager.GetString("ShellThumbnailCurrentSizeRange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The current ShellObject does not have a thumbnail. Try using ShellThumbnailFormatOption.Default to get the icon for this item.. + /// + internal static string ShellThumbnailDoesNotHaveThumbnail { + get { + return ResourceManager.GetString("ShellThumbnailDoesNotHaveThumbnail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The current ShellObject does not have a valid thumbnail handler or there was a problem in extracting the thumbnail for this specific shell object.. + /// + internal static string ShellThumbnailNoHandler { + get { + return ResourceManager.GetString("ShellThumbnailNoHandler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CurrentSize (width or height) cannot be 0.. + /// + internal static string ShellThumbnailSizeCannotBe0 { + get { + return ResourceManager.GetString("ShellThumbnailSizeCannotBe0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ShowHiddenItems cannot be changed while dialog is showing.. + /// + internal static string ShowHiddenItemsCannotBeChanged { + get { + return ResourceManager.GetString("ShowHiddenItemsCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Show places list cannot be changed while dialog is showing.. + /// + internal static string ShowPlacesListCannotBeChanged { + get { + return ResourceManager.GetString("ShowPlacesListCannotBeChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Stock Icon identifier given is invalid ({0}).. + /// + internal static string StockIconInvalidGuid { + get { + return ResourceManager.GetString("StockIconInvalidGuid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Child control's window handle cannot be zero.. + /// + internal static string TabbedThumbnailZeroChildHandle { + get { + return ResourceManager.GetString("TabbedThumbnailZeroChildHandle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parent window handle cannot be zero.. + /// + internal static string TabbedThumbnailZeroParentHandle { + get { + return ResourceManager.GetString("TabbedThumbnailZeroParentHandle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to TabbedThumbnailProxyWindow has not been set.. + /// + internal static string TasbarWindowProxyWindowSet { + get { + return ResourceManager.GetString("TasbarWindowProxyWindowSet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid active Window is needed to update the Taskbar.. + /// + internal static string TaskbarManagerValidWindowRequired { + get { + return ResourceManager.GetString("TaskbarManagerValidWindowRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The array of buttons must contain at least 1 item.. + /// + internal static string TaskbarWindowEmptyButtonArray { + get { + return ResourceManager.GetString("TaskbarWindowEmptyButtonArray", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Tool bar buttons for this window are already added. Please refer to the Remarks section of the AddButtons method for more information on updating the properties or hiding existing buttons.. + /// + internal static string TaskbarWindowManagerButtonsAlreadyAdded { + get { + return ResourceManager.GetString("TaskbarWindowManagerButtonsAlreadyAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Value is already set. It cannot be set more than once.. + /// + internal static string TaskbarWindowValueSet { + get { + return ResourceManager.GetString("TaskbarWindowValueSet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The given control has not been added to the taskbar.. + /// + internal static string ThumbnailManagerControlNotAdded { + get { + return ResourceManager.GetString("ThumbnailManagerControlNotAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Window handle is invalid.. + /// + internal static string ThumbnailManagerInvalidHandle { + get { + return ResourceManager.GetString("ThumbnailManagerInvalidHandle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This preview has already been added.. + /// + internal static string ThumbnailManagerPreviewAdded { + get { + return ResourceManager.GetString("ThumbnailManagerPreviewAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The given preview has not been added to the taskbar.. + /// + internal static string ThumbnailManagerPreviewNotAdded { + get { + return ResourceManager.GetString("ThumbnailManagerPreviewNotAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Maximum number of buttons allowed is 7.. + /// + internal static string ThumbnailToolbarManagerMaxButtons { + get { + return ResourceManager.GetString("ThumbnailToolbarManagerMaxButtons", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Null or empty arrays are not allowed.. + /// + internal static string ThumbnailToolbarManagerNullEmptyArray { + get { + return ResourceManager.GetString("ThumbnailToolbarManagerNullEmptyArray", resourceCulture); + } + } + } +} diff --git a/Shell/Resources/LocalizedMessages.resx b/Shell/Resources/LocalizedMessages.resx new file mode 100644 index 0000000..06256db --- /dev/null +++ b/Shell/Resources/LocalizedMessages.resx @@ -0,0 +1,516 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + AddToMostRecentlyUsedList cannot be changed while dialog is showing. + + + AlwaysAppendDefaultExtension cannot be changed while dialog is showing. + + + Index was outside the bounds of the CommonFileDialogComboBox. + + + File name not available - dialog was canceled. + + + Shell item could not be created. + + + Handle provided cannot be IntPtr.Zero. + + + Multiple files selected - the FileNames property should be used instead. + + + Multiple files selected - the Items property should be used instead. + + + File name not available - dialog has not closed yet. + + + Common File Dialog requires Windows Vista or later. + + + Office Files + + + All Picture Files + + + Text Files + + + CreatePrompt cannot be changed while dialog is showing. + + + Custom controls cannot be removed from a File dialog once added. + + + Control name cannot be null or zero length. + + + CommonFileDialogMenuItem controls can only be added to CommonFileDialogMenu controls. + + + Modifying controls collection while dialog is showing is not supported. + + + Dialog cannot have more than one control with the same name. + + + Dialog control must be removed from current collections first. + + + EnsureFileExists cannot be changed while dialog is showing. + + + EnsurePathExists cannot be changed while dialog is showing. + + + EnsureReadOnly cannot be changed while dialog is showing. + + + EnsureValidNames cannot be changed while dialog is showing. + + + ExplorerBrowser failed to get current view. + + + Unable to get icon size. + + + Unexpected error retrieving item count. + + + Unexpected error retrieving selected item count. + + + Unexpected error retrieving selection. + + + Unexpected error retrieving view items. + + + The given path does not exist ({0}) + + + Guid does not identify a known folder. + + + ControlPanel Category + + + ControlPanel Classic + + + Communications + + + Compressed Folder + + + Contacts + + + Documents + + + Games + + + Generic Library + + + Invalid + + + Library + + + Music + + + Music Icons + + + Network Explorer + + + Not Specified + + + Open Search + + + Other Users + + + Pictures + + + Printers + + + RecordedTV + + + RecycleBin + + + Saved Games + + + Search Connector + + + Searches + + + Generic SearchResults + + + Software Explorer + + + User Files + + + Users Libraries + + + Videos + + + IsExpandedMode cannot be changed while dialog is showing. + + + Custom categories cannot be added while recent documents tracking is turned off. + + + The file type is not registered with this application. + + + JumpListLink's path is required and cannot be null. + + + JumpListLink's title is required and cannot be null. + + + Negative numbers are not allowed for the ordinal position. + + + Given Known Folder ID is invalid. + + + Parsing name is invalid. + + + NavigateToShortcut cannot be changed while dialog is showing. + + + Parent cannot be null. + + + The method or operation is not implemented. + + + OverwritePrompt cannot be changed while dialog is showing. + + + This CanonicalName is not a valid index. + + + This PropertyKey is not a valid index. + + + Argument CanonicalName cannot be null or empty. + + + Index was outside the bounds of the CommonFileDialogRadioButtonList. + + + RestoreDirectory cannot be changed while dialog is showing. + + + Retrieved a null shell item from dialog. + + + Given property key is invalid. + + + Shell Exception has occurred, look at inner exception for information. + + + GetParsingName has failed. + + + The given CanonicalName is not valid. + + + DefaultSaveFolder path not found. + + + LibraryName cannot be empty. + + + Folder path not found. + + + Invalid FolderType Guid. + + + The given known folder is not a valid library. + + + Can't get the display name. + + + Destination array too small, or invalid arrayIndex. + + + Must have at least one shell object in the collection. + + + Cannot insert items into a read only list. + + + Cannot remove items from a read only list. + + + Shell item could not be created. + + + Shell Object creation requires Windows Vista or higher operating system. + + + Unable to Create Shell Item. + + + The value on this property cannot be set. To set the property value, use the ShellObject that is associated with this property. + + + Unable to set property. + + + Unable to get writable property store for this property. + + + A value had to be truncated in a string or rounded if a numeric value. Set AllowTruncatedValue to true to prevent this exception. + + + This Property is available on Windows 7 only. + + + This property only accepts a value of type \"{0}\". + + + Unable to set list of sort columns. + + + Unable to set visible columns. + + + CurrentSize (width or height) cannot be greater than the maximum size: {0}. + + + The current ShellObject does not have a thumbnail. Try using ShellThumbnailFormatOption.Default to get the icon for this item. + + + The current ShellObject does not have a valid thumbnail handler or there was a problem in extracting the thumbnail for this specific shell object. + + + CurrentSize (width or height) cannot be 0. + + + ShowHiddenItems cannot be changed while dialog is showing. + + + Show places list cannot be changed while dialog is showing. + + + The Stock Icon identifier given is invalid ({0}). + + + Child control's window handle cannot be zero. + + + Parent window handle cannot be zero. + + + TabbedThumbnailProxyWindow has not been set. + + + A valid active Window is needed to update the Taskbar. + + + The array of buttons must contain at least 1 item. + + + Tool bar buttons for this window are already added. Please refer to the Remarks section of the AddButtons method for more information on updating the properties or hiding existing buttons. + + + Value is already set. It cannot be set more than once. + + + The given control has not been added to the taskbar. + + + Window handle is invalid. + + + This preview has already been added. + + + The given preview has not been added to the taskbar. + + + Maximum number of buttons allowed is 7. + + + Null or empty arrays are not allowed. + + + Browsing to object failed. + + + Registration for change notification has failed. + + + No constructor found matching requested argument types. + + + Cannot create window on the listener thread because there is no existing window on the listener thread. + + + Window class could not be registered, check inner exception for more details. + + + Message filter registration failed. + + + No listener handled of that value is registered. + + + Creation of window has failed, view inner exception for details. + + + Unable to change watched events while listening. + + \ No newline at end of file diff --git a/Shell/Shell.csproj b/Shell/Shell.csproj new file mode 100644 index 0000000..8c770f2 --- /dev/null +++ b/Shell/Shell.csproj @@ -0,0 +1,385 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {AA0C00CB-8699-4F37-BFAE-40CA87ACC06D} + Library + Properties + Microsoft.WindowsAPICodePack.Shell + Microsoft.WindowsAPICodePack.Shell + v3.5 + 512 + + + 3.5 + + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\Microsoft.WindowsAPICodePack.Shell.XML + + + false + AllRules.ruleset + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AllRules.ruleset + + + true + bin\CodeAnalysisDebug\ + TRACE;DEBUG;CODE_ANALYSIS + bin\Debug\Microsoft.WindowsAPICodePack.Shell.XML + full + AnyCPU + + + true + GlobalSuppressions.cs + prompt + true + AllRules.ruleset + 4 + false + + + true + bin\x64\Debug\ + CODE_ANALYSIS;DEBUG;TRACE + bin\Debug\Microsoft.WindowsAPICodePack.Shell.XML + full + x64 + bin\Debug\Microsoft.WindowsAPICodePack.Shell.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + AllRules.ruleset + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + true + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + true + false + 4 + false + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + bin\Release\Microsoft.WindowsAPICodePack.Shell.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + AllRules.ruleset + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + true + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + true + 4 + + + true + bin\x64\CodeAnalysisDebug\ + CODE_ANALYSIS;TRACE;DEBUG;CODE_ANALYSIS + bin\Debug\Microsoft.WindowsAPICodePack.Shell.XML + full + x64 + true + bin\CodeAnalysisDebug\Microsoft.WindowsAPICodePack.Shell.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + AllRules.ruleset + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + false + ;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + true + 4 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Component + + + CommandLinkWPF.xaml + + + + + Form + + + + + UserControl + + + ExplorerBrowser.WPF.xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LocalizedMessages.resx + True + True + + + + + + + + + + + + + + + + + + + + + + + Form + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + + + {2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57} + Core + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + ResXFileCodeGenerator + LocalizedMessages.Designer.cs + Designer + + + + + + + + + \ No newline at end of file diff --git a/Shell/ShellObjectWatcher/ChangeNotifyEventManager.cs b/Shell/ShellObjectWatcher/ChangeNotifyEventManager.cs new file mode 100644 index 0000000..cd137b5 --- /dev/null +++ b/Shell/ShellObjectWatcher/ChangeNotifyEventManager.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal class ChangeNotifyEventManager + { + #region Change order + private static readonly ShellObjectChangeTypes[] _changeOrder = { + ShellObjectChangeTypes.ItemCreate, + ShellObjectChangeTypes.ItemRename, + ShellObjectChangeTypes.ItemDelete, + + ShellObjectChangeTypes.AttributesChange, + + ShellObjectChangeTypes.DirectoryCreate, + ShellObjectChangeTypes.DirectoryDelete, + ShellObjectChangeTypes.DirectoryContentsUpdate, + ShellObjectChangeTypes.DirectoryRename, + + ShellObjectChangeTypes.Update, + + ShellObjectChangeTypes.MediaInsert, + ShellObjectChangeTypes.MediaRemove, + ShellObjectChangeTypes.DriveAdd, + ShellObjectChangeTypes.DriveRemove, + ShellObjectChangeTypes.NetShare, + ShellObjectChangeTypes.NetUnshare, + + ShellObjectChangeTypes.ServerDisconnect, + ShellObjectChangeTypes.SystemImageUpdate, + + ShellObjectChangeTypes.AssociationChange, + ShellObjectChangeTypes.FreeSpace, + + ShellObjectChangeTypes.DiskEventsMask, + ShellObjectChangeTypes.GlobalEventsMask, + ShellObjectChangeTypes.AllEventsMask + }; + #endregion + + private Dictionary _events = new Dictionary(); + + public void Register(ShellObjectChangeTypes changeType, Delegate handler) + { + Delegate del; + if (!_events.TryGetValue(changeType, out del)) + { + _events.Add(changeType, handler); + } + else + { + del = MulticastDelegate.Combine(del, handler); + _events[changeType] = del; + } + } + + public void Unregister(ShellObjectChangeTypes changeType, Delegate handler) + { + Delegate del; + if (_events.TryGetValue(changeType, out del)) + { + del = MulticastDelegate.Remove(del, handler); + if (del == null) // It's a bug in .NET if del is non-null and has an empty invocation list. + { + _events.Remove(changeType); + } + else + { + _events[changeType] = del; + } + } + } + + public void UnregisterAll() + { + _events.Clear(); + } + + public void Invoke(object sender, ShellObjectChangeTypes changeType, EventArgs args) + { + // Removes FromInterrupt flag if pressent + changeType = changeType & ~ShellObjectChangeTypes.FromInterrupt; + + Delegate del; + foreach (var change in _changeOrder.Where(x => (x & changeType) != 0)) + { + if (_events.TryGetValue(change, out del)) + { + del.DynamicInvoke(sender, args); + } + } + } + + public ShellObjectChangeTypes RegisteredTypes + { + get + { + return _events.Keys.Aggregate( + ShellObjectChangeTypes.None, + (accumulator, changeType) => (changeType | accumulator)); + } + } + } +} diff --git a/Shell/ShellObjectWatcher/ChangeNotifyLock.cs b/Shell/ShellObjectWatcher/ChangeNotifyLock.cs new file mode 100644 index 0000000..37c0578 --- /dev/null +++ b/Shell/ShellObjectWatcher/ChangeNotifyLock.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; +using System.Diagnostics; +using Microsoft.WindowsAPICodePack.Shell.Interop; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal class ChangeNotifyLock + { + private uint _event = 0; + + internal ChangeNotifyLock(Message message) + { + IntPtr pidl; + IntPtr lockId = ShellNativeMethods.SHChangeNotification_Lock( + message.WParam, (int)message.LParam, out pidl, out _event); + try + { + Trace.TraceInformation("Message: {0}", (ShellObjectChangeTypes)_event); + + var notifyStruct = pidl.MarshalAs(); + + Guid guid = new Guid(ShellIIDGuid.IShellItem2); + if (notifyStruct.item1 != IntPtr.Zero && + (((ShellObjectChangeTypes)_event) & ShellObjectChangeTypes.SystemImageUpdate) == ShellObjectChangeTypes.None) + { + IShellItem2 nativeShellItem; + if (CoreErrorHelper.Succeeded(ShellNativeMethods.SHCreateItemFromIDList( + notifyStruct.item1, ref guid, out nativeShellItem))) + { + string name; + nativeShellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.FileSystemPath, + out name); + ItemName = name; + + Trace.TraceInformation("Item1: {0}", ItemName); + } + } + else + { + ImageIndex = notifyStruct.item1.ToInt32(); + } + + if (notifyStruct.item2 != IntPtr.Zero) + { + IShellItem2 nativeShellItem; + if (CoreErrorHelper.Succeeded(ShellNativeMethods.SHCreateItemFromIDList( + notifyStruct.item2, ref guid, out nativeShellItem))) + { + string name; + nativeShellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.FileSystemPath, + out name); + ItemName2 = name; + + Trace.TraceInformation("Item2: {0}", ItemName2); + } + } + } + finally + { + if (lockId != IntPtr.Zero) + { + ShellNativeMethods.SHChangeNotification_Unlock(lockId); + } + } + + } + + public bool FromSystemInterrupt + { + get + { + return ((ShellObjectChangeTypes)_event & ShellObjectChangeTypes.FromInterrupt) + != ShellObjectChangeTypes.None; + } + } + + public int ImageIndex { get; private set; } + public string ItemName { get; private set; } + public string ItemName2 { get; private set; } + + public ShellObjectChangeTypes ChangeType { get { return (ShellObjectChangeTypes)_event; } } + + + } +} diff --git a/Shell/ShellObjectWatcher/MessageListener.cs b/Shell/ShellObjectWatcher/MessageListener.cs new file mode 100644 index 0000000..b729e25 --- /dev/null +++ b/Shell/ShellObjectWatcher/MessageListener.cs @@ -0,0 +1,216 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Shell.Interop; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal class MessageListener : IDisposable + { + public const uint CreateWindowMessage = (uint)WindowMessage.User + 1; + public const uint DestroyWindowMessage = (uint)WindowMessage.User + 2; + public const uint BaseUserMessage = (uint)WindowMessage.User + 5; + + private const string MessageWindowClassName = "MessageListenerClass"; + + private static readonly object _threadlock = new object(); + private static uint _atom; + private static Thread _windowThread = null; + private static volatile bool _running = false; + + private static ShellObjectWatcherNativeMethods.WndProcDelegate wndProc = WndProc; + // Dictionary relating window's hwnd to its message window + private static Dictionary _listeners = new Dictionary(); + private static IntPtr _firstWindowHandle = IntPtr.Zero; + + private static readonly object _crossThreadWindowLock = new object(); + private static IntPtr _tempHandle = IntPtr.Zero; + + public event EventHandler MessageReceived; + + public MessageListener() + { + lock (_threadlock) + { + if (_windowThread == null) + { + _windowThread = new Thread(ThreadMethod); + _windowThread.SetApartmentState(ApartmentState.STA); + _windowThread.Name = "ShellObjectWatcherMessageListenerHelperThread"; + + lock (_crossThreadWindowLock) + { + _windowThread.Start(); + Monitor.Wait(_crossThreadWindowLock); + } + + _firstWindowHandle = WindowHandle; + } + else + { + CrossThreadCreateWindow(); + } + + if (WindowHandle == IntPtr.Zero) + { + throw new ShellException(LocalizedMessages.MessageListenerCannotCreateWindow, + Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error())); + } + + _listeners.Add(WindowHandle, this); + } + } + + private void CrossThreadCreateWindow() + { + if (_firstWindowHandle == IntPtr.Zero) + { + throw new InvalidOperationException(LocalizedMessages.MessageListenerNoWindowHandle); + } + + lock (_crossThreadWindowLock) + { + CoreNativeMethods.PostMessage(_firstWindowHandle, (WindowMessage)CreateWindowMessage, IntPtr.Zero, IntPtr.Zero); + Monitor.Wait(_crossThreadWindowLock); + } + + WindowHandle = _tempHandle; + } + + private static void RegisterWindowClass() + { + WindowClassEx classEx = new WindowClassEx(); + classEx.ClassName = MessageWindowClassName; + classEx.WndProc = wndProc; + + classEx.Size = (uint)Marshal.SizeOf(typeof(WindowClassEx)); + + var atom = ShellObjectWatcherNativeMethods.RegisterClassEx(ref classEx); + if (atom == 0) + { + throw new ShellException(LocalizedMessages.MessageListenerClassNotRegistered, + Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error())); + } + _atom = atom; + } + + private static IntPtr CreateWindow() + { + IntPtr handle = ShellObjectWatcherNativeMethods.CreateWindowEx( + 0, //extended style + MessageWindowClassName, //class name + "MessageListenerWindow", //title + 0, //style + 0, 0, 0, 0, // x,y,width,height + new IntPtr(-3), // -3 = Message-Only window + IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + + return handle; + } + + private void ThreadMethod() // Message Loop + { + lock (_crossThreadWindowLock) + { + _running = true; + if (_atom == 0) + { + RegisterWindowClass(); + } + WindowHandle = CreateWindow(); + + Monitor.Pulse(_crossThreadWindowLock); + } + + while (_running) + { + Message msg; + if (ShellObjectWatcherNativeMethods.GetMessage(out msg, IntPtr.Zero, 0, 0)) + { + ShellObjectWatcherNativeMethods.DispatchMessage(ref msg); + } + } + } + + private static int WndProc(IntPtr hwnd, uint msg, IntPtr wparam, IntPtr lparam) + { + switch (msg) + { + case CreateWindowMessage: + lock (_crossThreadWindowLock) + { + _tempHandle = CreateWindow(); + Monitor.Pulse(_crossThreadWindowLock); + } + break; + case (uint)WindowMessage.Destroy: + break; + default: + MessageListener listener; + if (_listeners.TryGetValue(hwnd, out listener)) + { + Message message = new Message(hwnd, msg, wparam, lparam, 0, new NativePoint()); + listener.MessageReceived.SafeRaise(listener, new WindowMessageEventArgs(message)); + } + break; + } + + return ShellObjectWatcherNativeMethods.DefWindowProc(hwnd, msg, wparam, lparam); + } + + public IntPtr WindowHandle { get; private set; } + public static bool Running { get { return _running; } } + + #region IDisposable Members + + ~MessageListener() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + lock (_threadlock) + { + _listeners.Remove(WindowHandle); + if (_listeners.Count == 0) + { + CoreNativeMethods.PostMessage(WindowHandle, WindowMessage.Destroy, IntPtr.Zero, IntPtr.Zero); + } + } + } + } + + #endregion + } + + + /// + /// Encapsulates the data about a window message + /// + public class WindowMessageEventArgs : EventArgs + { + /// + /// Received windows message. + /// + public Message Message { get; private set; } + + internal WindowMessageEventArgs(Message msg) + { + Message = msg; + } + } + + +} diff --git a/Shell/ShellObjectWatcher/MessageListenerFilter.cs b/Shell/ShellObjectWatcher/MessageListenerFilter.cs new file mode 100644 index 0000000..d63beea --- /dev/null +++ b/Shell/ShellObjectWatcher/MessageListenerFilter.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using MS.WindowsAPICodePack.Internal; +using System.Threading; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + internal static class MessageListenerFilter + { + private static readonly object _registerLock = new object(); + private static List _packages = new List(); + + public static MessageListenerFilterRegistrationResult Register(Action callback) + { + lock (_registerLock) + { + uint message = 0; + var package = _packages.FirstOrDefault(x => x.TryRegister(callback, out message)); + if (package == null) + { + package = new RegisteredListener(); + if (!package.TryRegister(callback, out message)) + { // this should never happen + throw new ShellException(LocalizedMessages.MessageListenerFilterUnableToRegister); + } + _packages.Add(package); + } + + return new MessageListenerFilterRegistrationResult( + package.Listener.WindowHandle, + message); + } + } + + public static void Unregister(IntPtr listenerHandle, uint message) + { + lock (_registerLock) + { + var package = _packages.FirstOrDefault(x => x.Listener.WindowHandle == listenerHandle); + if (package == null || !package.Callbacks.Remove(message)) + { + throw new ArgumentException(LocalizedMessages.MessageListenerFilterUnknownListenerHandle); + } + + if (package.Callbacks.Count == 0) + { + package.Listener.Dispose(); + _packages.Remove(package); + } + } + } + + class RegisteredListener + { + public Dictionary> Callbacks { get; private set; } + + public MessageListener Listener { get; private set; } + + public RegisteredListener() + { + Callbacks = new Dictionary>(); + Listener = new MessageListener(); + Listener.MessageReceived += MessageReceived; + } + + private void MessageReceived(object sender, WindowMessageEventArgs e) + { + Action action; + if (Callbacks.TryGetValue(e.Message.Msg, out action)) + { + action(e); + } + } + + private uint _lastMessage = MessageListener.BaseUserMessage; + public bool TryRegister(Action callback, out uint message) + { + message = 0; + if (Callbacks.Count < ushort.MaxValue - MessageListener.BaseUserMessage) + { + uint i = _lastMessage + 1; + while (i != _lastMessage) + { + if (i > ushort.MaxValue) { i = MessageListener.BaseUserMessage; } + + if (!Callbacks.ContainsKey(i)) + { + _lastMessage = message = i; + Callbacks.Add(i, callback); + return true; + } + i++; + } + } + return false; + } + } + } + + /// + /// The result of registering with the MessageListenerFilter + /// + internal class MessageListenerFilterRegistrationResult + { + internal MessageListenerFilterRegistrationResult(IntPtr handle, uint msg) + { + WindowHandle = handle; + Message = msg; + } + + /// + /// Gets the window handle to which the callback was registered. + /// + public IntPtr WindowHandle { get; private set; } + + /// + /// Gets the message for which the callback was registered. + /// + public uint Message { get; private set; } + } + + +} diff --git a/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs b/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs new file mode 100644 index 0000000..b607fb0 --- /dev/null +++ b/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs @@ -0,0 +1,79 @@ +using System; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Base class for the Event Args for change notifications raised by . + /// + public class ShellObjectNotificationEventArgs : EventArgs + { + /// + /// The type of the change that happened to the ShellObject + /// + public ShellObjectChangeTypes ChangeType { get; private set; } + + /// + /// True if the event was raised as a result of a system interrupt. + /// + public bool FromSystemInterrupt { get; private set; } + + internal ShellObjectNotificationEventArgs(ChangeNotifyLock notifyLock) + { + ChangeType = notifyLock.ChangeType; + FromSystemInterrupt = notifyLock.FromSystemInterrupt; + } + } + + /// + /// The data that describes a ShellObject event with a single path parameter + /// + public class ShellObjectChangedEventArgs : ShellObjectNotificationEventArgs + { + /// + /// The path of the shell object + /// + public string Path { get; private set; } + + internal ShellObjectChangedEventArgs(ChangeNotifyLock notifyLock) + : base(notifyLock) + { + Path = notifyLock.ItemName; + } + } + + /// + /// The data that describes a ShellObject renamed event + /// + public class ShellObjectRenamedEventArgs : ShellObjectChangedEventArgs + { + /// + /// The new path of the shell object + /// + public string NewPath { get; private set; } + + internal ShellObjectRenamedEventArgs(ChangeNotifyLock notifyLock) + : base(notifyLock) + { + NewPath = notifyLock.ItemName2; + } + } + + /// + /// The data that describes a SystemImageUpdated event. + /// + public class SystemImageUpdatedEventArgs : ShellObjectNotificationEventArgs + { + /// + /// Gets the index of the system image that has been updated. + /// + public int ImageIndex { get; private set; } + + internal SystemImageUpdatedEventArgs(ChangeNotifyLock notifyLock) + : base(notifyLock) + { + ImageIndex = notifyLock.ImageIndex; + } + } + + +} diff --git a/Shell/ShellObjectWatcher/ShellObjectWatcher.cs b/Shell/ShellObjectWatcher/ShellObjectWatcher.cs new file mode 100644 index 0000000..3639abf --- /dev/null +++ b/Shell/ShellObjectWatcher/ShellObjectWatcher.cs @@ -0,0 +1,561 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.ComponentModel; +using System.Threading; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Listens for changes in/on a ShellObject and raises events when they occur. + /// This class supports all items under the shell namespace including + /// files, folders and virtual folders (libraries, search results and network items), etc. + /// + public class ShellObjectWatcher : IDisposable + { + private ShellObject _shellObject; + private bool _recursive; + + private ChangeNotifyEventManager _manager = new ChangeNotifyEventManager(); + private IntPtr _listenerHandle; + private uint _message; + + private uint _registrationId; + private volatile bool _running; + + private SynchronizationContext _context = SynchronizationContext.Current; + + /// + /// Creates the ShellObjectWatcher for the given ShellObject + /// + /// The ShellObject to monitor + /// Whether to listen for changes recursively (for when monitoring a container) + public ShellObjectWatcher(ShellObject shellObject, bool recursive) + { + if (shellObject == null) + { + throw new ArgumentNullException("shellObject"); + } + + if (_context == null) + { + _context = new SynchronizationContext(); + SynchronizationContext.SetSynchronizationContext(_context); + } + + _shellObject = shellObject; + this._recursive = recursive; + + var result = MessageListenerFilter.Register(OnWindowMessageReceived); + _listenerHandle = result.WindowHandle; + _message = result.Message; + } + + /// + /// Gets whether the watcher is currently running. + /// + public bool Running + { + get { return _running; } + private set { _running = value; } + } + + /// + /// Start the watcher and begin receiving change notifications. + /// + /// If the watcher is running, has no effect. + /// Registration for notifications should be done before this is called. + /// + /// + public void Start() + { + if (Running) { return; } + + #region Registration + ShellNativeMethods.SHChangeNotifyEntry entry = new ShellNativeMethods.SHChangeNotifyEntry(); + entry.recursively = _recursive; + + entry.pIdl = _shellObject.PIDL; + + _registrationId = ShellNativeMethods.SHChangeNotifyRegister( + _listenerHandle, + ShellNativeMethods.ShellChangeNotifyEventSource.ShellLevel | ShellNativeMethods.ShellChangeNotifyEventSource.InterruptLevel | ShellNativeMethods.ShellChangeNotifyEventSource.NewDelivery, + _manager.RegisteredTypes, //ShellObjectChangeTypes.AllEventsMask, + _message, + 1, + ref entry); + + if (_registrationId == 0) + { + throw new Win32Exception(LocalizedMessages.ShellObjectWatcherRegisterFailed); + } + #endregion + + Running = true; + } + + /// + /// Stop the watcher and prevent further notifications from being received. + /// If the watcher is not running, this has no effect. + /// + public void Stop() + { + if (!Running) { return; } + if (_registrationId > 0) + { + ShellNativeMethods.SHChangeNotifyDeregister(_registrationId); + _registrationId = 0; + } + Running = false; + } + + private void OnWindowMessageReceived(WindowMessageEventArgs e) + { + if (e.Message.Msg == _message) + { + _context.Send(x => ProcessChangeNotificationEvent(e), null); + } + } + + private void ThrowIfRunning() + { + if (Running) + { + throw new InvalidOperationException(LocalizedMessages.ShellObjectWatcherUnableToChangeEvents); + } + } + + /// + /// Processes all change notifications sent by the Windows Shell. + /// + /// The windows message representing the notification event + protected virtual void ProcessChangeNotificationEvent(WindowMessageEventArgs e) + { + if (!Running) { return; } + if (e == null) { throw new ArgumentNullException("e"); } + + ChangeNotifyLock notifyLock = new ChangeNotifyLock(e.Message); + + ShellObjectNotificationEventArgs args = null; + switch (notifyLock.ChangeType) + { + case ShellObjectChangeTypes.DirectoryRename: + case ShellObjectChangeTypes.ItemRename: + args = new ShellObjectRenamedEventArgs(notifyLock); + break; + case ShellObjectChangeTypes.SystemImageUpdate: + args = new SystemImageUpdatedEventArgs(notifyLock); + break; + default: + args = new ShellObjectChangedEventArgs(notifyLock); + break; + } + + _manager.Invoke(this, notifyLock.ChangeType, args); + } + + #region Change Events + + #region Mask Events + /// + /// Raised when any event occurs. + /// + public event EventHandler AllEvents + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.AllEventsMask, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.AllEventsMask, value); + } + } + + /// + /// Raised when global events occur. + /// + public event EventHandler GlobalEvents + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.GlobalEventsMask, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.GlobalEventsMask, value); + } + } + + /// + /// Raised when disk events occur. + /// + public event EventHandler DiskEvents + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.DiskEventsMask, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.DiskEventsMask, value); + } + } + #endregion + + #region Single Events + /// + /// Raised when an item is renamed. + /// + public event EventHandler ItemRenamed + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.ItemRename, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.ItemRename, value); + } + } + + /// + /// Raised when an item is created. + /// + public event EventHandler ItemCreated + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.ItemCreate, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.ItemCreate, value); + } + } + + /// + /// Raised when an item is deleted. + /// + public event EventHandler ItemDeleted + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.ItemDelete, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.ItemDelete, value); + } + } + + /// + /// Raised when an item is updated. + /// + public event EventHandler Updated + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.Update, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.Update, value); + } + } + + /// + /// Raised when a directory is updated. + /// + public event EventHandler DirectoryUpdated + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.DirectoryContentsUpdate, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.DirectoryContentsUpdate, value); + } + } + + /// + /// Raised when a directory is renamed. + /// + public event EventHandler DirectoryRenamed + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.DirectoryRename, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.DirectoryRename, value); + } + } + + /// + /// Raised when a directory is created. + /// + public event EventHandler DirectoryCreated + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.DirectoryCreate, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.DirectoryCreate, value); + } + } + + /// + /// Raised when a directory is deleted. + /// + public event EventHandler DirectoryDeleted + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.DirectoryDelete, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.DirectoryDelete, value); + } + } + + /// + /// Raised when media is inserted. + /// + public event EventHandler MediaInserted + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.MediaInsert, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.MediaInsert, value); + } + } + + /// + /// Raised when media is removed. + /// + public event EventHandler MediaRemoved + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.MediaRemove, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.MediaRemove, value); + } + } + + /// + /// Raised when a drive is added. + /// + public event EventHandler DriveAdded + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.DriveAdd, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.DriveAdd, value); + } + } + + /// + /// Raised when a drive is removed. + /// + public event EventHandler DriveRemoved + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.DriveRemove, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.DriveRemove, value); + } + } + + /// + /// Raised when a folder is shared on a network. + /// + public event EventHandler FolderNetworkShared + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.NetShare, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.NetShare, value); + } + } + + /// + /// Raised when a folder is unshared from the network. + /// + public event EventHandler FolderNetworkUnshared + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.NetUnshare, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.NetUnshare, value); + } + } + + /// + /// Raised when a server is disconnected. + /// + public event EventHandler ServerDisconnected + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.ServerDisconnect, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.ServerDisconnect, value); + } + } + + /// + /// Raised when a system image is changed. + /// + public event EventHandler SystemImageChanged + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.SystemImageUpdate, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.SystemImageUpdate, value); + } + } + + /// + /// Raised when free space changes. + /// + public event EventHandler FreeSpaceChanged + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.FreeSpace, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.FreeSpace, value); + } + } + + /// + /// Raised when a file type association changes. + /// + public event EventHandler FileTypeAssociationChanged + { + add + { + ThrowIfRunning(); + _manager.Register(ShellObjectChangeTypes.AssociationChange, value); + } + remove + { + ThrowIfRunning(); + _manager.Unregister(ShellObjectChangeTypes.AssociationChange, value); + } + } + #endregion + + #endregion + + #region IDisposable Members + + /// + /// Disposes ShellObjectWatcher + /// + /// + protected virtual void Dispose(bool disposing) + { + Stop(); + _manager.UnregisterAll(); + + if (_listenerHandle != IntPtr.Zero) + { + MessageListenerFilter.Unregister(_listenerHandle, _message); + } + } + + /// + /// Disposes ShellObjectWatcher. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Finalizer for ShellObjectWatcher + /// + ~ShellObjectWatcher() + { + Dispose(false); + } + + #endregion + } + + +} diff --git a/Shell/ShellObjectWatcher/ShellObjectWatcherEnums.cs b/Shell/ShellObjectWatcher/ShellObjectWatcherEnums.cs new file mode 100644 index 0000000..111e9ea --- /dev/null +++ b/Shell/ShellObjectWatcher/ShellObjectWatcherEnums.cs @@ -0,0 +1,190 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Describes the event that has occurred. + /// Typically, only one event is specified at a time. + /// If more than one event is specified, + /// the values contained in the dwItem1 and dwItem2 parameters must be the same, + /// respectively, for all specified events. + /// This parameter can be one or more of the following values: + /// + [Flags] + public enum ShellObjectChangeTypes + { + /// + /// None + /// + None = 0, + + /// + /// The name of a nonfolder item has changed. + /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the previous PIDL or name of the item. + /// dwItem2 contains the new PIDL or name of the item. + /// + ItemRename = 0x00000001, + + /// + /// A nonfolder item has been created. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the item that was created. + /// dwItem2 is not used and should be NULL. + /// + ItemCreate = 0x00000002, + + /// + /// A nonfolder item has been deleted. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the item that was deleted. + /// dwItem2 is not used and should be NULL. + /// + ItemDelete = 0x00000004, + + /// + /// A folder has been created. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the folder that was created. + /// dwItem2 is not used and should be NULL. + /// + DirectoryCreate = 0x00000008, + + /// + /// A folder has been removed. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the folder that was removed. + /// dwItem2 is not used and should be NULL. + /// + DirectoryDelete = 0x00000010, + + /// + /// Storage media has been inserted into a drive. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the root of the drive that contains the new media. + /// dwItem2 is not used and should be NULL. + /// + MediaInsert = 0x00000020, + + /// + /// Storage media has been removed from a drive. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the root of the drive from which the media was removed. + /// dwItem2 is not used and should be NULL. + /// + MediaRemove = 0x00000040, + + /// + /// A drive has been removed. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the root of the drive that was removed. + /// dwItem2 is not used and should be NULL. + /// + DriveRemove = 0x00000080, + + /// + /// A drive has been added. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the root of the drive that was added. + /// dwItem2 is not used and should be NULL. + /// + DriveAdd = 0x00000100, + + /// + /// A folder on the local computer is being shared via the network. + /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the folder that is being shared. + /// dwItem2 is not used and should be NULL. + /// + NetShare = 0x00000200, + + /// + /// A folder on the local computer is no longer being shared via the network. + /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the folder that is no longer being shared. + /// dwItem2 is not used and should be NULL. + /// + NetUnshare = 0x00000400, + + /// + /// The attributes of an item or folder have changed. + /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the item or folder that has changed. + /// dwItem2 is not used and should be NULL. + /// + AttributesChange = 0x00000800, + + /// + /// The contents of an existing folder have changed, but the folder still exists and has not been renamed. + /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the folder that has changed. + /// dwItem2 is not used and should be NULL. + /// If a folder has been created, deleted, or renamed, use SHCNE_MKDIR, SHCNE_RMDIR, or SHCNE_RENAMEFOLDER, respectively. + /// + DirectoryContentsUpdate = 0x00001000, + + /// + /// An existing item (a folder or a nonfolder) has changed, but the item still exists and has not been renamed. + /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the item that has changed. + /// dwItem2 is not used and should be NULL. + /// If a nonfolder item has been created, deleted, or renamed, + /// use SHCNE_CREATE, SHCNE_DELETE, or SHCNE_RENAMEITEM, respectively, instead. + /// + Update = 0x00002000, + + /// + /// The computer has disconnected from a server. + /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the server from which the computer was disconnected. + /// dwItem2 is not used and should be NULL. + /// + ServerDisconnect = 0x00004000, + + /// + /// An image in the system image list has changed. + /// SHCNF_DWORD must be specified in uFlags. + /// dwItem1 is not used and should be NULL. + /// dwItem2 contains the index in the system image list that has changed. + /// //verify this is not opposite? + SystemImageUpdate = 0x00008000, + + /// + /// The name of a folder has changed. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the previous PIDL or name of the folder. + /// dwItem2 contains the new PIDL or name of the folder. + /// + DirectoryRename = 0x00020000, + + /// + /// The amount of free space on a drive has changed. + /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags. + /// dwItem1 contains the root of the drive on which the free space changed. + /// dwItem2 is not used and should be NULL. + /// + FreeSpace = 0x00040000, + + /// + /// A file type association has changed. + /// SHCNF_IDLIST must be specified in the uFlags parameter. + /// dwItem1 and dwItem2 are not used and must be NULL. + /// + AssociationChange = 0x08000000, + + /// + /// Specifies a combination of all of the disk event identifiers. + /// + DiskEventsMask = 0x0002381F, + + /// + /// Specifies a combination of all of the global event identifiers. + /// + GlobalEventsMask = 0x0C0581E0, + + /// + /// All events have occurred. + /// + AllEventsMask = 0x7FFFFFFF, + + /// + /// The specified event occurred as a result of a system interrupt. + /// As this value modifies other event values, it cannot be used alone. + /// + FromInterrupt = unchecked((int)0x80000000), + } +} diff --git a/Shell/StockIcons/StockIcon.cs b/Shell/StockIcons/StockIcon.cs new file mode 100644 index 0000000..43af02a --- /dev/null +++ b/Shell/StockIcons/StockIcon.cs @@ -0,0 +1,270 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Interop; +using System.Windows.Media.Imaging; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Represents a standard system icon. + /// + public class StockIcon : IDisposable + { + #region Private Members + + private StockIconIdentifier identifier = StockIconIdentifier.Application; + private StockIconSize currentSize = StockIconSize.Large; + private bool linkOverlay; + private bool selected; + private bool invalidateIcon = true; + private IntPtr hIcon = IntPtr.Zero; + + #endregion + + #region Public Constructors + + /// + /// Creates a new StockIcon instance with the specified identifer, default size + /// and no link overlay or selected states. + /// + /// A value that identifies the icon represented by this instance. + public StockIcon(StockIconIdentifier id) + { + identifier = id; + invalidateIcon = true; + } + + /// + /// Creates a new StockIcon instance with the specified identifer and options. + /// + /// A value that identifies the icon represented by this instance. + /// A value that indicates the size of the stock icon. + /// A bool value that indicates whether the icon has a link overlay. + /// A bool value that indicates whether the icon is in a selected state. + public StockIcon(StockIconIdentifier id, StockIconSize size, bool isLinkOverlay, bool isSelected) + { + identifier = id; + linkOverlay = isLinkOverlay; + selected = isSelected; + currentSize = size; + invalidateIcon = true; + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets a value indicating whether the icon appears selected. + /// + /// A value. + public bool Selected + { + get { return selected; } + set + { + selected = value; + invalidateIcon = true; + } + } + + /// + /// Gets or sets a value that cotrols whether to put a link overlay on the icon. + /// + /// A value. + public bool LinkOverlay + { + get { return linkOverlay; } + set + { + linkOverlay = value; + invalidateIcon = true; + } + } + + /// + /// Gets or sets a value that controls the size of the Stock Icon. + /// + /// A value. + public StockIconSize CurrentSize + { + get { return currentSize; } + set + { + currentSize = value; + invalidateIcon = true; + } + } + + /// + /// Gets or sets the Stock Icon identifier associated with this icon. + /// + public StockIconIdentifier Identifier + { + get { return identifier; } + set + { + identifier = value; + invalidateIcon = true; + } + } + + /// + /// Gets the icon image in format. + /// + public Bitmap Bitmap + { + get + { + UpdateHIcon(); + + return hIcon != IntPtr.Zero ? Bitmap.FromHicon(hIcon) : null; + } + } + + /// + /// Gets the icon image in format. + /// + public BitmapSource BitmapSource + { + get + { + UpdateHIcon(); + + return (hIcon != IntPtr.Zero) ? + Imaging.CreateBitmapSourceFromHIcon(hIcon, Int32Rect.Empty, null) : null; + } + } + + /// + /// Gets the icon image in format. + /// + public Icon Icon + { + get + { + UpdateHIcon(); + + return hIcon != IntPtr.Zero ? Icon.FromHandle(hIcon) : null; + } + } + + #endregion + + #region Private Methods + + private void UpdateHIcon() + { + if (invalidateIcon) + { + if (hIcon != IntPtr.Zero) + CoreNativeMethods.DestroyIcon(hIcon); + + hIcon = GetHIcon(); + + invalidateIcon = false; + } + } + + private IntPtr GetHIcon() + { + // Create our internal flag to pass to the native method + StockIconsNativeMethods.StockIconOptions flags = StockIconsNativeMethods.StockIconOptions.Handle; + + // Based on the current settings, update the flags + if (CurrentSize == StockIconSize.Small) + { + flags |= StockIconsNativeMethods.StockIconOptions.Small; + } + else if (CurrentSize == StockIconSize.ShellSize) + { + flags |= StockIconsNativeMethods.StockIconOptions.ShellSize; + } + else + { + flags |= StockIconsNativeMethods.StockIconOptions.Large; // default + } + + if (Selected) + { + flags |= StockIconsNativeMethods.StockIconOptions.Selected; + } + + if (LinkOverlay) + { + flags |= StockIconsNativeMethods.StockIconOptions.LinkOverlay; + } + + // Create a StockIconInfo structure to pass to the native method. + StockIconsNativeMethods.StockIconInfo info = new StockIconsNativeMethods.StockIconInfo(); + info.StuctureSize = (UInt32)Marshal.SizeOf(typeof(StockIconsNativeMethods.StockIconInfo)); + + // Pass the struct to the native method + HResult hr = StockIconsNativeMethods.SHGetStockIconInfo(identifier, flags, ref info); + + // If we get an error, return null as the icon requested might not be supported + // on the current system + if (hr != HResult.Ok) + { + if (hr == HResult.InvalidArguments) + { + throw new InvalidOperationException( + string.Format(System.Globalization.CultureInfo.InvariantCulture, + LocalizedMessages.StockIconInvalidGuid, + identifier)); + } + + return IntPtr.Zero; + } + + // If we succeed, return the HIcon + return info.Handle; + } + + #endregion + + #region IDisposable Members + + /// + /// Release the native and managed objects + /// + /// Indicates that this is being called from Dispose(), rather than the finalizer. + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // dispose managed resources here + } + + // Unmanaged resources + if (hIcon != IntPtr.Zero) + CoreNativeMethods.DestroyIcon(hIcon); + } + + /// + /// Release the native objects + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// + /// + ~StockIcon() + { + Dispose(false); + } + + #endregion + } +} + diff --git a/Shell/StockIcons/StockIconEnums.cs b/Shell/StockIcons/StockIconEnums.cs new file mode 100644 index 0000000..49a9452 --- /dev/null +++ b/Shell/StockIcons/StockIconEnums.cs @@ -0,0 +1,419 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Shell +{ + + /// + /// Specifies options for the size of the stock icon. + /// + public enum StockIconSize + { + /// + /// Retrieve the small version of the icon, as specified by SM_CXSMICON and SM_CYSMICON system metrics. + /// + Small, + + /// + /// Retrieve the large version of the icon, as specified by SM_CXICON and SM_CYICON system metrics. + /// + Large, + + /// + /// Retrieve the shell-sized icons (instead of the size specified by the system metrics). + /// + ShellSize, + } + + /// + /// Provides values used to specify which standard icon to retrieve. + /// + public enum StockIconIdentifier + { + /// + /// Icon for a document (blank page), no associated program. + /// + DocumentNotAssociated = 0, + /// + /// Icon for a document with an associated program. + /// + DocumentAssociated = 1, + /// + /// Icon for a generic application with no custom icon. + /// + Application = 2, + /// + /// Icon for a closed folder. + /// + Folder = 3, + /// + /// Icon for an open folder. + /// + FolderOpen = 4, + /// + /// Icon for a 5.25" floppy disk drive. + /// + Drive525 = 5, + /// + /// Icon for a 3.5" floppy disk drive. + /// + Drive35 = 6, + /// + /// Icon for a removable drive. + /// + DriveRemove = 7, + /// + /// Icon for a fixed (hard disk) drive. + /// + DriveFixed = 8, + /// + /// Icon for a network drive. + /// + DriveNetwork = 9, + /// + /// Icon for a disconnected network drive. + /// + DriveNetworkDisabled = 10, + /// + /// Icon for a CD drive. + /// + DriveCD = 11, + /// + /// Icon for a RAM disk drive. + /// + DriveRam = 12, + /// + /// Icon for an entire network. + /// + World = 13, + /// + /// Icon for a computer on the network. + /// + Server = 15, + /// + /// Icon for a printer. + /// + Printer = 16, + /// + /// Icon for My Network places. + /// + MyNetwork = 17, + /// + /// Icon for search (magnifying glass). + /// + Find = 22, + /// + /// Icon for help. + /// + Help = 23, + /// + /// Icon for an overlay indicating shared items. + /// + Share = 28, + /// + /// Icon for an overlay indicating shortcuts to items. + /// + Link = 29, + /// + /// Icon for an overlay for slow items. + /// + SlowFile = 30, + /// + /// Icon for a empty recycle bin. + /// + Recycler = 31, + /// + /// Icon for a full recycle bin. + /// + RecyclerFull = 32, + /// + /// Icon for audio CD media. + /// + MediaCDAudio = 40, + /// + /// Icon for a security lock. + /// + Lock = 47, + /// + /// Icon for a auto list. + /// + AutoList = 49, + /// + /// Icon for a network printer. + /// + PrinterNet = 50, + /// + /// Icon for a server share. + /// + ServerShare = 51, + /// + /// Icon for a Fax printer. + /// + PrinterFax = 52, + /// + /// Icon for a networked Fax printer. + /// + PrinterFaxNet = 53, + /// + /// Icon for print to file. + /// + PrinterFile = 54, + /// + /// Icon for a stack. + /// + Stack = 55, + /// + /// Icon for a SVCD media. + /// + MediaSvcd = 56, + /// + /// Icon for a folder containing other items. + /// + StuffedFolder = 57, + /// + /// Icon for an unknown drive. + /// + DriveUnknown = 58, + /// + /// Icon for a DVD drive. + /// + DriveDvd = 59, + /// + /// Icon for DVD media. + /// + MediaDvd = 60, + /// + /// Icon for DVD-RAM media. + /// + MediaDvdRam = 61, + /// + /// Icon for DVD-RW media. + /// + MediaDvdRW = 62, + /// + /// Icon for DVD-R media. + /// + MediaDvdR = 63, + /// + /// Icon for a DVD-ROM media. + /// + MediaDvdRom = 64, + /// + /// Icon for CD+ (Enhanced CD) media. + /// + MediaCDAudioPlus = 65, + /// + /// Icon for CD-RW media. + /// + MediaCDRW = 66, + /// + /// Icon for a CD-R media. + /// + MediaCDR = 67, + /// + /// Icon burning a CD. + /// + MediaCDBurn = 68, + /// + /// Icon for blank CD media. + /// + MediaBlankCD = 69, + /// + /// Icon for CD-ROM media. + /// + MediaCDRom = 70, + /// + /// Icon for audio files. + /// + AudioFiles = 71, + /// + /// Icon for image files. + /// + ImageFiles = 72, + /// + /// Icon for video files. + /// + VideoFiles = 73, + /// + /// Icon for mixed Files. + /// + MixedFiles = 74, + /// + /// Icon for a folder back. + /// + FolderBack = 75, + /// + /// Icon for a folder front. + /// + FolderFront = 76, + /// + /// Icon for a security shield. Use for UAC prompts only. + /// + Shield = 77, + /// + /// Icon for a warning. + /// + Warning = 78, + /// + /// Icon for an informational message. + /// + Info = 79, + /// + /// Icon for an error message. + /// + Error = 80, + /// + /// Icon for a key. + /// + Key = 81, + /// + /// Icon for software. + /// + Software = 82, + /// + /// Icon for a rename. + /// + Rename = 83, + /// + /// Icon for delete. + /// + Delete = 84, + /// + /// Icon for audio DVD media. + /// + MediaAudioDvd = 85, + /// + /// Icon for movie DVD media. + /// + MediaMovieDvd = 86, + /// + /// Icon for enhanced CD media. + /// + MediaEnhancedCD = 87, + /// + /// Icon for enhanced DVD media. + /// + MediaEnhancedDvd = 88, + /// + /// Icon for HD-DVD media. + /// + MediaHDDvd = 89, + /// + /// Icon for BluRay media. + /// + MediaBluRay = 90, + /// + /// Icon for VCD media. + /// + MediaVcd = 91, + /// + /// Icon for DVD+R media. + /// + MediaDvdPlusR = 92, + /// + /// Icon for DVD+RW media. + /// + MediaDvdPlusRW = 93, + /// + /// Icon for desktop computer. + /// + DesktopPC = 94, + /// + /// Icon for mobile computer (laptop/notebook). + /// + MobilePC = 95, + /// + /// Icon for users. + /// + Users = 96, + /// + /// Icon for smart media. + /// + MediaSmartMedia = 97, + /// + /// Icon for compact flash. + /// + MediaCompactFlash = 98, + /// + /// Icon for a cell phone. + /// + DeviceCellPhone = 99, + /// + /// Icon for a camera. + /// + DeviceCamera = 100, + /// + /// Icon for video camera. + /// + DeviceVideoCamera = 101, + /// + /// Icon for audio player. + /// + DeviceAudioPlayer = 102, + /// + /// Icon for connecting to network. + /// + NetworkConnect = 103, + /// + /// Icon for the Internet. + /// + Internet = 104, + /// + /// Icon for a ZIP file. + /// + ZipFile = 105, + /// + /// Icon for settings. + /// + Settings = 106, + + // 107-131 are internal Vista RTM icons + // 132-159 for SP1 icons + + /// + /// HDDVD Drive (all types) + /// + DriveHDDVD = 132, + + /// + /// Icon for BluRay Drive (all types) + /// + DriveBluRay = 133, + + /// + /// Icon for HDDVD-ROM Media + /// + MediaHDDVDROM = 134, + + /// + /// Icon for HDDVD-R Media + /// + MediaHDDVDR = 135, + + /// + /// Icon for HDDVD-RAM Media + /// + MediaHDDVDRAM = 136, + + /// + /// Icon for BluRay ROM Media + /// + MediaBluRayROM = 137, + + /// + /// Icon for BluRay R Media + /// + MediaBluRayR = 138, + + /// + /// Icon for BluRay RE Media (Rewriable and RAM) + /// + MediaBluRayRE = 139, + + /// + /// Icon for Clustered disk + /// + ClusteredDisk = 140, + + } + +} diff --git a/Shell/StockIcons/StockIcons.cs b/Shell/StockIcons/StockIcons.cs new file mode 100644 index 0000000..5df9bff --- /dev/null +++ b/Shell/StockIcons/StockIcons.cs @@ -0,0 +1,631 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; + +namespace Microsoft.WindowsAPICodePack.Shell +{ + /// + /// Collection of all the standard system stock icons + /// + public class StockIcons + { + #region Private Members + + private IDictionary stockIconCache; + private StockIconSize defaultSize = StockIconSize.Large; + private bool isSelected; + private bool isLinkOverlay; + + #endregion + + #region Public Constructors + + /// + /// Creates a stock icon collection using the default options for + /// size, link overlay and selection state. + /// + public StockIcons() + { + // Create an empty dictionary. Stock icons will be created when requested + // or when they are enumerated on this collection + stockIconCache = new Dictionary(); + + Array allIdentifiers = Enum.GetValues(typeof(StockIconIdentifier)); + + foreach (StockIconIdentifier id in allIdentifiers) + { + stockIconCache.Add(id, null); + } + } + + /// + /// Overloaded constructor that takes in size and Boolean values for + /// link overlay and selected icon state. The settings are applied to + /// all the stock icons in the collection. + /// + /// StockIcon size for all the icons in the collection. + /// Link Overlay state for all the icons in the collection. + /// Selection state for all the icons in the collection. + public StockIcons(StockIconSize size, bool linkOverlay, bool selected) + { + defaultSize = size; + isLinkOverlay = linkOverlay; + isSelected = selected; + + // Create an empty dictionary. Stock icons will be created when requested + // or when they are enumerated on this collection + stockIconCache = new Dictionary(); + + Array allIdentifiers = Enum.GetValues(typeof(StockIconIdentifier)); + + foreach (StockIconIdentifier id in allIdentifiers) + { + stockIconCache.Add(id, null); + } + } + + #endregion + + #region Public Properties + + /// + /// Gets the default stock icon size in one of the StockIconSize values. + /// This size applies to all the stock icons in the collection. + /// + public StockIconSize DefaultSize + { + get { return defaultSize; } + } + + /// + /// Gets the default link overlay state for the icon. This property + /// applies to all the stock icons in the collection. + /// + public bool DefaultLinkOverlay + { + get { return isLinkOverlay; } + } + + /// + /// Gets the default selected state for the icon. This property + /// applies to all the stock icons in the collection. + /// + public bool DefaultSelectedState + { + get { return isSelected; } + } + + /// + /// Gets a collection of all the system stock icons + /// + public ICollection AllStockIcons + { + get { return GetAllStockIcons(); } + } + + /// + /// Icon for a document (blank page), no associated program. + /// + public StockIcon DocumentNotAssociated { get { return GetStockIcon(StockIconIdentifier.DocumentNotAssociated); } } + + /// + /// Icon for a document with an associated program. + /// + public StockIcon DocumentAssociated { get { return GetStockIcon(StockIconIdentifier.DocumentAssociated); } } + + /// + /// Icon for a generic application with no custom icon. + /// + public StockIcon Application { get { return GetStockIcon(StockIconIdentifier.Application); } } + + /// + /// Icon for a closed folder. + /// + public StockIcon Folder { get { return GetStockIcon(StockIconIdentifier.Folder); } } + + /// + /// Icon for an open folder. + /// + public StockIcon FolderOpen { get { return GetStockIcon(StockIconIdentifier.FolderOpen); } } + + /// + /// Icon for a 5.25" floppy disk drive. + /// + public StockIcon Drive525 { get { return GetStockIcon(StockIconIdentifier.Drive525); } } + + /// + /// Icon for a 3.5" floppy disk drive. + /// + public StockIcon Drive35 { get { return GetStockIcon(StockIconIdentifier.Drive35); } } + + /// + /// Icon for a removable drive. + /// + public StockIcon DriveRemove { get { return GetStockIcon(StockIconIdentifier.DriveRemove); } } + + /// + /// Icon for a fixed (hard disk) drive. + /// + public StockIcon DriveFixed { get { return GetStockIcon(StockIconIdentifier.DriveFixed); } } + + /// + /// Icon for a network drive. + /// + public StockIcon DriveNetwork { get { return GetStockIcon(StockIconIdentifier.DriveNetwork); } } + + /// + /// Icon for a disconnected network drive. + /// + public StockIcon DriveNetworkDisabled { get { return GetStockIcon(StockIconIdentifier.DriveNetworkDisabled); } } + + /// + /// Icon for a CD drive. + /// + public StockIcon DriveCD { get { return GetStockIcon(StockIconIdentifier.DriveCD); } } + + /// + /// Icon for a RAM disk drive. + /// + public StockIcon DriveRam { get { return GetStockIcon(StockIconIdentifier.DriveRam); } } + + /// + /// Icon for an entire network. + /// + public StockIcon World { get { return GetStockIcon(StockIconIdentifier.World); } } + + /// + /// Icon for a computer on the network. + /// + public StockIcon Server { get { return GetStockIcon(StockIconIdentifier.Server); } } + + /// + /// Icon for a printer. + /// + public StockIcon Printer { get { return GetStockIcon(StockIconIdentifier.Printer); } } + + /// + /// Icon for My Network places. + /// + public StockIcon MyNetwork { get { return GetStockIcon(StockIconIdentifier.MyNetwork); } } + + /// + /// Icon for search (magnifying glass). + /// + public StockIcon Find { get { return GetStockIcon(StockIconIdentifier.Find); } } + + /// + /// Icon for help. + /// + public StockIcon Help { get { return GetStockIcon(StockIconIdentifier.Help); } } + + /// + /// Icon for an overlay indicating shared items. + /// + public StockIcon Share { get { return GetStockIcon(StockIconIdentifier.Share); } } + + /// + /// Icon for an overlay indicating shortcuts to items. + /// + public StockIcon Link { get { return GetStockIcon(StockIconIdentifier.Link); } } + + /// + /// Icon for an overlay for slow items. + /// + public StockIcon SlowFile { get { return GetStockIcon(StockIconIdentifier.SlowFile); } } + + /// + /// Icon for a empty recycle bin. + /// + public StockIcon Recycler { get { return GetStockIcon(StockIconIdentifier.Recycler); } } + + /// + /// Icon for a full recycle bin. + /// + public StockIcon RecyclerFull { get { return GetStockIcon(StockIconIdentifier.RecyclerFull); } } + + /// + /// Icon for audio CD media. + /// + public StockIcon MediaCDAudio { get { return GetStockIcon(StockIconIdentifier.MediaCDAudio); } } + + /// + /// Icon for a security lock. + /// + public StockIcon Lock { get { return GetStockIcon(StockIconIdentifier.Lock); } } + + /// + /// Icon for a auto list. + /// + public StockIcon AutoList { get { return GetStockIcon(StockIconIdentifier.AutoList); } } + + /// + /// Icon for a network printer. + /// + public StockIcon PrinterNet { get { return GetStockIcon(StockIconIdentifier.PrinterNet); } } + + /// + /// Icon for a server share. + /// + public StockIcon ServerShare { get { return GetStockIcon(StockIconIdentifier.ServerShare); } } + + /// + /// Icon for a Fax printer. + /// + public StockIcon PrinterFax { get { return GetStockIcon(StockIconIdentifier.PrinterFax); } } + + /// + /// Icon for a networked Fax printer. + /// + public StockIcon PrinterFaxNet { get { return GetStockIcon(StockIconIdentifier.PrinterFaxNet); } } + + /// + /// Icon for print to file. + /// + public StockIcon PrinterFile { get { return GetStockIcon(StockIconIdentifier.PrinterFile); } } + + /// + /// Icon for a stack. + /// + public StockIcon Stack { get { return GetStockIcon(StockIconIdentifier.Stack); } } + + /// + /// Icon for a SVCD media. + /// + public StockIcon MediaSvcd { get { return GetStockIcon(StockIconIdentifier.MediaSvcd); } } + + /// + /// Icon for a folder containing other items. + /// + public StockIcon StuffedFolder { get { return GetStockIcon(StockIconIdentifier.StuffedFolder); } } + + /// + /// Icon for an unknown drive. + /// + public StockIcon DriveUnknown { get { return GetStockIcon(StockIconIdentifier.DriveUnknown); } } + + /// + /// Icon for a DVD drive. + /// + public StockIcon DriveDvd { get { return GetStockIcon(StockIconIdentifier.DriveDvd); } } + + /// + /// Icon for DVD media. + /// + public StockIcon MediaDvd { get { return GetStockIcon(StockIconIdentifier.MediaDvd); } } + + /// + /// Icon for DVD-RAM media. + /// + public StockIcon MediaDvdRam { get { return GetStockIcon(StockIconIdentifier.MediaDvdRam); } } + + /// + /// Icon for DVD-RW media. + /// + public StockIcon MediaDvdRW { get { return GetStockIcon(StockIconIdentifier.MediaDvdRW); } } + + /// + /// Icon for DVD-R media. + /// + public StockIcon MediaDvdR { get { return GetStockIcon(StockIconIdentifier.MediaDvdR); } } + + /// + /// Icon for a DVD-ROM media. + /// + public StockIcon MediaDvdRom { get { return GetStockIcon(StockIconIdentifier.MediaDvdRom); } } + + /// + /// Icon for CD+ (Enhanced CD) media. + /// + public StockIcon MediaCDAudioPlus { get { return GetStockIcon(StockIconIdentifier.MediaCDAudioPlus); } } + + /// + /// Icon for CD-RW media. + /// + public StockIcon MediaCDRW { get { return GetStockIcon(StockIconIdentifier.MediaCDRW); } } + + /// + /// Icon for a CD-R media. + /// + public StockIcon MediaCDR { get { return GetStockIcon(StockIconIdentifier.MediaCDR); } } + + /// + /// Icon burning a CD. + /// + public StockIcon MediaCDBurn { get { return GetStockIcon(StockIconIdentifier.MediaCDBurn); } } + + /// + /// Icon for blank CD media. + /// + public StockIcon MediaBlankCD { get { return GetStockIcon(StockIconIdentifier.MediaBlankCD); } } + + /// + /// Icon for CD-ROM media. + /// + public StockIcon MediaCDRom { get { return GetStockIcon(StockIconIdentifier.MediaCDRom); } } + + /// + /// Icon for audio files. + /// + public StockIcon AudioFiles { get { return GetStockIcon(StockIconIdentifier.AudioFiles); } } + + /// + /// Icon for image files. + /// + public StockIcon ImageFiles { get { return GetStockIcon(StockIconIdentifier.ImageFiles); } } + + /// + /// Icon for video files. + /// + public StockIcon VideoFiles { get { return GetStockIcon(StockIconIdentifier.VideoFiles); } } + + /// + /// Icon for mixed Files. + /// + public StockIcon MixedFiles { get { return GetStockIcon(StockIconIdentifier.MixedFiles); } } + + /// + /// Icon for a folder back. + /// + public StockIcon FolderBack { get { return GetStockIcon(StockIconIdentifier.FolderBack); } } + + /// + /// Icon for a folder front. + /// + public StockIcon FolderFront { get { return GetStockIcon(StockIconIdentifier.FolderFront); } } + + /// + /// Icon for a security shield. Use for UAC prompts only. + /// + public StockIcon Shield { get { return GetStockIcon(StockIconIdentifier.Shield); } } + + /// + /// Icon for a warning. + /// + public StockIcon Warning { get { return GetStockIcon(StockIconIdentifier.Warning); } } + + /// + /// Icon for an informational message. + /// + public StockIcon Info { get { return GetStockIcon(StockIconIdentifier.Info); } } + + /// + /// Icon for an error message. + /// + public StockIcon Error { get { return GetStockIcon(StockIconIdentifier.Error); } } + + /// + /// Icon for a key. + /// + public StockIcon Key { get { return GetStockIcon(StockIconIdentifier.Key); } } + + /// + /// Icon for software. + /// + public StockIcon Software { get { return GetStockIcon(StockIconIdentifier.Software); } } + + /// + /// Icon for a rename. + /// + public StockIcon Rename { get { return GetStockIcon(StockIconIdentifier.Rename); } } + + /// + /// Icon for delete. + /// + public StockIcon Delete { get { return GetStockIcon(StockIconIdentifier.Delete); } } + + /// + /// Icon for audio DVD media. + /// + public StockIcon MediaAudioDvd { get { return GetStockIcon(StockIconIdentifier.MediaAudioDvd); } } + + /// + /// Icon for movie DVD media. + /// + public StockIcon MediaMovieDvd { get { return GetStockIcon(StockIconIdentifier.MediaMovieDvd); } } + + /// + /// Icon for enhanced CD media. + /// + public StockIcon MediaEnhancedCD { get { return GetStockIcon(StockIconIdentifier.MediaEnhancedCD); } } + + /// + /// Icon for enhanced DVD media. + /// + public StockIcon MediaEnhancedDvd { get { return GetStockIcon(StockIconIdentifier.MediaEnhancedDvd); } } + + /// + /// Icon for HD-DVD media. + /// + public StockIcon MediaHDDvd { get { return GetStockIcon(StockIconIdentifier.MediaHDDvd); } } + + /// + /// Icon for BluRay media. + /// + public StockIcon MediaBluRay { get { return GetStockIcon(StockIconIdentifier.MediaBluRay); } } + + /// + /// Icon for VCD media. + /// + public StockIcon MediaVcd { get { return GetStockIcon(StockIconIdentifier.MediaVcd); } } + + /// + /// Icon for DVD+R media. + /// + public StockIcon MediaDvdPlusR { get { return GetStockIcon(StockIconIdentifier.MediaDvdPlusR); } } + + /// + /// Icon for DVD+RW media. + /// + public StockIcon MediaDvdPlusRW { get { return GetStockIcon(StockIconIdentifier.MediaDvdPlusRW); } } + + /// + /// Icon for desktop computer. + /// + public StockIcon DesktopPC { get { return GetStockIcon(StockIconIdentifier.DesktopPC); } } + + /// + /// Icon for mobile computer (laptop/notebook). + /// + public StockIcon MobilePC { get { return GetStockIcon(StockIconIdentifier.MobilePC); } } + + /// + /// Icon for users. + /// + public StockIcon Users { get { return GetStockIcon(StockIconIdentifier.Users); } } + + /// + /// Icon for smart media. + /// + public StockIcon MediaSmartMedia { get { return GetStockIcon(StockIconIdentifier.MediaSmartMedia); } } + + /// + /// Icon for compact flash. + /// + public StockIcon MediaCompactFlash { get { return GetStockIcon(StockIconIdentifier.MediaCompactFlash); } } + + /// + /// Icon for a cell phone. + /// + public StockIcon DeviceCellPhone { get { return GetStockIcon(StockIconIdentifier.DeviceCellPhone); } } + + /// + /// Icon for a camera. + /// + public StockIcon DeviceCamera { get { return GetStockIcon(StockIconIdentifier.DeviceCamera); } } + + /// + /// Icon for video camera. + /// + public StockIcon DeviceVideoCamera { get { return GetStockIcon(StockIconIdentifier.DeviceVideoCamera); } } + + /// + /// Icon for audio player. + /// + public StockIcon DeviceAudioPlayer { get { return GetStockIcon(StockIconIdentifier.DeviceAudioPlayer); } } + + /// + /// Icon for connecting to network. + /// + public StockIcon NetworkConnect { get { return GetStockIcon(StockIconIdentifier.NetworkConnect); } } + + /// + /// Icon for the Internet. + /// + public StockIcon Internet { get { return GetStockIcon(StockIconIdentifier.Internet); } } + + /// + /// Icon for a ZIP file. + /// + public StockIcon ZipFile { get { return GetStockIcon(StockIconIdentifier.ZipFile); } } + + /// + /// Icon for settings. + /// + public StockIcon Settings { get { return GetStockIcon(StockIconIdentifier.Settings); } } + + /// + /// HDDVD Drive (all types) + /// + public StockIcon DriveHDDVD { get { return GetStockIcon(StockIconIdentifier.DriveHDDVD); } } + + /// + /// Icon for BluRay Drive (all types) + /// + public StockIcon DriveBluRay { get { return GetStockIcon(StockIconIdentifier.DriveBluRay); } } + + /// + /// Icon for HDDVD-ROM Media + /// + public StockIcon MediaHDDVDROM { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDROM); } } + + /// + /// Icon for HDDVD-R Media + /// + public StockIcon MediaHDDVDR { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDR); } } + + /// + /// Icon for HDDVD-RAM Media + /// + public StockIcon MediaHDDVDRAM { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDRAM); } } + + /// + /// Icon for BluRay ROM Media + /// + public StockIcon MediaBluRayROM { get { return GetStockIcon(StockIconIdentifier.MediaBluRayROM); } } + + /// + /// Icon for BluRay R Media + /// + public StockIcon MediaBluRayR { get { return GetStockIcon(StockIconIdentifier.MediaBluRayR); } } + + /// + /// Icon for BluRay RE Media (Rewriable and RAM) + /// + public StockIcon MediaBluRayRE { get { return GetStockIcon(StockIconIdentifier.MediaBluRayRE); } } + + /// + /// Icon for Clustered disk + /// + public StockIcon ClusteredDisk { get { return GetStockIcon(StockIconIdentifier.ClusteredDisk); } } + + #endregion + + #region Private Methods + + /// + /// Returns the existing stock icon from the internal cache, or creates a new one + /// based on the current settings if it's not in the cache. + /// + /// Unique identifier for the requested stock icon + /// Stock Icon based on the identifier given (either from the cache or created new) + private StockIcon GetStockIcon(StockIconIdentifier stockIconIdentifier) + { + // Check the cache first + if (stockIconCache[stockIconIdentifier] != null) + return stockIconCache[stockIconIdentifier]; + else + { + // Create a new icon based on our default settings + StockIcon icon = new StockIcon(stockIconIdentifier, defaultSize, isLinkOverlay, isSelected); + + try + { + // Add it to the cache + stockIconCache[stockIconIdentifier] = icon; + } + catch + { + icon.Dispose(); + throw; + } + + // Return + return icon; + } + } + + private ICollection GetAllStockIcons() + { + // Create a list of stock Identifiers + StockIconIdentifier[] ids = new StockIconIdentifier[stockIconCache.Count]; + stockIconCache.Keys.CopyTo(ids, 0); + + // For each identifier, if our cache is null, create a new stock icon + foreach (StockIconIdentifier id in ids) + { + if (stockIconCache[id] == null) + GetStockIcon(id); + } + + // return the list of stock icons + return stockIconCache.Values; + } + + + #endregion + + } + + +} diff --git a/Shell/Taskbar/JumpList.cs b/Shell/Taskbar/JumpList.cs new file mode 100644 index 0000000..e167582 --- /dev/null +++ b/Shell/Taskbar/JumpList.cs @@ -0,0 +1,575 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents an instance of a Taskbar button jump list. + /// + public class JumpList + { + + /// + /// Create a JumpList for the application's taskbar button. + /// + /// A new JumpList that is associated with the app id of the main application window + /// If there are any other child (top-level) windows for this application and they don't have + /// a specific JumpList created for them, they all will share the same JumpList as the main application window. + /// In order to have a individual JumpList for a top-level window, use the overloaded method CreateJumpListForIndividualWindow. + public static JumpList CreateJumpList() + { + return new JumpList(TaskbarManager.Instance.ApplicationId); + } + + /// + /// Create a JumpList for the application's taskbar button. + /// + /// Application Id for the individual window. This must be unique for each top-level window in order to have a individual JumpList. + /// Handle of the window associated with the new JumpList + /// A new JumpList that is associated with the specific window handle + public static JumpList CreateJumpListForIndividualWindow(string appId, IntPtr windowHandle) + { + return new JumpList(appId, windowHandle); + } + + /// + /// Create a JumpList for the application's taskbar button. + /// + /// Application Id for the individual window. This must be unique for each top-level window in order to have a individual JumpList. + /// WPF Window associated with the new JumpList + /// A new JumpList that is associated with the specific WPF window + public static JumpList CreateJumpListForIndividualWindow(string appId, System.Windows.Window window) + { + return new JumpList(appId, window); + } + + // Best practice recommends defining a private object to lock on + private readonly object syncLock = new Object(); + + // Native implementation of destination list + private ICustomDestinationList customDestinationList; + + #region Properties + + private JumpListCustomCategoryCollection customCategoriesCollection; + /// + /// Adds a collection of custom categories to the Taskbar jump list. + /// + /// The catagories to add to the jump list. + public void AddCustomCategories(params JumpListCustomCategory[] customCategories) + { + lock (syncLock) + { + if (customCategoriesCollection == null) + { + customCategoriesCollection = new JumpListCustomCategoryCollection(); + } + } + + if (customCategories != null) + { + foreach (JumpListCustomCategory category in customCategories) + { + customCategoriesCollection.Add(category); + } + } + } + + private JumpListItemCollection userTasks; + /// + /// Adds user tasks to the Taskbar JumpList. User tasks can only consist of JumpListTask or + /// JumpListSeparator objects. + /// + /// The user tasks to add to the JumpList. + public void AddUserTasks(params JumpListTask[] tasks) + { + if (userTasks == null) + { + // Make sure that we don't create multiple instances + // of this object + lock (syncLock) + { + if (userTasks == null) + { + userTasks = new JumpListItemCollection(); + } + } + } + + if (tasks != null) + { + foreach (JumpListTask task in tasks) + { + userTasks.Add(task); + } + } + } + + /// + /// Removes all user tasks that have been added. + /// + public void ClearAllUserTasks() + { + if (userTasks != null) + { + userTasks.Clear(); + } + } + + /// + /// Gets the recommended number of items to add to the jump list. + /// + /// + /// This number doesn’t + /// imply or suggest how many items will appear on the jump list. + /// This number should only be used for reference purposes since + /// the actual number of slots in the jump list can change after the last + /// refresh due to items being pinned or removed and resolution changes. + /// The jump list can increase in size accordingly. + /// + public uint MaxSlotsInList + { + get + { + // Because we need the correct number for max slots, start a commit, get the max slots + // and then abort. If we wait until the user calls RefreshTaskbarlist(), it will be too late. + // The user needs to use this number before they update the jumplist. + + object removedItems; + uint maxSlotsInList = 10; // default + + // Native call to start adding items to the taskbar destination list + HResult hr = customDestinationList.BeginList( + out maxSlotsInList, + ref TaskbarNativeMethods.TaskbarGuids.IObjectArray, + out removedItems); + + if (CoreErrorHelper.Succeeded(hr)) + { + customDestinationList.AbortList(); + } + + return maxSlotsInList; + } + } + + /// + /// Gets or sets the type of known categories to display. + /// + public JumpListKnownCategoryType KnownCategoryToDisplay { get; set; } + + private int knownCategoryOrdinalPosition; + /// + /// Gets or sets the value for the known category location relative to the + /// custom category collection. + /// + public int KnownCategoryOrdinalPosition + { + get + { + return knownCategoryOrdinalPosition; + } + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException("value", LocalizedMessages.JumpListNegativeOrdinalPosition); + } + + knownCategoryOrdinalPosition = value; + } + + } + + /// + /// Gets or sets the application ID to use for this jump list. + /// + public string ApplicationId { get; private set; } + + #endregion + + /// + /// Creates a new instance of the JumpList class with the specified + /// appId. The JumpList is associated with the main window of the application. + /// + /// Application Id to use for this instace. + internal JumpList(string appID) + : this(appID, TaskbarManager.Instance.OwnerHandle) + { + } + + /// + /// Creates a new instance of the JumpList class with the specified + /// appId. The JumpList is associated with the given WPF Window. + /// + /// Application Id to use for this instace. + /// WPF Window that is associated with this JumpList + internal JumpList(string appID, System.Windows.Window window) + : this(appID, (new System.Windows.Interop.WindowInteropHelper(window)).Handle) + { + } + + /// + /// Creates a new instance of the JumpList class with the specified + /// appId. The JumpList is associated with the given window. + /// + /// Application Id to use for this instace. + /// Window handle for the window that is associated with this JumpList + private JumpList(string appID, IntPtr windowHandle) + { + // Throw exception if not running on Win7 or newer + CoreHelpers.ThrowIfNotWin7(); + + // Native implementation of destination list + customDestinationList = (ICustomDestinationList)new CDestinationList(); + + // Set application user model ID + if (!string.IsNullOrEmpty(appID)) + { + ApplicationId = appID; + + // If the user hasn't yet set the application id for the whole process, + // use the first JumpList's AppId for the whole process. This will ensure + // we have the same JumpList for all the windows (unless user overrides and creates a new + // JumpList for a specific child window) + if (!TaskbarManager.Instance.ApplicationIdSetProcessWide) + { + TaskbarManager.Instance.ApplicationId = appID; + } + + TaskbarManager.Instance.SetApplicationIdForSpecificWindow(windowHandle, appID); + } + } + + /// + /// Reports document usage to the shell. + /// + /// The full path of the file to report usage. + public static void AddToRecent(string destination) + { + TaskbarNativeMethods.SHAddToRecentDocs(destination); + } + + /// + /// Commits the pending JumpList changes and refreshes the Taskbar. + /// + /// Will throw if the type of the file being added to the JumpList is not registered with the application. + /// Will throw if recent documents tracking is turned off by the user or via group policy. + /// Will throw if updating the JumpList fails for any other reason. + public void Refresh() + { + // Let the taskbar know which specific jumplist we are updating + if (!string.IsNullOrEmpty(ApplicationId)) + { + customDestinationList.SetAppID(ApplicationId); + } + + // Begins rendering on the taskbar destination list + BeginList(); + + Exception exception = null; + + try + { + // try to add the user tasks first + AppendTaskList(); + } + catch (Exception e) + { + // If this fails, save the exception but don't throw it yet. + // We need to continue to try and add the custom categories + exception = e; + } + + // Even it fails, continue appending the custom categories + try + { + // Add custom categories + AppendCustomCategories(); + } + finally + { + // End rendering of the taskbar destination list + customDestinationList.CommitList(); + } + + // If an exception was thrown while adding the user tasks or + // custom categories, throw it. + if (exception != null) + { + throw exception; + } + } + + private void BeginList() + { + // Get list of removed items from native code + object removedItems; + uint maxSlotsInList = 10; // default + + // Native call to start adding items to the taskbar destination list + HResult hr = customDestinationList.BeginList( + out maxSlotsInList, + ref TaskbarNativeMethods.TaskbarGuids.IObjectArray, + out removedItems); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + + // Process the deleted items + IEnumerable removedItemsArray = ProcessDeletedItems((IObjectArray)removedItems); + + // Raise the event if items were removed + if (JumpListItemsRemoved != null && removedItemsArray != null && removedItemsArray.GetEnumerator().MoveNext()) + { + JumpListItemsRemoved(this, new UserRemovedJumpListItemsEventArgs(removedItemsArray)); + } + } + + /// + /// Occurs when items are removed from the Taskbar's jump list since the last + /// refresh. + /// + /// + /// This event is not triggered + /// immediately when a user removes an item from the jump list but rather + /// when the application refreshes the task bar list directly. + /// + public event EventHandler JumpListItemsRemoved = delegate { }; + + /// + /// Retrieves the current list of destinations that have been removed from the existing jump list by the user. + /// The removed destinations may become items on a custom jump list. + /// + /// A collection of items (filenames) removed from the existing jump list by the user. + public IEnumerable RemovedDestinations + { + get + { + // Get list of removed items from native code + object removedItems; + + customDestinationList.GetRemovedDestinations(ref TaskbarNativeMethods.TaskbarGuids.IObjectArray, out removedItems); + + return ProcessDeletedItems((IObjectArray)removedItems); + } + } + + private IEnumerable ProcessDeletedItems(IObjectArray removedItems) + { + List removedItemsArray = new List(); + + uint count; + removedItems.GetCount(out count); + + // Process each removed item based on its type + for (uint i = 0; i < count; i++) + { + // Native call to retrieve objects from IObjectArray + object item; + removedItems.GetAt(i, + ref TaskbarNativeMethods.TaskbarGuids.IUnknown, + out item); + + IShellItem shellItem = item as IShellItem; + IShellLinkW shellLink; + // Process item + if (shellItem != null) + { + removedItemsArray.Add(RemoveCustomCategoryItem(shellItem)); + } + else if ((shellLink = item as IShellLinkW) != null) + { + removedItemsArray.Add(RemoveCustomCategoryLink(shellLink)); + } + } + return removedItemsArray; + } + + private string RemoveCustomCategoryItem(IShellItem item) + { + string path = null; + + if (customCategoriesCollection != null) + { + IntPtr pszString = IntPtr.Zero; + HResult hr = item.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.FileSystemPath, out pszString); + if (hr == HResult.Ok && pszString != IntPtr.Zero) + { + path = Marshal.PtrToStringAuto(pszString); + // Free the string + Marshal.FreeCoTaskMem(pszString); + } + + // Remove this item from each category + foreach (JumpListCustomCategory category in customCategoriesCollection) + { + category.RemoveJumpListItem(path); + } + + } + + return path; + } + + + private string RemoveCustomCategoryLink(IShellLinkW link) + { + string path = null; + + if (customCategoriesCollection != null) + { + StringBuilder sb = new StringBuilder(256); + link.GetPath(sb, sb.Capacity, IntPtr.Zero, 2); + + path = sb.ToString(); + + // Remove this item from each category + foreach (JumpListCustomCategory category in customCategoriesCollection) + { + category.RemoveJumpListItem(path); + } + } + + return path; + } + + private void AppendCustomCategories() + { + // Initialize our current index in the custom categories list + int currentIndex = 0; + + // Keep track whether we add the Known Categories to our list + bool knownCategoriesAdded = false; + + if (customCategoriesCollection != null) + { + // Append each category to list + foreach (JumpListCustomCategory category in customCategoriesCollection) + { + // If our current index is same as the KnownCategory OrdinalPosition, + // append the Known Categories + if (!knownCategoriesAdded && currentIndex == KnownCategoryOrdinalPosition) + { + AppendKnownCategories(); + knownCategoriesAdded = true; + } + + // Don't process empty categories + if (category.JumpListItems.Count == 0) { continue; } + + IObjectCollection categoryContent = + (IObjectCollection)new CEnumerableObjectCollection(); + + // Add each link's shell representation to the object array + foreach (IJumpListItem link in category.JumpListItems) + { + JumpListItem listItem = link as JumpListItem; + JumpListLink listLink = link as JumpListLink; + if (listItem != null) + { + categoryContent.AddObject(listItem.NativeShellItem); + } + else if (listLink != null) + { + categoryContent.AddObject(listLink.NativeShellLink); + } + } + + // Add current category to destination list + HResult hr = customDestinationList.AppendCategory( + category.Name, + (IObjectArray)categoryContent); + + if (!CoreErrorHelper.Succeeded(hr)) + { + if ((uint)hr == 0x80040F03) + { + throw new InvalidOperationException(LocalizedMessages.JumpListFileTypeNotRegistered); + } + else if ((uint)hr == 0x80070005 /*E_ACCESSDENIED*/) + { + // If the recent documents tracking is turned off by the user, + // custom categories or items to an existing category cannot be added. + // The recent documents tracking can be changed via: + // 1. Group Policy “Do not keep history of recently opened documents”. + // 2. Via the user setting “Store and display recently opened items in + // the Start menu and the taskbar” in the Start menu property dialog. + // + throw new UnauthorizedAccessException(LocalizedMessages.JumpListCustomCategoriesDisabled); + } + + throw new ShellException(hr); + } + + // Increase our current index + currentIndex++; + } + } + + // If the ordinal position was out of range, append the Known Categories + // at the end + if (!knownCategoriesAdded) + { + AppendKnownCategories(); + } + } + + private void AppendTaskList() + { + if (userTasks == null || userTasks.Count == 0) { return; } + + IObjectCollection taskContent = + (IObjectCollection)new CEnumerableObjectCollection(); + + // Add each task's shell representation to the object array + foreach (JumpListTask task in userTasks) + { + JumpListSeparator seperator; + JumpListLink link = task as JumpListLink; + if (link != null) + { + taskContent.AddObject(link.NativeShellLink); + } + else if ((seperator = task as JumpListSeparator) != null) + { + taskContent.AddObject(seperator.NativeShellLink); + } + } + + // Add tasks to the taskbar + HResult hr = customDestinationList.AddUserTasks((IObjectArray)taskContent); + + if (!CoreErrorHelper.Succeeded(hr)) + { + if ((uint)hr == 0x80040F03) + { + throw new InvalidOperationException(LocalizedMessages.JumpListFileTypeNotRegistered); + } + throw new ShellException(hr); + } + } + + private void AppendKnownCategories() + { + if (KnownCategoryToDisplay == JumpListKnownCategoryType.Recent) + { + customDestinationList.AppendKnownCategory(KnownDestinationCategory.Recent); + } + else if (KnownCategoryToDisplay == JumpListKnownCategoryType.Frequent) + { + customDestinationList.AppendKnownCategory(KnownDestinationCategory.Frequent); + } + } + } +} diff --git a/Shell/Taskbar/JumpListCustomCategory.cs b/Shell/Taskbar/JumpListCustomCategory.cs new file mode 100644 index 0000000..b5f616d --- /dev/null +++ b/Shell/Taskbar/JumpListCustomCategory.cs @@ -0,0 +1,92 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents a custom category on the taskbar's jump list + /// + public class JumpListCustomCategory + { + private string name; + + internal JumpListItemCollection JumpListItems + { + get; + private set; + } + + /// + /// Category name + /// + public string Name + { + get { return name; } + set + { + if (value != name) + { + name = value; + this.CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + } + } + } + + + /// + /// Add JumpList items for this category + /// + /// The items to add to the JumpList. + public void AddJumpListItems(params IJumpListItem[] items) + { + if (items != null) + { + foreach (IJumpListItem item in items) + { + JumpListItems.Add(item); + } + } + } + + /// + /// Event that is triggered when the jump list collection is modified + /// + internal event NotifyCollectionChangedEventHandler CollectionChanged = delegate { }; + + /// + /// Creates a new custom category instance + /// + /// Category name + public JumpListCustomCategory(string categoryName) + { + Name = categoryName; + + JumpListItems = new JumpListItemCollection(); + JumpListItems.CollectionChanged += OnJumpListCollectionChanged; + } + + internal void OnJumpListCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) + { + this.CollectionChanged(this, args); + } + + + internal void RemoveJumpListItem(string path) + { + List itemsToRemove = new List( + from i in JumpListItems + where string.Equals(path, i.Path, StringComparison.OrdinalIgnoreCase) + select i); + + // Remove matching items + for (int i = 0; i < itemsToRemove.Count; i++) + { + JumpListItems.Remove(itemsToRemove[i]); + } + } + } +} diff --git a/Shell/Taskbar/JumpListCustomCategoryCollection.cs b/Shell/Taskbar/JumpListCustomCategoryCollection.cs new file mode 100644 index 0000000..ba917a5 --- /dev/null +++ b/Shell/Taskbar/JumpListCustomCategoryCollection.cs @@ -0,0 +1,135 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents a collection of custom categories + /// + internal class JumpListCustomCategoryCollection + : ICollection, INotifyCollectionChanged + { + private List categories = new List(); + + /// + /// Event to trigger anytime this collection is modified + /// + public event NotifyCollectionChangedEventHandler CollectionChanged = delegate { }; + + /// + /// Determines if this collection is read-only + /// + public bool IsReadOnly { get; set; } + + /// + /// The number of items in this collection + /// + public int Count + { + get { return categories.Count; } + } + + /// + /// Add the specified category to this collection + /// + /// Category to add + public void Add(JumpListCustomCategory category) + { + if (category == null) + { + throw new ArgumentNullException("category"); + } + categories.Add(category); + + // Trigger CollectionChanged event + CollectionChanged( + this, + new NotifyCollectionChangedEventArgs( + NotifyCollectionChangedAction.Add, + category)); + + // Make sure that a collection changed event is fire if this category + // or it's corresponding jumplist is modified + category.CollectionChanged += CollectionChanged; + category.JumpListItems.CollectionChanged += CollectionChanged; + } + + /// + /// Remove the specified category from this collection + /// + /// Category item to remove + /// True if item was removed. + public bool Remove(JumpListCustomCategory category) + { + bool removed = categories.Remove(category); + + if (removed == true) + { + // Trigger CollectionChanged event + CollectionChanged( + this, + new NotifyCollectionChangedEventArgs( + NotifyCollectionChangedAction.Remove, + 0)); + } + + return removed; + } + + /// + /// Clear all items from the collection + /// + public void Clear() + { + categories.Clear(); + + CollectionChanged( + this, + new NotifyCollectionChangedEventArgs( + NotifyCollectionChangedAction.Reset)); + } + + /// + /// Determine if this collection contains the specified item + /// + /// Category to search for + /// True if category was found + public bool Contains(JumpListCustomCategory category) + { + return categories.Contains(category); + } + + /// + /// Copy this collection to a compatible one-dimensional array, + /// starting at the specified index of the target array + /// + /// Array to copy to + /// Index of target array to start copy + public void CopyTo(JumpListCustomCategory[] array, int index) + { + categories.CopyTo(array, index); + } + + /// + /// Returns an enumerator that iterates through this collection. + /// + /// Enumerator to iterate through this collection. + IEnumerator IEnumerable.GetEnumerator() + { + return categories.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through this collection. + /// + /// Enumerator to iterate through this collection. + IEnumerator IEnumerable.GetEnumerator() + { + return categories.GetEnumerator(); + } + } +} diff --git a/Shell/Taskbar/JumpListItem.cs b/Shell/Taskbar/JumpListItem.cs new file mode 100644 index 0000000..2b29c3a --- /dev/null +++ b/Shell/Taskbar/JumpListItem.cs @@ -0,0 +1,39 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents a jump list item. + /// + public class JumpListItem : ShellFile, IJumpListItem + { + /// + /// Creates a jump list item with the specified path. + /// + /// The path to the jump list item. + /// The file type should associate the given file + /// with the calling application. + public JumpListItem(string path) : base(path) { } + + #region IJumpListItem Members + + /// + /// Gets or sets the target path for this jump list item. + /// + public new string Path + { + get + { + return base.Path; + } + set + { + base.ParsingName = value; + } + } + + #endregion + } +} diff --git a/Shell/Taskbar/JumpListItemCollection.cs b/Shell/Taskbar/JumpListItemCollection.cs new file mode 100644 index 0000000..2cfda5c --- /dev/null +++ b/Shell/Taskbar/JumpListItemCollection.cs @@ -0,0 +1,126 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents a collection of jump list items. + /// + /// The type of elements in this collection. + internal class JumpListItemCollection : ICollection, INotifyCollectionChanged + { + private List items = new List(); + + /// + /// Occurs anytime a change is made to the underlying collection. + /// + public event NotifyCollectionChangedEventHandler CollectionChanged = delegate { }; + + /// + /// Gets or sets a value that determines if this collection is read-only. + /// + public bool IsReadOnly { get; set; } + + /// + /// Gets a count of the items currently in this collection. + /// + public int Count + { + get { return items.Count; } + } + + /// + /// Adds the specified item to this collection. + /// + /// The item to add. + public void Add(T item) + { + items.Add(item); + + // Trigger CollectionChanged event + CollectionChanged( + this, + new NotifyCollectionChangedEventArgs( + NotifyCollectionChangedAction.Add, + item)); + } + + /// + /// Removes the first instance of the specified item from the collection. + /// + /// The item to remove. + /// true if an item was removed, otherwise false if no items were removed. + public bool Remove(T item) + { + bool removed = items.Remove(item); + + if (removed == true) + { + // Trigger CollectionChanged event + CollectionChanged( + this, + new NotifyCollectionChangedEventArgs( + NotifyCollectionChangedAction.Remove, + 0)); + } + + return removed; + } + + /// + /// Clears all items from this collection. + /// + public void Clear() + { + items.Clear(); + + // Trigger CollectionChanged event + CollectionChanged( + this, + new NotifyCollectionChangedEventArgs( + NotifyCollectionChangedAction.Reset)); + } + + /// + /// Determines if this collection contains the specified item. + /// + /// The search item. + /// true if an item was found, otherwise false. + public bool Contains(T item) + { + return items.Contains(item); + } + + /// + /// Copies this collection to a compatible one-dimensional array, + /// starting at the specified index of the target array. + /// + /// The array name. + /// The index of the starting element. + public void CopyTo(T[] array, int index) + { + items.CopyTo(array, index); + } + + /// + /// Returns an enumerator that iterates through a collection. + /// + /// An enumerator to iterate through this collection. + IEnumerator IEnumerable.GetEnumerator() + { + return items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through a collection of a specified type. + /// + /// An enumerator to iterate through this collection. + IEnumerator IEnumerable.GetEnumerator() + { + return items.GetEnumerator(); + } + } +} diff --git a/Shell/Taskbar/JumpListLink.cs b/Shell/Taskbar/JumpListLink.cs new file mode 100644 index 0000000..8aa168c --- /dev/null +++ b/Shell/Taskbar/JumpListLink.cs @@ -0,0 +1,201 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents a jump list link object. + /// + public class JumpListLink : JumpListTask, IJumpListItem, IDisposable + { + internal static PropertyKey PKEY_Title = SystemProperties.System.Title; + + /// + /// Initializes a new instance of a JumpListLink with the specified path. + /// + /// The path to the item. The path is required for the JumpList Link + /// The title for the JumpListLink item. The title is required for the JumpList link. + public JumpListLink(string pathValue, string titleValue) + { + if (string.IsNullOrEmpty(pathValue)) + { + throw new ArgumentNullException("pathValue", LocalizedMessages.JumpListLinkPathRequired); + } + + if (string.IsNullOrEmpty(titleValue)) + { + throw new ArgumentNullException("titleValue", LocalizedMessages.JumpListLinkTitleRequired); + } + + Path = pathValue; + Title = titleValue; + } + + private string title; + /// + /// Gets or sets the link's title + /// + public string Title + { + get { return title; } + set + { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value", LocalizedMessages.JumpListLinkTitleRequired); + } + + title = value; + } + } + + private string path; + /// + /// Gets or sets the link's path + /// + public string Path + { + get { return path; } + set + { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value", LocalizedMessages.JumpListLinkTitleRequired); + } + + path = value; + } + } + + /// + /// Gets or sets the icon reference (location and index) of the link's icon. + /// + public IconReference IconReference { get; set; } + + /// + /// Gets or sets the object's arguments (passed to the command line). + /// + public string Arguments { get; set; } + + /// + /// Gets or sets the object's working directory. + /// + public string WorkingDirectory { get; set; } + + /// + /// Gets or sets the show command of the lauched application. + /// + public WindowShowCommand ShowCommand { get; set; } + + private IPropertyStore nativePropertyStore; + private IShellLinkW nativeShellLink; + /// + /// Gets an IShellLinkW representation of this object + /// + internal override IShellLinkW NativeShellLink + { + get + { + if (nativeShellLink != null) + { + Marshal.ReleaseComObject(nativeShellLink); + nativeShellLink = null; + } + + nativeShellLink = (IShellLinkW)new CShellLink(); + + if (nativePropertyStore != null) + { + Marshal.ReleaseComObject(nativePropertyStore); + nativePropertyStore = null; + } + + nativePropertyStore = (IPropertyStore)nativeShellLink; + + nativeShellLink.SetPath(Path); + + if (!string.IsNullOrEmpty(IconReference.ModuleName)) + { + nativeShellLink.SetIconLocation(IconReference.ModuleName, IconReference.ResourceId); + } + + if (!string.IsNullOrEmpty(Arguments)) + { + nativeShellLink.SetArguments(Arguments); + } + + if (!string.IsNullOrEmpty(WorkingDirectory)) + { + nativeShellLink.SetWorkingDirectory(WorkingDirectory); + } + + nativeShellLink.SetShowCmd((uint)ShowCommand); + + using (PropVariant propVariant = new PropVariant(Title)) + { + HResult result = nativePropertyStore.SetValue(ref PKEY_Title, propVariant); + if (!CoreErrorHelper.Succeeded(result)) + { + throw new ShellException(result); + } + + nativePropertyStore.Commit(); + } + + return nativeShellLink; + } + } + + #region IDisposable Members + + /// + /// Release the native and managed objects + /// + /// Indicates that this is being called from Dispose(), rather than the finalizer. + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + title = null; + } + + if (nativePropertyStore != null) + { + Marshal.ReleaseComObject(nativePropertyStore); + nativePropertyStore = null; + } + + if (nativeShellLink != null) + { + Marshal.ReleaseComObject(nativeShellLink); + nativeShellLink = null; + } + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Implement the finalizer. + /// + ~JumpListLink() + { + Dispose(false); + } + + #endregion + + } +} diff --git a/Shell/Taskbar/JumpListSeparator.cs b/Shell/Taskbar/JumpListSeparator.cs new file mode 100644 index 0000000..0af5aa6 --- /dev/null +++ b/Shell/Taskbar/JumpListSeparator.cs @@ -0,0 +1,99 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents a separator in the user task list. The JumpListSeparator control + /// can only be used in a user task list. + /// + public class JumpListSeparator : JumpListTask, IDisposable + { + internal static PropertyKey PKEY_AppUserModel_IsDestListSeparator = SystemProperties.System.AppUserModel.IsDestinationListSeparator; + + private IPropertyStore nativePropertyStore; + private IShellLinkW nativeShellLink; + /// + /// Gets an IShellLinkW representation of this object + /// + internal override IShellLinkW NativeShellLink + { + get + { + if (nativeShellLink != null) + { + Marshal.ReleaseComObject(nativeShellLink); + nativeShellLink = null; + } + + nativeShellLink = (IShellLinkW)new CShellLink(); + + if (nativePropertyStore != null) + { + Marshal.ReleaseComObject(nativePropertyStore); + nativePropertyStore = null; + } + + nativePropertyStore = (IPropertyStore)nativeShellLink; + + using(PropVariant propVariant = new PropVariant(true)) + { + HResult result = nativePropertyStore.SetValue(ref PKEY_AppUserModel_IsDestListSeparator, propVariant); + if (!CoreErrorHelper.Succeeded(result)) + { + throw new ShellException(result); + } + nativePropertyStore.Commit(); + } + + return nativeShellLink; ; + } + } + + #region IDisposable Members + + /// + /// Release the native and managed objects + /// + /// Indicates that this is being called from Dispose(), rather than the finalizer. + protected virtual void Dispose(bool disposing) + { + if (nativePropertyStore != null) + { + Marshal.ReleaseComObject(nativePropertyStore); + nativePropertyStore = null; + } + + if (nativeShellLink != null) + { + Marshal.ReleaseComObject(nativeShellLink); + nativeShellLink = null; + } + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Implement the finalizer. + /// + ~JumpListSeparator() + { + Dispose(false); + } + + #endregion + + } +} diff --git a/Shell/Taskbar/TabbedThumbnail.cs b/Shell/Taskbar/TabbedThumbnail.cs new file mode 100644 index 0000000..fe56511 --- /dev/null +++ b/Shell/Taskbar/TabbedThumbnail.cs @@ -0,0 +1,566 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Drawing; +using System.IO; +using System.Threading; +using System.Windows; +using System.Windows.Forms; +using System.Windows.Interop; +using System.Windows.Media.Imaging; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents a tabbed thumbnail on the taskbar for a given window or a control. + /// + public class TabbedThumbnail : IDisposable + { + #region Internal members + + // Control properties + internal IntPtr WindowHandle { get; set; } + internal IntPtr ParentWindowHandle { get; set; } + + // WPF properties + internal UIElement WindowsControl { get; set; } + internal Window WindowsControlParentWindow { get; set; } + + private TaskbarWindow _taskbarWindow; + internal TaskbarWindow TaskbarWindow + { + get { return _taskbarWindow; } + set + { + _taskbarWindow = value; + + // If we have a TaskbarWindow assigned, set it's icon + if (_taskbarWindow != null && _taskbarWindow.TabbedThumbnailProxyWindow != null) + { + _taskbarWindow.TabbedThumbnailProxyWindow.Icon = Icon; + } + } + } + + private bool _addedToTaskbar; + internal bool AddedToTaskbar + { + get { return _addedToTaskbar; } + set + { + _addedToTaskbar = value; + + // The user has updated the clipping region, so invalidate our existing preview + if (ClippingRectangle != null) + { + TaskbarWindowManager.InvalidatePreview(this.TaskbarWindow); + } + } + } + + internal bool RemovedFromTaskbar { get; set; } + + #endregion + + #region Constructors + + /// + /// Creates a new TabbedThumbnail with the given window handle of the parent and + /// a child control/window's handle (e.g. TabPage or Panel) + /// + /// Window handle of the parent window. + /// This window has to be a top-level window and the handle cannot be null or IntPtr.Zero + /// Window handle of the child control or window for which a tabbed + /// thumbnail needs to be displayed + public TabbedThumbnail(IntPtr parentWindowHandle, IntPtr windowHandle) + { + if (parentWindowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.TabbedThumbnailZeroParentHandle, "parentWindowHandle"); + } + if (windowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.TabbedThumbnailZeroChildHandle, "windowHandle"); + } + + WindowHandle = windowHandle; + ParentWindowHandle = parentWindowHandle; + } + + /// + /// Creates a new TabbedThumbnail with the given window handle of the parent and + /// a child control (e.g. TabPage or Panel) + /// + /// Window handle of the parent window. + /// This window has to be a top-level window and the handle cannot be null or IntPtr.Zero + /// Child control for which a tabbed thumbnail needs to be displayed + /// This method can also be called when using a WindowsFormHost control in a WPF application. + /// Call this method with the main WPF Window's handle, and windowsFormHost.Child control. + public TabbedThumbnail(IntPtr parentWindowHandle, Control control) + { + if (parentWindowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.TabbedThumbnailZeroParentHandle, "parentWindowHandle"); + } + if (control == null) + { + throw new ArgumentNullException("control"); + } + + WindowHandle = control.Handle; + ParentWindowHandle = parentWindowHandle; + } + + /// + /// Creates a new TabbedThumbnail with the given window handle of the parent and + /// a WPF child Window. For WindowsFormHost control, use TabbedThumbnail(IntPtr, Control) overload and pass + /// the WindowsFormHost.Child as the second parameter. + /// + /// Parent window for the UIElement control. + /// This window has to be a top-level window and the handle cannot be null + /// WPF Control (UIElement) for which a tabbed thumbnail needs to be displayed + /// Offset point used for displaying the peek bitmap. This setting is + /// recomended for hidden WPF controls as it is difficult to calculate their offset. + public TabbedThumbnail(Window parentWindow, UIElement windowsControl, Vector peekOffset) + { + if (windowsControl == null) + { + throw new ArgumentNullException("windowsControl"); + } + if (parentWindow == null) + { + throw new ArgumentNullException("parentWindow"); + } + + WindowHandle = IntPtr.Zero; + + WindowsControl = windowsControl; + WindowsControlParentWindow = parentWindow; + ParentWindowHandle = (new WindowInteropHelper(parentWindow)).Handle; + PeekOffset = peekOffset; + } + + #endregion + + #region Public Properties + + private string _title = string.Empty; + /// + /// Title for the window shown as the taskbar thumbnail. + /// + public string Title + { + get + { + return _title; + } + set + { + if (_title != value) + { + _title = value; + if (TitleChanged != null) { TitleChanged(this, EventArgs.Empty); } + } + } + } + + private string _tooltip = string.Empty; + /// + /// Tooltip to be shown for this thumbnail on the taskbar. + /// By default this is full title of the window shown on the taskbar. + /// + public string Tooltip + { + get { return _tooltip; } + set + { + if (_tooltip != value) + { + _tooltip = value; + if (TooltipChanged != null) { TooltipChanged(this, EventArgs.Empty); } + } + } + } + + /// + /// Sets the window icon for this thumbnail preview + /// + /// System.Drawing.Icon for the window/control associated with this preview + public void SetWindowIcon(Icon icon) + { + Icon = icon; + + // If we have a TaskbarWindow assigned, set its icon + if (TaskbarWindow != null && TaskbarWindow.TabbedThumbnailProxyWindow != null) + { + TaskbarWindow.TabbedThumbnailProxyWindow.Icon = Icon; + } + } + + /// + /// Sets the window icon for this thumbnail preview + /// + /// Icon handle (hIcon) for the window/control associated with this preview + /// This method will not release the icon handle. It is the caller's responsibility to release the icon handle. + public void SetWindowIcon(IntPtr iconHandle) + { + Icon = iconHandle != IntPtr.Zero ? System.Drawing.Icon.FromHandle(iconHandle) : null; + + if (TaskbarWindow != null && TaskbarWindow.TabbedThumbnailProxyWindow != null) + { + TaskbarWindow.TabbedThumbnailProxyWindow.Icon = Icon; + } + } + + private Rectangle? _clippingRectangle; + /// + /// Specifies that only a portion of the window's client area + /// should be used in the window's thumbnail. + /// A value of null will clear the clipping area and use the default thumbnail. + /// + public Rectangle? ClippingRectangle + { + get { return _clippingRectangle; } + set + { + _clippingRectangle = value; + + // The user has updated the clipping region, so invalidate our existing preview + TaskbarWindowManager.InvalidatePreview(this.TaskbarWindow); + } + } + + internal IntPtr CurrentHBitmap { get; set; } + + internal Icon Icon { get; private set; } + + /// + /// Override the thumbnail and peek bitmap. + /// By providing this bitmap manually, Thumbnail Window manager will provide the + /// Desktop Window Manager (DWM) this bitmap instead of rendering one automatically. + /// Use this property to update the bitmap whenever the control is updated and the user + /// needs to be shown a new thumbnail on the taskbar preview (or aero peek). + /// + /// The image to use. + /// + /// If the bitmap doesn't have the right dimensions, the DWM may scale it or not + /// render certain areas as appropriate - it is the user's responsibility + /// to render a bitmap with the proper dimensions. + /// + public void SetImage(Bitmap bitmap) + { + if (bitmap != null) + { + SetImage(bitmap.GetHbitmap()); + } + else + { + SetImage(IntPtr.Zero); + } + } + + /// + /// Override the thumbnail and peek bitmap. + /// By providing this bitmap manually, Thumbnail Window manager will provide the + /// Desktop Window Manager (DWM) this bitmap instead of rendering one automatically. + /// Use this property to update the bitmap whenever the control is updated and the user + /// needs to be shown a new thumbnail on the taskbar preview (or aero peek). + /// + /// The image to use. + /// + /// If the bitmap doesn't have the right dimensions, the DWM may scale it or not + /// render certain areas as appropriate - it is the user's responsibility + /// to render a bitmap with the proper dimensions. + /// + public void SetImage(BitmapSource bitmapSource) + { + if (bitmapSource == null) + { + SetImage(IntPtr.Zero); + return; + } + + BmpBitmapEncoder encoder = new BmpBitmapEncoder(); + encoder.Frames.Add(BitmapFrame.Create(bitmapSource)); + + using (MemoryStream memoryStream = new MemoryStream()) + { + encoder.Save(memoryStream); + memoryStream.Position = 0; + + using (Bitmap bmp = new Bitmap(memoryStream)) + { + SetImage(bmp.GetHbitmap()); + } + } + } + + /// + /// Override the thumbnail and peek bitmap. + /// By providing this bitmap manually, Thumbnail Window manager will provide the + /// Desktop Window Manager (DWM) this bitmap instead of rendering one automatically. + /// Use this property to update the bitmap whenever the control is updated and the user + /// needs to be shown a new thumbnail on the taskbar preview (or aero peek). + /// + /// A bitmap handle for the image to use. + /// When the TabbedThumbnail is finalized, this class will delete the provided hBitmap. + /// + /// If the bitmap doesn't have the right dimensions, the DWM may scale it or not + /// render certain areas as appropriate - it is the user's responsibility + /// to render a bitmap with the proper dimensions. + /// + internal void SetImage(IntPtr hBitmap) + { + // Before we set a new bitmap, dispose the old one + if (CurrentHBitmap != IntPtr.Zero) + { + ShellNativeMethods.DeleteObject(CurrentHBitmap); + } + + // Set the new bitmap + CurrentHBitmap = hBitmap; + + // Let DWM know to invalidate its cached thumbnail/preview and ask us for a new one + TaskbarWindowManager.InvalidatePreview(TaskbarWindow); + } + + /// + /// Specifies whether a standard window frame will be displayed + /// around the bitmap. If the bitmap represents a top-level window, + /// you would probably set this flag to true. If the bitmap + /// represents a child window (or a frameless window), you would + /// probably set this flag to false. + /// + public bool DisplayFrameAroundBitmap { get; set; } + + /// + /// Invalidate any existing thumbnail preview. Calling this method + /// will force DWM to request a new bitmap next time user previews the thumbnails + /// or requests Aero peek preview. + /// + public void InvalidatePreview() + { + // clear current image and invalidate + SetImage(IntPtr.Zero); + } + + /// + /// Gets or sets the offset used for displaying the peek bitmap. This setting is + /// recomended for hidden WPF controls as it is difficult to calculate their offset. + /// + public Vector? PeekOffset { get; set; } + + #endregion + + + + #region Events + + /// + /// This event is raised when the Title property changes. + /// + public event EventHandler TitleChanged; + + /// + /// This event is raised when the Tooltip property changes. + /// + public event EventHandler TooltipChanged; + + /// + /// The event that occurs when a tab is closed on the taskbar thumbnail preview. + /// + public event EventHandler TabbedThumbnailClosed; + + /// + /// The event that occurs when a tab is maximized via the taskbar thumbnail preview (context menu). + /// + public event EventHandler TabbedThumbnailMaximized; + + /// + /// The event that occurs when a tab is minimized via the taskbar thumbnail preview (context menu). + /// + public event EventHandler TabbedThumbnailMinimized; + + /// + /// The event that occurs when a tab is activated (clicked) on the taskbar thumbnail preview. + /// + public event EventHandler TabbedThumbnailActivated; + + /// + /// The event that occurs when a thumbnail or peek bitmap is requested by the user. + /// + public event EventHandler TabbedThumbnailBitmapRequested; + + + internal void OnTabbedThumbnailMaximized() + { + if (TabbedThumbnailMaximized != null) + { + TabbedThumbnailMaximized(this, GetTabbedThumbnailEventArgs()); + } + else + { + // No one is listening to these events. + // Forward the message to the main window + CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.SystemCommand, new IntPtr(TabbedThumbnailNativeMethods.ScMaximize), IntPtr.Zero); + } + } + + internal void OnTabbedThumbnailMinimized() + { + if (TabbedThumbnailMinimized != null) + { + TabbedThumbnailMinimized(this, GetTabbedThumbnailEventArgs()); + } + else + { + // No one is listening to these events. + // Forward the message to the main window + CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.SystemCommand, new IntPtr(TabbedThumbnailNativeMethods.ScMinimize), IntPtr.Zero); + } + + } + + /// + /// Returns true if the thumbnail was removed from the taskbar; false if it was not. + /// + /// Returns true if the thumbnail was removed from the taskbar; false if it was not. + internal bool OnTabbedThumbnailClosed() + { + var closedHandler = TabbedThumbnailClosed; + if (closedHandler != null) + { + var closingEvent = GetTabbedThumbnailClosingEventArgs(); + + closedHandler(this, closingEvent); + + if (closingEvent.Cancel) { return false; } + } + else + { + // No one is listening to these events. Forward the message to the main window + CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.NCDestroy, IntPtr.Zero, IntPtr.Zero); + } + + // Remove it from the internal list as well as the taskbar + TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview(this); + return true; + } + + internal void OnTabbedThumbnailActivated() + { + if (TabbedThumbnailActivated != null) + { + TabbedThumbnailActivated(this, GetTabbedThumbnailEventArgs()); + } + else + { + // No one is listening to these events. + // Forward the message to the main window + CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.ActivateApplication, new IntPtr(1), new IntPtr(Thread.CurrentThread.GetHashCode())); + } + } + + internal void OnTabbedThumbnailBitmapRequested() + { + if (TabbedThumbnailBitmapRequested != null) + { + TabbedThumbnailBitmapRequestedEventArgs eventArgs = null; + + if (this.WindowHandle != IntPtr.Zero) + { + eventArgs = new TabbedThumbnailBitmapRequestedEventArgs(this.WindowHandle); + } + else if (this.WindowsControl != null) + { + eventArgs = new TabbedThumbnailBitmapRequestedEventArgs(this.WindowsControl); + } + + TabbedThumbnailBitmapRequested(this, eventArgs); + } + } + + private TabbedThumbnailClosedEventArgs GetTabbedThumbnailClosingEventArgs() + { + TabbedThumbnailClosedEventArgs eventArgs = null; + + if (this.WindowHandle != IntPtr.Zero) + { + eventArgs = new TabbedThumbnailClosedEventArgs(this.WindowHandle); + } + else if (this.WindowsControl != null) + { + eventArgs = new TabbedThumbnailClosedEventArgs(this.WindowsControl); + } + + return eventArgs; + } + + private TabbedThumbnailEventArgs GetTabbedThumbnailEventArgs() + { + TabbedThumbnailEventArgs eventArgs = null; + + if (this.WindowHandle != IntPtr.Zero) + { + eventArgs = new TabbedThumbnailEventArgs(this.WindowHandle); + } + else if (this.WindowsControl != null) + { + eventArgs = new TabbedThumbnailEventArgs(this.WindowsControl); + } + + return eventArgs; + } + + #endregion + + #region IDisposable Members + + /// + /// + /// + ~TabbedThumbnail() + { + Dispose(false); + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Release the native objects. + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + _taskbarWindow = null; + + if (Icon != null) { Icon.Dispose(); } + Icon = null; + + _title = null; + _tooltip = null; + WindowsControl = null; + } + + if (CurrentHBitmap != IntPtr.Zero) + { + ShellNativeMethods.DeleteObject(CurrentHBitmap); + CurrentHBitmap = IntPtr.Zero; + } + } + + #endregion + } +} diff --git a/Shell/Taskbar/TabbedThumbnailBitmapRequestedEventArgs.cs b/Shell/Taskbar/TabbedThumbnailBitmapRequestedEventArgs.cs new file mode 100644 index 0000000..701d0f9 --- /dev/null +++ b/Shell/Taskbar/TabbedThumbnailBitmapRequestedEventArgs.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Drawing; +using System.Windows; +using System.Windows.Media.Imaging; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Event args for the TabbedThumbnailBitmapRequested event. The event allows applications to + /// provide a bitmap for the tabbed thumbnail's preview and peek. The application should also + /// set the Handled property if a custom bitmap is provided. + /// + public class TabbedThumbnailBitmapRequestedEventArgs : TabbedThumbnailEventArgs + { + /// + /// Creates a Event Args for a TabbedThumbnailBitmapRequested event. + /// + /// Window handle for the control/window related to the event + public TabbedThumbnailBitmapRequestedEventArgs(IntPtr windowHandle) + : base(windowHandle) + { + } + + /// + /// Creates a Event Args for a TabbedThumbnailBitmapRequested event. + /// + /// WPF Control (UIElement) related to the event + public TabbedThumbnailBitmapRequestedEventArgs(UIElement windowsControl) + : base(windowsControl) + { + } + + + /// + /// Gets or sets a value indicating whether the TabbedThumbnailBitmapRequested event was handled. + /// Set this property if the SetImage method is called with a custom bitmap for the thumbnail/peek. + /// + public bool Handled { get; set; } + } +} diff --git a/Shell/Taskbar/TabbedThumbnailClosedEventArgs.cs b/Shell/Taskbar/TabbedThumbnailClosedEventArgs.cs new file mode 100644 index 0000000..b90a695 --- /dev/null +++ b/Shell/Taskbar/TabbedThumbnailClosedEventArgs.cs @@ -0,0 +1,29 @@ +using System; +using System.Windows; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Event args for when close is selected on a tabbed thumbnail proxy window. + /// + public class TabbedThumbnailClosedEventArgs : TabbedThumbnailEventArgs + { + /// + /// Creates a Event Args for a specific tabbed thumbnail event. + /// + /// Window handle for the control/window related to the event + public TabbedThumbnailClosedEventArgs(IntPtr windowHandle) : base(windowHandle) { } + + /// + /// Creates a Event Args for a specific tabbed thumbnail event. + /// + /// WPF Control (UIElement) related to the event + public TabbedThumbnailClosedEventArgs(UIElement windowsControl) : base(windowsControl) { } + + /// + /// If set to true, the proxy window will not be removed from the taskbar. + /// + public bool Cancel { get; set; } + + } +} diff --git a/Shell/Taskbar/TabbedThumbnailEventArgs.cs b/Shell/Taskbar/TabbedThumbnailEventArgs.cs new file mode 100644 index 0000000..8788ae0 --- /dev/null +++ b/Shell/Taskbar/TabbedThumbnailEventArgs.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Windows; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Event args for various Tabbed Thumbnail related events + /// + public class TabbedThumbnailEventArgs : EventArgs + { + /// + /// Creates a Event Args for a specific tabbed thumbnail event. + /// + /// Window handle for the control/window related to the event + public TabbedThumbnailEventArgs(IntPtr windowHandle) + { + WindowHandle = windowHandle; + WindowsControl = null; + } + + /// + /// Creates a Event Args for a specific tabbed thumbnail event. + /// + /// WPF Control (UIElement) related to the event + public TabbedThumbnailEventArgs(UIElement windowsControl) + { + WindowHandle = IntPtr.Zero; + WindowsControl = windowsControl; + } + + /// + /// Gets the Window handle for the specific control/window that is related to this event. + /// + /// For WPF Controls (UIElement) the WindowHandle will be IntPtr.Zero. + /// Check the WindowsControl property to get the specific control associated with this event. + public IntPtr WindowHandle { get; private set; } + + /// + /// Gets the WPF Control (UIElement) that is related to this event. This property may be null + /// for non-WPF applications. + /// + public UIElement WindowsControl { get; private set; } + } +} diff --git a/Shell/Taskbar/TabbedThumbnailManager.cs b/Shell/Taskbar/TabbedThumbnailManager.cs new file mode 100644 index 0000000..73a7e57 --- /dev/null +++ b/Shell/Taskbar/TabbedThumbnailManager.cs @@ -0,0 +1,464 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Forms; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Shell.Interop; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents the main class for adding and removing tabbed thumbnails on the Taskbar + /// for child windows and controls. + /// + public class TabbedThumbnailManager + { + /// + /// Internal dictionary to keep track of the user's window handle and its + /// corresponding thumbnail preview objects. + /// + private Dictionary _tabbedThumbnailCache; + private Dictionary _tabbedThumbnailCacheWPF; // list for WPF controls + + /// + /// Internal constructor that creates a new dictionary for keeping track of the window handles + /// and their corresponding thumbnail preview objects. + /// + internal TabbedThumbnailManager() + { + _tabbedThumbnailCache = new Dictionary(); + _tabbedThumbnailCacheWPF = new Dictionary(); + } + + /// + /// Adds a new tabbed thumbnail to the taskbar. + /// + /// Thumbnail preview for a specific window handle or control. The preview + /// object can be initialized with specific properties for the title, bitmap, and tooltip. + /// If the tabbed thumbnail has already been added + public void AddThumbnailPreview(TabbedThumbnail preview) + { + if (preview == null) { throw new ArgumentNullException("preview"); } + + // UI Element has a windowHandle of zero. + if (preview.WindowHandle == IntPtr.Zero) + { + if (_tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl)) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewAdded, "preview"); + } + _tabbedThumbnailCacheWPF.Add(preview.WindowsControl, preview); + } + else + { + // Regular control with a valid handle + if (_tabbedThumbnailCache.ContainsKey(preview.WindowHandle)) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewAdded, "preview"); + } + _tabbedThumbnailCache.Add(preview.WindowHandle, preview); + } + + TaskbarWindowManager.AddTabbedThumbnail(preview); + + preview.InvalidatePreview(); // Note: Why this here? + } + + /// + /// Gets the TabbedThumbnail object associated with the given window handle + /// + /// Window handle for the control/window + /// TabbedThumbnail associated with the given window handle + public TabbedThumbnail GetThumbnailPreview(IntPtr windowHandle) + { + if (windowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerInvalidHandle, "windowHandle"); + } + + TabbedThumbnail thumbnail; + return _tabbedThumbnailCache.TryGetValue(windowHandle, out thumbnail) ? thumbnail : null; + } + + /// + /// Gets the TabbedThumbnail object associated with the given control + /// + /// Specific control for which the preview object is requested + /// TabbedThumbnail associated with the given control + public TabbedThumbnail GetThumbnailPreview(Control control) + { + if (control == null) + { + throw new ArgumentNullException("control"); + } + + return GetThumbnailPreview(control.Handle); + } + + /// + /// Gets the TabbedThumbnail object associated with the given WPF Window + /// + /// WPF Control (UIElement) for which the preview object is requested + /// TabbedThumbnail associated with the given WPF Window + public TabbedThumbnail GetThumbnailPreview(UIElement windowsControl) + { + if (windowsControl == null) + { + throw new ArgumentNullException("windowsControl"); + } + + TabbedThumbnail thumbnail; + return _tabbedThumbnailCacheWPF.TryGetValue(windowsControl, out thumbnail) ? thumbnail : null; + } + + /// + /// Remove the tabbed thumbnail from the taskbar. + /// + /// TabbedThumbnail associated with the control/window that + /// is to be removed from the taskbar + public void RemoveThumbnailPreview(TabbedThumbnail preview) + { + if (preview == null) + { + throw new ArgumentNullException("preview"); + } + + if (_tabbedThumbnailCache.ContainsKey(preview.WindowHandle)) + { + RemoveThumbnailPreview(preview.WindowHandle); + } + else if (_tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl)) + { + RemoveThumbnailPreview(preview.WindowsControl); + } + } + + /// + /// Remove the tabbed thumbnail from the taskbar. + /// + /// TabbedThumbnail associated with the window handle that + /// is to be removed from the taskbar + public void RemoveThumbnailPreview(IntPtr windowHandle) + { + if (!_tabbedThumbnailCache.ContainsKey(windowHandle)) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerControlNotAdded, "windowHandle"); + } + + TaskbarWindowManager.UnregisterTab(_tabbedThumbnailCache[windowHandle].TaskbarWindow); + + _tabbedThumbnailCache.Remove(windowHandle); + + TaskbarWindow taskbarWindow = TaskbarWindowManager.GetTaskbarWindow(windowHandle, TaskbarProxyWindowType.TabbedThumbnail); + + if (taskbarWindow != null) + { + if (TaskbarWindowManager._taskbarWindowList.Contains(taskbarWindow)) + TaskbarWindowManager._taskbarWindowList.Remove(taskbarWindow); + taskbarWindow.Dispose(); + taskbarWindow = null; + } + } + + /// + /// Remove the tabbed thumbnail from the taskbar. + /// + /// TabbedThumbnail associated with the control that + /// is to be removed from the taskbar + public void RemoveThumbnailPreview(Control control) + { + if (control == null) + { + throw new ArgumentNullException("control"); + } + + IntPtr handle = control.Handle; + + RemoveThumbnailPreview(handle); + } + + /// + /// Remove the tabbed thumbnail from the taskbar. + /// + /// TabbedThumbnail associated with the WPF Control (UIElement) that + /// is to be removed from the taskbar + public void RemoveThumbnailPreview(UIElement windowsControl) + { + if (windowsControl == null) { throw new ArgumentNullException("windowsControl"); } + + if (!_tabbedThumbnailCacheWPF.ContainsKey(windowsControl)) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerControlNotAdded, "windowsControl"); + } + + TaskbarWindowManager.UnregisterTab(_tabbedThumbnailCacheWPF[windowsControl].TaskbarWindow); + + _tabbedThumbnailCacheWPF.Remove(windowsControl); + + TaskbarWindow taskbarWindow = TaskbarWindowManager.GetTaskbarWindow(windowsControl, TaskbarProxyWindowType.TabbedThumbnail); + + if (taskbarWindow != null) + { + if (TaskbarWindowManager._taskbarWindowList.Contains(taskbarWindow)) + { + TaskbarWindowManager._taskbarWindowList.Remove(taskbarWindow); + } + taskbarWindow.Dispose(); + taskbarWindow = null; + } + } + + /// + /// Sets the given tabbed thumbnail preview object as being active on the taskbar tabbed thumbnails list. + /// Call this method to keep the application and the taskbar in sync as to which window/control + /// is currently active (or selected, in the case of tabbed application). + /// + /// TabbedThumbnail for the specific control/indow that is currently active in the application + /// If the control/window is not yet added to the tabbed thumbnails list + public void SetActiveTab(TabbedThumbnail preview) + { + if (preview == null) { throw new ArgumentNullException("preview"); } + + if (preview.WindowHandle != IntPtr.Zero) + { + if (!_tabbedThumbnailCache.ContainsKey(preview.WindowHandle)) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewNotAdded, "preview"); + } + TaskbarWindowManager.SetActiveTab(_tabbedThumbnailCache[preview.WindowHandle].TaskbarWindow); + } + else if (preview.WindowsControl != null) + { + if (!_tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl)) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewNotAdded, "preview"); + } + TaskbarWindowManager.SetActiveTab(_tabbedThumbnailCacheWPF[preview.WindowsControl].TaskbarWindow); + } + } + + /// + /// Sets the given window handle as being active on the taskbar tabbed thumbnails list. + /// Call this method to keep the application and the taskbar in sync as to which window/control + /// is currently active (or selected, in the case of tabbed application). + /// + /// Window handle for the control/window that is currently active in the application + /// If the control/window is not yet added to the tabbed thumbnails list + public void SetActiveTab(IntPtr windowHandle) + { + if (!_tabbedThumbnailCache.ContainsKey(windowHandle)) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewNotAdded, "windowHandle"); + } + TaskbarWindowManager.SetActiveTab(_tabbedThumbnailCache[windowHandle].TaskbarWindow); + } + + /// + /// Sets the given Control/Form window as being active on the taskbar tabbed thumbnails list. + /// Call this method to keep the application and the taskbar in sync as to which window/control + /// is currently active (or selected, in the case of tabbed application). + /// + /// Control/Form that is currently active in the application + /// If the control/window is not yet added to the tabbed thumbnails list + public void SetActiveTab(Control control) + { + if (control == null) + { + throw new ArgumentNullException("control"); + } + SetActiveTab(control.Handle); + } + + /// + /// Sets the given WPF window as being active on the taskbar tabbed thumbnails list. + /// Call this method to keep the application and the taskbar in sync as to which window/control + /// is currently active (or selected, in the case of tabbed application). + /// + /// WPF control that is currently active in the application + /// If the control/window is not yet added to the tabbed thumbnails list + public void SetActiveTab(UIElement windowsControl) + { + if (windowsControl == null) + { + throw new ArgumentNullException("windowsControl"); + } + + if (!_tabbedThumbnailCacheWPF.ContainsKey(windowsControl)) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewNotAdded, "windowsControl"); + } + TaskbarWindowManager.SetActiveTab(_tabbedThumbnailCacheWPF[windowsControl].TaskbarWindow); + + } + + /// + /// Determines whether the given preview has been added to the taskbar's tabbed thumbnail list. + /// + /// The preview to locate on the taskbar's tabbed thumbnail list + /// true if the tab is already added on the taskbar; otherwise, false. + public bool IsThumbnailPreviewAdded(TabbedThumbnail preview) + { + if (preview == null) + { + throw new ArgumentNullException("preview"); + } + + if (preview.WindowHandle != IntPtr.Zero && _tabbedThumbnailCache.ContainsKey(preview.WindowHandle)) + { + return true; + } + else if (preview.WindowsControl != null && _tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl)) + { + return true; + } + + return false; + } + + /// + /// Determines whether the given window has been added to the taskbar's tabbed thumbnail list. + /// + /// The window to locate on the taskbar's tabbed thumbnail list + /// true if the tab is already added on the taskbar; otherwise, false. + public bool IsThumbnailPreviewAdded(IntPtr windowHandle) + { + if (windowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerInvalidHandle, "windowHandle"); + } + + return _tabbedThumbnailCache.ContainsKey(windowHandle); + } + + /// + /// Determines whether the given control has been added to the taskbar's tabbed thumbnail list. + /// + /// The preview to locate on the taskbar's tabbed thumbnail list + /// true if the tab is already added on the taskbar; otherwise, false. + public bool IsThumbnailPreviewAdded(Control control) + { + if (control == null) + { + throw new ArgumentNullException("control"); + } + + return _tabbedThumbnailCache.ContainsKey(control.Handle); + } + + /// + /// Determines whether the given control has been added to the taskbar's tabbed thumbnail list. + /// + /// The preview to locate on the taskbar's tabbed thumbnail list + /// true if the tab is already added on the taskbar; otherwise, false. + public bool IsThumbnailPreviewAdded(UIElement control) + { + if (control == null) + { + throw new ArgumentNullException("control"); + } + + return _tabbedThumbnailCacheWPF.ContainsKey(control); + } + + /// + /// Invalidates all the tabbed thumbnails. This will force the Desktop Window Manager + /// to not use the cached thumbnail or preview or aero peek and request a new one next time. + /// + /// This method should not be called frequently. + /// Doing so can lead to poor performance as new bitmaps are created and retrieved. + public void InvalidateThumbnails() + { + // Invalidate all the previews currently in our cache. + // This will ensure we get updated bitmaps next time + + foreach (TabbedThumbnail thumbnail in _tabbedThumbnailCache.Values) + { + TaskbarWindowManager.InvalidatePreview(thumbnail.TaskbarWindow); + thumbnail.SetImage(IntPtr.Zero); // TODO: Investigate this, and why it needs to be called. + } + + foreach (TabbedThumbnail thumbnail in _tabbedThumbnailCacheWPF.Values) + { + TaskbarWindowManager.InvalidatePreview(thumbnail.TaskbarWindow); + thumbnail.SetImage(IntPtr.Zero); + } + } + + /// + /// Clear a clip that is already in place and return to the default display of the thumbnail. + /// + /// The handle to a window represented in the taskbar. This has to be a top-level window. + public static void ClearThumbnailClip(IntPtr windowHandle) + { + TaskbarList.Instance.SetThumbnailClip(windowHandle, IntPtr.Zero); + } + + /// + /// Selects a portion of a window's client area to display as that window's thumbnail in the taskbar. + /// + /// The handle to a window represented in the taskbar. This has to be a top-level window. + /// Rectangle structure that specifies a selection within the window's client area, + /// relative to the upper-left corner of that client area. + /// If this parameter is null, the clipping area will be cleared and the default display of the thumbnail will be used instead. + public void SetThumbnailClip(IntPtr windowHandle, Rectangle? clippingRectangle) + { + if (clippingRectangle == null) + { + ClearThumbnailClip(windowHandle); + return; + } + + NativeRect rect = new NativeRect(); + rect.Left = clippingRectangle.Value.Left; + rect.Top = clippingRectangle.Value.Top; + rect.Right = clippingRectangle.Value.Right; + rect.Bottom = clippingRectangle.Value.Bottom; + + IntPtr rectPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(rect)); + try + { + Marshal.StructureToPtr(rect, rectPtr, true); + TaskbarList.Instance.SetThumbnailClip(windowHandle, rectPtr); + } + finally + { + Marshal.FreeCoTaskMem(rectPtr); + } + } + + /// + /// Moves an existing thumbnail to a new position in the application's group. + /// + /// Preview for the window whose order is being changed. + /// This value is required, must already be added via AddThumbnailPreview method, and cannot be null. + /// The preview of the tab window whose thumbnail that previewToChange is inserted to the left of. + /// This preview must already be added via AddThumbnailPreview. If this value is null, the previewToChange tab is added to the end of the list. + /// + public static void SetTabOrder(TabbedThumbnail previewToChange, TabbedThumbnail insertBeforePreview) + { + if (previewToChange == null) + { + throw new ArgumentNullException("previewToChange"); + } + + IntPtr handleToReorder = previewToChange.TaskbarWindow.WindowToTellTaskbarAbout; + + if (insertBeforePreview == null) + { + TaskbarList.Instance.SetTabOrder(handleToReorder, IntPtr.Zero); + } + else + { + IntPtr handleBefore = insertBeforePreview.TaskbarWindow.WindowToTellTaskbarAbout; + TaskbarList.Instance.SetTabOrder(handleToReorder, handleBefore); + } + } + } +} diff --git a/Shell/Taskbar/TabbedThumbnailProxyWindow.cs b/Shell/Taskbar/TabbedThumbnailProxyWindow.cs new file mode 100644 index 0000000..c71bebe --- /dev/null +++ b/Shell/Taskbar/TabbedThumbnailProxyWindow.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Windows; +using System.Windows.Forms; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + internal sealed class TabbedThumbnailProxyWindow : Form, IDisposable + { + + internal TabbedThumbnailProxyWindow(TabbedThumbnail preview) + { + TabbedThumbnail = preview; + Size = new System.Drawing.Size(1, 1); + + if (!string.IsNullOrEmpty(preview.Title)) + { + Text = preview.Title; + } + + if (preview.WindowsControl != null) + { + WindowsControl = preview.WindowsControl; + } + } + + internal TabbedThumbnail TabbedThumbnail { get; private set; } + + internal UIElement WindowsControl { get; private set; } + + internal IntPtr WindowToTellTaskbarAbout { get { return this.Handle; } } + + protected override void WndProc(ref Message m) + { + bool handled = false; + + if (this.TabbedThumbnail != null) + { + handled = TaskbarWindowManager.DispatchMessage(ref m, this.TabbedThumbnail.TaskbarWindow); + } + + // If it's a WM_Destroy message, then also forward it to the base class (our native window) + if ((m.Msg == (int)WindowMessage.Destroy) || + (m.Msg == (int)WindowMessage.NCDestroy) || + ((m.Msg == (int)WindowMessage.SystemCommand) && (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose))) + { + base.WndProc(ref m); + } + else if (!handled) { base.WndProc(ref m); } + } + + #region IDisposable Members + + /// + /// + /// + ~TabbedThumbnailProxyWindow() + { + Dispose(false); + } + + /// + /// Release the native objects. + /// + void IDisposable.Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + // Dispose managed resources + if (TabbedThumbnail != null) { TabbedThumbnail.Dispose(); } + + TabbedThumbnail = null; + + WindowsControl = null; + } + + base.Dispose(disposing); + } + + #endregion + } +} \ No newline at end of file diff --git a/Shell/Taskbar/TabbedThumbnailScreenCapture.cs b/Shell/Taskbar/TabbedThumbnailScreenCapture.cs new file mode 100644 index 0000000..041437e --- /dev/null +++ b/Shell/Taskbar/TabbedThumbnailScreenCapture.cs @@ -0,0 +1,181 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Drawing; +using System.IO; +using System.Windows; +using System.Windows.Interop; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using Microsoft.WindowsAPICodePack.Shell; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Helper class to capture a control or window as System.Drawing.Bitmap + /// + public static class TabbedThumbnailScreenCapture + { + /// + /// Captures a screenshot of the specified window at the specified + /// bitmap size. NOTE: This method will not accurately capture controls + /// that are hidden or obstructed (partially or completely) by another control (e.g. hidden tabs, + /// or MDI child windows that are obstructed by other child windows/forms). + /// + /// The window handle. + /// The requested bitmap size. + /// A screen capture of the window. + public static Bitmap GrabWindowBitmap(IntPtr windowHandle, System.Drawing.Size bitmapSize) + { + if (bitmapSize.Height <= 0 || bitmapSize.Width <= 0) { return null; } + + IntPtr windowDC = IntPtr.Zero; + + try + { + windowDC = TabbedThumbnailNativeMethods.GetWindowDC(windowHandle); + + System.Drawing.Size realWindowSize; + TabbedThumbnailNativeMethods.GetClientSize(windowHandle, out realWindowSize); + + if (realWindowSize == System.Drawing.Size.Empty) + { + realWindowSize = new System.Drawing.Size(200, 200); + } + + System.Drawing.Size size = (bitmapSize == System.Drawing.Size.Empty) ? + realWindowSize : bitmapSize; + + Bitmap targetBitmap = null; + try + { + + + targetBitmap = new Bitmap(size.Width, size.Height); + + using (Graphics targetGr = Graphics.FromImage(targetBitmap)) + { + IntPtr targetDC = targetGr.GetHdc(); + uint operation = 0x00CC0020 /*SRCCOPY*/; + + System.Drawing.Size ncArea = WindowUtilities.GetNonClientArea(windowHandle); + + bool success = TabbedThumbnailNativeMethods.StretchBlt( + targetDC, 0, 0, targetBitmap.Width, targetBitmap.Height, + windowDC, ncArea.Width, ncArea.Height, realWindowSize.Width, + realWindowSize.Height, operation); + + targetGr.ReleaseHdc(targetDC); + + if (!success) { return null; } + + return targetBitmap; + } + } + catch + { + if (targetBitmap != null) { targetBitmap.Dispose(); } + throw; + } + } + finally + { + if (windowDC != IntPtr.Zero) + { + TabbedThumbnailNativeMethods.ReleaseDC(windowHandle, windowDC); + } + } + } + + /// + /// Grabs a snapshot of a WPF UIElement and returns the image as Bitmap. + /// + /// Represents the element to take the snapshot from. + /// Represents the X DPI value used to capture this snapshot. + /// Represents the Y DPI value used to capture this snapshot. + /// The requested bitmap width. + /// The requested bitmap height. + /// Returns the bitmap (PNG format). + public static Bitmap GrabWindowBitmap(UIElement element, int dpiX, int dpiY, int width, int height) + { + // Special case for HwndHost controls + HwndHost host = element as HwndHost; + if (host != null) + { + IntPtr handle = host.Handle; + return GrabWindowBitmap(handle, new System.Drawing.Size(width, height)); + } + + Rect bounds = VisualTreeHelper.GetDescendantBounds(element); + + // create the renderer. + if (bounds.Height == 0 || bounds.Width == 0) + { + return null; // 0 sized element. Probably hidden + } + + RenderTargetBitmap rendertarget = new RenderTargetBitmap((int)(bounds.Width * dpiX / 96.0), + (int)(bounds.Height * dpiY / 96.0), dpiX, dpiY, PixelFormats.Default); + + DrawingVisual dv = new DrawingVisual(); + using (DrawingContext ctx = dv.RenderOpen()) + { + VisualBrush vb = new VisualBrush(element); + ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point(), bounds.Size)); + } + + rendertarget.Render(dv); + + BitmapEncoder bmpe = new PngBitmapEncoder(); + bmpe.Frames.Add(BitmapFrame.Create(rendertarget)); + + Bitmap bmp; + // Create a MemoryStream with the image. + using (MemoryStream fl = new MemoryStream()) + { + bmpe.Save(fl); + fl.Position = 0; + bmp = new Bitmap(fl); + } + + return (Bitmap)bmp.GetThumbnailImage(width, height, null, IntPtr.Zero); + } + + /// + /// Resizes the given bitmap while maintaining the aspect ratio. + /// + /// Original/source bitmap + /// Maximum width for the new image + /// Maximum height for the new image + /// If true and requested image is wider than the source, the new image is resized accordingly. + /// + internal static Bitmap ResizeImageWithAspect(IntPtr originalHBitmap, int newWidth, int maxHeight, bool resizeIfWider) + { + Bitmap originalBitmap = Bitmap.FromHbitmap(originalHBitmap); + + try + { + if (resizeIfWider && originalBitmap.Width <= newWidth) + { + newWidth = originalBitmap.Width; + } + + int newHeight = originalBitmap.Height * newWidth / originalBitmap.Width; + + if (newHeight > maxHeight) // Height resize if necessary + { + newWidth = originalBitmap.Width * maxHeight / originalBitmap.Height; + newHeight = maxHeight; + } + + // Create the new image with the sizes we've calculated + return (Bitmap)originalBitmap.GetThumbnailImage(newWidth, newHeight, null, IntPtr.Zero); + } + finally + { + originalBitmap.Dispose(); + originalBitmap = null; + } + } + } +} diff --git a/Shell/Taskbar/TaskbarEnums.cs b/Shell/Taskbar/TaskbarEnums.cs new file mode 100644 index 0000000..5fafb2f --- /dev/null +++ b/Shell/Taskbar/TaskbarEnums.cs @@ -0,0 +1,65 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + + internal enum TaskbarProxyWindowType + { + TabbedThumbnail, + ThumbnailToolbar, + } + + /// + /// Known category to display + /// + public enum JumpListKnownCategoryType + { + /// + /// Don't display either known category. You must have at least one + /// user task or custom category link in order to not see the + /// default 'Recent' known category + /// + Neither = 0, + + /// + /// Display the 'Recent' known category + /// + Recent, + + /// + /// Display the 'Frequent' known category + /// + Frequent, + } + + /// + /// Represents the thumbnail progress bar state. + /// + public enum TaskbarProgressBarState + { + /// + /// No progress is displayed. + /// + NoProgress = 0, + + /// + /// The progress is indeterminate (marquee). + /// + Indeterminate = 0x1, + + /// + /// Normal progress is displayed. + /// + Normal = 0x2, + + /// + /// An error occurred (red). + /// + Error = 0x4, + + /// + /// The operation is paused (yellow). + /// + Paused = 0x8 + } +} diff --git a/Shell/Taskbar/TaskbarInterfaces.cs b/Shell/Taskbar/TaskbarInterfaces.cs new file mode 100644 index 0000000..efa1d64 --- /dev/null +++ b/Shell/Taskbar/TaskbarInterfaces.cs @@ -0,0 +1,25 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Interface for jump list items + /// + public interface IJumpListItem + { + /// + /// Gets or sets this item's path + /// + string Path { get; set; } + } + + /// + /// Interface for jump list tasks + /// + public abstract class JumpListTask + { + internal abstract IShellLinkW NativeShellLink { get; } + } +} diff --git a/Shell/Taskbar/TaskbarList.cs b/Shell/Taskbar/TaskbarList.cs new file mode 100644 index 0000000..a6ee9f4 --- /dev/null +++ b/Shell/Taskbar/TaskbarList.cs @@ -0,0 +1,33 @@ + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Provides internal access to the functions provided by the ITaskbarList4 interface, + /// without being forced to refer to it through another singleton. + /// + internal static class TaskbarList + { + private static object _syncLock = new object(); + + private static ITaskbarList4 _taskbarList; + internal static ITaskbarList4 Instance + { + get + { + if (_taskbarList == null) + { + lock (_syncLock) + { + if (_taskbarList == null) + { + _taskbarList = (ITaskbarList4)new CTaskbarList(); + _taskbarList.HrInit(); + } + } + } + + return _taskbarList; + } + } + } +} diff --git a/Shell/Taskbar/TaskbarManager.cs b/Shell/Taskbar/TaskbarManager.cs new file mode 100644 index 0000000..80f1677 --- /dev/null +++ b/Shell/Taskbar/TaskbarManager.cs @@ -0,0 +1,317 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Diagnostics; +using System.Windows.Interop; +using MS.WindowsAPICodePack.Internal; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents an instance of the Windows taskbar + /// + public class TaskbarManager + { + // Hide the default constructor + private TaskbarManager() + { + CoreHelpers.ThrowIfNotWin7(); + } + + // Best practice recommends defining a private object to lock on + private static object _syncLock = new object(); + + private static TaskbarManager _instance; + /// + /// Represents an instance of the Windows Taskbar + /// + public static TaskbarManager Instance + { + get + { + if (_instance == null) + { + lock (_syncLock) + { + if (_instance == null) + { + _instance = new TaskbarManager(); + } + } + } + + return _instance; + } + } + + /// + /// Applies an overlay to a taskbar button of the main application window to indicate application status or a notification to the user. + /// + /// The overlay icon + /// String that provides an alt text version of the information conveyed by the overlay, for accessibility purposes + public void SetOverlayIcon(System.Drawing.Icon icon, string accessibilityText) + { + TaskbarList.Instance.SetOverlayIcon( + OwnerHandle, + icon != null ? icon.Handle : IntPtr.Zero, + accessibilityText); + } + + /// + /// Applies an overlay to a taskbar button of the given window handle to indicate application status or a notification to the user. + /// + /// The handle of the window whose associated taskbar button receives the overlay. This handle must belong to a calling process associated with the button's application and must be a valid HWND or the call is ignored. + /// The overlay icon + /// String that provides an alt text version of the information conveyed by the overlay, for accessibility purposes + public void SetOverlayIcon(IntPtr windowHandle, System.Drawing.Icon icon, string accessibilityText) + { + TaskbarList.Instance.SetOverlayIcon( + windowHandle, + icon != null ? icon.Handle : IntPtr.Zero, + accessibilityText); + } + + /// + /// Applies an overlay to a taskbar button of the given WPF window to indicate application status or a notification to the user. + /// + /// The window whose associated taskbar button receives the overlay. This window belong to a calling process associated with the button's application and must be already loaded. + /// The overlay icon + /// String that provides an alt text version of the information conveyed by the overlay, for accessibility purposes + public void SetOverlayIcon(System.Windows.Window window, System.Drawing.Icon icon, string accessibilityText) + { + TaskbarList.Instance.SetOverlayIcon( + (new WindowInteropHelper(window)).Handle, + icon != null ? icon.Handle : IntPtr.Zero, + accessibilityText); + } + + /// + /// Displays or updates a progress bar hosted in a taskbar button of the main application window + /// to show the specific percentage completed of the full operation. + /// + /// An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called. + /// An application-defined value that specifies the value currentValue will have when the operation is complete. + public void SetProgressValue(int currentValue, int maximumValue) + { + TaskbarList.Instance.SetProgressValue( + OwnerHandle, + Convert.ToUInt32(currentValue), + Convert.ToUInt32(maximumValue)); + } + + /// + /// Displays or updates a progress bar hosted in a taskbar button of the given window handle + /// to show the specific percentage completed of the full operation. + /// + /// The handle of the window whose associated taskbar button is being used as a progress indicator. + /// This window belong to a calling process associated with the button's application and must be already loaded. + /// An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called. + /// An application-defined value that specifies the value currentValue will have when the operation is complete. + public void SetProgressValue(int currentValue, int maximumValue, IntPtr windowHandle) + { + TaskbarList.Instance.SetProgressValue( + windowHandle, + Convert.ToUInt32(currentValue), + Convert.ToUInt32(maximumValue)); + } + + /// + /// Displays or updates a progress bar hosted in a taskbar button of the given WPF window + /// to show the specific percentage completed of the full operation. + /// + /// The window whose associated taskbar button is being used as a progress indicator. + /// This window belong to a calling process associated with the button's application and must be already loaded. + /// An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called. + /// An application-defined value that specifies the value currentValue will have when the operation is complete. + public void SetProgressValue(int currentValue, int maximumValue, System.Windows.Window window) + { + TaskbarList.Instance.SetProgressValue( + (new WindowInteropHelper(window)).Handle, + Convert.ToUInt32(currentValue), + Convert.ToUInt32(maximumValue)); + } + + /// + /// Sets the type and state of the progress indicator displayed on a taskbar button of the main application window. + /// + /// Progress state of the progress button + public void SetProgressState(TaskbarProgressBarState state) + { + TaskbarList.Instance.SetProgressState(OwnerHandle, (TaskbarProgressBarStatus)state); + } + + /// + /// Sets the type and state of the progress indicator displayed on a taskbar button + /// of the given window handle + /// + /// The handle of the window whose associated taskbar button is being used as a progress indicator. + /// This window belong to a calling process associated with the button's application and must be already loaded. + /// Progress state of the progress button + public void SetProgressState(TaskbarProgressBarState state, IntPtr windowHandle) + { + TaskbarList.Instance.SetProgressState(windowHandle, (TaskbarProgressBarStatus)state); + } + + /// + /// Sets the type and state of the progress indicator displayed on a taskbar button + /// of the given WPF window + /// + /// The window whose associated taskbar button is being used as a progress indicator. + /// This window belong to a calling process associated with the button's application and must be already loaded. + /// Progress state of the progress button + public void SetProgressState(TaskbarProgressBarState state, System.Windows.Window window) + { + TaskbarList.Instance.SetProgressState( + (new WindowInteropHelper(window)).Handle, + (TaskbarProgressBarStatus)state); + } + + private TabbedThumbnailManager _tabbedThumbnail; + /// + /// Gets the Tabbed Thumbnail manager class for adding/updating + /// tabbed thumbnail previews. + /// + public TabbedThumbnailManager TabbedThumbnail + { + get + { + if (_tabbedThumbnail == null) + { + _tabbedThumbnail = new TabbedThumbnailManager(); + } + return _tabbedThumbnail; + } + } + + private ThumbnailToolBarManager _thumbnailToolBarManager; + /// + /// Gets the Thumbnail toolbar manager class for adding/updating + /// toolbar buttons. + /// + public ThumbnailToolBarManager ThumbnailToolBars + { + get + { + if (_thumbnailToolBarManager == null) + { + _thumbnailToolBarManager = new ThumbnailToolBarManager(); + } + + return _thumbnailToolBarManager; + } + } + + /// + /// Gets or sets the application user model id. Use this to explicitly + /// set the application id when generating custom jump lists + /// + public string ApplicationId + { + get + { + return GetCurrentProcessAppId(); + } + set + { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value"); + } + + SetCurrentProcessAppId(value); + ApplicationIdSetProcessWide = true; + } + } + + private IntPtr _ownerHandle; + /// + /// Sets the handle of the window whose taskbar button will be used + /// to display progress. + /// + internal IntPtr OwnerHandle + { + get + { + if (_ownerHandle == IntPtr.Zero) + { + Process currentProcess = Process.GetCurrentProcess(); + + if (currentProcess == null || currentProcess.MainWindowHandle == IntPtr.Zero) + { + throw new InvalidOperationException(LocalizedMessages.TaskbarManagerValidWindowRequired); + } + + _ownerHandle = currentProcess.MainWindowHandle; + } + + return _ownerHandle; + } + } + + /// + /// Sets the application user model id for an individual window + /// + /// The app id to set + /// Window handle for the window that needs a specific application id + /// AppId specifies a unique Application User Model ID (AppID) for the application or individual + /// top-level window whose taskbar button will hold the custom JumpList built through the methods class. + /// By setting an appId for a specific window, the window will not be grouped with it's parent window/application. Instead it will have it's own taskbar button. + public void SetApplicationIdForSpecificWindow(IntPtr windowHandle, string appId) + { + // Left as instance method, to follow singleton pattern. + TaskbarNativeMethods.SetWindowAppId(windowHandle, appId); + } + + /// + /// Sets the application user model id for a given window + /// + /// The app id to set + /// Window that needs a specific application id + /// AppId specifies a unique Application User Model ID (AppID) for the application or individual + /// top-level window whose taskbar button will hold the custom JumpList built through the methods class. + /// By setting an appId for a specific window, the window will not be grouped with it's parent window/application. Instead it will have it's own taskbar button. + public void SetApplicationIdForSpecificWindow(System.Windows.Window window, string appId) + { + // Left as instance method, to follow singleton pattern. + TaskbarNativeMethods.SetWindowAppId((new WindowInteropHelper(window)).Handle, appId); + } + + /// + /// Sets the current process' explicit application user model id. + /// + /// The application id. + private void SetCurrentProcessAppId(string appId) + { + TaskbarNativeMethods.SetCurrentProcessExplicitAppUserModelID(appId); + } + + /// + /// Gets the current process' explicit application user model id. + /// + /// The app id or null if no app id has been defined. + private string GetCurrentProcessAppId() + { + string appId = string.Empty; + TaskbarNativeMethods.GetCurrentProcessExplicitAppUserModelID(out appId); + return appId; + } + + /// + /// Indicates if the user has set the application id for the whole process (all windows) + /// + internal bool ApplicationIdSetProcessWide { get; private set; } + + /// + /// Indicates whether this feature is supported on the current platform. + /// + public static bool IsPlatformSupported + { + get + { + // We need Windows 7 onwards ... + return CoreHelpers.RunningOnWin7; + } + } + } +} diff --git a/Shell/Taskbar/TaskbarWindow.cs b/Shell/Taskbar/TaskbarWindow.cs new file mode 100644 index 0000000..c141662 --- /dev/null +++ b/Shell/Taskbar/TaskbarWindow.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Windows; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + internal class TaskbarWindow : IDisposable + { + internal TabbedThumbnailProxyWindow TabbedThumbnailProxyWindow { get; set; } + + internal ThumbnailToolbarProxyWindow ThumbnailToolbarProxyWindow { get; set; } + + internal bool EnableTabbedThumbnails { get; set; } + + internal bool EnableThumbnailToolbars { get; set; } + + internal IntPtr UserWindowHandle { get; set; } + + internal UIElement WindowsControl { get; set; } + + private TabbedThumbnail _tabbedThumbnailPreview; + internal TabbedThumbnail TabbedThumbnail + { + get { return _tabbedThumbnailPreview; } + set + { + if (_tabbedThumbnailPreview != null) + { + throw new InvalidOperationException(LocalizedMessages.TaskbarWindowValueSet); + } + + TabbedThumbnailProxyWindow = new TabbedThumbnailProxyWindow(value); + _tabbedThumbnailPreview = value; + _tabbedThumbnailPreview.TaskbarWindow = this; + } + } + + private ThumbnailToolBarButton[] _thumbnailButtons; + internal ThumbnailToolBarButton[] ThumbnailButtons + { + get { return _thumbnailButtons; } + set + { + _thumbnailButtons = value; + UpdateHandles(); + } + } + + private void UpdateHandles() + { + foreach (ThumbnailToolBarButton button in _thumbnailButtons) + { + button.WindowHandle = WindowToTellTaskbarAbout; + button.AddedToTaskbar = false; + } + } + + + // TODO: Verify the logic of this property. There are situations where this will throw InvalidOperationException when it shouldn't. + internal IntPtr WindowToTellTaskbarAbout + { + get + { + if (EnableThumbnailToolbars && !EnableTabbedThumbnails && ThumbnailToolbarProxyWindow != null) + { + return ThumbnailToolbarProxyWindow.WindowToTellTaskbarAbout; + } + else if (!EnableThumbnailToolbars && EnableTabbedThumbnails && TabbedThumbnailProxyWindow != null) + { + return TabbedThumbnailProxyWindow.WindowToTellTaskbarAbout; + } + // Bug: What should happen when TabedThumbnailProxyWindow IS null, but it is enabled? + // This occurs during the TabbedThumbnailProxyWindow constructor at line 31. + else if (EnableTabbedThumbnails && EnableThumbnailToolbars && TabbedThumbnailProxyWindow != null) + { + return TabbedThumbnailProxyWindow.WindowToTellTaskbarAbout; + } + + throw new InvalidOperationException(); + } + } + + internal void SetTitle(string title) + { + if (TabbedThumbnailProxyWindow == null) + { + throw new InvalidOperationException(LocalizedMessages.TasbarWindowProxyWindowSet); + } + TabbedThumbnailProxyWindow.Text = title; + } + + internal TaskbarWindow(IntPtr userWindowHandle, params ThumbnailToolBarButton[] buttons) + { + if (userWindowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "userWindowHandle"); + } + + if (buttons == null || buttons.Length == 0) + { + throw new ArgumentException(LocalizedMessages.TaskbarWindowEmptyButtonArray, "buttons"); + } + + // Create our proxy window + ThumbnailToolbarProxyWindow = new ThumbnailToolbarProxyWindow(userWindowHandle, buttons); + ThumbnailToolbarProxyWindow.TaskbarWindow = this; + + // Set our current state + EnableThumbnailToolbars = true; + EnableTabbedThumbnails = false; + + // + this.ThumbnailButtons = buttons; + UserWindowHandle = userWindowHandle; + WindowsControl = null; + } + + internal TaskbarWindow(System.Windows.UIElement windowsControl, params ThumbnailToolBarButton[] buttons) + { + if (windowsControl == null) + { + throw new ArgumentNullException("windowsControl"); + } + + if (buttons == null || buttons.Length == 0) + { + throw new ArgumentException(LocalizedMessages.TaskbarWindowEmptyButtonArray, "buttons"); + } + + // Create our proxy window + ThumbnailToolbarProxyWindow = new ThumbnailToolbarProxyWindow(windowsControl, buttons); + ThumbnailToolbarProxyWindow.TaskbarWindow = this; + + // Set our current state + EnableThumbnailToolbars = true; + EnableTabbedThumbnails = false; + + this.ThumbnailButtons = buttons; + UserWindowHandle = IntPtr.Zero; + WindowsControl = windowsControl; + } + + internal TaskbarWindow(TabbedThumbnail preview) + { + if (preview == null) { throw new ArgumentNullException("preview"); } + + // Create our proxy window + // Bug: This is only called in this constructor. Which will cause the property + // to fail if TaskbarWindow is initialized from a different constructor. + TabbedThumbnailProxyWindow = new TabbedThumbnailProxyWindow(preview); + + // set our current state + EnableThumbnailToolbars = false; + EnableTabbedThumbnails = true; + + // copy values + UserWindowHandle = preview.WindowHandle; + WindowsControl = preview.WindowsControl; + TabbedThumbnail = preview; + } + + #region IDisposable Members + + /// + /// + /// + ~TaskbarWindow() + { + Dispose(false); + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + public void Dispose(bool disposing) + { + if (disposing) + { + // Dispose managed resources + if (_tabbedThumbnailPreview != null) + { + _tabbedThumbnailPreview.Dispose(); + } + _tabbedThumbnailPreview = null; + + if (ThumbnailToolbarProxyWindow != null) + { + ThumbnailToolbarProxyWindow.Dispose(); + } + ThumbnailToolbarProxyWindow = null; + + if (TabbedThumbnailProxyWindow != null) + { + TabbedThumbnailProxyWindow.Dispose(); + } + TabbedThumbnailProxyWindow = null; + + // Don't dispose the thumbnail buttons as they might be used in another window. + // Setting them to null will indicate we don't need use anymore. + _thumbnailButtons = null; + } + } + + #endregion + } +} diff --git a/Shell/Taskbar/TaskbarWindowManager.cs b/Shell/Taskbar/TaskbarWindowManager.cs new file mode 100644 index 0000000..e750b1b --- /dev/null +++ b/Shell/Taskbar/TaskbarWindowManager.cs @@ -0,0 +1,794 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using System.Windows.Media; +using Microsoft.WindowsAPICodePack.Shell; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + internal static class TaskbarWindowManager + { + internal static List _taskbarWindowList = new List(); + + private static bool _buttonsAdded; + + internal static void AddThumbnailButtons(IntPtr userWindowHandle, params ThumbnailToolBarButton[] buttons) + { + // Try to get an existing taskbar window for this user windowhandle + TaskbarWindow taskbarWindow = GetTaskbarWindow(userWindowHandle, TaskbarProxyWindowType.ThumbnailToolbar); + TaskbarWindow temp = null; + try + { + AddThumbnailButtons( + taskbarWindow ?? (temp = new TaskbarWindow(userWindowHandle, buttons)), + taskbarWindow == null, + buttons); + } + catch + { + if (temp != null) { temp.Dispose(); } + throw; + } + } + + internal static void AddThumbnailButtons(System.Windows.UIElement control, params ThumbnailToolBarButton[] buttons) + { + // Try to get an existing taskbar window for this user uielement + TaskbarWindow taskbarWindow = GetTaskbarWindow(control, TaskbarProxyWindowType.ThumbnailToolbar); + TaskbarWindow temp = null; + try + { + AddThumbnailButtons( + taskbarWindow ?? (temp = new TaskbarWindow(control, buttons)), + taskbarWindow == null, + buttons); + } + catch + { + if (temp != null) { temp.Dispose(); } + throw; + } + } + + private static void AddThumbnailButtons(TaskbarWindow taskbarWindow, bool add, params ThumbnailToolBarButton[] buttons) + { + if (add) + { + _taskbarWindowList.Add(taskbarWindow); + } + else if (taskbarWindow.ThumbnailButtons == null) + { + taskbarWindow.ThumbnailButtons = buttons; + } + else + { + // We already have buttons assigned + throw new InvalidOperationException(LocalizedMessages.TaskbarWindowManagerButtonsAlreadyAdded); + } + } + + internal static void AddTabbedThumbnail(TabbedThumbnail preview) + { + // Create a TOP-LEVEL proxy window for the user's source window/control + TaskbarWindow taskbarWindow = null; + + // get the TaskbarWindow for UIElement/WindowHandle respectfully. + if (preview.WindowHandle == IntPtr.Zero) + { + taskbarWindow = GetTaskbarWindow(preview.WindowsControl, TaskbarProxyWindowType.TabbedThumbnail); + } + else + { + taskbarWindow = GetTaskbarWindow(preview.WindowHandle, TaskbarProxyWindowType.TabbedThumbnail); + } + + //create taskbar, or set its TabbedThumbnail + if (taskbarWindow == null) + { + taskbarWindow = new TaskbarWindow(preview); + _taskbarWindowList.Add(taskbarWindow); + } + else if (taskbarWindow.TabbedThumbnail == null) + { + taskbarWindow.TabbedThumbnail = preview; + } + + // Listen for Title changes + preview.TitleChanged += new EventHandler(thumbnailPreview_TitleChanged); + preview.TooltipChanged += new EventHandler(thumbnailPreview_TooltipChanged); + + // Get/Set properties for proxy window + IntPtr windowHandle = taskbarWindow.WindowToTellTaskbarAbout; + + // Register this new tab and set it as being active. + TaskbarList.Instance.RegisterTab(windowHandle, preview.ParentWindowHandle); + TaskbarList.Instance.SetTabOrder(windowHandle, IntPtr.Zero); + TaskbarList.Instance.SetTabActive(windowHandle, preview.ParentWindowHandle, 0); + + // We need to make sure we can set these properties even when running with admin + TabbedThumbnailNativeMethods.ChangeWindowMessageFilter( + TabbedThumbnailNativeMethods.WmDwmSendIconicThumbnail, + TabbedThumbnailNativeMethods.MsgfltAdd); + + TabbedThumbnailNativeMethods.ChangeWindowMessageFilter( + TabbedThumbnailNativeMethods.WmDwmSendIconicLivePreviewBitmap, + TabbedThumbnailNativeMethods.MsgfltAdd); + + // BUG: There should be somewhere to disable CustomWindowPreview. I didn't find it. + TabbedThumbnailNativeMethods.EnableCustomWindowPreview(windowHandle, true); + + // Make sure we use the initial title set by the user + // Trigger a "fake" title changed event, so the title is set on the taskbar thumbnail. + // Empty/null title will be ignored. + thumbnailPreview_TitleChanged(preview, EventArgs.Empty); + thumbnailPreview_TooltipChanged(preview, EventArgs.Empty); + + // Indicate to the preview that we've added it on the taskbar + preview.AddedToTaskbar = true; + } + + internal static TaskbarWindow GetTaskbarWindow(System.Windows.UIElement windowsControl, TaskbarProxyWindowType taskbarProxyWindowType) + { + if (windowsControl == null) { throw new ArgumentNullException("windowsControl"); } + + TaskbarWindow toReturn = _taskbarWindowList.FirstOrDefault(window => + { + return (window.TabbedThumbnail != null && window.TabbedThumbnail.WindowsControl == windowsControl) || + (window.ThumbnailToolbarProxyWindow != null && + window.ThumbnailToolbarProxyWindow.WindowsControl == windowsControl); + }); + + if (toReturn != null) + { + if (taskbarProxyWindowType == TaskbarProxyWindowType.ThumbnailToolbar) + { + toReturn.EnableThumbnailToolbars = true; + } + else if (taskbarProxyWindowType == TaskbarProxyWindowType.TabbedThumbnail) + { + toReturn.EnableTabbedThumbnails = true; + } + } + + return toReturn; + } + + internal static TaskbarWindow GetTaskbarWindow(IntPtr userWindowHandle, TaskbarProxyWindowType taskbarProxyWindowType) + { + if (userWindowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "userWindowHandle"); + } + + TaskbarWindow toReturn = _taskbarWindowList.FirstOrDefault(window => window.UserWindowHandle == userWindowHandle); + + // If its not in the list, return null so it can be added. + if (toReturn != null) + { + if (taskbarProxyWindowType == TaskbarProxyWindowType.ThumbnailToolbar) + { + toReturn.EnableThumbnailToolbars = true; + } + else if (taskbarProxyWindowType == TaskbarProxyWindowType.TabbedThumbnail) + { + toReturn.EnableTabbedThumbnails = true; + } + } + + return toReturn; + } + + #region Message dispatch methods + private static void DispatchTaskbarButtonMessages(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) + { + if (m.Msg == (int)TaskbarNativeMethods.WmTaskbarButtonCreated) + { + AddButtons(taskbarWindow); + } + else + { + if (!_buttonsAdded) + { + AddButtons(taskbarWindow); + } + + if (m.Msg == TaskbarNativeMethods.WmCommand && + CoreNativeMethods.GetHiWord(m.WParam.ToInt64(), 16) == ThumbButton.Clicked) + { + int buttonId = CoreNativeMethods.GetLoWord(m.WParam.ToInt64()); + + var buttonsFound = + from b in taskbarWindow.ThumbnailButtons + where b.Id == buttonId + select b; + + foreach (ThumbnailToolBarButton button in buttonsFound) + { + button.FireClick(taskbarWindow); + } + } + } + } + + private static bool DispatchActivateMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) + { + if (m.Msg == (int)WindowMessage.Activate) + { + // Raise the event + taskbarWindow.TabbedThumbnail.OnTabbedThumbnailActivated(); + SetActiveTab(taskbarWindow); + return true; + } + return false; + } + + private static bool DispatchSendIconThumbnailMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) + { + if (m.Msg == (int)TaskbarNativeMethods.WmDwmSendIconThumbnail) + { + int width = (int)((long)m.LParam >> 16); + int height = (int)(((long)m.LParam) & (0xFFFF)); + Size requestedSize = new Size(width, height); + + // Fire an event to let the user update their bitmap + taskbarWindow.TabbedThumbnail.OnTabbedThumbnailBitmapRequested(); + + IntPtr hBitmap = IntPtr.Zero; + + // Default size for the thumbnail + Size realWindowSize = new Size(200, 200); + + // Get the size of teh control or UIElement + if (taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero) + { + TabbedThumbnailNativeMethods.GetClientSize(taskbarWindow.TabbedThumbnail.WindowHandle, out realWindowSize); + } + else if (taskbarWindow.TabbedThumbnail.WindowsControl != null) + { + realWindowSize = new Size( + Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Width), + Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Height)); + } + + if (realWindowSize.Height == -1 && realWindowSize.Width == -1) + { + realWindowSize.Width = realWindowSize.Height = 199; + } + + // capture the bitmap for the given control + // If the user has already specified us a bitmap to use, use that. + if (taskbarWindow.TabbedThumbnail.ClippingRectangle != null && + taskbarWindow.TabbedThumbnail.ClippingRectangle.Value != Rectangle.Empty) + { + if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + hBitmap = GrabBitmap(taskbarWindow, realWindowSize); + } + else + { + hBitmap = taskbarWindow.TabbedThumbnail.CurrentHBitmap; + } + + // Clip the bitmap we just got. + Bitmap bmp = Bitmap.FromHbitmap(hBitmap); + + Rectangle clippingRectangle = taskbarWindow.TabbedThumbnail.ClippingRectangle.Value; + + // If our clipping rect is out of bounds, update it + if (clippingRectangle.Height > requestedSize.Height) + { + clippingRectangle.Height = requestedSize.Height; + } + if (clippingRectangle.Width > requestedSize.Width) + { + clippingRectangle.Width = requestedSize.Width; + } + + // NOTE: Is this a memory leak? + bmp = bmp.Clone(clippingRectangle, bmp.PixelFormat); + + // Make sure we dispose the bitmap before assigning, otherwise we'll have a memory leak + if (hBitmap != IntPtr.Zero && taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + ShellNativeMethods.DeleteObject(hBitmap); + } + hBitmap = bmp.GetHbitmap(); + bmp.Dispose(); + } + else + { + // Else, user didn't want any clipping, if they haven't provided us a bitmap, + // use the screencapture utility and capture it. + + hBitmap = taskbarWindow.TabbedThumbnail.CurrentHBitmap; + + // If no bitmap, capture one using the utility + if (hBitmap == IntPtr.Zero) + { + hBitmap = GrabBitmap(taskbarWindow, realWindowSize); + } + } + + // Only set the thumbnail if it's not null. + // If it's null (either we didn't get the bitmap or size was 0), + // let DWM handle it + if (hBitmap != IntPtr.Zero) + { + Bitmap temp = TabbedThumbnailScreenCapture.ResizeImageWithAspect( + hBitmap, requestedSize.Width, requestedSize.Height, true); + + if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + ShellNativeMethods.DeleteObject(hBitmap); + } + + hBitmap = temp.GetHbitmap(); + TabbedThumbnailNativeMethods.SetIconicThumbnail(taskbarWindow.WindowToTellTaskbarAbout, hBitmap); + temp.Dispose(); + } + + // If the bitmap we have is not coming from the user (i.e. we created it here), + // then make sure we delete it as we don't need it now. + if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + ShellNativeMethods.DeleteObject(hBitmap); + } + + return true; + } + return false; + } + + private static bool DispatchLivePreviewBitmapMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) + { + if (m.Msg == (int)TaskbarNativeMethods.WmDwmSendIconicLivePreviewBitmap) + { + // Try to get the width/height + int width = (int)(((long)m.LParam) >> 16); + int height = (int)(((long)m.LParam) & (0xFFFF)); + + // Default size for the thumbnail + Size realWindowSize = new Size(200, 200); + + if (taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero) + { + TabbedThumbnailNativeMethods.GetClientSize(taskbarWindow.TabbedThumbnail.WindowHandle, out realWindowSize); + } + else if (taskbarWindow.TabbedThumbnail.WindowsControl != null) + { + realWindowSize = new Size( + Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Width), + Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Height)); + } + + // If we don't have a valid height/width, use the original window's size + if (width <= 0) + { + width = realWindowSize.Width; + } + if (height <= 0) + { + height = realWindowSize.Height; + } + + // Fire an event to let the user update their bitmap + // Raise the event + taskbarWindow.TabbedThumbnail.OnTabbedThumbnailBitmapRequested(); + + // capture the bitmap for the given control + // If the user has already specified us a bitmap to use, use that. + IntPtr hBitmap = taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero ? GrabBitmap(taskbarWindow, realWindowSize) : taskbarWindow.TabbedThumbnail.CurrentHBitmap; + + // If we have a valid parent window handle, + // calculate the offset so we can place the "peek" bitmap + // correctly on the app window + if (taskbarWindow.TabbedThumbnail.ParentWindowHandle != IntPtr.Zero && taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero) + { + System.Drawing.Point offset = new System.Drawing.Point(); + + // if we don't have a offset specified already by the user... + if (!taskbarWindow.TabbedThumbnail.PeekOffset.HasValue) + { + offset = WindowUtilities.GetParentOffsetOfChild(taskbarWindow.TabbedThumbnail.WindowHandle, taskbarWindow.TabbedThumbnail.ParentWindowHandle); + } + else + { + offset = new System.Drawing.Point(Convert.ToInt32(taskbarWindow.TabbedThumbnail.PeekOffset.Value.X), + Convert.ToInt32(taskbarWindow.TabbedThumbnail.PeekOffset.Value.Y)); + } + + // Only set the peek bitmap if it's not null. + // If it's null (either we didn't get the bitmap or size was 0), + // let DWM handle it + if (hBitmap != IntPtr.Zero) + { + if (offset.X >= 0 && offset.Y >= 0) + { + TabbedThumbnailNativeMethods.SetPeekBitmap( + taskbarWindow.WindowToTellTaskbarAbout, + hBitmap, offset, + taskbarWindow.TabbedThumbnail.DisplayFrameAroundBitmap); + } + } + + // If the bitmap we have is not coming from the user (i.e. we created it here), + // then make sure we delete it as we don't need it now. + if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + ShellNativeMethods.DeleteObject(hBitmap); + } + + return true; + } + // Else, we don't have a valid window handle from the user. This is mostly likely because + // we have a WPF UIElement control. If that's the case, use a different screen capture method + // and also couple of ways to try to calculate the control's offset w.r.t it's parent. + else if (taskbarWindow.TabbedThumbnail.ParentWindowHandle != IntPtr.Zero && + taskbarWindow.TabbedThumbnail.WindowsControl != null) + { + System.Windows.Point offset; + + if (!taskbarWindow.TabbedThumbnail.PeekOffset.HasValue) + { + // Calculate the offset for a WPF UIElement control + // For hidden controls, we can't seem to perform the transform. + GeneralTransform objGeneralTransform = taskbarWindow.TabbedThumbnail.WindowsControl.TransformToVisual(taskbarWindow.TabbedThumbnail.WindowsControlParentWindow); + offset = objGeneralTransform.Transform(new System.Windows.Point(0, 0)); + } + else + { + offset = new System.Windows.Point(taskbarWindow.TabbedThumbnail.PeekOffset.Value.X, taskbarWindow.TabbedThumbnail.PeekOffset.Value.Y); + } + + // Only set the peek bitmap if it's not null. + // If it's null (either we didn't get the bitmap or size was 0), + // let DWM handle it + if (hBitmap != IntPtr.Zero) + { + if (offset.X >= 0 && offset.Y >= 0) + { + TabbedThumbnailNativeMethods.SetPeekBitmap( + taskbarWindow.WindowToTellTaskbarAbout, + hBitmap, new System.Drawing.Point((int)offset.X, (int)offset.Y), + taskbarWindow.TabbedThumbnail.DisplayFrameAroundBitmap); + } + else + { + TabbedThumbnailNativeMethods.SetPeekBitmap( + taskbarWindow.WindowToTellTaskbarAbout, + hBitmap, + taskbarWindow.TabbedThumbnail.DisplayFrameAroundBitmap); + } + } + + // If the bitmap we have is not coming from the user (i.e. we created it here), + // then make sure we delete it as we don't need it now. + if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + ShellNativeMethods.DeleteObject(hBitmap); + } + + return true; + } + else + { + // Else (no parent specified), just set the bitmap. It would take over the entire + // application window (would work only if you are a MDI app) + + // Only set the peek bitmap if it's not null. + // If it's null (either we didn't get the bitmap or size was 0), + // let DWM handle it + if (hBitmap != null) + { + TabbedThumbnailNativeMethods.SetPeekBitmap(taskbarWindow.WindowToTellTaskbarAbout, hBitmap, taskbarWindow.TabbedThumbnail.DisplayFrameAroundBitmap); + } + + // If the bitmap we have is not coming from the user (i.e. we created it here), + // then make sure we delete it as we don't need it now. + if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + ShellNativeMethods.DeleteObject(hBitmap); + } + + return true; + } + } + return false; + } + + private static bool DispatchDestroyMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) + { + if (m.Msg == (int)WindowMessage.Destroy) + { + TaskbarList.Instance.UnregisterTab(taskbarWindow.WindowToTellTaskbarAbout); + + taskbarWindow.TabbedThumbnail.RemovedFromTaskbar = true; + + return true; + } + return false; + } + + private static bool DispatchNCDestroyMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) + { + if (m.Msg == (int)WindowMessage.NCDestroy) + { + // Raise the event + taskbarWindow.TabbedThumbnail.OnTabbedThumbnailClosed(); + + // Remove the taskbar window from our internal list + if (_taskbarWindowList.Contains(taskbarWindow)) + { + _taskbarWindowList.Remove(taskbarWindow); + } + + taskbarWindow.Dispose(); + + return true; + } + return false; + } + + private static bool DispatchSystemCommandMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) + { + if (m.Msg == (int)WindowMessage.SystemCommand) + { + if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose) + { + // Raise the event + if (taskbarWindow.TabbedThumbnail.OnTabbedThumbnailClosed()) + { + // Remove the taskbar window from our internal list + if (_taskbarWindowList.Contains(taskbarWindow)) + { + _taskbarWindowList.Remove(taskbarWindow); + } + + taskbarWindow.Dispose(); + taskbarWindow = null; + } + } + else if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScMaximize) + { + // Raise the event + taskbarWindow.TabbedThumbnail.OnTabbedThumbnailMaximized(); + } + else if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScMinimize) + { + // Raise the event + taskbarWindow.TabbedThumbnail.OnTabbedThumbnailMinimized(); + } + + return true; + } + return false; + } + + #endregion + + /// + /// Dispatches a window message so that the appropriate events + /// can be invoked. This is used for the Taskbar's thumbnail toolbar feature. + /// + /// The window message, typically obtained + /// from a Windows Forms or WPF window procedure. + /// Taskbar window for which we are intercepting the messages + /// Returns true if this method handles the window message + internal static bool DispatchMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) + { + if (taskbarWindow.EnableThumbnailToolbars) + { + DispatchTaskbarButtonMessages(ref m, taskbarWindow); + } + + // If we are removed from the taskbar, ignore all the messages + if (taskbarWindow.EnableTabbedThumbnails) + { + if (taskbarWindow.TabbedThumbnail == null || + taskbarWindow.TabbedThumbnail.RemovedFromTaskbar) + { + return false; + } + + if (DispatchActivateMessage(ref m, taskbarWindow)) + { + return true; + } + + if (DispatchSendIconThumbnailMessage(ref m, taskbarWindow)) + { + return true; + } + + if (DispatchLivePreviewBitmapMessage(ref m, taskbarWindow)) + { + return true; + } + + if (DispatchDestroyMessage(ref m, taskbarWindow)) + { + return true; + } + + if (DispatchNCDestroyMessage(ref m, taskbarWindow)) + { + return true; + } + + if (DispatchSystemCommandMessage(ref m, taskbarWindow)) + { + return true; + } + } + + return false; + } + + /// + /// Helper function to capture a bitmap for a given window handle or incase of WPF app, + /// an UIElement. + /// + /// The proxy window for which a bitmap needs to be created + /// Size for the requested bitmap image + /// Bitmap captured from the window handle or UIElement. Null if the window is hidden or it's size is zero. + private static IntPtr GrabBitmap(TaskbarWindow taskbarWindow, System.Drawing.Size requestedSize) + { + IntPtr hBitmap = IntPtr.Zero; + + if (taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero) + { //TabbedThumbnail is linked to WinformsControl + if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + using (Bitmap bmp = TabbedThumbnailScreenCapture.GrabWindowBitmap( + taskbarWindow.TabbedThumbnail.WindowHandle, requestedSize)) + { + + hBitmap = bmp.GetHbitmap(); + } + } + else + { + using (Image img = Image.FromHbitmap(taskbarWindow.TabbedThumbnail.CurrentHBitmap)) + { + using (Bitmap bmp = new Bitmap(img, requestedSize)) + { + hBitmap = bmp != null ? bmp.GetHbitmap() : IntPtr.Zero; + } + } + } + } + else if (taskbarWindow.TabbedThumbnail.WindowsControl != null) + { //TabbedThumbnail is linked to a WPF UIElement + if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero) + { + Bitmap bmp = TabbedThumbnailScreenCapture.GrabWindowBitmap( + taskbarWindow.TabbedThumbnail.WindowsControl, + 96, 96, requestedSize.Width, requestedSize.Height); + + if (bmp != null) + { + hBitmap = bmp.GetHbitmap(); + bmp.Dispose(); + } + } + else + { + using (Image img = Image.FromHbitmap(taskbarWindow.TabbedThumbnail.CurrentHBitmap)) + { + using (Bitmap bmp = new Bitmap(img, requestedSize)) + { + + hBitmap = bmp != null ? bmp.GetHbitmap() : IntPtr.Zero; + } + } + } + } + + return hBitmap; + } + + internal static void SetActiveTab(TaskbarWindow taskbarWindow) + { + if (taskbarWindow != null) + { + TaskbarList.Instance.SetTabActive( + taskbarWindow.WindowToTellTaskbarAbout, + taskbarWindow.TabbedThumbnail.ParentWindowHandle, 0); + } + } + + internal static void UnregisterTab(TaskbarWindow taskbarWindow) + { + if (taskbarWindow != null) + { + TaskbarList.Instance.UnregisterTab(taskbarWindow.WindowToTellTaskbarAbout); + } + } + + internal static void InvalidatePreview(TaskbarWindow taskbarWindow) + { + if (taskbarWindow != null) + { + TabbedThumbnailNativeMethods.DwmInvalidateIconicBitmaps( + taskbarWindow.WindowToTellTaskbarAbout); + } + } + + private static void AddButtons(TaskbarWindow taskbarWindow) + { + // Add the buttons + // Get the array of thumbnail buttons in native format + ThumbButton[] nativeButtons = (from thumbButton in taskbarWindow.ThumbnailButtons + select thumbButton.Win32ThumbButton).ToArray(); + + // Add the buttons on the taskbar + HResult hr = TaskbarList.Instance.ThumbBarAddButtons(taskbarWindow.WindowToTellTaskbarAbout, (uint)taskbarWindow.ThumbnailButtons.Length, nativeButtons); + + if (!CoreErrorHelper.Succeeded(hr)) + { + throw new ShellException(hr); + } + + _buttonsAdded = true; + + foreach (ThumbnailToolBarButton button in taskbarWindow.ThumbnailButtons) + { + button.AddedToTaskbar = _buttonsAdded; + } + } + + #region Event handlers + + private static void thumbnailPreview_TooltipChanged(object sender, EventArgs e) + { + TabbedThumbnail preview = sender as TabbedThumbnail; + + TaskbarWindow taskbarWindow = null; + + if (preview.WindowHandle == IntPtr.Zero) + { + taskbarWindow = GetTaskbarWindow(preview.WindowsControl, TaskbarProxyWindowType.TabbedThumbnail); + } + else + { + taskbarWindow = GetTaskbarWindow(preview.WindowHandle, TaskbarProxyWindowType.TabbedThumbnail); + } + + // Update the proxy window for the tabbed thumbnail + if (taskbarWindow != null) + { + TaskbarList.Instance.SetThumbnailTooltip(taskbarWindow.WindowToTellTaskbarAbout, preview.Tooltip); + } + } + + private static void thumbnailPreview_TitleChanged(object sender, EventArgs e) + { + TabbedThumbnail preview = sender as TabbedThumbnail; + + TaskbarWindow taskbarWindow = null; + + if (preview.WindowHandle == IntPtr.Zero) + { + taskbarWindow = GetTaskbarWindow(preview.WindowsControl, TaskbarProxyWindowType.TabbedThumbnail); + } + else + { + taskbarWindow = GetTaskbarWindow(preview.WindowHandle, TaskbarProxyWindowType.TabbedThumbnail); + } + + // Update the proxy window for the tabbed thumbnail + if (taskbarWindow != null) + { + taskbarWindow.SetTitle(preview.Title); + } + } + + #endregion + } +} diff --git a/Shell/Taskbar/ThumbnailButton.cs b/Shell/Taskbar/ThumbnailButton.cs new file mode 100644 index 0000000..8ad48d2 --- /dev/null +++ b/Shell/Taskbar/ThumbnailButton.cs @@ -0,0 +1,362 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Drawing; +using Microsoft.WindowsAPICodePack.Shell; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Represents a taskbar thumbnail button in the thumbnail toolbar. + /// + public sealed class ThumbnailToolBarButton : IDisposable + { + private static uint nextId = 101; + private ThumbButton win32ThumbButton; + + /// + /// The event that occurs when the taskbar thumbnail button + /// is clicked. + /// + public event EventHandler Click; + + // Internal bool to track whether we should be updating the taskbar + // if any of our properties change or if it's just an internal update + // on the properties (via the constructor) + private bool internalUpdate = false; + + /// + /// Initializes an instance of this class + /// + /// The icon to use for this button + /// The tooltip string to use for this button. + public ThumbnailToolBarButton(Icon icon, string tooltip) + { + // Start internal update (so we don't accidently update the taskbar + // via the native API) + internalUpdate = true; + + // Set our id + Id = nextId; + + // increment the ID + if (nextId == Int32.MaxValue) + nextId = 101; // our starting point + else + nextId++; + + // Set user settings + Icon = icon; + Tooltip = tooltip; + + // Defaults + Enabled = true; + + // Create a native + win32ThumbButton = new ThumbButton(); + + // End our internal update + internalUpdate = false; + } + + #region Public properties + + /// + /// Gets thumbnail button's id. + /// + internal uint Id { get; set; } + + private Icon icon; + /// + /// Gets or sets the thumbnail button's icon. + /// + public Icon Icon + { + get + { + return icon; + } + set + { + if (icon != value) + { + icon = value; + UpdateThumbnailButton(); + } + } + } + + private string tooltip; + /// + /// Gets or sets the thumbnail button's tooltip. + /// + public string Tooltip + { + get + { + return tooltip; + } + set + { + if (tooltip != value) + { + tooltip = value; + UpdateThumbnailButton(); + } + } + } + + private bool visible = true; + /// + /// Gets or sets the thumbnail button's visibility. Default is true. + /// + public bool Visible + { + get + { + return (this.Flags & ThumbButtonOptions.Hidden) == 0; + } + set + { + if (visible != value) + { + visible = value; + + if (value) + { + this.Flags &= ~(ThumbButtonOptions.Hidden); + } + else + { + this.Flags |= ThumbButtonOptions.Hidden; + } + + UpdateThumbnailButton(); + } + + } + } + + private bool enabled = true; + /// + /// Gets or sets the thumbnail button's enabled state. If the button is disabled, it is present, + /// but has a visual state that indicates that it will not respond to user action. Default is true. + /// + public bool Enabled + { + get + { + return (this.Flags & ThumbButtonOptions.Disabled) == 0; + } + set + { + if (value != enabled) + { + enabled = value; + + if (value) + { + this.Flags &= ~(ThumbButtonOptions.Disabled); + } + else + { + this.Flags |= ThumbButtonOptions.Disabled; + } + + UpdateThumbnailButton(); + } + } + } + + private bool dismissOnClick; + /// + /// Gets or sets the property that describes the behavior when the button is clicked. + /// If set to true, the taskbar button's flyout will close immediately. Default is false. + /// + public bool DismissOnClick + { + get + { + return (this.Flags & ThumbButtonOptions.DismissOnClick) == 0; + } + set + { + if (value != dismissOnClick) + { + dismissOnClick = value; + + if (value) + { + this.Flags |= ThumbButtonOptions.DismissOnClick; + } + else + { + this.Flags &= ~(ThumbButtonOptions.DismissOnClick); + } + + UpdateThumbnailButton(); + } + } + } + + private bool isInteractive = true; + /// + /// Gets or sets the property that describes whether the button is interactive with the user. Default is true. + /// + /// + /// Non-interactive buttons don't display any hover behavior nor do they raise click events. + /// They are intended to be used as status icons. This is mostly similar to being not Enabled, + /// but the image is not desaturated. + /// + public bool IsInteractive + { + get + { + return (this.Flags & ThumbButtonOptions.NonInteractive) == 0; + } + set + { + if (value != isInteractive) + { + isInteractive = value; + + if (value) + { + this.Flags &= ~(ThumbButtonOptions.NonInteractive); + } + else + { + this.Flags |= ThumbButtonOptions.NonInteractive; + } + + UpdateThumbnailButton(); + } + } + } + + #endregion + + #region Internal Methods + + /// + /// Native flags enum (used when creating the native button) + /// + internal ThumbButtonOptions Flags { get; set; } + + /// + /// Native representation of the thumbnail button + /// + internal ThumbButton Win32ThumbButton + { + get + { + win32ThumbButton.Id = Id; + win32ThumbButton.Tip = Tooltip; + win32ThumbButton.Icon = Icon != null ? Icon.Handle : IntPtr.Zero; + win32ThumbButton.Flags = Flags; + + win32ThumbButton.Mask = ThumbButtonMask.THB_FLAGS; + if (Tooltip != null) + { + win32ThumbButton.Mask |= ThumbButtonMask.Tooltip; + } + if (Icon != null) + { + win32ThumbButton.Mask |= ThumbButtonMask.Icon; + } + + return win32ThumbButton; + } + } + + /// + /// The window manager should call this method to raise the public click event to all + /// the subscribers. + /// + /// Taskbar Window associated with this button + internal void FireClick(TaskbarWindow taskbarWindow) + { + if (Click != null && taskbarWindow != null) + { + if (taskbarWindow.UserWindowHandle != IntPtr.Zero) + { + Click(this, new ThumbnailButtonClickedEventArgs(taskbarWindow.UserWindowHandle, this)); + } + else if (taskbarWindow.WindowsControl != null) + { + Click(this, new ThumbnailButtonClickedEventArgs(taskbarWindow.WindowsControl, this)); + } + } + } + + /// + /// Handle to the window to which this button is for (on the taskbar). + /// + internal IntPtr WindowHandle + { + get; + set; + } + + /// + /// Indicates if this button was added to the taskbar. If it's not yet added, + /// then we can't do any updates on it. + /// + internal bool AddedToTaskbar + { + get; + set; + } + + internal void UpdateThumbnailButton() + { + if (internalUpdate || !AddedToTaskbar) { return; } + + // Get the array of thumbnail buttons in native format + ThumbButton[] nativeButtons = { Win32ThumbButton }; + + HResult hr = TaskbarList.Instance.ThumbBarUpdateButtons(WindowHandle, 1, nativeButtons); + + if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); } + } + + #endregion + + #region IDisposable Members + + /// + /// + /// + ~ThumbnailToolBarButton() + { + Dispose(false); + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Release the native objects. + /// + /// + public void Dispose(bool disposing) + { + if (disposing) + { + // Dispose managed resources + Icon.Dispose(); + tooltip = null; + } + } + + #endregion + } + +} diff --git a/Shell/Taskbar/ThumbnailButtonClickedEventArgs.cs b/Shell/Taskbar/ThumbnailButtonClickedEventArgs.cs new file mode 100644 index 0000000..87b6549 --- /dev/null +++ b/Shell/Taskbar/ThumbnailButtonClickedEventArgs.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Windows; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Event args for TabbedThumbnailButton.Click event + /// + public class ThumbnailButtonClickedEventArgs : EventArgs + { + /// + /// Creates a Event Args for the TabbedThumbnailButton.Click event + /// + /// Window handle for the control/window related to the event + /// Thumbnail toolbar button that was clicked + public ThumbnailButtonClickedEventArgs(IntPtr windowHandle, ThumbnailToolBarButton button) + { + ThumbnailButton = button; + WindowHandle = windowHandle; + WindowsControl = null; + } + + /// + /// Creates a Event Args for the TabbedThumbnailButton.Click event + /// + /// WPF Control (UIElement) related to the event + /// Thumbnail toolbar button that was clicked + public ThumbnailButtonClickedEventArgs(UIElement windowsControl, ThumbnailToolBarButton button) + { + ThumbnailButton = button; + WindowHandle = IntPtr.Zero; + WindowsControl = windowsControl; + } + + /// + /// Gets the Window handle for the specific control/window that is related to this event. + /// + /// For WPF Controls (UIElement) the WindowHandle will be IntPtr.Zero. + /// Check the WindowsControl property to get the specific control associated with this event. + public IntPtr WindowHandle { get; private set; } + + /// + /// Gets the WPF Control (UIElement) that is related to this event. This property may be null + /// for non-WPF applications. + /// + public UIElement WindowsControl { get; private set; } + + /// + /// Gets the ThumbnailToolBarButton that was clicked + /// + public ThumbnailToolBarButton ThumbnailButton { get; private set; } + } +} diff --git a/Shell/Taskbar/ThumbnailToolbarManager.cs b/Shell/Taskbar/ThumbnailToolbarManager.cs new file mode 100644 index 0000000..793b2b1 --- /dev/null +++ b/Shell/Taskbar/ThumbnailToolbarManager.cs @@ -0,0 +1,77 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Windows; +using Microsoft.WindowsAPICodePack.Shell.Resources; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Thumbnail toolbar manager class for adding a thumbnail toolbar with a specified set of buttons + /// to the thumbnail image of a window in a taskbar button flyout. + /// + public class ThumbnailToolBarManager + { + internal ThumbnailToolBarManager() + { + // Hide the public constructor so users can't create an instance of this class. + } + + /// + /// Adds thumbnail toolbar for the specified window. + /// + /// Window handle for which the thumbnail toolbar buttons need to be added + /// Thumbnail buttons for the window's thumbnail toolbar + /// If the number of buttons exceed the maximum allowed capacity (7). + /// If the Window Handle passed in invalid + /// After a toolbar has been added to a thumbnail, buttons can be altered only through various + /// properties on the . While individual buttons cannot be added or removed, + /// they can be shown and hidden through as needed. + /// The toolbar itself cannot be removed without re-creating the window itself. + /// + public void AddButtons(IntPtr windowHandle, params ThumbnailToolBarButton[] buttons) + { + if (windowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.ThumbnailManagerInvalidHandle, "windowHandle"); + } + VerifyButtons(buttons); + + // Add the buttons to our window manager, which will also create a proxy window + TaskbarWindowManager.AddThumbnailButtons(windowHandle, buttons); + } + + /// + /// Adds thumbnail toolbar for the specified WPF Control. + /// + /// WPF Control for which the thumbnail toolbar buttons need to be added + /// Thumbnail buttons for the window's thumbnail toolbar + /// If the number of buttons exceed the maximum allowed capacity (7). + /// If the control passed in null + /// After a toolbar has been added to a thumbnail, buttons can be altered only through various + /// properties on the ThumbnailToolBarButton. While individual buttons cannot be added or removed, + /// they can be shown and hidden through ThumbnailToolBarButton.Visible as needed. + /// The toolbar itself cannot be removed without re-creating the window itself. + /// + public void AddButtons(UIElement control, params ThumbnailToolBarButton[] buttons) + { + if (control == null) { throw new ArgumentNullException("control"); } + VerifyButtons(buttons); + + // Add the buttons to our window manager, which will also create a proxy window + TaskbarWindowManager.AddThumbnailButtons(control, buttons); + } + + private static void VerifyButtons(params ThumbnailToolBarButton[] buttons) + { + if (buttons != null && buttons.Length == 0) + { + throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerNullEmptyArray, "buttons"); + } + if (buttons.Length > 7) + { + throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerMaxButtons, "buttons"); + } + } + } +} diff --git a/Shell/Taskbar/ThumbnailToolbarProxyWindow.cs b/Shell/Taskbar/ThumbnailToolbarProxyWindow.cs new file mode 100644 index 0000000..012f0ad --- /dev/null +++ b/Shell/Taskbar/ThumbnailToolbarProxyWindow.cs @@ -0,0 +1,125 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Windows.Forms; +using Microsoft.WindowsAPICodePack.Shell.Resources; +using MS.WindowsAPICodePack.Internal; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + internal class ThumbnailToolbarProxyWindow : NativeWindow, IDisposable + { + private ThumbnailToolBarButton[] _thumbnailButtons; + private IntPtr _internalWindowHandle; + + internal System.Windows.UIElement WindowsControl { get; set; } + + internal IntPtr WindowToTellTaskbarAbout + { + get + { + return _internalWindowHandle != IntPtr.Zero ? _internalWindowHandle : this.Handle; + } + } + + internal TaskbarWindow TaskbarWindow { get; set; } + + internal ThumbnailToolbarProxyWindow(IntPtr windowHandle, ThumbnailToolBarButton[] buttons) + { + if (windowHandle == IntPtr.Zero) + { + throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "windowHandle"); + } + if (buttons != null && buttons.Length == 0) + { + throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerNullEmptyArray, "buttons"); + } + + _internalWindowHandle = windowHandle; + _thumbnailButtons = buttons; + + // Set the window handle on the buttons (for future updates) + Array.ForEach(_thumbnailButtons, new Action(UpdateHandle)); + + // Assign the window handle (coming from the user) to this native window + // so we can intercept the window messages sent from the taskbar to this window. + this.AssignHandle(windowHandle); + } + + internal ThumbnailToolbarProxyWindow(System.Windows.UIElement windowsControl, ThumbnailToolBarButton[] buttons) + { + if (windowsControl == null) { throw new ArgumentNullException("windowsControl"); } + if (buttons != null && buttons.Length == 0) + { + throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerNullEmptyArray, "buttons"); + } + + _internalWindowHandle = IntPtr.Zero; + WindowsControl = windowsControl; + _thumbnailButtons = buttons; + + // Set the window handle on the buttons (for future updates) + Array.ForEach(_thumbnailButtons, new Action(UpdateHandle)); + } + + private void UpdateHandle(ThumbnailToolBarButton button) + { + button.WindowHandle = _internalWindowHandle; + button.AddedToTaskbar = false; + } + + protected override void WndProc(ref Message m) + { + bool handled = false; + + handled = TaskbarWindowManager.DispatchMessage(ref m, this.TaskbarWindow); + + // If it's a WM_Destroy message, then also forward it to the base class (our native window) + if ((m.Msg == (int)WindowMessage.Destroy) || + (m.Msg == (int)WindowMessage.NCDestroy) || + ((m.Msg == (int)WindowMessage.SystemCommand) && (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose))) + { + base.WndProc(ref m); + } + else if (!handled) + { + base.WndProc(ref m); + } + } + + #region IDisposable Members + + /// + /// + /// + ~ThumbnailToolbarProxyWindow() + { + Dispose(false); + } + + /// + /// Release the native objects. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + public void Dispose(bool disposing) + { + if (disposing) + { + // Dispose managed resources + + // Don't dispose the thumbnail buttons + // as they might be used in another window. + // Setting them to null will indicate we don't need use anymore. + _thumbnailButtons = null; + } + } + + #endregion + + } +} diff --git a/Shell/Taskbar/UserRemovedJumpListItemsEventArg.cs b/Shell/Taskbar/UserRemovedJumpListItemsEventArg.cs new file mode 100644 index 0000000..2520f5b --- /dev/null +++ b/Shell/Taskbar/UserRemovedJumpListItemsEventArg.cs @@ -0,0 +1,29 @@ +//Copyright (c) Microsoft Corporation. All rights reserved. + +using System; +using System.Collections; + +namespace Microsoft.WindowsAPICodePack.Taskbar +{ + /// + /// Event arguments for when the user is notified of items + /// that have been removed from the taskbar destination list + /// + public class UserRemovedJumpListItemsEventArgs : EventArgs + { + private readonly IEnumerable _removedItems; + + internal UserRemovedJumpListItemsEventArgs(IEnumerable RemovedItems) + { + _removedItems = RemovedItems; + } + + /// + /// The collection of removed items based on path. + /// + public IEnumerable RemovedItems + { + get { return _removedItems; } + } + } +}