From 1476fd2e0373edda4515fff947491dd21e6c123b Mon Sep 17 00:00:00 2001 From: "github-actions-dotnet-formatter[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 6 Dec 2020 03:21:24 +0000 Subject: [PATCH] Automated dotnet-format update --- .../Microsoft.Windows.Shell/JumpItem.cs | 14 +- .../JumpItemRejectionReason.cs | 14 +- .../JumpItemsRejectedEventArgs.cs | 46 +- .../JumpItemsRemovedEventArgs.cs | 32 +- .../Microsoft.Windows.Shell/JumpList.cs | 1388 ++++++------- .../Microsoft.Windows.Shell/JumpPath.cs | 8 +- .../Microsoft.Windows.Shell/JumpTask.cs | 20 +- .../Microsoft.Windows.Shell/Standard/AC.cs | 10 +- .../Standard/APPDOCLISTTYPE.cs | 10 +- .../Standard/Assert.cs | 398 ++-- .../Microsoft.Windows.Shell/Standard/BI.cs | 8 +- .../Standard/BITMAPINFO.cs | 10 +- .../Standard/BITMAPINFOHEADER.cs | 30 +- .../Standard/BLENDFUNCTION.cs | 14 +- .../Standard/CHANGEFILTERSTRUCT.cs | 10 +- .../Microsoft.Windows.Shell/Standard/CLSID.cs | 26 +- .../Standard/CREATESTRUCT.cs | 36 +- .../Microsoft.Windows.Shell/Standard/CS.cs | 34 +- .../Standard/CombineRgnResult.cs | 14 +- .../Microsoft.Windows.Shell/Standard/DOGIF.cs | 16 +- .../Standard/DWMFLIP3D.cs | 12 +- .../Standard/DWMNCRP.cs | 12 +- .../Microsoft.Windows.Shell/Standard/DWMWA.cs | 30 +- .../Standard/DWM_SIT.cs | 10 +- .../Standard/DWM_TIMING_INFO.cs | 88 +- .../Standard/DeviceCap.cs | 14 +- .../Standard/DoubleUtilities.cs | 88 +- .../Standard/DpiHelper.cs | 108 +- .../Standard/ErrorModes.cs | 18 +- .../Microsoft.Windows.Shell/Standard/FO.cs | 14 +- .../Microsoft.Windows.Shell/Standard/FOF.cs | 38 +- .../Standard/Facility.cs | 26 +- .../Microsoft.Windows.Shell/Standard/GCLP.cs | 8 +- .../Microsoft.Windows.Shell/Standard/GPS.cs | 26 +- .../Microsoft.Windows.Shell/Standard/GWL.cs | 20 +- .../Microsoft.Windows.Shell/Standard/HCF.cs | 22 +- .../Standard/HIGHCONTRAST.cs | 12 +- .../Standard/HRESULT.cs | 394 ++-- .../Microsoft.Windows.Shell/Standard/HT.cs | 64 +- .../Standard/IApplicationDestinations.cs | 18 +- .../Standard/IApplicationDocumentLists.cs | 18 +- .../Standard/ICustomDestinationList.cs | 38 +- .../Standard/IEnumIDList.cs | 24 +- .../Standard/IEnumObjects.cs | 20 +- .../Microsoft.Windows.Shell/Standard/IID.cs | 54 +- .../Microsoft.Windows.Shell/Standard/INPUT.cs | 10 +- .../Standard/INPUT_TYPE.cs | 8 +- .../Standard/IObjectArray.cs | 18 +- .../Standard/IObjectCollection.cs | 26 +- .../Standard/IObjectWithAppUserModelId.cs | 18 +- .../Standard/IObjectWithProgId.cs | 18 +- .../Standard/IPropertyStore.cs | 22 +- .../Standard/IShellFolder.cs | 42 +- .../Standard/IShellItem.cs | 26 +- .../Standard/IShellItem2.cs | 64 +- .../Standard/IShellItemArray.cs | 34 +- .../Standard/IShellLinkW.cs | 48 +- .../Standard/ITaskbarList.cs | 22 +- .../Standard/ITaskbarList2.cs | 24 +- .../Standard/ITaskbarList3.cs | 72 +- .../Standard/ITaskbarList4.cs | 74 +- .../Microsoft.Windows.Shell/Standard/KDC.cs | 10 +- .../Standard/LOGFONT.cs | 38 +- .../Standard/MARGINS.cs | 14 +- .../Microsoft.Windows.Shell/Standard/MF.cs | 18 +- .../Standard/MINMAXINFO.cs | 16 +- .../Standard/MONITORINFO.cs | 16 +- .../Standard/MOUSEEVENTF.cs | 10 +- .../Standard/MOUSEINPUT.cs | 18 +- .../Standard/MSGFLT.cs | 12 +- .../Standard/MSGFLTINFO.cs | 14 +- .../Standard/ManagedIStream.cs | 248 +-- .../Standard/MessageHandler.cs | 2 +- .../Standard/MessageWindow.cs | 222 +- .../Microsoft.Windows.Shell/Standard/NIF.cs | 28 +- .../Microsoft.Windows.Shell/Standard/NIIF.cs | 24 +- .../Microsoft.Windows.Shell/Standard/NIM.cs | 16 +- .../Standard/NONCLIENTMETRICS.cs | 82 +- .../Standard/NOTIFYICONDATA.cs | 46 +- .../Standard/NativeMethods.cs | 1794 ++++++++--------- .../Standard/OLECMDEXECOPT.cs | 14 +- .../Standard/OLECMDF.cs | 18 +- .../Standard/OLECMDID.cs | 120 +- .../Microsoft.Windows.Shell/Standard/PKEY.cs | 34 +- .../Microsoft.Windows.Shell/Standard/POINT.cs | 10 +- .../Standard/PROPVARIANT.cs | 148 +- .../Standard/READYSTATE.cs | 16 +- .../Microsoft.Windows.Shell/Standard/RECT.cs | 262 +-- .../Standard/RGBQUAD.cs | 14 +- .../Microsoft.Windows.Shell/Standard/RGN.cs | 16 +- .../Standard/RefPOINT.cs | 14 +- .../Standard/RefRECT.cs | 178 +- .../Microsoft.Windows.Shell/Standard/SC.cs | 52 +- .../Microsoft.Windows.Shell/Standard/SFGAO.cs | 76 +- .../Microsoft.Windows.Shell/Standard/SHARD.cs | 20 +- .../Standard/SHARDAPPIDINFO.cs | 18 +- .../Standard/SHARDAPPIDINFOIDLIST.cs | 16 +- .../Standard/SHARDAPPIDINFOLINK.cs | 16 +- .../Standard/SHCONTF.cs | 30 +- .../Standard/SHFILEOPSTRUCT.cs | 30 +- .../Microsoft.Windows.Shell/Standard/SHGDN.cs | 18 +- .../Standard/SIATTRIBFLAGS.cs | 12 +- .../Standard/SICHINT.cs | 14 +- .../Microsoft.Windows.Shell/Standard/SIGDN.cs | 24 +- .../Microsoft.Windows.Shell/Standard/SIZE.cs | 10 +- .../Microsoft.Windows.Shell/Standard/SLGP.cs | 14 +- .../Microsoft.Windows.Shell/Standard/SM.cs | 174 +- .../Microsoft.Windows.Shell/Standard/SPI.cs | 436 ++-- .../Microsoft.Windows.Shell/Standard/SPIF.cs | 16 +- .../Standard/STATE_SYSTEM.cs | 72 +- .../Microsoft.Windows.Shell/Standard/STPF.cs | 18 +- .../Standard/STR_GPS.cs | 18 +- .../Microsoft.Windows.Shell/Standard/SW.cs | 34 +- .../Microsoft.Windows.Shell/Standard/SWP.cs | 38 +- .../Standard/SafeConnectionPointCookie.cs | 128 +- .../Standard/SafeDC.cs | 266 +-- .../Standard/SafeFindHandle.cs | 22 +- .../Standard/SafeGdiplusStartupToken.cs | 56 +- .../Standard/SafeHBITMAP.cs | 22 +- .../Standard/StartupInput.cs | 16 +- .../Standard/StartupOutput.cs | 10 +- .../Standard/Status.cs | 50 +- .../Standard/StockObject.cs | 30 +- .../Microsoft.Windows.Shell/Standard/TBPF.cs | 16 +- .../Microsoft.Windows.Shell/Standard/THB.cs | 16 +- .../Microsoft.Windows.Shell/Standard/THBF.cs | 20 +- .../Standard/THUMBBUTTON.cs | 24 +- .../Standard/TITLEBARINFO.cs | 22 +- .../Standard/TITLEBARINFOEX.cs | 34 +- .../Microsoft.Windows.Shell/Standard/ULW.cs | 12 +- .../Standard/UNSIGNED_RATIO.cs | 10 +- .../Standard/Utility.cs | 1490 +++++++------- .../Standard/Verify.cs | 438 ++-- .../Standard/WIN32_FIND_DATAW.cs | 36 +- .../Standard/WINDOWPLACEMENT.cs | 20 +- .../Standard/WINDOWPOS.cs | 20 +- .../Standard/WINDOWTHEMEATTRIBUTETYPE.cs | 8 +- .../Microsoft.Windows.Shell/Standard/WM.cs | 268 +-- .../Standard/WNDCLASSEX.cs | 36 +- .../Microsoft.Windows.Shell/Standard/WS.cs | 62 +- .../Microsoft.Windows.Shell/Standard/WS_EX.cs | 62 +- .../Standard/WTA_OPTIONS.cs | 22 +- .../Microsoft.Windows.Shell/Standard/WTNCA.cs | 18 +- .../Microsoft.Windows.Shell/Standard/WVR.cs | 22 +- .../Standard/Win32Error.cs | 184 +- .../Standard/Win32Value.cs | 20 +- .../Standard/WndProc.cs | 2 +- .../Standard/WndProcHook.cs | 2 +- .../Microsoft.Windows.Shell/SystemCommands.cs | 114 +- .../SystemParameters2.cs | 954 ++++----- .../TaskbarItemInfo.cs | 1156 +++++------ .../TaskbarItemProgressState.cs | 16 +- .../ThumbButtonInfo.cs | 496 ++--- .../ThumbButtonInfoCollection.cs | 42 +- .../Microsoft.Windows.Shell/WindowChrome.cs | 370 ++-- .../WindowChromeWorker.cs | 1478 +++++++------- 156 files changed, 8279 insertions(+), 8279 deletions(-) diff --git a/src/Shared/Microsoft.Windows.Shell/JumpItem.cs b/src/Shared/Microsoft.Windows.Shell/JumpItem.cs index 2733344e..be6f003d 100644 --- a/src/Shared/Microsoft.Windows.Shell/JumpItem.cs +++ b/src/Shared/Microsoft.Windows.Shell/JumpItem.cs @@ -2,12 +2,12 @@ namespace Microsoft.Windows.Shell { - public abstract class JumpItem - { - internal JumpItem() - { - } + public abstract class JumpItem + { + internal JumpItem() + { + } - public string CustomCategory { get; set; } - } + public string CustomCategory { get; set; } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/JumpItemRejectionReason.cs b/src/Shared/Microsoft.Windows.Shell/JumpItemRejectionReason.cs index 75fa583b..25611435 100644 --- a/src/Shared/Microsoft.Windows.Shell/JumpItemRejectionReason.cs +++ b/src/Shared/Microsoft.Windows.Shell/JumpItemRejectionReason.cs @@ -2,11 +2,11 @@ namespace Microsoft.Windows.Shell { - public enum JumpItemRejectionReason - { - None, - InvalidItem, - NoRegisteredHandler, - RemovedByUser - } + public enum JumpItemRejectionReason + { + None, + InvalidItem, + NoRegisteredHandler, + RemovedByUser + } } diff --git a/src/Shared/Microsoft.Windows.Shell/JumpItemsRejectedEventArgs.cs b/src/Shared/Microsoft.Windows.Shell/JumpItemsRejectedEventArgs.cs index ba9d9097..28cafd71 100644 --- a/src/Shared/Microsoft.Windows.Shell/JumpItemsRejectedEventArgs.cs +++ b/src/Shared/Microsoft.Windows.Shell/JumpItemsRejectedEventArgs.cs @@ -3,30 +3,30 @@ using System.Collections.Generic; namespace Microsoft.Windows.Shell { - public sealed class JumpItemsRejectedEventArgs : EventArgs - { - public JumpItemsRejectedEventArgs() : this(null, null) - { - } + public sealed class JumpItemsRejectedEventArgs : EventArgs + { + public JumpItemsRejectedEventArgs() : this(null, null) + { + } - public JumpItemsRejectedEventArgs(IList rejectedItems, IList reasons) - { - if ((rejectedItems == null && reasons != null) || (reasons == null && rejectedItems != null) || (rejectedItems != null && reasons != null && rejectedItems.Count != reasons.Count)) - { - throw new ArgumentException("The counts of rejected items doesn't match the count of reasons."); - } - if (rejectedItems != null) - { - this.RejectedItems = new List(rejectedItems).AsReadOnly(); - this.RejectionReasons = new List(reasons).AsReadOnly(); - return; - } - this.RejectedItems = new List().AsReadOnly(); - this.RejectionReasons = new List().AsReadOnly(); - } + public JumpItemsRejectedEventArgs(IList rejectedItems, IList reasons) + { + if ((rejectedItems == null && reasons != null) || (reasons == null && rejectedItems != null) || (rejectedItems != null && reasons != null && rejectedItems.Count != reasons.Count)) + { + throw new ArgumentException("The counts of rejected items doesn't match the count of reasons."); + } + if (rejectedItems != null) + { + this.RejectedItems = new List(rejectedItems).AsReadOnly(); + this.RejectionReasons = new List(reasons).AsReadOnly(); + return; + } + this.RejectedItems = new List().AsReadOnly(); + this.RejectionReasons = new List().AsReadOnly(); + } - public IList RejectedItems { get; private set; } + public IList RejectedItems { get; private set; } - public IList RejectionReasons { get; private set; } - } + public IList RejectionReasons { get; private set; } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/JumpItemsRemovedEventArgs.cs b/src/Shared/Microsoft.Windows.Shell/JumpItemsRemovedEventArgs.cs index ddfdb0b0..4f28c9a3 100644 --- a/src/Shared/Microsoft.Windows.Shell/JumpItemsRemovedEventArgs.cs +++ b/src/Shared/Microsoft.Windows.Shell/JumpItemsRemovedEventArgs.cs @@ -3,22 +3,22 @@ using System.Collections.Generic; namespace Microsoft.Windows.Shell { - public sealed class JumpItemsRemovedEventArgs : EventArgs - { - public JumpItemsRemovedEventArgs() : this(null) - { - } + public sealed class JumpItemsRemovedEventArgs : EventArgs + { + public JumpItemsRemovedEventArgs() : this(null) + { + } - public JumpItemsRemovedEventArgs(IList removedItems) - { - if (removedItems != null) - { - this.RemovedItems = new List(removedItems).AsReadOnly(); - return; - } - this.RemovedItems = new List().AsReadOnly(); - } + public JumpItemsRemovedEventArgs(IList removedItems) + { + if (removedItems != null) + { + this.RemovedItems = new List(removedItems).AsReadOnly(); + return; + } + this.RemovedItems = new List().AsReadOnly(); + } - public IList RemovedItems { get; private set; } - } + public IList RemovedItems { get; private set; } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/JumpList.cs b/src/Shared/Microsoft.Windows.Shell/JumpList.cs index 66ed6964..6086bc21 100644 --- a/src/Shared/Microsoft.Windows.Shell/JumpList.cs +++ b/src/Shared/Microsoft.Windows.Shell/JumpList.cs @@ -12,739 +12,739 @@ using Standard; namespace Microsoft.Windows.Shell { - [ContentProperty("JumpItems")] - public sealed class JumpList : ISupportInitialize - { - public static void AddToRecentCategory(string itemPath) - { - Verify.FileExists(itemPath, "itemPath"); - itemPath = Path.GetFullPath(itemPath); - NativeMethods.SHAddToRecentDocs(itemPath); - } + [ContentProperty("JumpItems")] + public sealed class JumpList : ISupportInitialize + { + public static void AddToRecentCategory(string itemPath) + { + Verify.FileExists(itemPath, "itemPath"); + itemPath = Path.GetFullPath(itemPath); + NativeMethods.SHAddToRecentDocs(itemPath); + } - [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] - public static void AddToRecentCategory(JumpPath jumpPath) - { - Verify.IsNotNull(jumpPath, "jumpPath"); - JumpList.AddToRecentCategory(jumpPath.Path); - } + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] + public static void AddToRecentCategory(JumpPath jumpPath) + { + Verify.IsNotNull(jumpPath, "jumpPath"); + JumpList.AddToRecentCategory(jumpPath.Path); + } - public static void AddToRecentCategory(JumpTask jumpTask) - { - Verify.IsNotNull(jumpTask, "jumpTask"); - if (Utility.IsOSWindows7OrNewer) - { - IShellLinkW shellLinkW = JumpList.CreateLinkFromJumpTask(jumpTask, false); - try - { - if (shellLinkW != null) - { - NativeMethods.SHAddToRecentDocs(shellLinkW); - } - } - finally - { - Utility.SafeRelease(ref shellLinkW); - } - } - } + public static void AddToRecentCategory(JumpTask jumpTask) + { + Verify.IsNotNull(jumpTask, "jumpTask"); + if (Utility.IsOSWindows7OrNewer) + { + IShellLinkW shellLinkW = JumpList.CreateLinkFromJumpTask(jumpTask, false); + try + { + if (shellLinkW != null) + { + NativeMethods.SHAddToRecentDocs(shellLinkW); + } + } + finally + { + Utility.SafeRelease(ref shellLinkW); + } + } + } - public static void SetJumpList(Application application, JumpList value) - { - Verify.IsNotNull(application, "application"); - lock (JumpList.s_lock) - { - JumpList jumpList; - if (JumpList.s_applicationMap.TryGetValue(application, out jumpList) && jumpList != null) - { - jumpList._application = null; - } - JumpList.s_applicationMap[application] = value; - if (value != null) - { - value._application = application; - } - } - if (value != null) - { - value.ApplyFromApplication(); - } - } + public static void SetJumpList(Application application, JumpList value) + { + Verify.IsNotNull(application, "application"); + lock (JumpList.s_lock) + { + JumpList jumpList; + if (JumpList.s_applicationMap.TryGetValue(application, out jumpList) && jumpList != null) + { + jumpList._application = null; + } + JumpList.s_applicationMap[application] = value; + if (value != null) + { + value._application = application; + } + } + if (value != null) + { + value.ApplyFromApplication(); + } + } - public static JumpList GetJumpList(Application application) - { - Verify.IsNotNull(application, "application"); - JumpList result; - JumpList.s_applicationMap.TryGetValue(application, out result); - return result; - } + public static JumpList GetJumpList(Application application) + { + Verify.IsNotNull(application, "application"); + JumpList result; + JumpList.s_applicationMap.TryGetValue(application, out result); + return result; + } - public JumpList() : this(null, false, false) - { - this._initializing = null; - } + public JumpList() : this(null, false, false) + { + this._initializing = null; + } - public JumpList(IEnumerable items, bool showFrequent, bool showRecent) - { - if (items != null) - { - this._jumpItems = new List(items); - } - else - { - this._jumpItems = new List(); - } - this.ShowFrequentCategory = showFrequent; - this.ShowRecentCategory = showRecent; - this._initializing = new bool?(false); - } + public JumpList(IEnumerable items, bool showFrequent, bool showRecent) + { + if (items != null) + { + this._jumpItems = new List(items); + } + else + { + this._jumpItems = new List(); + } + this.ShowFrequentCategory = showFrequent; + this.ShowRecentCategory = showRecent; + this._initializing = new bool?(false); + } - public bool ShowFrequentCategory { get; set; } + public bool ShowFrequentCategory { get; set; } - public bool ShowRecentCategory { get; set; } + public bool ShowRecentCategory { get; set; } - [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")] - public List JumpItems - { - get - { - return this._jumpItems; - } - } + [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")] + public List JumpItems + { + get + { + return this._jumpItems; + } + } - private bool _IsUnmodified - { - get - { - return this._initializing == null && this.JumpItems.Count == 0 && !this.ShowRecentCategory && !this.ShowFrequentCategory; - } - } + private bool _IsUnmodified + { + get + { + return this._initializing == null && this.JumpItems.Count == 0 && !this.ShowRecentCategory && !this.ShowFrequentCategory; + } + } - [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "BeginInit")] - public void BeginInit() - { - if (!this._IsUnmodified) - { - throw new InvalidOperationException("Calls to BeginInit cannot be nested."); - } - this._initializing = new bool?(true); - } + [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "BeginInit")] + public void BeginInit() + { + if (!this._IsUnmodified) + { + throw new InvalidOperationException("Calls to BeginInit cannot be nested."); + } + this._initializing = new bool?(true); + } - [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "EndInit")] - [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "BeginInit")] - public void EndInit() - { - if (this._initializing != true) - { - throw new NotSupportedException("Can't call EndInit without first calling BeginInit."); - } - this._initializing = new bool?(false); - this.ApplyFromApplication(); - } + [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "EndInit")] + [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "BeginInit")] + public void EndInit() + { + if (this._initializing != true) + { + throw new NotSupportedException("Can't call EndInit without first calling BeginInit."); + } + this._initializing = new bool?(false); + this.ApplyFromApplication(); + } - private static string _RuntimeId - { - get - { - string result; - HRESULT hrLeft = NativeMethods.GetCurrentProcessExplicitAppUserModelID(out result); - if (hrLeft == HRESULT.E_FAIL) - { - hrLeft = HRESULT.S_OK; - result = null; - } - hrLeft.ThrowIfFailed(); - return result; - } - } + private static string _RuntimeId + { + get + { + string result; + HRESULT hrLeft = NativeMethods.GetCurrentProcessExplicitAppUserModelID(out result); + if (hrLeft == HRESULT.E_FAIL) + { + hrLeft = HRESULT.S_OK; + result = null; + } + hrLeft.ThrowIfFailed(); + return result; + } + } - [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "JumpList")] - [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "EndInit")] - public void Apply() - { - if (this._initializing == true) - { - throw new InvalidOperationException("The JumpList can't be applied until EndInit has been called."); - } - this._initializing = new bool?(false); - this._ApplyList(); - } + [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "JumpList")] + [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "EndInit")] + public void Apply() + { + if (this._initializing == true) + { + throw new InvalidOperationException("The JumpList can't be applied until EndInit has been called."); + } + this._initializing = new bool?(false); + this._ApplyList(); + } - private void ApplyFromApplication() - { - if (this._initializing != true && !this._IsUnmodified) - { - this._initializing = new bool?(false); - } - if (this._application == Application.Current && this._initializing == false) - { - this._ApplyList(); - } - } + private void ApplyFromApplication() + { + if (this._initializing != true && !this._IsUnmodified) + { + this._initializing = new bool?(false); + } + if (this._application == Application.Current && this._initializing == false) + { + this._ApplyList(); + } + } - [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.Verify.IsApartmentState(System.Threading.ApartmentState,System.String)")] - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "JumpLists")] - private void _ApplyList() - { - Verify.IsApartmentState(ApartmentState.STA, "JumpLists can only be effected on STA threads."); - if (!Utility.IsOSWindows7OrNewer) - { - this.RejectEverything(); - return; - } - List jumpItems; - List list; - List list2; - try - { - this._BuildShellLists(out jumpItems, out list, out list2); - } - catch (Exception) - { - this.RejectEverything(); - return; - } - this._jumpItems = jumpItems; - EventHandler jumpItemsRejected = this.JumpItemsRejected; - EventHandler jumpItemsRemovedByUser = this.JumpItemsRemovedByUser; - if (list.Count > 0 && jumpItemsRejected != null) - { - List list3 = new List(list.Count); - List list4 = new List(list.Count); - foreach (JumpList._RejectedJumpItemPair rejectedJumpItemPair in list) - { - list3.Add(rejectedJumpItemPair.JumpItem); - list4.Add(rejectedJumpItemPair.Reason); - } - jumpItemsRejected(this, new JumpItemsRejectedEventArgs(list3, list4)); - } - if (list2.Count > 0 && jumpItemsRemovedByUser != null) - { - List list5 = new List(list2.Count); - foreach (JumpList._ShellObjectPair shellObjectPair in list2) - { - if (shellObjectPair.JumpItem != null) - { - list5.Add(shellObjectPair.JumpItem); - } - } - if (list5.Count > 0) - { - jumpItemsRemovedByUser(this, new JumpItemsRemovedEventArgs(list5)); - } - } - } + [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.Verify.IsApartmentState(System.Threading.ApartmentState,System.String)")] + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] + [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "JumpLists")] + private void _ApplyList() + { + Verify.IsApartmentState(ApartmentState.STA, "JumpLists can only be effected on STA threads."); + if (!Utility.IsOSWindows7OrNewer) + { + this.RejectEverything(); + return; + } + List jumpItems; + List list; + List list2; + try + { + this._BuildShellLists(out jumpItems, out list, out list2); + } + catch (Exception) + { + this.RejectEverything(); + return; + } + this._jumpItems = jumpItems; + EventHandler jumpItemsRejected = this.JumpItemsRejected; + EventHandler jumpItemsRemovedByUser = this.JumpItemsRemovedByUser; + if (list.Count > 0 && jumpItemsRejected != null) + { + List list3 = new List(list.Count); + List list4 = new List(list.Count); + foreach (JumpList._RejectedJumpItemPair rejectedJumpItemPair in list) + { + list3.Add(rejectedJumpItemPair.JumpItem); + list4.Add(rejectedJumpItemPair.Reason); + } + jumpItemsRejected(this, new JumpItemsRejectedEventArgs(list3, list4)); + } + if (list2.Count > 0 && jumpItemsRemovedByUser != null) + { + List list5 = new List(list2.Count); + foreach (JumpList._ShellObjectPair shellObjectPair in list2) + { + if (shellObjectPair.JumpItem != null) + { + list5.Add(shellObjectPair.JumpItem); + } + } + if (list5.Count > 0) + { + jumpItemsRemovedByUser(this, new JumpItemsRemovedEventArgs(list5)); + } + } + } - private void _BuildShellLists(out List successList, out List rejectedList, out List removedList) - { - List> list = null; - removedList = null; - ICustomDestinationList customDestinationList = CLSID.CoCreateInstance("77f10cf0-3db5-4966-b520-b7c54fd35ed6"); - try - { - string runtimeId = JumpList._RuntimeId; - if (!string.IsNullOrEmpty(runtimeId)) - { - customDestinationList.SetAppID(runtimeId); - } - Guid guid = new Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9"); - uint num; - IObjectArray shellObjects = (IObjectArray)customDestinationList.BeginList(out num, ref guid); - removedList = JumpList.GenerateJumpItems(shellObjects); - successList = new List(this.JumpItems.Count); - rejectedList = new List(this.JumpItems.Count); - list = new List> - { - new List() - }; - foreach (JumpItem jumpItem in this.JumpItems) - { - if (jumpItem == null) - { - rejectedList.Add(new JumpList._RejectedJumpItemPair - { - JumpItem = jumpItem, - Reason = JumpItemRejectionReason.InvalidItem - }); - } - else - { - object obj = null; - try - { - obj = JumpList.GetShellObjectForJumpItem(jumpItem); - if (obj == null) - { - rejectedList.Add(new JumpList._RejectedJumpItemPair - { - Reason = JumpItemRejectionReason.InvalidItem, - JumpItem = jumpItem - }); - } - else if (JumpList.ListContainsShellObject(removedList, obj)) - { - rejectedList.Add(new JumpList._RejectedJumpItemPair - { - Reason = JumpItemRejectionReason.RemovedByUser, - JumpItem = jumpItem - }); - } - else - { - JumpList._ShellObjectPair item = new JumpList._ShellObjectPair - { - JumpItem = jumpItem, - ShellObject = obj - }; - if (string.IsNullOrEmpty(jumpItem.CustomCategory)) - { - list[0].Add(item); - } - else - { - bool flag = false; - foreach (List list2 in list) - { - if (list2.Count > 0 && list2[0].JumpItem.CustomCategory == jumpItem.CustomCategory) - { - list2.Add(item); - flag = true; - break; - } - } - if (!flag) - { - list.Add(new List - { - item - }); - } - } - obj = null; - } - } - finally - { - Utility.SafeRelease(ref obj); - } - } - } - list.Reverse(); - if (this.ShowFrequentCategory) - { - customDestinationList.AppendKnownCategory(KDC.FREQUENT); - } - if (this.ShowRecentCategory) - { - customDestinationList.AppendKnownCategory(KDC.RECENT); - } - foreach (List list3 in list) - { - if (list3.Count > 0) - { - string customCategory = list3[0].JumpItem.CustomCategory; - JumpList.AddCategory(customDestinationList, customCategory, list3, successList, rejectedList); - } - } - customDestinationList.CommitList(); - successList.Reverse(); - } - finally - { - Utility.SafeRelease(ref customDestinationList); - if (list != null) - { - foreach (List list4 in list) - { - JumpList._ShellObjectPair.ReleaseShellObjects(list4); - } - } - JumpList._ShellObjectPair.ReleaseShellObjects(removedList); - } - } + private void _BuildShellLists(out List successList, out List rejectedList, out List removedList) + { + List> list = null; + removedList = null; + ICustomDestinationList customDestinationList = CLSID.CoCreateInstance("77f10cf0-3db5-4966-b520-b7c54fd35ed6"); + try + { + string runtimeId = JumpList._RuntimeId; + if (!string.IsNullOrEmpty(runtimeId)) + { + customDestinationList.SetAppID(runtimeId); + } + Guid guid = new Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9"); + uint num; + IObjectArray shellObjects = (IObjectArray) customDestinationList.BeginList(out num, ref guid); + removedList = JumpList.GenerateJumpItems(shellObjects); + successList = new List(this.JumpItems.Count); + rejectedList = new List(this.JumpItems.Count); + list = new List> + { + new List() + }; + foreach (JumpItem jumpItem in this.JumpItems) + { + if (jumpItem == null) + { + rejectedList.Add(new JumpList._RejectedJumpItemPair + { + JumpItem = jumpItem, + Reason = JumpItemRejectionReason.InvalidItem + }); + } + else + { + object obj = null; + try + { + obj = JumpList.GetShellObjectForJumpItem(jumpItem); + if (obj == null) + { + rejectedList.Add(new JumpList._RejectedJumpItemPair + { + Reason = JumpItemRejectionReason.InvalidItem, + JumpItem = jumpItem + }); + } + else if (JumpList.ListContainsShellObject(removedList, obj)) + { + rejectedList.Add(new JumpList._RejectedJumpItemPair + { + Reason = JumpItemRejectionReason.RemovedByUser, + JumpItem = jumpItem + }); + } + else + { + JumpList._ShellObjectPair item = new JumpList._ShellObjectPair + { + JumpItem = jumpItem, + ShellObject = obj + }; + if (string.IsNullOrEmpty(jumpItem.CustomCategory)) + { + list[0].Add(item); + } + else + { + bool flag = false; + foreach (List list2 in list) + { + if (list2.Count > 0 && list2[0].JumpItem.CustomCategory == jumpItem.CustomCategory) + { + list2.Add(item); + flag = true; + break; + } + } + if (!flag) + { + list.Add(new List + { + item + }); + } + } + obj = null; + } + } + finally + { + Utility.SafeRelease(ref obj); + } + } + } + list.Reverse(); + if (this.ShowFrequentCategory) + { + customDestinationList.AppendKnownCategory(KDC.FREQUENT); + } + if (this.ShowRecentCategory) + { + customDestinationList.AppendKnownCategory(KDC.RECENT); + } + foreach (List list3 in list) + { + if (list3.Count > 0) + { + string customCategory = list3[0].JumpItem.CustomCategory; + JumpList.AddCategory(customDestinationList, customCategory, list3, successList, rejectedList); + } + } + customDestinationList.CommitList(); + successList.Reverse(); + } + finally + { + Utility.SafeRelease(ref customDestinationList); + if (list != null) + { + foreach (List list4 in list) + { + JumpList._ShellObjectPair.ReleaseShellObjects(list4); + } + } + JumpList._ShellObjectPair.ReleaseShellObjects(removedList); + } + } - private static bool ListContainsShellObject(List removedList, object shellObject) - { - if (removedList.Count == 0) - { - return false; - } - IShellItem shellItem = shellObject as IShellItem; - if (shellItem != null) - { - foreach (JumpList._ShellObjectPair shellObjectPair in removedList) - { - IShellItem shellItem2 = shellObjectPair.ShellObject as IShellItem; - if (shellItem2 != null && shellItem.Compare(shellItem2, (SICHINT)805306368u) == 0) - { - return true; - } - } - return false; - } - IShellLinkW shellLinkW = shellObject as IShellLinkW; - if (shellLinkW != null) - { - foreach (JumpList._ShellObjectPair shellObjectPair2 in removedList) - { - IShellLinkW shellLinkW2 = shellObjectPair2.ShellObject as IShellLinkW; - if (shellLinkW2 != null) - { - string a = JumpList.ShellLinkToString(shellLinkW2); - string b = JumpList.ShellLinkToString(shellLinkW); - if (a == b) - { - return true; - } - } - } - return false; - } - return false; - } + private static bool ListContainsShellObject(List removedList, object shellObject) + { + if (removedList.Count == 0) + { + return false; + } + IShellItem shellItem = shellObject as IShellItem; + if (shellItem != null) + { + foreach (JumpList._ShellObjectPair shellObjectPair in removedList) + { + IShellItem shellItem2 = shellObjectPair.ShellObject as IShellItem; + if (shellItem2 != null && shellItem.Compare(shellItem2, (SICHINT) 805306368u) == 0) + { + return true; + } + } + return false; + } + IShellLinkW shellLinkW = shellObject as IShellLinkW; + if (shellLinkW != null) + { + foreach (JumpList._ShellObjectPair shellObjectPair2 in removedList) + { + IShellLinkW shellLinkW2 = shellObjectPair2.ShellObject as IShellLinkW; + if (shellLinkW2 != null) + { + string a = JumpList.ShellLinkToString(shellLinkW2); + string b = JumpList.ShellLinkToString(shellLinkW); + if (a == b) + { + return true; + } + } + } + return false; + } + return false; + } - private static object GetShellObjectForJumpItem(JumpItem jumpItem) - { - JumpPath jumpPath = jumpItem as JumpPath; - JumpTask jumpTask = jumpItem as JumpTask; - if (jumpPath != null) - { - return JumpList.CreateItemFromJumpPath(jumpPath); - } - if (jumpTask != null) - { - return JumpList.CreateLinkFromJumpTask(jumpTask, true); - } - return null; - } + private static object GetShellObjectForJumpItem(JumpItem jumpItem) + { + JumpPath jumpPath = jumpItem as JumpPath; + JumpTask jumpTask = jumpItem as JumpTask; + if (jumpPath != null) + { + return JumpList.CreateItemFromJumpPath(jumpPath); + } + if (jumpTask != null) + { + return JumpList.CreateLinkFromJumpTask(jumpTask, true); + } + return null; + } - private static List GenerateJumpItems(IObjectArray shellObjects) - { - List list = new List(); - Guid guid = new Guid("00000000-0000-0000-C000-000000000046"); - uint count = shellObjects.GetCount(); - for (uint num = 0u; num < count; num += 1u) - { - object at = shellObjects.GetAt(num, ref guid); - JumpItem jumpItem = null; - try - { - jumpItem = JumpList.GetJumpItemForShellObject(at); - } - catch (Exception ex) - { - if (ex is NullReferenceException || ex is SEHException) - { - throw; - } - } - list.Add(new JumpList._ShellObjectPair - { - ShellObject = at, - JumpItem = jumpItem - }); - } - return list; - } + private static List GenerateJumpItems(IObjectArray shellObjects) + { + List list = new List(); + Guid guid = new Guid("00000000-0000-0000-C000-000000000046"); + uint count = shellObjects.GetCount(); + for (uint num = 0u; num < count; num += 1u) + { + object at = shellObjects.GetAt(num, ref guid); + JumpItem jumpItem = null; + try + { + jumpItem = JumpList.GetJumpItemForShellObject(at); + } + catch (Exception ex) + { + if (ex is NullReferenceException || ex is SEHException) + { + throw; + } + } + list.Add(new JumpList._ShellObjectPair + { + ShellObject = at, + JumpItem = jumpItem + }); + } + return list; + } - private static void AddCategory(ICustomDestinationList cdl, string category, List jumpItems, List successList, List rejectionList) - { - JumpList.AddCategory(cdl, category, jumpItems, successList, rejectionList, true); - } + private static void AddCategory(ICustomDestinationList cdl, string category, List jumpItems, List successList, List rejectionList) + { + JumpList.AddCategory(cdl, category, jumpItems, successList, rejectionList, true); + } - private static void AddCategory(ICustomDestinationList cdl, string category, List jumpItems, List successList, List rejectionList, bool isHeterogenous) - { - IObjectCollection objectCollection = (IObjectCollection)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("2d3468c1-36a7-43b6-ac24-d3f02fd9607a"))); - foreach (JumpList._ShellObjectPair shellObjectPair in jumpItems) - { - objectCollection.AddObject(shellObjectPair.ShellObject); - } - HRESULT hrLeft; - if (string.IsNullOrEmpty(category)) - { - hrLeft = cdl.AddUserTasks(objectCollection); - } - else - { - hrLeft = cdl.AppendCategory(category, objectCollection); - } - if (hrLeft.Succeeded) - { - int num = jumpItems.Count; - while (--num >= 0) - { - successList.Add(jumpItems[num].JumpItem); - } - return; - } - if (isHeterogenous && hrLeft == HRESULT.DESTS_E_NO_MATCHING_ASSOC_HANDLER) - { - Utility.SafeRelease(ref objectCollection); - List list = new List(); - foreach (JumpList._ShellObjectPair shellObjectPair2 in jumpItems) - { - if (shellObjectPair2.JumpItem is JumpPath) - { - rejectionList.Add(new JumpList._RejectedJumpItemPair - { - JumpItem = shellObjectPair2.JumpItem, - Reason = JumpItemRejectionReason.NoRegisteredHandler - }); - } - else - { - list.Add(shellObjectPair2); - } - } - if (list.Count > 0) - { - JumpList.AddCategory(cdl, category, list, successList, rejectionList, false); - return; - } - } - else - { - foreach (JumpList._ShellObjectPair shellObjectPair3 in jumpItems) - { - rejectionList.Add(new JumpList._RejectedJumpItemPair - { - JumpItem = shellObjectPair3.JumpItem, - Reason = JumpItemRejectionReason.InvalidItem - }); - } - } - } + private static void AddCategory(ICustomDestinationList cdl, string category, List jumpItems, List successList, List rejectionList, bool isHeterogenous) + { + IObjectCollection objectCollection = (IObjectCollection) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("2d3468c1-36a7-43b6-ac24-d3f02fd9607a"))); + foreach (JumpList._ShellObjectPair shellObjectPair in jumpItems) + { + objectCollection.AddObject(shellObjectPair.ShellObject); + } + HRESULT hrLeft; + if (string.IsNullOrEmpty(category)) + { + hrLeft = cdl.AddUserTasks(objectCollection); + } + else + { + hrLeft = cdl.AppendCategory(category, objectCollection); + } + if (hrLeft.Succeeded) + { + int num = jumpItems.Count; + while (--num >= 0) + { + successList.Add(jumpItems[num].JumpItem); + } + return; + } + if (isHeterogenous && hrLeft == HRESULT.DESTS_E_NO_MATCHING_ASSOC_HANDLER) + { + Utility.SafeRelease(ref objectCollection); + List list = new List(); + foreach (JumpList._ShellObjectPair shellObjectPair2 in jumpItems) + { + if (shellObjectPair2.JumpItem is JumpPath) + { + rejectionList.Add(new JumpList._RejectedJumpItemPair + { + JumpItem = shellObjectPair2.JumpItem, + Reason = JumpItemRejectionReason.NoRegisteredHandler + }); + } + else + { + list.Add(shellObjectPair2); + } + } + if (list.Count > 0) + { + JumpList.AddCategory(cdl, category, list, successList, rejectionList, false); + return; + } + } + else + { + foreach (JumpList._ShellObjectPair shellObjectPair3 in jumpItems) + { + rejectionList.Add(new JumpList._RejectedJumpItemPair + { + JumpItem = shellObjectPair3.JumpItem, + Reason = JumpItemRejectionReason.InvalidItem + }); + } + } + } - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - private static IShellLinkW CreateLinkFromJumpTask(JumpTask jumpTask, bool allowSeparators) - { - if (string.IsNullOrEmpty(jumpTask.Title) && (!allowSeparators || !string.IsNullOrEmpty(jumpTask.CustomCategory))) - { - return null; - } - IShellLinkW shellLinkW = (IShellLinkW)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("00021401-0000-0000-C000-000000000046"))); - IShellLinkW result; - try - { - string path = JumpList._FullName; - if (!string.IsNullOrEmpty(jumpTask.ApplicationPath)) - { - path = jumpTask.ApplicationPath; - } - shellLinkW.SetPath(path); - if (!string.IsNullOrEmpty(jumpTask.WorkingDirectory)) - { - shellLinkW.SetWorkingDirectory(jumpTask.WorkingDirectory); - } - if (!string.IsNullOrEmpty(jumpTask.Arguments)) - { - shellLinkW.SetArguments(jumpTask.Arguments); - } - if (jumpTask.IconResourceIndex != -1) - { - string pszIconPath = JumpList._FullName; - if (!string.IsNullOrEmpty(jumpTask.IconResourcePath)) - { - if ((long)jumpTask.IconResourcePath.Length >= 260L) - { - return null; - } - pszIconPath = jumpTask.IconResourcePath; - } - shellLinkW.SetIconLocation(pszIconPath, jumpTask.IconResourceIndex); - } - if (!string.IsNullOrEmpty(jumpTask.Description)) - { - shellLinkW.SetDescription(jumpTask.Description); - } - IPropertyStore propertyStore = (IPropertyStore)shellLinkW; - using (PROPVARIANT propvariant = new PROPVARIANT()) - { - PKEY pkey = default(PKEY); - if (!string.IsNullOrEmpty(jumpTask.Title)) - { - propvariant.SetValue(jumpTask.Title); - pkey = PKEY.Title; - } - else - { - propvariant.SetValue(true); - pkey = PKEY.AppUserModel_IsDestListSeparator; - } - propertyStore.SetValue(ref pkey, propvariant); - } - propertyStore.Commit(); - IShellLinkW shellLinkW2 = shellLinkW; - shellLinkW = null; - result = shellLinkW2; - } - catch (Exception) - { - result = null; - } - finally - { - Utility.SafeRelease(ref shellLinkW); - } - return result; - } + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] + private static IShellLinkW CreateLinkFromJumpTask(JumpTask jumpTask, bool allowSeparators) + { + if (string.IsNullOrEmpty(jumpTask.Title) && (!allowSeparators || !string.IsNullOrEmpty(jumpTask.CustomCategory))) + { + return null; + } + IShellLinkW shellLinkW = (IShellLinkW) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("00021401-0000-0000-C000-000000000046"))); + IShellLinkW result; + try + { + string path = JumpList._FullName; + if (!string.IsNullOrEmpty(jumpTask.ApplicationPath)) + { + path = jumpTask.ApplicationPath; + } + shellLinkW.SetPath(path); + if (!string.IsNullOrEmpty(jumpTask.WorkingDirectory)) + { + shellLinkW.SetWorkingDirectory(jumpTask.WorkingDirectory); + } + if (!string.IsNullOrEmpty(jumpTask.Arguments)) + { + shellLinkW.SetArguments(jumpTask.Arguments); + } + if (jumpTask.IconResourceIndex != -1) + { + string pszIconPath = JumpList._FullName; + if (!string.IsNullOrEmpty(jumpTask.IconResourcePath)) + { + if ((long) jumpTask.IconResourcePath.Length >= 260L) + { + return null; + } + pszIconPath = jumpTask.IconResourcePath; + } + shellLinkW.SetIconLocation(pszIconPath, jumpTask.IconResourceIndex); + } + if (!string.IsNullOrEmpty(jumpTask.Description)) + { + shellLinkW.SetDescription(jumpTask.Description); + } + IPropertyStore propertyStore = (IPropertyStore) shellLinkW; + using (PROPVARIANT propvariant = new PROPVARIANT()) + { + PKEY pkey = default(PKEY); + if (!string.IsNullOrEmpty(jumpTask.Title)) + { + propvariant.SetValue(jumpTask.Title); + pkey = PKEY.Title; + } + else + { + propvariant.SetValue(true); + pkey = PKEY.AppUserModel_IsDestListSeparator; + } + propertyStore.SetValue(ref pkey, propvariant); + } + propertyStore.Commit(); + IShellLinkW shellLinkW2 = shellLinkW; + shellLinkW = null; + result = shellLinkW2; + } + catch (Exception) + { + result = null; + } + finally + { + Utility.SafeRelease(ref shellLinkW); + } + return result; + } - private static IShellItem2 GetShellItemForPath(string path) - { - if (string.IsNullOrEmpty(path)) - { - return null; - } - Guid guid = new Guid("7e9fb0d3-919f-4307-ab2e-9b1860310c93"); - object obj; - HRESULT hrLeft = NativeMethods.SHCreateItemFromParsingName(path, null, ref guid, out obj); - if (hrLeft == (HRESULT)Win32Error.ERROR_FILE_NOT_FOUND || hrLeft == (HRESULT)Win32Error.ERROR_PATH_NOT_FOUND) - { - hrLeft = HRESULT.S_OK; - obj = null; - } - hrLeft.ThrowIfFailed(); - return (IShellItem2)obj; - } + private static IShellItem2 GetShellItemForPath(string path) + { + if (string.IsNullOrEmpty(path)) + { + return null; + } + Guid guid = new Guid("7e9fb0d3-919f-4307-ab2e-9b1860310c93"); + object obj; + HRESULT hrLeft = NativeMethods.SHCreateItemFromParsingName(path, null, ref guid, out obj); + if (hrLeft == (HRESULT) Win32Error.ERROR_FILE_NOT_FOUND || hrLeft == (HRESULT) Win32Error.ERROR_PATH_NOT_FOUND) + { + hrLeft = HRESULT.S_OK; + obj = null; + } + hrLeft.ThrowIfFailed(); + return (IShellItem2) obj; + } - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - private static IShellItem2 CreateItemFromJumpPath(JumpPath jumpPath) - { - try - { - return JumpList.GetShellItemForPath(Path.GetFullPath(jumpPath.Path)); - } - catch (Exception) - { - } - return null; - } + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] + private static IShellItem2 CreateItemFromJumpPath(JumpPath jumpPath) + { + try + { + return JumpList.GetShellItemForPath(Path.GetFullPath(jumpPath.Path)); + } + catch (Exception) + { + } + return null; + } - private static JumpItem GetJumpItemForShellObject(object shellObject) - { - IShellItem2 shellItem = shellObject as IShellItem2; - IShellLinkW shellLinkW = shellObject as IShellLinkW; - if (shellItem != null) - { - return new JumpPath - { - Path = shellItem.GetDisplayName((SIGDN)2147647488u) - }; - } - if (shellLinkW != null) - { - StringBuilder stringBuilder = new StringBuilder(260); - shellLinkW.GetPath(stringBuilder, stringBuilder.Capacity, null, SLGP.RAWPATH); - StringBuilder stringBuilder2 = new StringBuilder(1024); - shellLinkW.GetArguments(stringBuilder2, stringBuilder2.Capacity); - StringBuilder stringBuilder3 = new StringBuilder(1024); - shellLinkW.GetDescription(stringBuilder3, stringBuilder3.Capacity); - StringBuilder stringBuilder4 = new StringBuilder(260); - int iconResourceIndex; - shellLinkW.GetIconLocation(stringBuilder4, stringBuilder4.Capacity, out iconResourceIndex); - StringBuilder stringBuilder5 = new StringBuilder(260); - shellLinkW.GetWorkingDirectory(stringBuilder5, stringBuilder5.Capacity); - JumpTask jumpTask = new JumpTask - { - ApplicationPath = stringBuilder.ToString(), - Arguments = stringBuilder2.ToString(), - Description = stringBuilder3.ToString(), - IconResourceIndex = iconResourceIndex, - IconResourcePath = stringBuilder4.ToString(), - WorkingDirectory = stringBuilder5.ToString() - }; - using (PROPVARIANT propvariant = new PROPVARIANT()) - { - IPropertyStore propertyStore = (IPropertyStore)shellLinkW; - PKEY title = PKEY.Title; - propertyStore.GetValue(ref title, propvariant); - jumpTask.Title = (propvariant.GetValue() ?? ""); - } - return jumpTask; - } - return null; - } + private static JumpItem GetJumpItemForShellObject(object shellObject) + { + IShellItem2 shellItem = shellObject as IShellItem2; + IShellLinkW shellLinkW = shellObject as IShellLinkW; + if (shellItem != null) + { + return new JumpPath + { + Path = shellItem.GetDisplayName((SIGDN) 2147647488u) + }; + } + if (shellLinkW != null) + { + StringBuilder stringBuilder = new StringBuilder(260); + shellLinkW.GetPath(stringBuilder, stringBuilder.Capacity, null, SLGP.RAWPATH); + StringBuilder stringBuilder2 = new StringBuilder(1024); + shellLinkW.GetArguments(stringBuilder2, stringBuilder2.Capacity); + StringBuilder stringBuilder3 = new StringBuilder(1024); + shellLinkW.GetDescription(stringBuilder3, stringBuilder3.Capacity); + StringBuilder stringBuilder4 = new StringBuilder(260); + int iconResourceIndex; + shellLinkW.GetIconLocation(stringBuilder4, stringBuilder4.Capacity, out iconResourceIndex); + StringBuilder stringBuilder5 = new StringBuilder(260); + shellLinkW.GetWorkingDirectory(stringBuilder5, stringBuilder5.Capacity); + JumpTask jumpTask = new JumpTask + { + ApplicationPath = stringBuilder.ToString(), + Arguments = stringBuilder2.ToString(), + Description = stringBuilder3.ToString(), + IconResourceIndex = iconResourceIndex, + IconResourcePath = stringBuilder4.ToString(), + WorkingDirectory = stringBuilder5.ToString() + }; + using (PROPVARIANT propvariant = new PROPVARIANT()) + { + IPropertyStore propertyStore = (IPropertyStore) shellLinkW; + PKEY title = PKEY.Title; + propertyStore.GetValue(ref title, propvariant); + jumpTask.Title = (propvariant.GetValue() ?? ""); + } + return jumpTask; + } + return null; + } - private static string ShellLinkToString(IShellLinkW shellLink) - { - StringBuilder stringBuilder = new StringBuilder(260); - shellLink.GetPath(stringBuilder, stringBuilder.Capacity, null, SLGP.RAWPATH); - string text = null; - using (PROPVARIANT propvariant = new PROPVARIANT()) - { - IPropertyStore propertyStore = (IPropertyStore)shellLink; - PKEY title = PKEY.Title; - propertyStore.GetValue(ref title, propvariant); - text = (propvariant.GetValue() ?? ""); - } - StringBuilder stringBuilder2 = new StringBuilder(1024); - shellLink.GetArguments(stringBuilder2, stringBuilder2.Capacity); - return stringBuilder.ToString().ToUpperInvariant() + text.ToUpperInvariant() + stringBuilder2.ToString(); - } + private static string ShellLinkToString(IShellLinkW shellLink) + { + StringBuilder stringBuilder = new StringBuilder(260); + shellLink.GetPath(stringBuilder, stringBuilder.Capacity, null, SLGP.RAWPATH); + string text = null; + using (PROPVARIANT propvariant = new PROPVARIANT()) + { + IPropertyStore propertyStore = (IPropertyStore) shellLink; + PKEY title = PKEY.Title; + propertyStore.GetValue(ref title, propvariant); + text = (propvariant.GetValue() ?? ""); + } + StringBuilder stringBuilder2 = new StringBuilder(1024); + shellLink.GetArguments(stringBuilder2, stringBuilder2.Capacity); + return stringBuilder.ToString().ToUpperInvariant() + text.ToUpperInvariant() + stringBuilder2.ToString(); + } - private void RejectEverything() - { - EventHandler jumpItemsRejected = this.JumpItemsRejected; - if (jumpItemsRejected == null) - { - this._jumpItems.Clear(); - return; - } - if (this._jumpItems.Count > 0) - { - List list = new List(this.JumpItems.Count); - for (int i = 0; i < this.JumpItems.Count; i++) - { - list.Add(JumpItemRejectionReason.InvalidItem); - } - JumpItemsRejectedEventArgs e = new JumpItemsRejectedEventArgs(this.JumpItems, list); - this._jumpItems.Clear(); - jumpItemsRejected(this, e); - } - } + private void RejectEverything() + { + EventHandler jumpItemsRejected = this.JumpItemsRejected; + if (jumpItemsRejected == null) + { + this._jumpItems.Clear(); + return; + } + if (this._jumpItems.Count > 0) + { + List list = new List(this.JumpItems.Count); + for (int i = 0; i < this.JumpItems.Count; i++) + { + list.Add(JumpItemRejectionReason.InvalidItem); + } + JumpItemsRejectedEventArgs e = new JumpItemsRejectedEventArgs(this.JumpItems, list); + this._jumpItems.Clear(); + jumpItemsRejected(this, e); + } + } - public event EventHandler JumpItemsRejected; + public event EventHandler JumpItemsRejected; - public event EventHandler JumpItemsRemovedByUser; + public event EventHandler JumpItemsRemovedByUser; - private static readonly object s_lock = new object(); + private static readonly object s_lock = new object(); - private static readonly Dictionary s_applicationMap = new Dictionary(); + private static readonly Dictionary s_applicationMap = new Dictionary(); - private Application _application; + private Application _application; - private bool? _initializing; + private bool? _initializing; - private List _jumpItems; + private List _jumpItems; - private static readonly string _FullName = NativeMethods.GetModuleFileName(IntPtr.Zero); + private static readonly string _FullName = NativeMethods.GetModuleFileName(IntPtr.Zero); - private class _RejectedJumpItemPair - { - public JumpItem JumpItem { get; set; } + private class _RejectedJumpItemPair + { + public JumpItem JumpItem { get; set; } - public JumpItemRejectionReason Reason { get; set; } - } + public JumpItemRejectionReason Reason { get; set; } + } - private class _ShellObjectPair - { - public JumpItem JumpItem { get; set; } + private class _ShellObjectPair + { + public JumpItem JumpItem { get; set; } - public object ShellObject { get; set; } + public object ShellObject { get; set; } - public static void ReleaseShellObjects(List list) - { - if (list != null) - { - foreach (JumpList._ShellObjectPair shellObjectPair in list) - { - object shellObject = shellObjectPair.ShellObject; - shellObjectPair.ShellObject = null; - Utility.SafeRelease(ref shellObject); - } - } - } - } - } + public static void ReleaseShellObjects(List list) + { + if (list != null) + { + foreach (JumpList._ShellObjectPair shellObjectPair in list) + { + object shellObject = shellObjectPair.ShellObject; + shellObjectPair.ShellObject = null; + Utility.SafeRelease(ref shellObject); + } + } + } + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/JumpPath.cs b/src/Shared/Microsoft.Windows.Shell/JumpPath.cs index 0cec68f4..f58926d2 100644 --- a/src/Shared/Microsoft.Windows.Shell/JumpPath.cs +++ b/src/Shared/Microsoft.Windows.Shell/JumpPath.cs @@ -2,8 +2,8 @@ namespace Microsoft.Windows.Shell { - public class JumpPath : JumpItem - { - public string Path { get; set; } - } + public class JumpPath : JumpItem + { + public string Path { get; set; } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/JumpTask.cs b/src/Shared/Microsoft.Windows.Shell/JumpTask.cs index d49ffb46..d4a64eb7 100644 --- a/src/Shared/Microsoft.Windows.Shell/JumpTask.cs +++ b/src/Shared/Microsoft.Windows.Shell/JumpTask.cs @@ -2,20 +2,20 @@ namespace Microsoft.Windows.Shell { - public class JumpTask : JumpItem - { - public string Title { get; set; } + public class JumpTask : JumpItem + { + public string Title { get; set; } - public string Description { get; set; } + public string Description { get; set; } - public string ApplicationPath { get; set; } + public string ApplicationPath { get; set; } - public string Arguments { get; set; } + public string Arguments { get; set; } - public string WorkingDirectory { get; set; } + public string WorkingDirectory { get; set; } - public string IconResourcePath { get; set; } + public string IconResourcePath { get; set; } - public int IconResourceIndex { get; set; } - } + public int IconResourceIndex { get; set; } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/AC.cs b/src/Shared/Microsoft.Windows.Shell/Standard/AC.cs index 5ea00a24..84bbe118 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/AC.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/AC.cs @@ -2,9 +2,9 @@ namespace Standard { - internal enum AC : byte - { - SRC_OVER, - SRC_ALPHA - } + internal enum AC : byte + { + SRC_OVER, + SRC_ALPHA + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/APPDOCLISTTYPE.cs b/src/Shared/Microsoft.Windows.Shell/Standard/APPDOCLISTTYPE.cs index 24f09f3e..bcad937a 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/APPDOCLISTTYPE.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/APPDOCLISTTYPE.cs @@ -2,9 +2,9 @@ namespace Standard { - internal enum APPDOCLISTTYPE - { - ADLT_RECENT, - ADLT_FREQUENT - } + internal enum APPDOCLISTTYPE + { + ADLT_RECENT, + ADLT_FREQUENT + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/Assert.cs b/src/Shared/Microsoft.Windows.Shell/Standard/Assert.cs index 603c477a..efea3fbd 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/Assert.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/Assert.cs @@ -5,229 +5,229 @@ using System.Windows; namespace Standard { - internal static class Assert - { - private static void _Break() - { - Debugger.Break(); - } + internal static class Assert + { + private static void _Break() + { + Debugger.Break(); + } - [Conditional("DEBUG")] - public static void Evaluate(Assert.EvaluateFunction argument) - { - argument(); - } + [Conditional("DEBUG")] + public static void Evaluate(Assert.EvaluateFunction argument) + { + argument(); + } - [Obsolete("Use Assert.AreEqual instead of Assert.Equals", false)] - [Conditional("DEBUG")] - public static void Equals(T expected, T actual) - { - } + [Obsolete("Use Assert.AreEqual instead of Assert.Equals", false)] + [Conditional("DEBUG")] + public static void Equals(T expected, T actual) + { + } - [Conditional("DEBUG")] - public static void AreEqual(T expected, T actual) - { - if (expected == null) - { - if (actual != null && !actual.Equals(expected)) - { - Assert._Break(); - return; - } - } - else if (!expected.Equals(actual)) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void AreEqual(T expected, T actual) + { + if (expected == null) + { + if (actual != null && !actual.Equals(expected)) + { + Assert._Break(); + return; + } + } + else if (!expected.Equals(actual)) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void AreNotEqual(T notExpected, T actual) - { - if (notExpected == null) - { - if (actual == null || actual.Equals(notExpected)) - { - Assert._Break(); - return; - } - } - else if (notExpected.Equals(actual)) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void AreNotEqual(T notExpected, T actual) + { + if (notExpected == null) + { + if (actual == null || actual.Equals(notExpected)) + { + Assert._Break(); + return; + } + } + else if (notExpected.Equals(actual)) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void Implies(bool condition, bool result) - { - if (condition && !result) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void Implies(bool condition, bool result) + { + if (condition && !result) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void Implies(bool condition, Assert.ImplicationFunction result) - { - if (condition && !result()) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void Implies(bool condition, Assert.ImplicationFunction result) + { + if (condition && !result()) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void IsNeitherNullNorEmpty(string value) - { - } + [Conditional("DEBUG")] + public static void IsNeitherNullNorEmpty(string value) + { + } - [Conditional("DEBUG")] - public static void IsNeitherNullNorWhitespace(string value) - { - if (string.IsNullOrEmpty(value)) - { - Assert._Break(); - } - if (value.Trim().Length == 0) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsNeitherNullNorWhitespace(string value) + { + if (string.IsNullOrEmpty(value)) + { + Assert._Break(); + } + if (value.Trim().Length == 0) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void IsNotNull(T value) where T : class - { - if (value == null) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsNotNull(T value) where T : class + { + if (value == null) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void IsDefault(T value) where T : struct - { - value.Equals(default(T)); - } + [Conditional("DEBUG")] + public static void IsDefault(T value) where T : struct + { + value.Equals(default(T)); + } - [Conditional("DEBUG")] - public static void IsNotDefault(T value) where T : struct - { - value.Equals(default(T)); - } + [Conditional("DEBUG")] + public static void IsNotDefault(T value) where T : struct + { + value.Equals(default(T)); + } - [Conditional("DEBUG")] - public static void IsFalse(bool condition) - { - if (condition) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsFalse(bool condition) + { + if (condition) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void IsFalse(bool condition, string message) - { - if (condition) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsFalse(bool condition, string message) + { + if (condition) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void IsTrue(bool condition) - { - if (!condition) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsTrue(bool condition) + { + if (!condition) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void IsTrue(bool condition, string message) - { - if (!condition) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsTrue(bool condition, string message) + { + if (!condition) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void Fail() - { - Assert._Break(); - } + [Conditional("DEBUG")] + public static void Fail() + { + Assert._Break(); + } - [Conditional("DEBUG")] - public static void Fail(string message) - { - Assert._Break(); - } + [Conditional("DEBUG")] + public static void Fail(string message) + { + Assert._Break(); + } - [Conditional("DEBUG")] - public static void IsNull(T item) where T : class - { - if (item != null) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsNull(T item) where T : class + { + if (item != null) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void BoundedDoubleInc(double lowerBoundInclusive, double value, double upperBoundInclusive) - { - if (value < lowerBoundInclusive || value > upperBoundInclusive) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void BoundedDoubleInc(double lowerBoundInclusive, double value, double upperBoundInclusive) + { + if (value < lowerBoundInclusive || value > upperBoundInclusive) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void BoundedInteger(int lowerBoundInclusive, int value, int upperBoundExclusive) - { - if (value < lowerBoundInclusive || value >= upperBoundExclusive) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void BoundedInteger(int lowerBoundInclusive, int value, int upperBoundExclusive) + { + if (value < lowerBoundInclusive || value >= upperBoundExclusive) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void IsApartmentState(ApartmentState expectedState) - { - if (Thread.CurrentThread.GetApartmentState() != expectedState) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsApartmentState(ApartmentState expectedState) + { + if (Thread.CurrentThread.GetApartmentState() != expectedState) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void NullableIsNotNull(T? value) where T : struct - { - if (value == null) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void NullableIsNotNull(T? value) where T : struct + { + if (value == null) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void NullableIsNull(T? value) where T : struct - { - if (value != null) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void NullableIsNull(T? value) where T : struct + { + if (value != null) + { + Assert._Break(); + } + } - [Conditional("DEBUG")] - public static void IsNotOnMainThread() - { - if (Application.Current.Dispatcher.CheckAccess()) - { - Assert._Break(); - } - } + [Conditional("DEBUG")] + public static void IsNotOnMainThread() + { + if (Application.Current.Dispatcher.CheckAccess()) + { + Assert._Break(); + } + } - public delegate void EvaluateFunction(); + public delegate void EvaluateFunction(); - public delegate bool ImplicationFunction(); - } + public delegate bool ImplicationFunction(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/BI.cs b/src/Shared/Microsoft.Windows.Shell/Standard/BI.cs index 90d1914a..b7385201 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/BI.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/BI.cs @@ -2,8 +2,8 @@ namespace Standard { - internal enum BI - { - RGB - } + internal enum BI + { + RGB + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/BITMAPINFO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/BITMAPINFO.cs index fc3ff7ca..1bc43fce 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/BITMAPINFO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/BITMAPINFO.cs @@ -2,10 +2,10 @@ namespace Standard { - internal struct BITMAPINFO - { - public BITMAPINFOHEADER bmiHeader; + internal struct BITMAPINFO + { + public BITMAPINFOHEADER bmiHeader; - public RGBQUAD bmiColors; - } + public RGBQUAD bmiColors; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/BITMAPINFOHEADER.cs b/src/Shared/Microsoft.Windows.Shell/Standard/BITMAPINFOHEADER.cs index 773a7285..8e20e6dd 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/BITMAPINFOHEADER.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/BITMAPINFOHEADER.cs @@ -3,29 +3,29 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential, Pack = 2)] - internal struct BITMAPINFOHEADER - { - public int biSize; + [StructLayout(LayoutKind.Sequential, Pack = 2)] + internal struct BITMAPINFOHEADER + { + public int biSize; - public int biWidth; + public int biWidth; - public int biHeight; + public int biHeight; - public short biPlanes; + public short biPlanes; - public short biBitCount; + public short biBitCount; - public BI biCompression; + public BI biCompression; - public int biSizeImage; + public int biSizeImage; - public int biXPelsPerMeter; + public int biXPelsPerMeter; - public int biYPelsPerMeter; + public int biYPelsPerMeter; - public int biClrUsed; + public int biClrUsed; - public int biClrImportant; - } + public int biClrImportant; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/BLENDFUNCTION.cs b/src/Shared/Microsoft.Windows.Shell/Standard/BLENDFUNCTION.cs index ddca67a1..049b7f6c 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/BLENDFUNCTION.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/BLENDFUNCTION.cs @@ -2,14 +2,14 @@ namespace Standard { - internal struct BLENDFUNCTION - { - public AC BlendOp; + internal struct BLENDFUNCTION + { + public AC BlendOp; - public byte BlendFlags; + public byte BlendFlags; - public byte SourceConstantAlpha; + public byte SourceConstantAlpha; - public AC AlphaFormat; - } + public AC AlphaFormat; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/CHANGEFILTERSTRUCT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/CHANGEFILTERSTRUCT.cs index e24872f0..48666fa3 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/CHANGEFILTERSTRUCT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/CHANGEFILTERSTRUCT.cs @@ -2,10 +2,10 @@ namespace Standard { - internal struct CHANGEFILTERSTRUCT - { - public uint cbSize; + internal struct CHANGEFILTERSTRUCT + { + public uint cbSize; - public MSGFLTINFO ExtStatus; - } + public MSGFLTINFO ExtStatus; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/CLSID.cs b/src/Shared/Microsoft.Windows.Shell/Standard/CLSID.cs index bf79a5dc..82471f7b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/CLSID.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/CLSID.cs @@ -2,23 +2,23 @@ namespace Standard { - internal static class CLSID - { - public static T CoCreateInstance(string clsid) - { - return (T)((object)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(clsid)))); - } + internal static class CLSID + { + public static T CoCreateInstance(string clsid) + { + return (T) ((object) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(clsid)))); + } - public const string TaskbarList = "56FDF344-FD6D-11d0-958A-006097C9A090"; + public const string TaskbarList = "56FDF344-FD6D-11d0-958A-006097C9A090"; - public const string EnumerableObjectCollection = "2d3468c1-36a7-43b6-ac24-d3f02fd9607a"; + public const string EnumerableObjectCollection = "2d3468c1-36a7-43b6-ac24-d3f02fd9607a"; - public const string ShellLink = "00021401-0000-0000-C000-000000000046"; + public const string ShellLink = "00021401-0000-0000-C000-000000000046"; - public const string DestinationList = "77f10cf0-3db5-4966-b520-b7c54fd35ed6"; + public const string DestinationList = "77f10cf0-3db5-4966-b520-b7c54fd35ed6"; - public const string ApplicationDestinations = "86c14003-4d6b-4ef3-a7b4-0506663b2e68"; + public const string ApplicationDestinations = "86c14003-4d6b-4ef3-a7b4-0506663b2e68"; - public const string ApplicationDocumentLists = "86bec222-30f2-47e0-9f25-60d11cd75c28"; - } + public const string ApplicationDocumentLists = "86bec222-30f2-47e0-9f25-60d11cd75c28"; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/CREATESTRUCT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/CREATESTRUCT.cs index f237908e..2ca9094f 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/CREATESTRUCT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/CREATESTRUCT.cs @@ -3,33 +3,33 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal struct CREATESTRUCT - { - public IntPtr lpCreateParams; + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct CREATESTRUCT + { + public IntPtr lpCreateParams; - public IntPtr hInstance; + public IntPtr hInstance; - public IntPtr hMenu; + public IntPtr hMenu; - public IntPtr hwndParent; + public IntPtr hwndParent; - public int cy; + public int cy; - public int cx; + public int cx; - public int y; + public int y; - public int x; + public int x; - public WS style; + public WS style; - [MarshalAs(UnmanagedType.LPWStr)] - public string lpszName; + [MarshalAs(UnmanagedType.LPWStr)] + public string lpszName; - [MarshalAs(UnmanagedType.LPWStr)] - public string lpszClass; + [MarshalAs(UnmanagedType.LPWStr)] + public string lpszClass; - public WS_EX dwExStyle; - } + public WS_EX dwExStyle; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/CS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/CS.cs index 0e036b49..d73d81cb 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/CS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/CS.cs @@ -2,21 +2,21 @@ namespace Standard { - [Flags] - internal enum CS : uint - { - VREDRAW = 1u, - HREDRAW = 2u, - DBLCLKS = 8u, - OWNDC = 32u, - CLASSDC = 64u, - PARENTDC = 128u, - NOCLOSE = 512u, - SAVEBITS = 2048u, - BYTEALIGNCLIENT = 4096u, - BYTEALIGNWINDOW = 8192u, - GLOBALCLASS = 16384u, - IME = 65536u, - DROPSHADOW = 131072u - } + [Flags] + internal enum CS : uint + { + VREDRAW = 1u, + HREDRAW = 2u, + DBLCLKS = 8u, + OWNDC = 32u, + CLASSDC = 64u, + PARENTDC = 128u, + NOCLOSE = 512u, + SAVEBITS = 2048u, + BYTEALIGNCLIENT = 4096u, + BYTEALIGNWINDOW = 8192u, + GLOBALCLASS = 16384u, + IME = 65536u, + DROPSHADOW = 131072u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/CombineRgnResult.cs b/src/Shared/Microsoft.Windows.Shell/Standard/CombineRgnResult.cs index 1d6848fa..a883de54 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/CombineRgnResult.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/CombineRgnResult.cs @@ -2,11 +2,11 @@ namespace Standard { - internal enum CombineRgnResult - { - ERROR, - NULLREGION, - SIMPLEREGION, - COMPLEXREGION - } + internal enum CombineRgnResult + { + ERROR, + NULLREGION, + SIMPLEREGION, + COMPLEXREGION + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DOGIF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DOGIF.cs index 20bc745a..c46f781c 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DOGIF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DOGIF.cs @@ -2,12 +2,12 @@ namespace Standard { - internal enum DOGIF - { - DEFAULT, - TRAVERSE_LINK, - NO_HDROP, - NO_URL = 4, - ONLY_IF_ONE = 8 - } + internal enum DOGIF + { + DEFAULT, + TRAVERSE_LINK, + NO_HDROP, + NO_URL = 4, + ONLY_IF_ONE = 8 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DWMFLIP3D.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DWMFLIP3D.cs index 2f4c07d9..0d54674e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DWMFLIP3D.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DWMFLIP3D.cs @@ -2,10 +2,10 @@ namespace Standard { - internal enum DWMFLIP3D - { - DEFAULT, - EXCLUDEBELOW, - EXCLUDEABOVE - } + internal enum DWMFLIP3D + { + DEFAULT, + EXCLUDEBELOW, + EXCLUDEABOVE + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DWMNCRP.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DWMNCRP.cs index 6fddb087..97acd2a6 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DWMNCRP.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DWMNCRP.cs @@ -2,10 +2,10 @@ namespace Standard { - internal enum DWMNCRP - { - USEWINDOWSTYLE, - DISABLED, - ENABLED - } + internal enum DWMNCRP + { + USEWINDOWSTYLE, + DISABLED, + ENABLED + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DWMWA.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DWMWA.cs index 723e09ea..c201dc09 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DWMWA.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DWMWA.cs @@ -2,19 +2,19 @@ namespace Standard { - internal enum DWMWA - { - NCRENDERING_ENABLED = 1, - NCRENDERING_POLICY, - TRANSITIONS_FORCEDISABLED, - ALLOW_NCPAINT, - CAPTION_BUTTON_BOUNDS, - NONCLIENT_RTL_LAYOUT, - FORCE_ICONIC_REPRESENTATION, - FLIP3D_POLICY, - EXTENDED_FRAME_BOUNDS, - HAS_ICONIC_BITMAP, - DISALLOW_PEEK, - EXCLUDED_FROM_PEEK - } + internal enum DWMWA + { + NCRENDERING_ENABLED = 1, + NCRENDERING_POLICY, + TRANSITIONS_FORCEDISABLED, + ALLOW_NCPAINT, + CAPTION_BUTTON_BOUNDS, + NONCLIENT_RTL_LAYOUT, + FORCE_ICONIC_REPRESENTATION, + FLIP3D_POLICY, + EXTENDED_FRAME_BOUNDS, + HAS_ICONIC_BITMAP, + DISALLOW_PEEK, + EXCLUDED_FROM_PEEK + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DWM_SIT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DWM_SIT.cs index 332476ca..7f1bd334 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DWM_SIT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DWM_SIT.cs @@ -2,9 +2,9 @@ namespace Standard { - internal enum DWM_SIT - { - None, - DISPLAYFRAME - } + internal enum DWM_SIT + { + None, + DISPLAYFRAME + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DWM_TIMING_INFO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DWM_TIMING_INFO.cs index 5835befa..db062bdf 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DWM_TIMING_INFO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DWM_TIMING_INFO.cs @@ -3,87 +3,87 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct DWM_TIMING_INFO - { - public int cbSize; + [StructLayout(LayoutKind.Sequential, Pack = 1)] + internal struct DWM_TIMING_INFO + { + public int cbSize; - public UNSIGNED_RATIO rateRefresh; + public UNSIGNED_RATIO rateRefresh; - public ulong qpcRefreshPeriod; + public ulong qpcRefreshPeriod; - public UNSIGNED_RATIO rateCompose; + public UNSIGNED_RATIO rateCompose; - public ulong qpcVBlank; + public ulong qpcVBlank; - public ulong cRefresh; + public ulong cRefresh; - public uint cDXRefresh; + public uint cDXRefresh; - public ulong qpcCompose; + public ulong qpcCompose; - public ulong cFrame; + public ulong cFrame; - public uint cDXPresent; + public uint cDXPresent; - public ulong cRefreshFrame; + public ulong cRefreshFrame; - public ulong cFrameSubmitted; + public ulong cFrameSubmitted; - public uint cDXPresentSubmitted; + public uint cDXPresentSubmitted; - public ulong cFrameConfirmed; + public ulong cFrameConfirmed; - public uint cDXPresentConfirmed; + public uint cDXPresentConfirmed; - public ulong cRefreshConfirmed; + public ulong cRefreshConfirmed; - public uint cDXRefreshConfirmed; + public uint cDXRefreshConfirmed; - public ulong cFramesLate; + public ulong cFramesLate; - public uint cFramesOutstanding; + public uint cFramesOutstanding; - public ulong cFrameDisplayed; + public ulong cFrameDisplayed; - public ulong qpcFrameDisplayed; + public ulong qpcFrameDisplayed; - public ulong cRefreshFrameDisplayed; + public ulong cRefreshFrameDisplayed; - public ulong cFrameComplete; + public ulong cFrameComplete; - public ulong qpcFrameComplete; + public ulong qpcFrameComplete; - public ulong cFramePending; + public ulong cFramePending; - public ulong qpcFramePending; + public ulong qpcFramePending; - public ulong cFramesDisplayed; + public ulong cFramesDisplayed; - public ulong cFramesComplete; + public ulong cFramesComplete; - public ulong cFramesPending; + public ulong cFramesPending; - public ulong cFramesAvailable; + public ulong cFramesAvailable; - public ulong cFramesDropped; + public ulong cFramesDropped; - public ulong cFramesMissed; + public ulong cFramesMissed; - public ulong cRefreshNextDisplayed; + public ulong cRefreshNextDisplayed; - public ulong cRefreshNextPresented; + public ulong cRefreshNextPresented; - public ulong cRefreshesDisplayed; + public ulong cRefreshesDisplayed; - public ulong cRefreshesPresented; + public ulong cRefreshesPresented; - public ulong cRefreshStarted; + public ulong cRefreshStarted; - public ulong cPixelsReceived; + public ulong cPixelsReceived; - public ulong cPixelsDrawn; + public ulong cPixelsDrawn; - public ulong cBuffersEmpty; - } + public ulong cBuffersEmpty; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DeviceCap.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DeviceCap.cs index 50cc63af..a39da16f 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DeviceCap.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DeviceCap.cs @@ -2,11 +2,11 @@ namespace Standard { - internal enum DeviceCap - { - BITSPIXEL = 12, - PLANES = 14, - LOGPIXELSX = 88, - LOGPIXELSY = 90 - } + internal enum DeviceCap + { + BITSPIXEL = 12, + PLANES = 14, + LOGPIXELSX = 88, + LOGPIXELSY = 90 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DoubleUtilities.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DoubleUtilities.cs index 66353816..e263470e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DoubleUtilities.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DoubleUtilities.cs @@ -3,55 +3,55 @@ using System.Diagnostics.CodeAnalysis; namespace Standard { - internal static class DoubleUtilities - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool AreClose(double value1, double value2) - { - if (value1 == value2) - { - return true; - } - double num = value1 - value2; - return num < 1.53E-06 && num > -1.53E-06; - } + internal static class DoubleUtilities + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool AreClose(double value1, double value2) + { + if (value1 == value2) + { + return true; + } + double num = value1 - value2; + return num < 1.53E-06 && num > -1.53E-06; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool LessThan(double value1, double value2) - { - return value1 < value2 && !DoubleUtilities.AreClose(value1, value2); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool LessThan(double value1, double value2) + { + return value1 < value2 && !DoubleUtilities.AreClose(value1, value2); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool GreaterThan(double value1, double value2) - { - return value1 > value2 && !DoubleUtilities.AreClose(value1, value2); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool GreaterThan(double value1, double value2) + { + return value1 > value2 && !DoubleUtilities.AreClose(value1, value2); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool LessThanOrClose(double value1, double value2) - { - return value1 < value2 || DoubleUtilities.AreClose(value1, value2); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool LessThanOrClose(double value1, double value2) + { + return value1 < value2 || DoubleUtilities.AreClose(value1, value2); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool GreaterThanOrClose(double value1, double value2) - { - return value1 > value2 || DoubleUtilities.AreClose(value1, value2); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool GreaterThanOrClose(double value1, double value2) + { + return value1 > value2 || DoubleUtilities.AreClose(value1, value2); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool IsFinite(double value) - { - return !double.IsNaN(value) && !double.IsInfinity(value); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool IsFinite(double value) + { + return !double.IsNaN(value) && !double.IsInfinity(value); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool IsValidSize(double value) - { - return DoubleUtilities.IsFinite(value) && DoubleUtilities.GreaterThanOrClose(value, 0.0); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool IsValidSize(double value) + { + return DoubleUtilities.IsFinite(value) && DoubleUtilities.GreaterThanOrClose(value, 0.0); + } - private const double Epsilon = 1.53E-06; - } + private const double Epsilon = 1.53E-06; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/DpiHelper.cs b/src/Shared/Microsoft.Windows.Shell/Standard/DpiHelper.cs index 000cb4de..8b621005 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/DpiHelper.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/DpiHelper.cs @@ -5,66 +5,66 @@ using System.Windows.Media; namespace Standard { - internal static class DpiHelper - { - [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")] - static DpiHelper() - { - using (SafeDC desktop = SafeDC.GetDesktop()) - { - int deviceCaps = NativeMethods.GetDeviceCaps(desktop, DeviceCap.LOGPIXELSX); - int deviceCaps2 = NativeMethods.GetDeviceCaps(desktop, DeviceCap.LOGPIXELSY); - DpiHelper._transformToDip = Matrix.Identity; - DpiHelper._transformToDip.Scale(96.0 / (double)deviceCaps, 96.0 / (double)deviceCaps2); - DpiHelper._transformToDevice = Matrix.Identity; - DpiHelper._transformToDevice.Scale((double)deviceCaps / 96.0, (double)deviceCaps2 / 96.0); - } - } + internal static class DpiHelper + { + [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")] + static DpiHelper() + { + using (SafeDC desktop = SafeDC.GetDesktop()) + { + int deviceCaps = NativeMethods.GetDeviceCaps(desktop, DeviceCap.LOGPIXELSX); + int deviceCaps2 = NativeMethods.GetDeviceCaps(desktop, DeviceCap.LOGPIXELSY); + DpiHelper._transformToDip = Matrix.Identity; + DpiHelper._transformToDip.Scale(96.0 / (double) deviceCaps, 96.0 / (double) deviceCaps2); + DpiHelper._transformToDevice = Matrix.Identity; + DpiHelper._transformToDevice.Scale((double) deviceCaps / 96.0, (double) deviceCaps2 / 96.0); + } + } - public static Point LogicalPixelsToDevice(Point logicalPoint) - { - return DpiHelper._transformToDevice.Transform(logicalPoint); - } + public static Point LogicalPixelsToDevice(Point logicalPoint) + { + return DpiHelper._transformToDevice.Transform(logicalPoint); + } - public static Point DevicePixelsToLogical(Point devicePoint) - { - return DpiHelper._transformToDip.Transform(devicePoint); - } + public static Point DevicePixelsToLogical(Point devicePoint) + { + return DpiHelper._transformToDip.Transform(devicePoint); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static Rect LogicalRectToDevice(Rect logicalRectangle) - { - Point point = DpiHelper.LogicalPixelsToDevice(new Point(logicalRectangle.Left, logicalRectangle.Top)); - Point point2 = DpiHelper.LogicalPixelsToDevice(new Point(logicalRectangle.Right, logicalRectangle.Bottom)); - return new Rect(point, point2); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static Rect LogicalRectToDevice(Rect logicalRectangle) + { + Point point = DpiHelper.LogicalPixelsToDevice(new Point(logicalRectangle.Left, logicalRectangle.Top)); + Point point2 = DpiHelper.LogicalPixelsToDevice(new Point(logicalRectangle.Right, logicalRectangle.Bottom)); + return new Rect(point, point2); + } - public static Rect DeviceRectToLogical(Rect deviceRectangle) - { - Point point = DpiHelper.DevicePixelsToLogical(new Point(deviceRectangle.Left, deviceRectangle.Top)); - Point point2 = DpiHelper.DevicePixelsToLogical(new Point(deviceRectangle.Right, deviceRectangle.Bottom)); - return new Rect(point, point2); - } + public static Rect DeviceRectToLogical(Rect deviceRectangle) + { + Point point = DpiHelper.DevicePixelsToLogical(new Point(deviceRectangle.Left, deviceRectangle.Top)); + Point point2 = DpiHelper.DevicePixelsToLogical(new Point(deviceRectangle.Right, deviceRectangle.Bottom)); + return new Rect(point, point2); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static Size LogicalSizeToDevice(Size logicalSize) - { - Point point = DpiHelper.LogicalPixelsToDevice(new Point(logicalSize.Width, logicalSize.Height)); - return new Size - { - Width = point.X, - Height = point.Y - }; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static Size LogicalSizeToDevice(Size logicalSize) + { + Point point = DpiHelper.LogicalPixelsToDevice(new Point(logicalSize.Width, logicalSize.Height)); + return new Size + { + Width = point.X, + Height = point.Y + }; + } - public static Size DeviceSizeToLogical(Size deviceSize) - { - Point point = DpiHelper.DevicePixelsToLogical(new Point(deviceSize.Width, deviceSize.Height)); - return new Size(point.X, point.Y); - } + public static Size DeviceSizeToLogical(Size deviceSize) + { + Point point = DpiHelper.DevicePixelsToLogical(new Point(deviceSize.Width, deviceSize.Height)); + return new Size(point.X, point.Y); + } - private static Matrix _transformToDevice; + private static Matrix _transformToDevice; - private static Matrix _transformToDip; - } + private static Matrix _transformToDip; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/ErrorModes.cs b/src/Shared/Microsoft.Windows.Shell/Standard/ErrorModes.cs index d2413688..481a72e8 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/ErrorModes.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/ErrorModes.cs @@ -2,13 +2,13 @@ namespace Standard { - [Flags] - internal enum ErrorModes - { - Default = 0, - FailCriticalErrors = 1, - NoGpFaultErrorBox = 2, - NoAlignmentFaultExcept = 4, - NoOpenFileErrorBox = 32768 - } + [Flags] + internal enum ErrorModes + { + Default = 0, + FailCriticalErrors = 1, + NoGpFaultErrorBox = 2, + NoAlignmentFaultExcept = 4, + NoOpenFileErrorBox = 32768 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/FO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/FO.cs index e2fae172..ff48cf98 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/FO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/FO.cs @@ -2,11 +2,11 @@ namespace Standard { - internal enum FO - { - MOVE = 1, - COPY, - DELETE, - RENAME - } + internal enum FO + { + MOVE = 1, + COPY, + DELETE, + RENAME + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/FOF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/FOF.cs index 09b6b926..72688267 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/FOF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/FOF.cs @@ -2,23 +2,23 @@ namespace Standard { - internal enum FOF : ushort - { - MULTIDESTFILES = 1, - CONFIRMMOUSE, - SILENT = 4, - RENAMEONCOLLISION = 8, - NOCONFIRMATION = 16, - WANTMAPPINGHANDLE = 32, - ALLOWUNDO = 64, - FILESONLY = 128, - SIMPLEPROGRESS = 256, - NOCONFIRMMKDIR = 512, - NOERRORUI = 1024, - NOCOPYSECURITYATTRIBS = 2048, - NORECURSION = 4096, - NO_CONNECTED_ELEMENTS = 8192, - WANTNUKEWARNING = 16384, - NORECURSEREPARSE = 32768 - } + internal enum FOF : ushort + { + MULTIDESTFILES = 1, + CONFIRMMOUSE, + SILENT = 4, + RENAMEONCOLLISION = 8, + NOCONFIRMATION = 16, + WANTMAPPINGHANDLE = 32, + ALLOWUNDO = 64, + FILESONLY = 128, + SIMPLEPROGRESS = 256, + NOCONFIRMMKDIR = 512, + NOERRORUI = 1024, + NOCOPYSECURITYATTRIBS = 2048, + NORECURSION = 4096, + NO_CONNECTED_ELEMENTS = 8192, + WANTNUKEWARNING = 16384, + NORECURSEREPARSE = 32768 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/Facility.cs b/src/Shared/Microsoft.Windows.Shell/Standard/Facility.cs index 9c91841a..3287cfcb 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/Facility.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/Facility.cs @@ -2,18 +2,18 @@ namespace Standard { - [Flags] + [Flags] internal enum Facility - { - Null, - Rpc, - Dispatch, - Storage, - Itf, - Win32 = 7, - Windows, - Control = 10, - Ese = 3678, - WinCodec = 2200 - } + { + Null, + Rpc, + Dispatch, + Storage, + Itf, + Win32 = 7, + Windows, + Control = 10, + Ese = 3678, + WinCodec = 2200 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/GCLP.cs b/src/Shared/Microsoft.Windows.Shell/Standard/GCLP.cs index ee56c454..8704c36e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/GCLP.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/GCLP.cs @@ -2,8 +2,8 @@ namespace Standard { - internal enum GCLP - { - HBRBACKGROUND = -10 - } + internal enum GCLP + { + HBRBACKGROUND = -10 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/GPS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/GPS.cs index 3f8d3d3d..ce778197 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/GPS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/GPS.cs @@ -2,17 +2,17 @@ namespace Standard { - internal enum GPS - { - DEFAULT, - HANDLERPROPERTIESONLY, - READWRITE, - TEMPORARY = 4, - FASTPROPERTIESONLY = 8, - OPENSLOWITEM = 16, - DELAYCREATION = 32, - BESTEFFORT = 64, - NO_OPLOCK = 128, - MASK_VALID = 255 - } + internal enum GPS + { + DEFAULT, + HANDLERPROPERTIESONLY, + READWRITE, + TEMPORARY = 4, + FASTPROPERTIESONLY = 8, + OPENSLOWITEM = 16, + DELAYCREATION = 32, + BESTEFFORT = 64, + NO_OPLOCK = 128, + MASK_VALID = 255 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/GWL.cs b/src/Shared/Microsoft.Windows.Shell/Standard/GWL.cs index 277cd460..26541f9d 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/GWL.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/GWL.cs @@ -2,14 +2,14 @@ namespace Standard { - internal enum GWL - { - WNDPROC = -4, - HINSTANCE = -6, - HWNDPARENT = -8, - STYLE = -16, - EXSTYLE = -20, - USERDATA = -21, - ID = -12 - } + internal enum GWL + { + WNDPROC = -4, + HINSTANCE = -6, + HWNDPARENT = -8, + STYLE = -16, + EXSTYLE = -20, + USERDATA = -21, + ID = -12 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/HCF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/HCF.cs index 5272a7ec..d3596459 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/HCF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/HCF.cs @@ -2,15 +2,15 @@ namespace Standard { - [Flags] - internal enum HCF - { - HIGHCONTRASTON = 1, - AVAILABLE = 2, - HOTKEYACTIVE = 4, - CONFIRMHOTKEY = 8, - HOTKEYSOUND = 16, - INDICATOR = 32, - HOTKEYAVAILABLE = 64 - } + [Flags] + internal enum HCF + { + HIGHCONTRASTON = 1, + AVAILABLE = 2, + HOTKEYACTIVE = 4, + CONFIRMHOTKEY = 8, + HOTKEYSOUND = 16, + INDICATOR = 32, + HOTKEYAVAILABLE = 64 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/HIGHCONTRAST.cs b/src/Shared/Microsoft.Windows.Shell/Standard/HIGHCONTRAST.cs index f2e1b199..3f1c884a 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/HIGHCONTRAST.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/HIGHCONTRAST.cs @@ -2,12 +2,12 @@ namespace Standard { - internal struct HIGHCONTRAST - { - public int cbSize; + internal struct HIGHCONTRAST + { + public int cbSize; - public HCF dwFlags; + public HCF dwFlags; - public IntPtr lpszDefaultScheme; - } + public IntPtr lpszDefaultScheme; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/HRESULT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/HRESULT.cs index 6ec17fd6..b8842d8a 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/HRESULT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/HRESULT.cs @@ -7,238 +7,238 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Explicit)] - internal struct HRESULT - { - public HRESULT(uint i) - { - this._value = i; - } + [StructLayout(LayoutKind.Explicit)] + internal struct HRESULT + { + public HRESULT(uint i) + { + this._value = i; + } - public static HRESULT Make(bool severe, Facility facility, int code) - { - return new HRESULT((uint)((severe ? (Facility)(-2147483648) : Facility.Null) | (Facility) ((int)facility << 16) | (Facility)code)); - } + public static HRESULT Make(bool severe, Facility facility, int code) + { + return new HRESULT((uint) ((severe ? (Facility) (-2147483648) : Facility.Null) | (Facility) ((int) facility << 16) | (Facility) code)); + } - public Facility Facility - { - get - { - return HRESULT.GetFacility((int)this._value); - } - } + public Facility Facility + { + get + { + return HRESULT.GetFacility((int) this._value); + } + } - public static Facility GetFacility(int errorCode) - { - return (Facility)(errorCode >> 16 & 8191); - } + public static Facility GetFacility(int errorCode) + { + return (Facility) (errorCode >> 16 & 8191); + } - public int Code - { - get - { - return HRESULT.GetCode((int)this._value); - } - } + public int Code + { + get + { + return HRESULT.GetCode((int) this._value); + } + } - public static int GetCode(int error) - { - return error & 65535; - } + public static int GetCode(int error) + { + return error & 65535; + } - public override string ToString() - { - foreach (FieldInfo fieldInfo in typeof(HRESULT).GetFields(BindingFlags.Static | BindingFlags.Public)) - { - if (fieldInfo.FieldType == typeof(HRESULT)) - { - HRESULT hrLeft = (HRESULT)fieldInfo.GetValue(null); - if (hrLeft == this) - { - return fieldInfo.Name; - } - } - } - if (this.Facility == Facility.Win32) - { - foreach (FieldInfo fieldInfo2 in typeof(Win32Error).GetFields(BindingFlags.Static | BindingFlags.Public)) - { - if (fieldInfo2.FieldType == typeof(Win32Error)) - { - Win32Error error = (Win32Error)fieldInfo2.GetValue(null); - if ((HRESULT)error == this) - { - return "HRESULT_FROM_WIN32(" + fieldInfo2.Name + ")"; - } - } - } - } - return string.Format(CultureInfo.InvariantCulture, "0x{0:X8}", new object[] - { - this._value - }); - } + public override string ToString() + { + foreach (FieldInfo fieldInfo in typeof(HRESULT).GetFields(BindingFlags.Static | BindingFlags.Public)) + { + if (fieldInfo.FieldType == typeof(HRESULT)) + { + HRESULT hrLeft = (HRESULT) fieldInfo.GetValue(null); + if (hrLeft == this) + { + return fieldInfo.Name; + } + } + } + if (this.Facility == Facility.Win32) + { + foreach (FieldInfo fieldInfo2 in typeof(Win32Error).GetFields(BindingFlags.Static | BindingFlags.Public)) + { + if (fieldInfo2.FieldType == typeof(Win32Error)) + { + Win32Error error = (Win32Error) fieldInfo2.GetValue(null); + if ((HRESULT) error == this) + { + return "HRESULT_FROM_WIN32(" + fieldInfo2.Name + ")"; + } + } + } + } + return string.Format(CultureInfo.InvariantCulture, "0x{0:X8}", new object[] + { + this._value + }); + } - public override bool Equals(object obj) - { - bool result; - try - { - result = (((HRESULT)obj)._value == this._value); - } - catch (InvalidCastException) - { - result = false; - } - return result; - } + public override bool Equals(object obj) + { + bool result; + try + { + result = (((HRESULT) obj)._value == this._value); + } + catch (InvalidCastException) + { + result = false; + } + return result; + } - public override int GetHashCode() - { - return this._value.GetHashCode(); - } + public override int GetHashCode() + { + return this._value.GetHashCode(); + } - public static bool operator ==(HRESULT hrLeft, HRESULT hrRight) - { - return hrLeft._value == hrRight._value; - } + public static bool operator ==(HRESULT hrLeft, HRESULT hrRight) + { + return hrLeft._value == hrRight._value; + } - public static bool operator !=(HRESULT hrLeft, HRESULT hrRight) - { - return !(hrLeft == hrRight); - } + public static bool operator !=(HRESULT hrLeft, HRESULT hrRight) + { + return !(hrLeft == hrRight); + } - public bool Succeeded - { - get - { - return this._value >= 0u; - } - } + public bool Succeeded + { + get + { + return this._value >= 0u; + } + } - public bool Failed - { - get - { - return this._value < 0u; - } - } + public bool Failed + { + get + { + return this._value < 0u; + } + } - public void ThrowIfFailed() - { - this.ThrowIfFailed(null); - } + public void ThrowIfFailed() + { + this.ThrowIfFailed(null); + } - [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "Only recreating Exceptions that were already raised.")] - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public void ThrowIfFailed(string message) - { - if (this.Failed) - { - if (string.IsNullOrEmpty(message)) - { - message = this.ToString(); - } - Exception ex = Marshal.GetExceptionForHR((int)this._value, new IntPtr(-1)); - if (ex.GetType() == typeof(COMException)) - { - Facility facility = this.Facility; - if (facility == Facility.Win32) - { - ex = new Win32Exception(this.Code, message); - } - else - { - ex = new COMException(message, (int)this._value); - } - } - else - { - ConstructorInfo constructor = ex.GetType().GetConstructor(new Type[] - { - typeof(string) - }); - if (null != constructor) - { - ex = (constructor.Invoke(new object[] - { - message - }) as Exception); - } - } - throw ex; - } - } + [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "Only recreating Exceptions that were already raised.")] + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public void ThrowIfFailed(string message) + { + if (this.Failed) + { + if (string.IsNullOrEmpty(message)) + { + message = this.ToString(); + } + Exception ex = Marshal.GetExceptionForHR((int) this._value, new IntPtr(-1)); + if (ex.GetType() == typeof(COMException)) + { + Facility facility = this.Facility; + if (facility == Facility.Win32) + { + ex = new Win32Exception(this.Code, message); + } + else + { + ex = new COMException(message, (int) this._value); + } + } + else + { + ConstructorInfo constructor = ex.GetType().GetConstructor(new Type[] + { + typeof(string) + }); + if (null != constructor) + { + ex = (constructor.Invoke(new object[] + { + message + }) as Exception); + } + } + throw ex; + } + } - public static void ThrowLastError() - { - ((HRESULT)Win32Error.GetLastError()).ThrowIfFailed(); - } + public static void ThrowLastError() + { + ((HRESULT) Win32Error.GetLastError()).ThrowIfFailed(); + } - [FieldOffset(0)] - private readonly uint _value; + [FieldOffset(0)] + private readonly uint _value; - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT S_OK = new HRESULT(0u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT S_OK = new HRESULT(0u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT S_FALSE = new HRESULT(1u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT S_FALSE = new HRESULT(1u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_PENDING = new HRESULT(2147483658u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_PENDING = new HRESULT(2147483658u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_NOTIMPL = new HRESULT(2147500033u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_NOTIMPL = new HRESULT(2147500033u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_NOINTERFACE = new HRESULT(2147500034u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_NOINTERFACE = new HRESULT(2147500034u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_POINTER = new HRESULT(2147500035u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_POINTER = new HRESULT(2147500035u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_ABORT = new HRESULT(2147500036u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_ABORT = new HRESULT(2147500036u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_FAIL = new HRESULT(2147500037u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_FAIL = new HRESULT(2147500037u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_UNEXPECTED = new HRESULT(2147549183u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_UNEXPECTED = new HRESULT(2147549183u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT STG_E_INVALIDFUNCTION = new HRESULT(2147680257u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT STG_E_INVALIDFUNCTION = new HRESULT(2147680257u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT REGDB_E_CLASSNOTREG = new HRESULT(2147746132u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT REGDB_E_CLASSNOTREG = new HRESULT(2147746132u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT DESTS_E_NO_MATCHING_ASSOC_HANDLER = new HRESULT(2147749635u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT DESTS_E_NO_MATCHING_ASSOC_HANDLER = new HRESULT(2147749635u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT DESTS_E_NORECDOCS = new HRESULT(2147749636u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT DESTS_E_NORECDOCS = new HRESULT(2147749636u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT DESTS_E_NOTALLCLEARED = new HRESULT(2147749637u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT DESTS_E_NOTALLCLEARED = new HRESULT(2147749637u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_ACCESSDENIED = new HRESULT(2147942405u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_ACCESSDENIED = new HRESULT(2147942405u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_OUTOFMEMORY = new HRESULT(2147942414u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_OUTOFMEMORY = new HRESULT(2147942414u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT E_INVALIDARG = new HRESULT(2147942487u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT E_INVALIDARG = new HRESULT(2147942487u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT INTSAFE_E_ARITHMETIC_OVERFLOW = new HRESULT(2147942934u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT INTSAFE_E_ARITHMETIC_OVERFLOW = new HRESULT(2147942934u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT COR_E_OBJECTDISPOSED = new HRESULT(2148734498u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT COR_E_OBJECTDISPOSED = new HRESULT(2148734498u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT WC_E_GREATERTHAN = new HRESULT(3222072867u); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT WC_E_GREATERTHAN = new HRESULT(3222072867u); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly HRESULT WC_E_SYNTAX = new HRESULT(3222072877u); - } + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly HRESULT WC_E_SYNTAX = new HRESULT(3222072877u); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/HT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/HT.cs index abb24d4f..35edb8c7 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/HT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/HT.cs @@ -2,36 +2,36 @@ namespace Standard { - internal enum HT - { - ERROR = -2, - TRANSPARENT, - NOWHERE, - CLIENT, - CAPTION, - SYSMENU, - GROWBOX, - SIZE = 4, - MENU, - HSCROLL, - VSCROLL, - MINBUTTON, - MAXBUTTON, - LEFT, - RIGHT, - TOP, - TOPLEFT, - TOPRIGHT, - BOTTOM, - BOTTOMLEFT, - BOTTOMRIGHT, - BORDER, - REDUCE = 8, - ZOOM, - SIZEFIRST, - SIZELAST = 17, - OBJECT = 19, - CLOSE, - HELP - } + internal enum HT + { + ERROR = -2, + TRANSPARENT, + NOWHERE, + CLIENT, + CAPTION, + SYSMENU, + GROWBOX, + SIZE = 4, + MENU, + HSCROLL, + VSCROLL, + MINBUTTON, + MAXBUTTON, + LEFT, + RIGHT, + TOP, + TOPLEFT, + TOPRIGHT, + BOTTOM, + BOTTOMLEFT, + BOTTOMRIGHT, + BORDER, + REDUCE = 8, + ZOOM, + SIZEFIRST, + SIZELAST = 17, + OBJECT = 19, + CLOSE, + HELP + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IApplicationDestinations.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IApplicationDestinations.cs index 1329ccaa..0180333c 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IApplicationDestinations.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IApplicationDestinations.cs @@ -3,15 +3,15 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("12337d35-94c6-48a0-bce7-6a9c69d4d600")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IApplicationDestinations - { - void SetAppID([MarshalAs(UnmanagedType.LPWStr)] [In] string pszAppID); + [Guid("12337d35-94c6-48a0-bce7-6a9c69d4d600")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IApplicationDestinations + { + void SetAppID([MarshalAs(UnmanagedType.LPWStr)][In] string pszAppID); - void RemoveDestination([MarshalAs(UnmanagedType.IUnknown)] object punk); + void RemoveDestination([MarshalAs(UnmanagedType.IUnknown)] object punk); - void RemoveAllDestinations(); - } + void RemoveAllDestinations(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IApplicationDocumentLists.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IApplicationDocumentLists.cs index ac621afe..a0b1b026 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IApplicationDocumentLists.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IApplicationDocumentLists.cs @@ -3,14 +3,14 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("3c594f9f-9f30-47a1-979a-c9e83d3d0a06")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IApplicationDocumentLists - { - void SetAppID([MarshalAs(UnmanagedType.LPWStr)] string pszAppID); + [Guid("3c594f9f-9f30-47a1-979a-c9e83d3d0a06")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IApplicationDocumentLists + { + void SetAppID([MarshalAs(UnmanagedType.LPWStr)] string pszAppID); - [return: MarshalAs(UnmanagedType.IUnknown)] - object GetList([In] APPDOCLISTTYPE listtype, [In] uint cItemsDesired, [In] ref Guid riid); - } + [return: MarshalAs(UnmanagedType.IUnknown)] + object GetList([In] APPDOCLISTTYPE listtype, [In] uint cItemsDesired, [In] ref Guid riid); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/ICustomDestinationList.cs b/src/Shared/Microsoft.Windows.Shell/Standard/ICustomDestinationList.cs index a371cbf6..68ad37d0 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/ICustomDestinationList.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/ICustomDestinationList.cs @@ -3,31 +3,31 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("6332debf-87b5-4670-90c0-5e57b408a49e")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface ICustomDestinationList - { - void SetAppID([MarshalAs(UnmanagedType.LPWStr)] [In] string pszAppID); + [Guid("6332debf-87b5-4670-90c0-5e57b408a49e")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface ICustomDestinationList + { + void SetAppID([MarshalAs(UnmanagedType.LPWStr)][In] string pszAppID); - [return: MarshalAs(UnmanagedType.Interface)] - object BeginList(out uint pcMaxSlots, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object BeginList(out uint pcMaxSlots, [In] ref Guid riid); - [PreserveSig] - HRESULT AppendCategory([MarshalAs(UnmanagedType.LPWStr)] string pszCategory, IObjectArray poa); + [PreserveSig] + HRESULT AppendCategory([MarshalAs(UnmanagedType.LPWStr)] string pszCategory, IObjectArray poa); - void AppendKnownCategory(KDC category); + void AppendKnownCategory(KDC category); - [PreserveSig] - HRESULT AddUserTasks(IObjectArray poa); + [PreserveSig] + HRESULT AddUserTasks(IObjectArray poa); - void CommitList(); + void CommitList(); - [return: MarshalAs(UnmanagedType.Interface)] - object GetRemovedDestinations([In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object GetRemovedDestinations([In] ref Guid riid); - void DeleteList([MarshalAs(UnmanagedType.LPWStr)] string pszAppID); + void DeleteList([MarshalAs(UnmanagedType.LPWStr)] string pszAppID); - void AbortList(); - } + void AbortList(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IEnumIDList.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IEnumIDList.cs index 33955da2..0cd66852 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IEnumIDList.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IEnumIDList.cs @@ -3,19 +3,19 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("000214F2-0000-0000-C000-000000000046")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IEnumIDList - { - [PreserveSig] - HRESULT Next(uint celt, out IntPtr rgelt, out int pceltFetched); + [Guid("000214F2-0000-0000-C000-000000000046")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IEnumIDList + { + [PreserveSig] + HRESULT Next(uint celt, out IntPtr rgelt, out int pceltFetched); - [PreserveSig] - HRESULT Skip(uint celt); + [PreserveSig] + HRESULT Skip(uint celt); - void Reset(); + void Reset(); - void Clone([MarshalAs(UnmanagedType.Interface)] out IEnumIDList ppenum); - } + void Clone([MarshalAs(UnmanagedType.Interface)] out IEnumIDList ppenum); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IEnumObjects.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IEnumObjects.cs index 990f93e3..4b522189 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IEnumObjects.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IEnumObjects.cs @@ -3,17 +3,17 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("2c1c7e2e-2d0e-4059-831e-1e6f82335c2e")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IEnumObjects - { - void Next(uint celt, [In] ref Guid riid, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.IUnknown, SizeParamIndex = 0)] [Out] object[] rgelt, out uint pceltFetched); + [Guid("2c1c7e2e-2d0e-4059-831e-1e6f82335c2e")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IEnumObjects + { + void Next(uint celt, [In] ref Guid riid, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.IUnknown, SizeParamIndex = 0)][Out] object[] rgelt, out uint pceltFetched); - void Skip(uint celt); + void Skip(uint celt); - void Reset(); + void Reset(); - IEnumObjects Clone(); - } + IEnumObjects Clone(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IID.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IID.cs index 266ef449..6e2bc86b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IID.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IID.cs @@ -2,54 +2,54 @@ namespace Standard { - internal static class IID - { - public const string EnumIdList = "000214F2-0000-0000-C000-000000000046"; + internal static class IID + { + public const string EnumIdList = "000214F2-0000-0000-C000-000000000046"; - public const string EnumObjects = "2c1c7e2e-2d0e-4059-831e-1e6f82335c2e"; + public const string EnumObjects = "2c1c7e2e-2d0e-4059-831e-1e6f82335c2e"; - public const string HtmlDocument2 = "332C4425-26CB-11D0-B483-00C04FD90119"; + public const string HtmlDocument2 = "332C4425-26CB-11D0-B483-00C04FD90119"; - public const string ModalWindow = "b4db1657-70d7-485e-8e3e-6fcb5a5c1802"; + public const string ModalWindow = "b4db1657-70d7-485e-8e3e-6fcb5a5c1802"; - public const string ObjectArray = "92CA9DCD-5622-4bba-A805-5E9F541BD8C9"; + public const string ObjectArray = "92CA9DCD-5622-4bba-A805-5E9F541BD8C9"; - public const string ObjectCollection = "5632b1a4-e38a-400a-928a-d4cd63230295"; + public const string ObjectCollection = "5632b1a4-e38a-400a-928a-d4cd63230295"; - public const string PropertyNotifySink = "9BFBBC02-EFF1-101A-84ED-00AA00341D07"; + public const string PropertyNotifySink = "9BFBBC02-EFF1-101A-84ED-00AA00341D07"; - public const string PropertyStore = "886d8eeb-8cf2-4446-8d02-cdba1dbdcf99"; + public const string PropertyStore = "886d8eeb-8cf2-4446-8d02-cdba1dbdcf99"; - public const string ServiceProvider = "6d5140c1-7436-11ce-8034-00aa006009fa"; + public const string ServiceProvider = "6d5140c1-7436-11ce-8034-00aa006009fa"; - public const string ShellFolder = "000214E6-0000-0000-C000-000000000046"; + public const string ShellFolder = "000214E6-0000-0000-C000-000000000046"; - public const string ShellLink = "000214F9-0000-0000-C000-000000000046"; + public const string ShellLink = "000214F9-0000-0000-C000-000000000046"; - public const string ShellItem = "43826d1e-e718-42ee-bc55-a1e261c37bfe"; + public const string ShellItem = "43826d1e-e718-42ee-bc55-a1e261c37bfe"; - public const string ShellItem2 = "7e9fb0d3-919f-4307-ab2e-9b1860310c93"; + public const string ShellItem2 = "7e9fb0d3-919f-4307-ab2e-9b1860310c93"; - public const string ShellItemArray = "B63EA76D-1F85-456F-A19C-48159EFA858B"; + public const string ShellItemArray = "B63EA76D-1F85-456F-A19C-48159EFA858B"; - public const string TaskbarList = "56FDF342-FD6D-11d0-958A-006097C9A090"; + public const string TaskbarList = "56FDF342-FD6D-11d0-958A-006097C9A090"; - public const string TaskbarList2 = "602D4995-B13A-429b-A66E-1935E44F4317"; + public const string TaskbarList2 = "602D4995-B13A-429b-A66E-1935E44F4317"; - public const string Unknown = "00000000-0000-0000-C000-000000000046"; + public const string Unknown = "00000000-0000-0000-C000-000000000046"; - public const string ApplicationDestinations = "12337d35-94c6-48a0-bce7-6a9c69d4d600"; + public const string ApplicationDestinations = "12337d35-94c6-48a0-bce7-6a9c69d4d600"; - public const string ApplicationDocumentLists = "3c594f9f-9f30-47a1-979a-c9e83d3d0a06"; + public const string ApplicationDocumentLists = "3c594f9f-9f30-47a1-979a-c9e83d3d0a06"; - public const string CustomDestinationList = "6332debf-87b5-4670-90c0-5e57b408a49e"; + public const string CustomDestinationList = "6332debf-87b5-4670-90c0-5e57b408a49e"; - public const string ObjectWithAppUserModelId = "36db0196-9665-46d1-9ba7-d3709eecf9ed"; + public const string ObjectWithAppUserModelId = "36db0196-9665-46d1-9ba7-d3709eecf9ed"; - public const string ObjectWithProgId = "71e806fb-8dee-46fc-bf8c-7748a8a1ae13"; + public const string ObjectWithProgId = "71e806fb-8dee-46fc-bf8c-7748a8a1ae13"; - public const string TaskbarList3 = "ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf"; + public const string TaskbarList3 = "ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf"; - public const string TaskbarList4 = "c43dc798-95d1-4bea-9030-bb99e2983a1a"; - } + public const string TaskbarList4 = "c43dc798-95d1-4bea-9030-bb99e2983a1a"; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/INPUT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/INPUT.cs index 7bd8793a..35ee9454 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/INPUT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/INPUT.cs @@ -2,10 +2,10 @@ namespace Standard { - internal struct INPUT - { - public uint type; + internal struct INPUT + { + public uint type; - public MOUSEINPUT mi; - } + public MOUSEINPUT mi; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/INPUT_TYPE.cs b/src/Shared/Microsoft.Windows.Shell/Standard/INPUT_TYPE.cs index 7ada551a..01781737 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/INPUT_TYPE.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/INPUT_TYPE.cs @@ -2,8 +2,8 @@ namespace Standard { - internal enum INPUT_TYPE : uint - { - MOUSE - } + internal enum INPUT_TYPE : uint + { + MOUSE + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IObjectArray.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IObjectArray.cs index d084511f..628d50aa 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IObjectArray.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IObjectArray.cs @@ -3,14 +3,14 @@ using System.Runtime.InteropServices; namespace Standard { - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9")] - [ComImport] - internal interface IObjectArray - { - uint GetCount(); + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9")] + [ComImport] + internal interface IObjectArray + { + uint GetCount(); - [return: MarshalAs(UnmanagedType.IUnknown)] - object GetAt([In] uint uiIndex, [In] ref Guid riid); - } + [return: MarshalAs(UnmanagedType.IUnknown)] + object GetAt([In] uint uiIndex, [In] ref Guid riid); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IObjectCollection.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IObjectCollection.cs index 6f3b672e..1ad6b47e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IObjectCollection.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IObjectCollection.cs @@ -3,22 +3,22 @@ using System.Runtime.InteropServices; namespace Standard { - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9")] - [ComImport] - internal interface IObjectCollection : IObjectArray - { - uint GetCount(); + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9")] + [ComImport] + internal interface IObjectCollection : IObjectArray + { + uint GetCount(); - [return: MarshalAs(UnmanagedType.IUnknown)] - object GetAt([In] uint uiIndex, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.IUnknown)] + object GetAt([In] uint uiIndex, [In] ref Guid riid); - void AddObject([MarshalAs(UnmanagedType.IUnknown)] object punk); + void AddObject([MarshalAs(UnmanagedType.IUnknown)] object punk); - void AddFromArray(IObjectArray poaSource); + void AddFromArray(IObjectArray poaSource); - void RemoveObjectAt(uint uiIndex); + void RemoveObjectAt(uint uiIndex); - void Clear(); - } + void Clear(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IObjectWithAppUserModelId.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IObjectWithAppUserModelId.cs index a605067e..2ae8d895 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IObjectWithAppUserModelId.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IObjectWithAppUserModelId.cs @@ -3,14 +3,14 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("36db0196-9665-46d1-9ba7-d3709eecf9ed")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IObjectWithAppUserModelId - { - void SetAppID([MarshalAs(UnmanagedType.LPWStr)] string pszAppID); + [Guid("36db0196-9665-46d1-9ba7-d3709eecf9ed")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IObjectWithAppUserModelId + { + void SetAppID([MarshalAs(UnmanagedType.LPWStr)] string pszAppID); - [return: MarshalAs(UnmanagedType.LPWStr)] - string GetAppID(); - } + [return: MarshalAs(UnmanagedType.LPWStr)] + string GetAppID(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IObjectWithProgId.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IObjectWithProgId.cs index 4433dce3..20455fd8 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IObjectWithProgId.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IObjectWithProgId.cs @@ -3,14 +3,14 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("71e806fb-8dee-46fc-bf8c-7748a8a1ae13")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IObjectWithProgId - { - void SetProgID([MarshalAs(UnmanagedType.LPWStr)] string pszProgID); + [Guid("71e806fb-8dee-46fc-bf8c-7748a8a1ae13")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IObjectWithProgId + { + void SetProgID([MarshalAs(UnmanagedType.LPWStr)] string pszProgID); - [return: MarshalAs(UnmanagedType.LPWStr)] - string GetProgID(); - } + [return: MarshalAs(UnmanagedType.LPWStr)] + string GetProgID(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IPropertyStore.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IPropertyStore.cs index 6f8a7c26..9779307b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IPropertyStore.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IPropertyStore.cs @@ -3,19 +3,19 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IPropertyStore - { - uint GetCount(); + [Guid("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IPropertyStore + { + uint GetCount(); - PKEY GetAt(uint iProp); + PKEY GetAt(uint iProp); - void GetValue([In] ref PKEY pkey, [In] [Out] PROPVARIANT pv); + void GetValue([In] ref PKEY pkey, [In][Out] PROPVARIANT pv); - void SetValue([In] ref PKEY pkey, PROPVARIANT pv); + void SetValue([In] ref PKEY pkey, PROPVARIANT pv); - void Commit(); - } + void Commit(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IShellFolder.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IShellFolder.cs index 833ef135..03ab4eb4 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IShellFolder.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IShellFolder.cs @@ -4,34 +4,34 @@ using System.Runtime.InteropServices.ComTypes; namespace Standard { - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("000214E6-0000-0000-C000-000000000046")] - [ComImport] - internal interface IShellFolder - { - void ParseDisplayName([In] IntPtr hwnd, [In] IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] [In] string pszDisplayName, [In] [Out] ref int pchEaten, out IntPtr ppidl, [In] [Out] ref uint pdwAttributes); + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("000214E6-0000-0000-C000-000000000046")] + [ComImport] + internal interface IShellFolder + { + void ParseDisplayName([In] IntPtr hwnd, [In] IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)][In] string pszDisplayName, [In][Out] ref int pchEaten, out IntPtr ppidl, [In][Out] ref uint pdwAttributes); - IEnumIDList EnumObjects([In] IntPtr hwnd, [In] SHCONTF grfFlags); + IEnumIDList EnumObjects([In] IntPtr hwnd, [In] SHCONTF grfFlags); - [return: MarshalAs(UnmanagedType.Interface)] - object BindToObject([In] IntPtr pidl, [In] IBindCtx pbc, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object BindToObject([In] IntPtr pidl, [In] IBindCtx pbc, [In] ref Guid riid); - [return: MarshalAs(UnmanagedType.Interface)] - object BindToStorage([In] IntPtr pidl, [In] IBindCtx pbc, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object BindToStorage([In] IntPtr pidl, [In] IBindCtx pbc, [In] ref Guid riid); - [PreserveSig] - HRESULT CompareIDs([In] IntPtr lParam, [In] IntPtr pidl1, [In] IntPtr pidl2); + [PreserveSig] + HRESULT CompareIDs([In] IntPtr lParam, [In] IntPtr pidl1, [In] IntPtr pidl2); - [return: MarshalAs(UnmanagedType.Interface)] - object CreateViewObject([In] IntPtr hwndOwner, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object CreateViewObject([In] IntPtr hwndOwner, [In] ref Guid riid); - void GetAttributesOf([In] uint cidl, [In] IntPtr apidl, [In] [Out] ref SFGAO rgfInOut); + void GetAttributesOf([In] uint cidl, [In] IntPtr apidl, [In][Out] ref SFGAO rgfInOut); - [return: MarshalAs(UnmanagedType.Interface)] - object GetUIObjectOf([In] IntPtr hwndOwner, [In] uint cidl, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.SysInt, SizeParamIndex = 2)] [In] IntPtr apidl, [In] ref Guid riid, [In] [Out] ref uint rgfReserved); + [return: MarshalAs(UnmanagedType.Interface)] + object GetUIObjectOf([In] IntPtr hwndOwner, [In] uint cidl, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.SysInt, SizeParamIndex = 2)][In] IntPtr apidl, [In] ref Guid riid, [In][Out] ref uint rgfReserved); - void GetDisplayNameOf([In] IntPtr pidl, [In] SHGDN uFlags, out IntPtr pName); + void GetDisplayNameOf([In] IntPtr pidl, [In] SHGDN uFlags, out IntPtr pName); - void SetNameOf([In] IntPtr hwnd, [In] IntPtr pidl, [MarshalAs(UnmanagedType.LPWStr)] [In] string pszName, [In] SHGDN uFlags, out IntPtr ppidlOut); - } + void SetNameOf([In] IntPtr hwnd, [In] IntPtr pidl, [MarshalAs(UnmanagedType.LPWStr)][In] string pszName, [In] SHGDN uFlags, out IntPtr ppidlOut); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IShellItem.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IShellItem.cs index 38ffae6a..5f2d12ec 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IShellItem.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IShellItem.cs @@ -4,21 +4,21 @@ using System.Runtime.InteropServices.ComTypes; namespace Standard { - [Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IShellItem - { - [return: MarshalAs(UnmanagedType.Interface)] - object BindToHandler(IBindCtx pbc, [In] ref Guid bhid, [In] ref Guid riid); + [Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IShellItem + { + [return: MarshalAs(UnmanagedType.Interface)] + object BindToHandler(IBindCtx pbc, [In] ref Guid bhid, [In] ref Guid riid); - IShellItem GetParent(); + IShellItem GetParent(); - [return: MarshalAs(UnmanagedType.LPWStr)] - string GetDisplayName(SIGDN sigdnName); + [return: MarshalAs(UnmanagedType.LPWStr)] + string GetDisplayName(SIGDN sigdnName); - SFGAO GetAttributes(SFGAO sfgaoMask); + SFGAO GetAttributes(SFGAO sfgaoMask); - int Compare(IShellItem psi, SICHINT hint); - } + int Compare(IShellItem psi, SICHINT hint); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IShellItem2.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IShellItem2.cs index dc87db2e..80bc1699 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IShellItem2.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IShellItem2.cs @@ -4,53 +4,53 @@ using System.Runtime.InteropServices.ComTypes; namespace Standard { - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("7e9fb0d3-919f-4307-ab2e-9b1860310c93")] - [ComImport] - internal interface IShellItem2 : IShellItem - { - [return: MarshalAs(UnmanagedType.Interface)] - object BindToHandler([In] IBindCtx pbc, [In] ref Guid bhid, [In] ref Guid riid); + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("7e9fb0d3-919f-4307-ab2e-9b1860310c93")] + [ComImport] + internal interface IShellItem2 : IShellItem + { + [return: MarshalAs(UnmanagedType.Interface)] + object BindToHandler([In] IBindCtx pbc, [In] ref Guid bhid, [In] ref Guid riid); - IShellItem GetParent(); + IShellItem GetParent(); - [return: MarshalAs(UnmanagedType.LPWStr)] - string GetDisplayName(SIGDN sigdnName); + [return: MarshalAs(UnmanagedType.LPWStr)] + string GetDisplayName(SIGDN sigdnName); - SFGAO GetAttributes(SFGAO sfgaoMask); + SFGAO GetAttributes(SFGAO sfgaoMask); - int Compare(IShellItem psi, SICHINT hint); + int Compare(IShellItem psi, SICHINT hint); - [return: MarshalAs(UnmanagedType.Interface)] - object GetPropertyStore(GPS flags, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object GetPropertyStore(GPS flags, [In] ref Guid riid); - [return: MarshalAs(UnmanagedType.Interface)] - object GetPropertyStoreWithCreateObject(GPS flags, [MarshalAs(UnmanagedType.IUnknown)] object punkCreateObject, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object GetPropertyStoreWithCreateObject(GPS flags, [MarshalAs(UnmanagedType.IUnknown)] object punkCreateObject, [In] ref Guid riid); - [return: MarshalAs(UnmanagedType.Interface)] - object GetPropertyStoreForKeys(IntPtr rgKeys, uint cKeys, GPS flags, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object GetPropertyStoreForKeys(IntPtr rgKeys, uint cKeys, GPS flags, [In] ref Guid riid); - [return: MarshalAs(UnmanagedType.Interface)] - object GetPropertyDescriptionList(IntPtr keyType, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object GetPropertyDescriptionList(IntPtr keyType, [In] ref Guid riid); - void Update(IBindCtx pbc); + void Update(IBindCtx pbc); - PROPVARIANT GetProperty(IntPtr key); + PROPVARIANT GetProperty(IntPtr key); - Guid GetCLSID(IntPtr key); + Guid GetCLSID(IntPtr key); - System.Runtime.InteropServices.ComTypes.FILETIME GetFileTime(IntPtr key); + System.Runtime.InteropServices.ComTypes.FILETIME GetFileTime(IntPtr key); - int GetInt32(IntPtr key); + int GetInt32(IntPtr key); - [return: MarshalAs(UnmanagedType.LPWStr)] - string GetString(IntPtr key); + [return: MarshalAs(UnmanagedType.LPWStr)] + string GetString(IntPtr key); - uint GetUInt32(IntPtr key); + uint GetUInt32(IntPtr key); - ulong GetUInt64(IntPtr key); + ulong GetUInt64(IntPtr key); - [return: MarshalAs(UnmanagedType.Bool)] - void GetBool(IntPtr key); - } + [return: MarshalAs(UnmanagedType.Bool)] + void GetBool(IntPtr key); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IShellItemArray.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IShellItemArray.cs index 3d9950b8..1227a28f 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IShellItemArray.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IShellItemArray.cs @@ -4,27 +4,27 @@ using System.Runtime.InteropServices.ComTypes; namespace Standard { - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("B63EA76D-1F85-456F-A19C-48159EFA858B")] - [ComImport] - internal interface IShellItemArray - { - [return: MarshalAs(UnmanagedType.Interface)] - object BindToHandler(IBindCtx pbc, [In] ref Guid rbhid, [In] ref Guid riid); + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("B63EA76D-1F85-456F-A19C-48159EFA858B")] + [ComImport] + internal interface IShellItemArray + { + [return: MarshalAs(UnmanagedType.Interface)] + object BindToHandler(IBindCtx pbc, [In] ref Guid rbhid, [In] ref Guid riid); - [return: MarshalAs(UnmanagedType.Interface)] - object GetPropertyStore(int flags, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object GetPropertyStore(int flags, [In] ref Guid riid); - [return: MarshalAs(UnmanagedType.Interface)] - object GetPropertyDescriptionList([In] ref PKEY keyType, [In] ref Guid riid); + [return: MarshalAs(UnmanagedType.Interface)] + object GetPropertyDescriptionList([In] ref PKEY keyType, [In] ref Guid riid); - uint GetAttributes(SIATTRIBFLAGS dwAttribFlags, uint sfgaoMask); + uint GetAttributes(SIATTRIBFLAGS dwAttribFlags, uint sfgaoMask); - uint GetCount(); + uint GetCount(); - IShellItem GetItemAt(uint dwIndex); + IShellItem GetItemAt(uint dwIndex); - [return: MarshalAs(UnmanagedType.Interface)] - object EnumItems(); - } + [return: MarshalAs(UnmanagedType.Interface)] + object EnumItems(); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/IShellLinkW.cs b/src/Shared/Microsoft.Windows.Shell/Standard/IShellLinkW.cs index a2c558c5..3394d67b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/IShellLinkW.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/IShellLinkW.cs @@ -4,45 +4,45 @@ using System.Text; namespace Standard { - [Guid("000214F9-0000-0000-C000-000000000046")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface IShellLinkW - { - void GetPath([MarshalAs(UnmanagedType.LPWStr)] [Out] StringBuilder pszFile, int cchMaxPath, [In] [Out] WIN32_FIND_DATAW pfd, SLGP fFlags); + [Guid("000214F9-0000-0000-C000-000000000046")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface IShellLinkW + { + void GetPath([MarshalAs(UnmanagedType.LPWStr)][Out] StringBuilder pszFile, int cchMaxPath, [In][Out] WIN32_FIND_DATAW pfd, SLGP fFlags); - void GetIDList(out IntPtr ppidl); + void GetIDList(out IntPtr ppidl); - void SetIDList(IntPtr pidl); + void SetIDList(IntPtr pidl); - void GetDescription([MarshalAs(UnmanagedType.LPWStr)] [Out] StringBuilder pszFile, int cchMaxName); + void GetDescription([MarshalAs(UnmanagedType.LPWStr)][Out] StringBuilder pszFile, int cchMaxName); - void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName); + void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName); - void GetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] [Out] StringBuilder pszDir, int cchMaxPath); + void GetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)][Out] StringBuilder pszDir, int cchMaxPath); - void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir); + void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir); - void GetArguments([MarshalAs(UnmanagedType.LPWStr)] [Out] StringBuilder pszArgs, int cchMaxPath); + void GetArguments([MarshalAs(UnmanagedType.LPWStr)][Out] StringBuilder pszArgs, int cchMaxPath); - void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs); + void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs); - short GetHotKey(); + short GetHotKey(); - void SetHotKey(short wHotKey); + void SetHotKey(short wHotKey); - uint GetShowCmd(); + uint GetShowCmd(); - void SetShowCmd(uint iShowCmd); + void SetShowCmd(uint iShowCmd); - void GetIconLocation([MarshalAs(UnmanagedType.LPWStr)] [Out] StringBuilder pszIconPath, int cchIconPath, out int piIcon); + void GetIconLocation([MarshalAs(UnmanagedType.LPWStr)][Out] StringBuilder pszIconPath, int cchIconPath, out int piIcon); - void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon); + void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon); - void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, uint dwReserved); + void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, uint dwReserved); - void Resolve(IntPtr hwnd, uint fFlags); + void Resolve(IntPtr hwnd, uint fFlags); - void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile); - } + void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList.cs b/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList.cs index 5fc0e132..6ef760be 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList.cs @@ -3,19 +3,19 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("56FDF342-FD6D-11d0-958A-006097C9A090")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface ITaskbarList - { - void HrInit(); + [Guid("56FDF342-FD6D-11d0-958A-006097C9A090")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface ITaskbarList + { + void HrInit(); - void AddTab(IntPtr hwnd); + void AddTab(IntPtr hwnd); - void DeleteTab(IntPtr hwnd); + void DeleteTab(IntPtr hwnd); - void ActivateTab(IntPtr hwnd); + void ActivateTab(IntPtr hwnd); - void SetActiveAlt(IntPtr hwnd); - } + void SetActiveAlt(IntPtr hwnd); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList2.cs b/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList2.cs index 2c761c46..3d7d566f 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList2.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList2.cs @@ -3,21 +3,21 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("602D4995-B13A-429b-A66E-1935E44F4317")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface ITaskbarList2 : ITaskbarList - { - void HrInit(); + [Guid("602D4995-B13A-429b-A66E-1935E44F4317")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface ITaskbarList2 : ITaskbarList + { + void HrInit(); - void AddTab(IntPtr hwnd); + void AddTab(IntPtr hwnd); - void DeleteTab(IntPtr hwnd); + void DeleteTab(IntPtr hwnd); - void ActivateTab(IntPtr hwnd); + void ActivateTab(IntPtr hwnd); - void SetActiveAlt(IntPtr hwnd); + void SetActiveAlt(IntPtr hwnd); - void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); - } + void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList3.cs b/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList3.cs index d824fb5e..e91c69e8 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList3.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList3.cs @@ -3,57 +3,57 @@ using System.Runtime.InteropServices; namespace Standard { - [Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - internal interface ITaskbarList3 : ITaskbarList2, ITaskbarList - { - void HrInit(); + [Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + internal interface ITaskbarList3 : ITaskbarList2, ITaskbarList + { + void HrInit(); - void AddTab(IntPtr hwnd); + void AddTab(IntPtr hwnd); - void DeleteTab(IntPtr hwnd); + void DeleteTab(IntPtr hwnd); - void ActivateTab(IntPtr hwnd); + void ActivateTab(IntPtr hwnd); - void SetActiveAlt(IntPtr hwnd); + void SetActiveAlt(IntPtr hwnd); - void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); + void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); - [PreserveSig] - HRESULT SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal); + [PreserveSig] + HRESULT SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal); - [PreserveSig] - HRESULT SetProgressState(IntPtr hwnd, TBPF tbpFlags); + [PreserveSig] + HRESULT SetProgressState(IntPtr hwnd, TBPF tbpFlags); - [PreserveSig] - HRESULT RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); + [PreserveSig] + HRESULT RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); - [PreserveSig] - HRESULT UnregisterTab(IntPtr hwndTab); + [PreserveSig] + HRESULT UnregisterTab(IntPtr hwndTab); - [PreserveSig] - HRESULT SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); + [PreserveSig] + HRESULT SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); - [PreserveSig] - HRESULT SetTabActive(IntPtr hwndTab, IntPtr hwndMDI, uint dwReserved); + [PreserveSig] + HRESULT SetTabActive(IntPtr hwndTab, IntPtr hwndMDI, uint dwReserved); - [PreserveSig] - HRESULT ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] THUMBBUTTON[] pButtons); + [PreserveSig] + HRESULT ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] THUMBBUTTON[] pButtons); - [PreserveSig] - HRESULT ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] THUMBBUTTON[] pButtons); + [PreserveSig] + HRESULT ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] THUMBBUTTON[] pButtons); - [PreserveSig] - HRESULT ThumbBarSetImageList(IntPtr hwnd, [MarshalAs(UnmanagedType.IUnknown)] object himl); + [PreserveSig] + HRESULT ThumbBarSetImageList(IntPtr hwnd, [MarshalAs(UnmanagedType.IUnknown)] object himl); - [PreserveSig] - HRESULT SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription); + [PreserveSig] + HRESULT SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription); - [PreserveSig] - HRESULT SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip); + [PreserveSig] + HRESULT SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip); - [PreserveSig] - HRESULT SetThumbnailClip(IntPtr hwnd, RefRECT prcClip); - } + [PreserveSig] + HRESULT SetThumbnailClip(IntPtr hwnd, RefRECT prcClip); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList4.cs b/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList4.cs index 0c70461c..3e46805f 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList4.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/ITaskbarList4.cs @@ -3,59 +3,59 @@ using System.Runtime.InteropServices; namespace Standard { - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")] - [ComImport] - internal interface ITaskbarList4 : ITaskbarList3, ITaskbarList2, ITaskbarList - { - void HrInit(); + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")] + [ComImport] + internal interface ITaskbarList4 : ITaskbarList3, ITaskbarList2, ITaskbarList + { + void HrInit(); - void AddTab(IntPtr hwnd); + void AddTab(IntPtr hwnd); - void DeleteTab(IntPtr hwnd); + void DeleteTab(IntPtr hwnd); - void ActivateTab(IntPtr hwnd); + void ActivateTab(IntPtr hwnd); - void SetActiveAlt(IntPtr hwnd); + void SetActiveAlt(IntPtr hwnd); - void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); + void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); - [PreserveSig] - HRESULT SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal); + [PreserveSig] + HRESULT SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal); - [PreserveSig] - HRESULT SetProgressState(IntPtr hwnd, TBPF tbpFlags); + [PreserveSig] + HRESULT SetProgressState(IntPtr hwnd, TBPF tbpFlags); - [PreserveSig] - HRESULT RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); + [PreserveSig] + HRESULT RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); - [PreserveSig] - HRESULT UnregisterTab(IntPtr hwndTab); + [PreserveSig] + HRESULT UnregisterTab(IntPtr hwndTab); - [PreserveSig] - HRESULT SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); + [PreserveSig] + HRESULT SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); - [PreserveSig] - HRESULT SetTabActive(IntPtr hwndTab, IntPtr hwndMDI, uint dwReserved); + [PreserveSig] + HRESULT SetTabActive(IntPtr hwndTab, IntPtr hwndMDI, uint dwReserved); - [PreserveSig] - HRESULT ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] THUMBBUTTON[] pButtons); + [PreserveSig] + HRESULT ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] THUMBBUTTON[] pButtons); - [PreserveSig] - HRESULT ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] THUMBBUTTON[] pButtons); + [PreserveSig] + HRESULT ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] THUMBBUTTON[] pButtons); - [PreserveSig] - HRESULT ThumbBarSetImageList(IntPtr hwnd, [MarshalAs(UnmanagedType.IUnknown)] object himl); + [PreserveSig] + HRESULT ThumbBarSetImageList(IntPtr hwnd, [MarshalAs(UnmanagedType.IUnknown)] object himl); - [PreserveSig] - HRESULT SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription); + [PreserveSig] + HRESULT SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription); - [PreserveSig] - HRESULT SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip); + [PreserveSig] + HRESULT SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip); - [PreserveSig] - HRESULT SetThumbnailClip(IntPtr hwnd, RefRECT prcClip); + [PreserveSig] + HRESULT SetThumbnailClip(IntPtr hwnd, RefRECT prcClip); - void SetTabProperties(IntPtr hwndTab, STPF stpFlags); - } + void SetTabProperties(IntPtr hwndTab, STPF stpFlags); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/KDC.cs b/src/Shared/Microsoft.Windows.Shell/Standard/KDC.cs index c98347f5..47ffd773 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/KDC.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/KDC.cs @@ -2,9 +2,9 @@ namespace Standard { - internal enum KDC - { - FREQUENT = 1, - RECENT - } + internal enum KDC + { + FREQUENT = 1, + RECENT + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/LOGFONT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/LOGFONT.cs index 17234be0..2415bbee 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/LOGFONT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/LOGFONT.cs @@ -3,36 +3,36 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal struct LOGFONT - { - public int lfHeight; + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct LOGFONT + { + public int lfHeight; - public int lfWidth; + public int lfWidth; - public int lfEscapement; + public int lfEscapement; - public int lfOrientation; + public int lfOrientation; - public int lfWeight; + public int lfWeight; - public byte lfItalic; + public byte lfItalic; - public byte lfUnderline; + public byte lfUnderline; - public byte lfStrikeOut; + public byte lfStrikeOut; - public byte lfCharSet; + public byte lfCharSet; - public byte lfOutPrecision; + public byte lfOutPrecision; - public byte lfClipPrecision; + public byte lfClipPrecision; - public byte lfQuality; + public byte lfQuality; - public byte lfPitchAndFamily; + public byte lfPitchAndFamily; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string lfFaceName; - } + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string lfFaceName; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MARGINS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MARGINS.cs index db134daa..1f68ff94 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MARGINS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MARGINS.cs @@ -2,14 +2,14 @@ namespace Standard { - internal struct MARGINS - { - public int cxLeftWidth; + internal struct MARGINS + { + public int cxLeftWidth; - public int cxRightWidth; + public int cxRightWidth; - public int cyTopHeight; + public int cyTopHeight; - public int cyBottomHeight; - } + public int cyBottomHeight; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MF.cs index 374087f0..e87794fc 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MF.cs @@ -2,13 +2,13 @@ namespace Standard { - [Flags] - internal enum MF : uint - { - DOES_NOT_EXIST = 4294967295u, - ENABLED = 0u, - BYCOMMAND = 0u, - GRAYED = 1u, - DISABLED = 2u - } + [Flags] + internal enum MF : uint + { + DOES_NOT_EXIST = 4294967295u, + ENABLED = 0u, + BYCOMMAND = 0u, + GRAYED = 1u, + DISABLED = 2u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MINMAXINFO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MINMAXINFO.cs index eba1b7b7..9337e43a 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MINMAXINFO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MINMAXINFO.cs @@ -2,16 +2,16 @@ namespace Standard { - internal struct MINMAXINFO - { - public POINT ptReserved; + internal struct MINMAXINFO + { + public POINT ptReserved; - public POINT ptMaxSize; + public POINT ptMaxSize; - public POINT ptMaxPosition; + public POINT ptMaxPosition; - public POINT ptMinTrackSize; + public POINT ptMinTrackSize; - public POINT ptMaxTrackSize; - } + public POINT ptMaxTrackSize; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MONITORINFO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MONITORINFO.cs index 31c8813e..c63bf057 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MONITORINFO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MONITORINFO.cs @@ -3,15 +3,15 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential)] - internal class MONITORINFO - { - public int cbSize = Marshal.SizeOf(typeof(MONITORINFO)); + [StructLayout(LayoutKind.Sequential)] + internal class MONITORINFO + { + public int cbSize = Marshal.SizeOf(typeof(MONITORINFO)); - public RECT rcMonitor; + public RECT rcMonitor; - public RECT rcWork; + public RECT rcWork; - public int dwFlags; - } + public int dwFlags; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MOUSEEVENTF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MOUSEEVENTF.cs index 37d98db6..b61db210 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MOUSEEVENTF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MOUSEEVENTF.cs @@ -2,9 +2,9 @@ namespace Standard { - internal enum MOUSEEVENTF - { - LEFTDOWN = 2, - LEFTUP = 4 - } + internal enum MOUSEEVENTF + { + LEFTDOWN = 2, + LEFTUP = 4 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MOUSEINPUT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MOUSEINPUT.cs index 70bfc8ea..06b02b59 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MOUSEINPUT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MOUSEINPUT.cs @@ -2,18 +2,18 @@ namespace Standard { - internal struct MOUSEINPUT - { - public int dx; + internal struct MOUSEINPUT + { + public int dx; - public int dy; + public int dy; - public int mouseData; + public int mouseData; - public int dwFlags; + public int dwFlags; - public int time; + public int time; - public IntPtr dwExtraInfo; - } + public IntPtr dwExtraInfo; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MSGFLT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MSGFLT.cs index 39ca35c8..e6b97e0b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MSGFLT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MSGFLT.cs @@ -2,10 +2,10 @@ namespace Standard { - internal enum MSGFLT - { - RESET, - ALLOW, - DISALLOW - } + internal enum MSGFLT + { + RESET, + ALLOW, + DISALLOW + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MSGFLTINFO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MSGFLTINFO.cs index cc91b3ef..49dd757c 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MSGFLTINFO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MSGFLTINFO.cs @@ -2,11 +2,11 @@ namespace Standard { - internal enum MSGFLTINFO - { - NONE, - ALREADYALLOWED_FORWND, - ALREADYDISALLOWED_FORWND, - ALLOWED_HIGHER - } + internal enum MSGFLTINFO + { + NONE, + ALREADYALLOWED_FORWND, + ALREADYDISALLOWED_FORWND, + ALLOWED_HIGHER + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/ManagedIStream.cs b/src/Shared/Microsoft.Windows.Shell/Standard/ManagedIStream.cs index 7b897cbd..4c121de7 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/ManagedIStream.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/ManagedIStream.cs @@ -6,145 +6,145 @@ using System.Runtime.InteropServices.ComTypes; namespace Standard { - internal sealed class ManagedIStream : IStream, IDisposable - { - public ManagedIStream(Stream source) - { - Verify.IsNotNull(source, "source"); - this._source = source; - } + internal sealed class ManagedIStream : IStream, IDisposable + { + public ManagedIStream(Stream source) + { + Verify.IsNotNull(source, "source"); + this._source = source; + } - private void _Validate() - { - if (this._source == null) - { - throw new ObjectDisposedException("this"); - } - } + private void _Validate() + { + if (this._source == null) + { + throw new ObjectDisposedException("this"); + } + } - [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.HRESULT.ThrowIfFailed(System.String)")] - [Obsolete("The method is not implemented", true)] - public void Clone(out IStream ppstm) - { - ppstm = null; - HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented."); - } + [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.HRESULT.ThrowIfFailed(System.String)")] + [Obsolete("The method is not implemented", true)] + public void Clone(out IStream ppstm) + { + ppstm = null; + HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented."); + } - public void Commit(int grfCommitFlags) - { - this._Validate(); - this._source.Flush(); - } + public void Commit(int grfCommitFlags) + { + this._Validate(); + this._source.Flush(); + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] - public void CopyTo(IStream pstm, long cb, IntPtr pcbRead, IntPtr pcbWritten) - { - Verify.IsNotNull(pstm, "pstm"); - this._Validate(); - byte[] array = new byte[4096]; - long num; - int num2; - for (num = 0L; num < cb; num += (long)num2) - { - num2 = this._source.Read(array, 0, array.Length); - if (num2 == 0) - { - break; - } - pstm.Write(array, num2, IntPtr.Zero); - } - if (IntPtr.Zero != pcbRead) - { - Marshal.WriteInt64(pcbRead, num); - } - if (IntPtr.Zero != pcbWritten) - { - Marshal.WriteInt64(pcbWritten, num); - } - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] + public void CopyTo(IStream pstm, long cb, IntPtr pcbRead, IntPtr pcbWritten) + { + Verify.IsNotNull(pstm, "pstm"); + this._Validate(); + byte[] array = new byte[4096]; + long num; + int num2; + for (num = 0L; num < cb; num += (long) num2) + { + num2 = this._source.Read(array, 0, array.Length); + if (num2 == 0) + { + break; + } + pstm.Write(array, num2, IntPtr.Zero); + } + if (IntPtr.Zero != pcbRead) + { + Marshal.WriteInt64(pcbRead, num); + } + if (IntPtr.Zero != pcbWritten) + { + Marshal.WriteInt64(pcbWritten, num); + } + } - [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.HRESULT.ThrowIfFailed(System.String)")] - [Obsolete("The method is not implemented", true)] - public void LockRegion(long libOffset, long cb, int dwLockType) - { - HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented."); - } + [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.HRESULT.ThrowIfFailed(System.String)")] + [Obsolete("The method is not implemented", true)] + public void LockRegion(long libOffset, long cb, int dwLockType) + { + HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented."); + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public void Read(byte[] pv, int cb, IntPtr pcbRead) - { - this._Validate(); - int val = this._source.Read(pv, 0, cb); - if (IntPtr.Zero != pcbRead) - { - Marshal.WriteInt32(pcbRead, val); - } - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public void Read(byte[] pv, int cb, IntPtr pcbRead) + { + this._Validate(); + int val = this._source.Read(pv, 0, cb); + if (IntPtr.Zero != pcbRead) + { + Marshal.WriteInt32(pcbRead, val); + } + } - [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.HRESULT.ThrowIfFailed(System.String)")] - [Obsolete("The method is not implemented", true)] - public void Revert() - { - HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented."); - } + [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.HRESULT.ThrowIfFailed(System.String)")] + [Obsolete("The method is not implemented", true)] + public void Revert() + { + HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented."); + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public void Seek(long dlibMove, int dwOrigin, IntPtr plibNewPosition) - { - this._Validate(); - long val = this._source.Seek(dlibMove, (SeekOrigin)dwOrigin); - if (IntPtr.Zero != plibNewPosition) - { - Marshal.WriteInt64(plibNewPosition, val); - } - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public void Seek(long dlibMove, int dwOrigin, IntPtr plibNewPosition) + { + this._Validate(); + long val = this._source.Seek(dlibMove, (SeekOrigin) dwOrigin); + if (IntPtr.Zero != plibNewPosition) + { + Marshal.WriteInt64(plibNewPosition, val); + } + } - public void SetSize(long libNewSize) - { - this._Validate(); - this._source.SetLength(libNewSize); - } + public void SetSize(long libNewSize) + { + this._Validate(); + this._source.SetLength(libNewSize); + } - public void Stat(out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int grfStatFlag) - { - pstatstg = default(System.Runtime.InteropServices.ComTypes.STATSTG); - this._Validate(); - pstatstg.type = 2; - pstatstg.cbSize = this._source.Length; - pstatstg.grfMode = 2; - pstatstg.grfLocksSupported = 2; - } + public void Stat(out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int grfStatFlag) + { + pstatstg = default(System.Runtime.InteropServices.ComTypes.STATSTG); + this._Validate(); + pstatstg.type = 2; + pstatstg.cbSize = this._source.Length; + pstatstg.grfMode = 2; + pstatstg.grfLocksSupported = 2; + } - [Obsolete("The method is not implemented", true)] - [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.HRESULT.ThrowIfFailed(System.String)")] - public void UnlockRegion(long libOffset, long cb, int dwLockType) - { - HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented."); - } + [Obsolete("The method is not implemented", true)] + [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Standard.HRESULT.ThrowIfFailed(System.String)")] + public void UnlockRegion(long libOffset, long cb, int dwLockType) + { + HRESULT.STG_E_INVALIDFUNCTION.ThrowIfFailed("The method is not implemented."); + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public void Write(byte[] pv, int cb, IntPtr pcbWritten) - { - this._Validate(); - this._source.Write(pv, 0, cb); - if (IntPtr.Zero != pcbWritten) - { - Marshal.WriteInt32(pcbWritten, cb); - } - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public void Write(byte[] pv, int cb, IntPtr pcbWritten) + { + this._Validate(); + this._source.Write(pv, 0, cb); + if (IntPtr.Zero != pcbWritten) + { + Marshal.WriteInt32(pcbWritten, cb); + } + } - public void Dispose() - { - this._source = null; - } + public void Dispose() + { + this._source = null; + } - private const int STGTY_STREAM = 2; + private const int STGTY_STREAM = 2; - private const int STGM_READWRITE = 2; + private const int STGM_READWRITE = 2; - private const int LOCK_EXCLUSIVE = 2; + private const int LOCK_EXCLUSIVE = 2; - private Stream _source; - } + private Stream _source; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MessageHandler.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MessageHandler.cs index b3fee3f4..5bc15578 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MessageHandler.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MessageHandler.cs @@ -2,5 +2,5 @@ namespace Standard { - internal delegate IntPtr MessageHandler(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled); + internal delegate IntPtr MessageHandler(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled); } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/MessageWindow.cs b/src/Shared/Microsoft.Windows.Shell/Standard/MessageWindow.cs index 30f7bad7..0dc6e68f 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/MessageWindow.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/MessageWindow.cs @@ -7,126 +7,126 @@ using System.Windows.Threading; namespace Standard { - internal sealed class MessageWindow : DispatcherObject, IDisposable - { - public IntPtr Handle { get; private set; } + internal sealed class MessageWindow : DispatcherObject, IDisposable + { + public IntPtr Handle { get; private set; } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public MessageWindow(CS classStyle, WS style, WS_EX exStyle, Rect location, string name, WndProc callback) - { - this._wndProcCallback = callback; - this._className = "MessageWindowClass+" + Guid.NewGuid().ToString(); - WNDCLASSEX wndclassex = new WNDCLASSEX - { - cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)), - style = classStyle, - lpfnWndProc = MessageWindow.s_WndProc, - hInstance = NativeMethods.GetModuleHandle(null), - hbrBackground = NativeMethods.GetStockObject(StockObject.NULL_BRUSH), - lpszMenuName = "", - lpszClassName = this._className - }; - NativeMethods.RegisterClassEx(ref wndclassex); - GCHandle value = default(GCHandle); - try - { - value = GCHandle.Alloc(this); - IntPtr lpParam = (IntPtr)value; - this.Handle = NativeMethods.CreateWindowEx(exStyle, this._className, name, style, (int)location.X, (int)location.Y, (int)location.Width, (int)location.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, lpParam); - } - finally - { - value.Free(); - } - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public MessageWindow(CS classStyle, WS style, WS_EX exStyle, Rect location, string name, WndProc callback) + { + this._wndProcCallback = callback; + this._className = "MessageWindowClass+" + Guid.NewGuid().ToString(); + WNDCLASSEX wndclassex = new WNDCLASSEX + { + cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)), + style = classStyle, + lpfnWndProc = MessageWindow.s_WndProc, + hInstance = NativeMethods.GetModuleHandle(null), + hbrBackground = NativeMethods.GetStockObject(StockObject.NULL_BRUSH), + lpszMenuName = "", + lpszClassName = this._className + }; + NativeMethods.RegisterClassEx(ref wndclassex); + GCHandle value = default(GCHandle); + try + { + value = GCHandle.Alloc(this); + IntPtr lpParam = (IntPtr) value; + this.Handle = NativeMethods.CreateWindowEx(exStyle, this._className, name, style, (int) location.X, (int) location.Y, (int) location.Width, (int) location.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, lpParam); + } + finally + { + value.Free(); + } + } - ~MessageWindow() - { - this._Dispose(false, false); - } + ~MessageWindow() + { + this._Dispose(false, false); + } - public void Dispose() - { - this._Dispose(true, false); - GC.SuppressFinalize(this); - } + public void Dispose() + { + this._Dispose(true, false); + GC.SuppressFinalize(this); + } - [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "disposing")] - private void _Dispose(bool disposing, bool isHwndBeingDestroyed) - { - if (this._isDisposed) - { - return; - } - this._isDisposed = true; - IntPtr hwnd = this.Handle; - string className = this._className; - if (isHwndBeingDestroyed) - { - base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback((object arg) => MessageWindow._DestroyWindow(IntPtr.Zero, className))); - } - else if (this.Handle != IntPtr.Zero) - { - if (base.CheckAccess()) - { - MessageWindow._DestroyWindow(hwnd, className); - } - else - { - base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback((object arg) => MessageWindow._DestroyWindow(hwnd, className))); - } - } - MessageWindow.s_windowLookup.Remove(hwnd); - this._className = null; - this.Handle = IntPtr.Zero; - } + [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "disposing")] + private void _Dispose(bool disposing, bool isHwndBeingDestroyed) + { + if (this._isDisposed) + { + return; + } + this._isDisposed = true; + IntPtr hwnd = this.Handle; + string className = this._className; + if (isHwndBeingDestroyed) + { + base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback((object arg) => MessageWindow._DestroyWindow(IntPtr.Zero, className))); + } + else if (this.Handle != IntPtr.Zero) + { + if (base.CheckAccess()) + { + MessageWindow._DestroyWindow(hwnd, className); + } + else + { + base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback((object arg) => MessageWindow._DestroyWindow(hwnd, className))); + } + } + MessageWindow.s_windowLookup.Remove(hwnd); + this._className = null; + this.Handle = IntPtr.Zero; + } - [SuppressMessage("Microsoft.Usage", "CA1816:CallGCSuppressFinalizeCorrectly")] - private static IntPtr _WndProc(IntPtr hwnd, WM msg, IntPtr wParam, IntPtr lParam) - { - IntPtr result = IntPtr.Zero; - MessageWindow messageWindow = null; - if (msg == WM.CREATE) - { - messageWindow = (MessageWindow)GCHandle.FromIntPtr(((CREATESTRUCT)Marshal.PtrToStructure(lParam, typeof(CREATESTRUCT))).lpCreateParams).Target; - MessageWindow.s_windowLookup.Add(hwnd, messageWindow); - } - else if (!MessageWindow.s_windowLookup.TryGetValue(hwnd, out messageWindow)) - { - return NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam); - } - WndProc wndProcCallback = messageWindow._wndProcCallback; - if (wndProcCallback != null) - { - result = wndProcCallback(hwnd, msg, wParam, lParam); - } - else - { - result = NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam); - } - if (msg == WM.NCDESTROY) - { - messageWindow._Dispose(true, true); - GC.SuppressFinalize(messageWindow); - } - return result; - } + [SuppressMessage("Microsoft.Usage", "CA1816:CallGCSuppressFinalizeCorrectly")] + private static IntPtr _WndProc(IntPtr hwnd, WM msg, IntPtr wParam, IntPtr lParam) + { + IntPtr result = IntPtr.Zero; + MessageWindow messageWindow = null; + if (msg == WM.CREATE) + { + messageWindow = (MessageWindow) GCHandle.FromIntPtr(((CREATESTRUCT) Marshal.PtrToStructure(lParam, typeof(CREATESTRUCT))).lpCreateParams).Target; + MessageWindow.s_windowLookup.Add(hwnd, messageWindow); + } + else if (!MessageWindow.s_windowLookup.TryGetValue(hwnd, out messageWindow)) + { + return NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam); + } + WndProc wndProcCallback = messageWindow._wndProcCallback; + if (wndProcCallback != null) + { + result = wndProcCallback(hwnd, msg, wParam, lParam); + } + else + { + result = NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam); + } + if (msg == WM.NCDESTROY) + { + messageWindow._Dispose(true, true); + GC.SuppressFinalize(messageWindow); + } + return result; + } - private static object _DestroyWindow(IntPtr hwnd, string className) - { - Utility.SafeDestroyWindow(ref hwnd); - NativeMethods.UnregisterClass(className, NativeMethods.GetModuleHandle(null)); - return null; - } + private static object _DestroyWindow(IntPtr hwnd, string className) + { + Utility.SafeDestroyWindow(ref hwnd); + NativeMethods.UnregisterClass(className, NativeMethods.GetModuleHandle(null)); + return null; + } - private static readonly WndProc s_WndProc = new WndProc(MessageWindow._WndProc); + private static readonly WndProc s_WndProc = new WndProc(MessageWindow._WndProc); - private static readonly Dictionary s_windowLookup = new Dictionary(); + private static readonly Dictionary s_windowLookup = new Dictionary(); - private WndProc _wndProcCallback; + private WndProc _wndProcCallback; - private string _className; + private string _className; - private bool _isDisposed; - } + private bool _isDisposed; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/NIF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/NIF.cs index d4c306a0..bad4c217 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/NIF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/NIF.cs @@ -2,18 +2,18 @@ namespace Standard { - [Flags] - internal enum NIF : uint - { - MESSAGE = 1u, - ICON = 2u, - TIP = 4u, - STATE = 8u, - INFO = 16u, - GUID = 32u, - REALTIME = 64u, - SHOWTIP = 128u, - XP_MASK = 59u, - VISTA_MASK = 251u - } + [Flags] + internal enum NIF : uint + { + MESSAGE = 1u, + ICON = 2u, + TIP = 4u, + STATE = 8u, + INFO = 16u, + GUID = 32u, + REALTIME = 64u, + SHOWTIP = 128u, + XP_MASK = 59u, + VISTA_MASK = 251u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/NIIF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/NIIF.cs index 3231c2cc..db9dbea1 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/NIIF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/NIIF.cs @@ -2,16 +2,16 @@ namespace Standard { - internal enum NIIF - { - NONE, - INFO, - WARNING, - ERROR, - USER, - NOSOUND = 16, - LARGE_ICON = 32, - NIIF_RESPECT_QUIET_TIME = 128, - XP_ICON_MASK = 15 - } + internal enum NIIF + { + NONE, + INFO, + WARNING, + ERROR, + USER, + NOSOUND = 16, + LARGE_ICON = 32, + NIIF_RESPECT_QUIET_TIME = 128, + XP_ICON_MASK = 15 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/NIM.cs b/src/Shared/Microsoft.Windows.Shell/Standard/NIM.cs index 84a09864..47e29b63 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/NIM.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/NIM.cs @@ -2,12 +2,12 @@ namespace Standard { - internal enum NIM : uint - { - ADD, - MODIFY, - DELETE, - SETFOCUS, - SETVERSION - } + internal enum NIM : uint + { + ADD, + MODIFY, + DELETE, + SETFOCUS, + SETVERSION + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/NONCLIENTMETRICS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/NONCLIENTMETRICS.cs index a5f23a06..00d8eb1e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/NONCLIENTMETRICS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/NONCLIENTMETRICS.cs @@ -4,62 +4,62 @@ using System.Runtime.InteropServices; namespace Standard { - internal struct NONCLIENTMETRICS - { - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public static NONCLIENTMETRICS VistaMetricsStruct - { - get - { - return new NONCLIENTMETRICS - { - cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)) - }; - } - } + internal struct NONCLIENTMETRICS + { + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public static NONCLIENTMETRICS VistaMetricsStruct + { + get + { + return new NONCLIENTMETRICS + { + cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)) + }; + } + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public static NONCLIENTMETRICS XPMetricsStruct - { - get - { - return new NONCLIENTMETRICS - { - cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)) - 4 - }; - } - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public static NONCLIENTMETRICS XPMetricsStruct + { + get + { + return new NONCLIENTMETRICS + { + cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)) - 4 + }; + } + } - public int cbSize; + public int cbSize; - public int iBorderWidth; + public int iBorderWidth; - public int iScrollWidth; + public int iScrollWidth; - public int iScrollHeight; + public int iScrollHeight; - public int iCaptionWidth; + public int iCaptionWidth; - public int iCaptionHeight; + public int iCaptionHeight; - public LOGFONT lfCaptionFont; + public LOGFONT lfCaptionFont; - public int iSmCaptionWidth; + public int iSmCaptionWidth; - public int iSmCaptionHeight; + public int iSmCaptionHeight; - public LOGFONT lfSmCaptionFont; + public LOGFONT lfSmCaptionFont; - public int iMenuWidth; + public int iMenuWidth; - public int iMenuHeight; + public int iMenuHeight; - public LOGFONT lfMenuFont; + public LOGFONT lfMenuFont; - public LOGFONT lfStatusFont; + public LOGFONT lfStatusFont; - public LOGFONT lfMessageFont; + public LOGFONT lfMessageFont; - public int iPaddedBorderWidth; - } + public int iPaddedBorderWidth; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/NOTIFYICONDATA.cs b/src/Shared/Microsoft.Windows.Shell/Standard/NOTIFYICONDATA.cs index 4ff9665b..b0ef5314 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/NOTIFYICONDATA.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/NOTIFYICONDATA.cs @@ -4,41 +4,41 @@ using System.Runtime.InteropServices; namespace Standard { - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - [StructLayout(LayoutKind.Sequential)] - internal class NOTIFYICONDATA - { - public int cbSize; + [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] + [StructLayout(LayoutKind.Sequential)] + internal class NOTIFYICONDATA + { + public int cbSize; - public IntPtr hWnd; + public IntPtr hWnd; - public int uID; + public int uID; - public NIF uFlags; + public NIF uFlags; - public int uCallbackMessage; + public int uCallbackMessage; - public IntPtr hIcon; + public IntPtr hIcon; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public char[] szTip = new char[128]; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public char[] szTip = new char[128]; - public uint dwState; + public uint dwState; - public uint dwStateMask; + public uint dwStateMask; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] - public char[] szInfo = new char[256]; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] + public char[] szInfo = new char[256]; - public uint uVersion; + public uint uVersion; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public char[] szInfoTitle = new char[64]; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] + public char[] szInfoTitle = new char[64]; - public uint dwInfoFlags; + public uint dwInfoFlags; - public Guid guidItem; + public Guid guidItem; - private IntPtr hBalloonIcon; - } + private IntPtr hBalloonIcon; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/NativeMethods.cs b/src/Shared/Microsoft.Windows.Shell/Standard/NativeMethods.cs index 746cc7be..e960c977 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/NativeMethods.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/NativeMethods.cs @@ -8,901 +8,901 @@ using System.Text; namespace Standard { - internal static class NativeMethods - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "AdjustWindowRectEx", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _AdjustWindowRectEx(ref RECT lpRect, WS dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, WS_EX dwExStyle); - - public static RECT AdjustWindowRectEx(RECT lpRect, WS dwStyle, bool bMenu, WS_EX dwExStyle) - { - if (!NativeMethods._AdjustWindowRectEx(ref lpRect, dwStyle, bMenu, dwExStyle)) - { - HRESULT.ThrowLastError(); - } - return lpRect; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "ChangeWindowMessageFilter", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _ChangeWindowMessageFilter(WM message, MSGFLT dwFlag); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "ChangeWindowMessageFilterEx", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _ChangeWindowMessageFilterEx(IntPtr hwnd, WM message, MSGFLT action, [In] [Out] ref CHANGEFILTERSTRUCT pChangeFilterStruct); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static HRESULT ChangeWindowMessageFilterEx(IntPtr hwnd, WM message, MSGFLT action, out MSGFLTINFO filterInfo) - { - filterInfo = MSGFLTINFO.NONE; - if (!Utility.IsOSVistaOrNewer) - { - return HRESULT.S_FALSE; - } - if (!Utility.IsOSWindows7OrNewer) - { - if (!NativeMethods._ChangeWindowMessageFilter(message, action)) - { - return (HRESULT)Win32Error.GetLastError(); - } - return HRESULT.S_OK; - } - else - { - CHANGEFILTERSTRUCT changefilterstruct = new CHANGEFILTERSTRUCT - { - cbSize = (uint)Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)) - }; - if (!NativeMethods._ChangeWindowMessageFilterEx(hwnd, message, action, ref changefilterstruct)) - { - return (HRESULT)Win32Error.GetLastError(); - } - filterInfo = changefilterstruct.ExtStatus; - return HRESULT.S_OK; - } - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll")] - public static extern CombineRgnResult CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1, IntPtr hrgnSrc2, RGN fnCombineMode); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("shell32.dll", CharSet = CharSet.Unicode, EntryPoint = "CommandLineToArgvW")] - private static extern IntPtr _CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string cmdLine, out int numArgs); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static string[] CommandLineToArgvW(string cmdLine) - { - IntPtr intPtr = IntPtr.Zero; - string[] result; - try - { - int num = 0; - intPtr = NativeMethods._CommandLineToArgvW(cmdLine, out num); - if (intPtr == IntPtr.Zero) - { - throw new Win32Exception(); - } - string[] array = new string[num]; - for (int i = 0; i < num; i++) - { - IntPtr ptr = Marshal.ReadIntPtr(intPtr, i * Marshal.SizeOf(typeof(IntPtr))); - array[i] = Marshal.PtrToStringUni(ptr); - } - result = array; - } - finally - { - NativeMethods._LocalFree(intPtr); - } - return result; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", EntryPoint = "CreateDIBSection", SetLastError = true)] - private static extern SafeHBITMAP _CreateDIBSection(SafeDC hdc, [In] ref BITMAPINFO bitmapInfo, int iUsage, out IntPtr ppvBits, IntPtr hSection, int dwOffset); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", EntryPoint = "CreateDIBSection", SetLastError = true)] - private static extern SafeHBITMAP _CreateDIBSectionIntPtr(IntPtr hdc, [In] ref BITMAPINFO bitmapInfo, int iUsage, out IntPtr ppvBits, IntPtr hSection, int dwOffset); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static SafeHBITMAP CreateDIBSection(SafeDC hdc, ref BITMAPINFO bitmapInfo, out IntPtr ppvBits, IntPtr hSection, int dwOffset) - { - SafeHBITMAP safeHBITMAP; - if (hdc == null) - { - safeHBITMAP = NativeMethods._CreateDIBSectionIntPtr(IntPtr.Zero, ref bitmapInfo, 0, out ppvBits, hSection, dwOffset); - } - else - { - safeHBITMAP = NativeMethods._CreateDIBSection(hdc, ref bitmapInfo, 0, out ppvBits, hSection, dwOffset); - } - if (safeHBITMAP.IsInvalid) - { - HRESULT.ThrowLastError(); - } - return safeHBITMAP; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", EntryPoint = "CreateRoundRectRgn", SetLastError = true)] - private static extern IntPtr _CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse) - { - IntPtr intPtr = NativeMethods._CreateRoundRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, nWidthEllipse, nHeightEllipse); - if (IntPtr.Zero == intPtr) - { - throw new Win32Exception(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", EntryPoint = "CreateRectRgn", SetLastError = true)] - private static extern IntPtr _CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) - { - IntPtr intPtr = NativeMethods._CreateRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect); - if (IntPtr.Zero == intPtr) - { - throw new Win32Exception(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", EntryPoint = "CreateRectRgnIndirect", SetLastError = true)] - private static extern IntPtr _CreateRectRgnIndirect([In] ref RECT lprc); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr CreateRectRgnIndirect(RECT lprc) - { - IntPtr intPtr = NativeMethods._CreateRectRgnIndirect(ref lprc); - if (IntPtr.Zero == intPtr) - { - throw new Win32Exception(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll")] - public static extern IntPtr CreateSolidBrush(int crColor); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "CreateWindowExW", SetLastError = true)] - private static extern IntPtr _CreateWindowEx(WS_EX dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName, [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr CreateWindowEx(WS_EX dwExStyle, string lpClassName, string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam) - { - IntPtr intPtr = NativeMethods._CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); - if (IntPtr.Zero == intPtr) - { - HRESULT.ThrowLastError(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "DefWindowProcW")] - public static extern IntPtr DefWindowProc(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool DeleteObject(IntPtr hObject); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool DestroyIcon(IntPtr handle); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool DestroyWindow(IntPtr hwnd); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool IsWindow(IntPtr hwnd); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS pMarInset); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("dwmapi.dll", EntryPoint = "DwmIsCompositionEnabled", PreserveSig = false)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _DwmIsCompositionEnabled(); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("dwmapi.dll", EntryPoint = "DwmGetColorizationColor")] - private static extern HRESULT _DwmGetColorizationColor(out uint pcrColorization, [MarshalAs(UnmanagedType.Bool)] out bool pfOpaqueBlend); - - public static bool DwmGetColorizationColor(out uint pcrColorization, out bool pfOpaqueBlend) - { - if (Utility.IsOSVistaOrNewer && NativeMethods.IsThemeActive() && NativeMethods._DwmGetColorizationColor(out pcrColorization, out pfOpaqueBlend).Succeeded) - { - return true; - } - pcrColorization = 4278190080u; - pfOpaqueBlend = true; - return false; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool DwmIsCompositionEnabled() - { - return Utility.IsOSVistaOrNewer && NativeMethods._DwmIsCompositionEnabled(); - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("dwmapi.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool DwmDefWindowProc(IntPtr hwnd, WM msg, IntPtr wParam, IntPtr lParam, out IntPtr plResult); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("dwmapi.dll", EntryPoint = "DwmSetWindowAttribute")] - private static extern void _DwmSetWindowAttribute(IntPtr hwnd, DWMWA dwAttribute, ref int pvAttribute, int cbAttribute); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void DwmSetWindowAttributeFlip3DPolicy(IntPtr hwnd, DWMFLIP3D flip3dPolicy) - { - int num = (int)flip3dPolicy; - NativeMethods._DwmSetWindowAttribute(hwnd, DWMWA.FLIP3D_POLICY, ref num, 4); - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void DwmSetWindowAttributeDisallowPeek(IntPtr hwnd, bool disallowPeek) - { - int num = disallowPeek ? 1 : 0; - NativeMethods._DwmSetWindowAttribute(hwnd, DWMWA.DISALLOW_PEEK, ref num, 4); - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "EnableMenuItem")] - private static extern int _EnableMenuItem(IntPtr hMenu, SC uIDEnableItem, MF uEnable); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static MF EnableMenuItem(IntPtr hMenu, SC uIDEnableItem, MF uEnable) - { - return (MF)NativeMethods._EnableMenuItem(hMenu, uIDEnableItem, uEnable); - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "RemoveMenu", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _RemoveMenu(IntPtr hMenu, uint uPosition, uint uFlags); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void RemoveMenu(IntPtr hMenu, SC uPosition, MF uFlags) - { - if (!NativeMethods._RemoveMenu(hMenu, (uint)uPosition, (uint)uFlags)) - { - throw new Win32Exception(); - } - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "DrawMenuBar", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _DrawMenuBar(IntPtr hWnd); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void DrawMenuBar(IntPtr hWnd) - { - if (!NativeMethods._DrawMenuBar(hWnd)) - { - throw new Win32Exception(); - } - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("kernel32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool FindClose(IntPtr handle); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern SafeFindHandle FindFirstFileW(string lpFileName, [MarshalAs(UnmanagedType.LPStruct)] [In] [Out] WIN32_FIND_DATAW lpFindFileData); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("kernel32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool FindNextFileW(SafeFindHandle hndFindFile, [MarshalAs(UnmanagedType.LPStruct)] [In] [Out] WIN32_FIND_DATAW lpFindFileData); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "GetClientRect", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _GetClientRect(IntPtr hwnd, out RECT lpRect); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static RECT GetClientRect(IntPtr hwnd) - { - RECT result; - if (!NativeMethods._GetClientRect(hwnd, out result)) - { - HRESULT.ThrowLastError(); - } - return result; - } - - [DllImport("uxtheme.dll", CharSet = CharSet.Unicode, EntryPoint = "GetCurrentThemeName")] - private static extern HRESULT _GetCurrentThemeName(StringBuilder pszThemeFileName, int dwMaxNameChars, StringBuilder pszColorBuff, int cchMaxColorChars, StringBuilder pszSizeBuff, int cchMaxSizeChars); - - public static void GetCurrentThemeName(out string themeFileName, out string color, out string size) - { - StringBuilder stringBuilder = new StringBuilder(260); - StringBuilder stringBuilder2 = new StringBuilder(260); - StringBuilder stringBuilder3 = new StringBuilder(260); - NativeMethods._GetCurrentThemeName(stringBuilder, stringBuilder.Capacity, stringBuilder2, stringBuilder2.Capacity, stringBuilder3, stringBuilder3.Capacity).ThrowIfFailed(); - themeFileName = stringBuilder.ToString(); - color = stringBuilder2.ToString(); - size = stringBuilder3.ToString(); - } - - [DllImport("uxtheme.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool IsThemeActive(); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [Obsolete("Use SafeDC.GetDC instead.", true)] - public static void GetDC() - { - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll")] - public static extern int GetDeviceCaps(SafeDC hdc, DeviceCap nIndex); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "GetModuleFileName", SetLastError = true)] - private static extern int _GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static string GetModuleFileName(IntPtr hModule) - { - StringBuilder stringBuilder = new StringBuilder(260); - for (;;) - { - int num = NativeMethods._GetModuleFileName(hModule, stringBuilder, stringBuilder.Capacity); - if (num == 0) - { - HRESULT.ThrowLastError(); - } - if (num != stringBuilder.Capacity) - { - break; - } - stringBuilder.EnsureCapacity(stringBuilder.Capacity * 2); - } - return stringBuilder.ToString(); - } - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "GetModuleHandleW", SetLastError = true)] - private static extern IntPtr _GetModuleHandle([MarshalAs(UnmanagedType.LPWStr)] string lpModuleName); - - public static IntPtr GetModuleHandle(string lpModuleName) - { - IntPtr intPtr = NativeMethods._GetModuleHandle(lpModuleName); - if (intPtr == IntPtr.Zero) - { - HRESULT.ThrowLastError(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "GetMonitorInfo", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _GetMonitorInfo(IntPtr hMonitor, [In] [Out] MONITORINFO lpmi); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static MONITORINFO GetMonitorInfo(IntPtr hMonitor) - { - MONITORINFO monitorinfo = new MONITORINFO(); - if (!NativeMethods._GetMonitorInfo(hMonitor, monitorinfo)) - { - throw new Win32Exception(); - } - return monitorinfo; - } - - [DllImport("gdi32.dll", EntryPoint = "GetStockObject", SetLastError = true)] - private static extern IntPtr _GetStockObject(StockObject fnObject); - - public static IntPtr GetStockObject(StockObject fnObject) - { - return NativeMethods._GetStockObject(fnObject); - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll")] - public static extern IntPtr GetSystemMenu(IntPtr hWnd, [MarshalAs(UnmanagedType.Bool)] bool bRevert); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll")] - public static extern int GetSystemMetrics(SM nIndex); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr GetWindowLongPtr(IntPtr hwnd, GWL nIndex) - { - IntPtr intPtr = IntPtr.Zero; - if (8 == IntPtr.Size) - { - intPtr = NativeMethods.GetWindowLongPtr64(hwnd, nIndex); - } - else - { - intPtr = new IntPtr(NativeMethods.GetWindowLongPtr32(hwnd, nIndex)); - } - if (IntPtr.Zero == intPtr) - { - throw new Win32Exception(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("uxtheme.dll", PreserveSig = false)] - public static extern void SetWindowThemeAttribute([In] IntPtr hwnd, [In] WINDOWTHEMEATTRIBUTETYPE eAttribute, [In] ref WTA_OPTIONS pvAttribute, [In] uint cbAttribute); - - [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "GetWindowLong", SetLastError = true)] - private static extern int GetWindowLongPtr32(IntPtr hWnd, GWL nIndex); - - [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr", SetLastError = true)] - private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, GWL nIndex); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool GetWindowPlacement(IntPtr hwnd, WINDOWPLACEMENT lpwndpl); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static WINDOWPLACEMENT GetWindowPlacement(IntPtr hwnd) - { - WINDOWPLACEMENT windowplacement = new WINDOWPLACEMENT(); - if (NativeMethods.GetWindowPlacement(hwnd, windowplacement)) - { - return windowplacement; - } - throw new Win32Exception(); - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "GetWindowRect", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _GetWindowRect(IntPtr hWnd, out RECT lpRect); - - public static RECT GetWindowRect(IntPtr hwnd) - { - RECT result; - if (!NativeMethods._GetWindowRect(hwnd, out result)) - { - HRESULT.ThrowLastError(); - } - return result; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdiplus.dll")] - public static extern Status GdipCreateBitmapFromStream(IStream stream, out IntPtr bitmap); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdiplus.dll")] - public static extern Status GdipCreateHBITMAPFromBitmap(IntPtr bitmap, out IntPtr hbmReturn, int background); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdiplus.dll")] - public static extern Status GdipCreateHICONFromBitmap(IntPtr bitmap, out IntPtr hbmReturn); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdiplus.dll")] - public static extern Status GdipDisposeImage(IntPtr image); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdiplus.dll")] - public static extern Status GdipImageForceValidation(IntPtr image); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdiplus.dll")] - public static extern Status GdiplusStartup(out IntPtr token, StartupInput input, out StartupOutput output); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdiplus.dll")] - public static extern Status GdiplusShutdown(IntPtr token); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool IsWindowVisible(IntPtr hwnd); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("kernel32.dll", EntryPoint = "LocalFree", SetLastError = true)] - private static extern IntPtr _LocalFree(IntPtr hMem); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll")] - public static extern IntPtr MonitorFromWindow(IntPtr hwnd, uint dwFlags); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "PostMessage", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _PostMessage(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void PostMessage(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam) - { - if (!NativeMethods._PostMessage(hWnd, Msg, wParam, lParam)) - { - throw new Win32Exception(); - } - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "RegisterClassExW", SetLastError = true)] - private static extern short _RegisterClassEx([In] ref WNDCLASSEX lpwcx); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static short RegisterClassEx(ref WNDCLASSEX lpwcx) - { - short num = NativeMethods._RegisterClassEx(ref lpwcx); - if (num == 0) - { - HRESULT.ThrowLastError(); - } - return num; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "RegisterWindowMessage", SetLastError = true)] - private static extern uint _RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static WM RegisterWindowMessage(string lpString) - { - uint num = NativeMethods._RegisterWindowMessage(lpString); - if (num == 0u) - { - HRESULT.ThrowLastError(); - } - return (WM)num; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "SetActiveWindow", SetLastError = true)] - private static extern IntPtr _SetActiveWindow(IntPtr hWnd); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr SetActiveWindow(IntPtr hwnd) - { - Verify.IsNotDefault(hwnd, "hwnd"); - IntPtr intPtr = NativeMethods._SetActiveWindow(hwnd); - if (intPtr == IntPtr.Zero) - { - HRESULT.ThrowLastError(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr SetClassLongPtr(IntPtr hwnd, GCLP nIndex, IntPtr dwNewLong) - { - if (8 == IntPtr.Size) - { - return NativeMethods.SetClassLongPtr64(hwnd, nIndex, dwNewLong); - } - return new IntPtr(NativeMethods.SetClassLongPtr32(hwnd, nIndex, dwNewLong.ToInt32())); - } - - [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "SetClassLong", SetLastError = true)] - private static extern int SetClassLongPtr32(IntPtr hWnd, GCLP nIndex, int dwNewLong); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] - [DllImport("user32.dll", EntryPoint = "SetClassLongPtr", SetLastError = true)] - private static extern IntPtr SetClassLongPtr64(IntPtr hWnd, GCLP nIndex, IntPtr dwNewLong); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("kernel32.dll", SetLastError = true)] - public static extern ErrorModes SetErrorMode(ErrorModes newMode); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _SetProcessWorkingSetSize(IntPtr hProcess, IntPtr dwMinimiumWorkingSetSize, IntPtr dwMaximumWorkingSetSize); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SetProcessWorkingSetSize(IntPtr hProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize) - { - if (!NativeMethods._SetProcessWorkingSetSize(hProcess, new IntPtr(dwMinimumWorkingSetSize), new IntPtr(dwMaximumWorkingSetSize))) - { - throw new Win32Exception(); - } - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr SetWindowLongPtr(IntPtr hwnd, GWL nIndex, IntPtr dwNewLong) - { - if (8 == IntPtr.Size) - { - return NativeMethods.SetWindowLongPtr64(hwnd, nIndex, dwNewLong); - } - return new IntPtr(NativeMethods.SetWindowLongPtr32(hwnd, nIndex, dwNewLong.ToInt32())); - } - - [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "SetWindowLong", SetLastError = true)] - private static extern int SetWindowLongPtr32(IntPtr hWnd, GWL nIndex, int dwNewLong); - - [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr", SetLastError = true)] - private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, GWL nIndex, IntPtr dwNewLong); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "SetWindowRgn", SetLastError = true)] - private static extern int _SetWindowRgn(IntPtr hWnd, IntPtr hRgn, [MarshalAs(UnmanagedType.Bool)] bool bRedraw); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw) - { - if (NativeMethods._SetWindowRgn(hWnd, hRgn, bRedraw) == 0) - { - throw new Win32Exception(); - } - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "SetWindowPos", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP uFlags); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP uFlags) - { - return NativeMethods._SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags); - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("shell32.dll")] - public static extern Win32Error SHFileOperation(ref SHFILEOPSTRUCT lpFileOp); - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool ShowWindow(IntPtr hwnd, SW nCmdShow); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "SystemParametersInfoW", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _SystemParametersInfo_String(SPI uiAction, int uiParam, [MarshalAs(UnmanagedType.LPWStr)] string pvParam, SPIF fWinIni); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "SystemParametersInfoW", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _SystemParametersInfo_NONCLIENTMETRICS(SPI uiAction, int uiParam, [In] [Out] ref NONCLIENTMETRICS pvParam, SPIF fWinIni); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "SystemParametersInfoW", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _SystemParametersInfo_HIGHCONTRAST(SPI uiAction, int uiParam, [In] [Out] ref HIGHCONTRAST pvParam, SPIF fWinIni); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SystemParametersInfo(SPI uiAction, int uiParam, string pvParam, SPIF fWinIni) - { - if (!NativeMethods._SystemParametersInfo_String(uiAction, uiParam, pvParam, fWinIni)) - { - HRESULT.ThrowLastError(); - } - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static NONCLIENTMETRICS SystemParameterInfo_GetNONCLIENTMETRICS() - { - NONCLIENTMETRICS result = Utility.IsOSVistaOrNewer ? NONCLIENTMETRICS.VistaMetricsStruct : NONCLIENTMETRICS.XPMetricsStruct; - if (!NativeMethods._SystemParametersInfo_NONCLIENTMETRICS(SPI.GETNONCLIENTMETRICS, result.cbSize, ref result, SPIF.None)) - { - HRESULT.ThrowLastError(); - } - return result; - } - - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public static HIGHCONTRAST SystemParameterInfo_GetHIGHCONTRAST() - { - HIGHCONTRAST result = new HIGHCONTRAST - { - cbSize = Marshal.SizeOf(typeof(HIGHCONTRAST)) - }; - if (!NativeMethods._SystemParametersInfo_HIGHCONTRAST(SPI.GETHIGHCONTRAST, result.cbSize, ref result, SPIF.None)) - { - HRESULT.ThrowLastError(); - } - return result; - } - - [DllImport("user32.dll")] - public static extern uint TrackPopupMenuEx(IntPtr hmenu, uint fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", EntryPoint = "SelectObject", SetLastError = true)] - private static extern IntPtr _SelectObject(SafeDC hdc, IntPtr hgdiobj); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr SelectObject(SafeDC hdc, IntPtr hgdiobj) - { - IntPtr intPtr = NativeMethods._SelectObject(hdc, hgdiobj); - if (intPtr == IntPtr.Zero) - { - HRESULT.ThrowLastError(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", EntryPoint = "SelectObject", SetLastError = true)] - private static extern IntPtr _SelectObjectSafeHBITMAP(SafeDC hdc, SafeHBITMAP hgdiobj); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static IntPtr SelectObject(SafeDC hdc, SafeHBITMAP hgdiobj) - { - IntPtr intPtr = NativeMethods._SelectObjectSafeHBITMAP(hdc, hgdiobj); - if (intPtr == IntPtr.Zero) - { - HRESULT.ThrowLastError(); - } - return intPtr; - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", SetLastError = true)] - public static extern int SendInput(int nInputs, ref INPUT pInputs, int cbSize); - - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr SendMessage(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "UnregisterClass", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _UnregisterClassAtom(IntPtr lpClassName, IntPtr hInstance); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "UnregisterClass", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _UnregisterClassName(string lpClassName, IntPtr hInstance); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void UnregisterClass(short atom, IntPtr hinstance) - { - if (!NativeMethods._UnregisterClassAtom(new IntPtr((int)atom), hinstance)) - { - HRESULT.ThrowLastError(); - } - } - - public static void UnregisterClass(string lpClassName, IntPtr hInstance) - { - if (!NativeMethods._UnregisterClassName(lpClassName, hInstance)) - { - HRESULT.ThrowLastError(); - } - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "UpdateLayeredWindow", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _UpdateLayeredWindow(IntPtr hwnd, SafeDC hdcDst, [In] ref POINT pptDst, [In] ref SIZE psize, SafeDC hdcSrc, [In] ref POINT pptSrc, int crKey, ref BLENDFUNCTION pblend, ULW dwFlags); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll", EntryPoint = "UpdateLayeredWindow", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _UpdateLayeredWindowIntPtr(IntPtr hwnd, IntPtr hdcDst, IntPtr pptDst, IntPtr psize, IntPtr hdcSrc, IntPtr pptSrc, int crKey, ref BLENDFUNCTION pblend, ULW dwFlags); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void UpdateLayeredWindow(IntPtr hwnd, SafeDC hdcDst, ref POINT pptDst, ref SIZE psize, SafeDC hdcSrc, ref POINT pptSrc, int crKey, ref BLENDFUNCTION pblend, ULW dwFlags) - { - if (!NativeMethods._UpdateLayeredWindow(hwnd, hdcDst, ref pptDst, ref psize, hdcSrc, ref pptSrc, crKey, ref pblend, dwFlags)) - { - HRESULT.ThrowLastError(); - } - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void UpdateLayeredWindow(IntPtr hwnd, int crKey, ref BLENDFUNCTION pblend, ULW dwFlags) - { - if (!NativeMethods._UpdateLayeredWindowIntPtr(hwnd, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, crKey, ref pblend, dwFlags)) - { - HRESULT.ThrowLastError(); - } - } - - [DllImport("shell32.dll", EntryPoint = "SHAddToRecentDocs")] - private static extern void _SHAddToRecentDocs_String(SHARD uFlags, [MarshalAs(UnmanagedType.LPWStr)] string pv); - - [DllImport("shell32.dll", EntryPoint = "SHAddToRecentDocs")] - private static extern void _SHAddToRecentDocs_ShellLink(SHARD uFlags, IShellLinkW pv); - - public static void SHAddToRecentDocs(string path) - { - NativeMethods._SHAddToRecentDocs_String(SHARD.PATHW, path); - } - - public static void SHAddToRecentDocs(IShellLinkW shellLink) - { - NativeMethods._SHAddToRecentDocs_ShellLink(SHARD.LINK, shellLink); - } - - [DllImport("dwmapi.dll", EntryPoint = "DwmGetCompositionTimingInfo")] - private static extern HRESULT _DwmGetCompositionTimingInfo(IntPtr hwnd, ref DWM_TIMING_INFO pTimingInfo); - - public static DWM_TIMING_INFO? DwmGetCompositionTimingInfo(IntPtr hwnd) - { - if (!Utility.IsOSVistaOrNewer) - { - return null; - } - DWM_TIMING_INFO value = new DWM_TIMING_INFO - { - cbSize = Marshal.SizeOf(typeof(DWM_TIMING_INFO)) - }; - HRESULT hrLeft = NativeMethods._DwmGetCompositionTimingInfo(hwnd, ref value); - if (hrLeft == HRESULT.E_PENDING) - { - return null; - } - hrLeft.ThrowIfFailed(); - return new DWM_TIMING_INFO?(value); - } - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmInvalidateIconicBitmaps(IntPtr hwnd); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmSetIconicThumbnail(IntPtr hwnd, IntPtr hbmp, DWM_SIT dwSITFlags); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmSetIconicLivePreviewBitmap(IntPtr hwnd, IntPtr hbmp, RefPOINT pptClient, DWM_SIT dwSITFlags); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("shell32.dll", PreserveSig = false)] - public static extern void SHGetItemFromDataObject(IDataObject pdtobj, DOGIF dwFlags, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("shell32.dll", PreserveSig = false)] - public static extern HRESULT SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IBindCtx pbc, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("shell32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool Shell_NotifyIcon(NIM dwMessage, [In] NOTIFYICONDATA lpdata); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("shell32.dll", PreserveSig = false)] - public static extern void SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID); - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("shell32.dll")] - public static extern HRESULT GetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] out string AppID); - } + internal static class NativeMethods + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "AdjustWindowRectEx", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _AdjustWindowRectEx(ref RECT lpRect, WS dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, WS_EX dwExStyle); + + public static RECT AdjustWindowRectEx(RECT lpRect, WS dwStyle, bool bMenu, WS_EX dwExStyle) + { + if (!NativeMethods._AdjustWindowRectEx(ref lpRect, dwStyle, bMenu, dwExStyle)) + { + HRESULT.ThrowLastError(); + } + return lpRect; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "ChangeWindowMessageFilter", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _ChangeWindowMessageFilter(WM message, MSGFLT dwFlag); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "ChangeWindowMessageFilterEx", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _ChangeWindowMessageFilterEx(IntPtr hwnd, WM message, MSGFLT action, [In][Out] ref CHANGEFILTERSTRUCT pChangeFilterStruct); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static HRESULT ChangeWindowMessageFilterEx(IntPtr hwnd, WM message, MSGFLT action, out MSGFLTINFO filterInfo) + { + filterInfo = MSGFLTINFO.NONE; + if (!Utility.IsOSVistaOrNewer) + { + return HRESULT.S_FALSE; + } + if (!Utility.IsOSWindows7OrNewer) + { + if (!NativeMethods._ChangeWindowMessageFilter(message, action)) + { + return (HRESULT) Win32Error.GetLastError(); + } + return HRESULT.S_OK; + } + else + { + CHANGEFILTERSTRUCT changefilterstruct = new CHANGEFILTERSTRUCT + { + cbSize = (uint) Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)) + }; + if (!NativeMethods._ChangeWindowMessageFilterEx(hwnd, message, action, ref changefilterstruct)) + { + return (HRESULT) Win32Error.GetLastError(); + } + filterInfo = changefilterstruct.ExtStatus; + return HRESULT.S_OK; + } + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll")] + public static extern CombineRgnResult CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1, IntPtr hrgnSrc2, RGN fnCombineMode); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("shell32.dll", CharSet = CharSet.Unicode, EntryPoint = "CommandLineToArgvW")] + private static extern IntPtr _CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string cmdLine, out int numArgs); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static string[] CommandLineToArgvW(string cmdLine) + { + IntPtr intPtr = IntPtr.Zero; + string[] result; + try + { + int num = 0; + intPtr = NativeMethods._CommandLineToArgvW(cmdLine, out num); + if (intPtr == IntPtr.Zero) + { + throw new Win32Exception(); + } + string[] array = new string[num]; + for (int i = 0; i < num; i++) + { + IntPtr ptr = Marshal.ReadIntPtr(intPtr, i * Marshal.SizeOf(typeof(IntPtr))); + array[i] = Marshal.PtrToStringUni(ptr); + } + result = array; + } + finally + { + NativeMethods._LocalFree(intPtr); + } + return result; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", EntryPoint = "CreateDIBSection", SetLastError = true)] + private static extern SafeHBITMAP _CreateDIBSection(SafeDC hdc, [In] ref BITMAPINFO bitmapInfo, int iUsage, out IntPtr ppvBits, IntPtr hSection, int dwOffset); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", EntryPoint = "CreateDIBSection", SetLastError = true)] + private static extern SafeHBITMAP _CreateDIBSectionIntPtr(IntPtr hdc, [In] ref BITMAPINFO bitmapInfo, int iUsage, out IntPtr ppvBits, IntPtr hSection, int dwOffset); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static SafeHBITMAP CreateDIBSection(SafeDC hdc, ref BITMAPINFO bitmapInfo, out IntPtr ppvBits, IntPtr hSection, int dwOffset) + { + SafeHBITMAP safeHBITMAP; + if (hdc == null) + { + safeHBITMAP = NativeMethods._CreateDIBSectionIntPtr(IntPtr.Zero, ref bitmapInfo, 0, out ppvBits, hSection, dwOffset); + } + else + { + safeHBITMAP = NativeMethods._CreateDIBSection(hdc, ref bitmapInfo, 0, out ppvBits, hSection, dwOffset); + } + if (safeHBITMAP.IsInvalid) + { + HRESULT.ThrowLastError(); + } + return safeHBITMAP; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", EntryPoint = "CreateRoundRectRgn", SetLastError = true)] + private static extern IntPtr _CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse) + { + IntPtr intPtr = NativeMethods._CreateRoundRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, nWidthEllipse, nHeightEllipse); + if (IntPtr.Zero == intPtr) + { + throw new Win32Exception(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", EntryPoint = "CreateRectRgn", SetLastError = true)] + private static extern IntPtr _CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) + { + IntPtr intPtr = NativeMethods._CreateRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect); + if (IntPtr.Zero == intPtr) + { + throw new Win32Exception(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", EntryPoint = "CreateRectRgnIndirect", SetLastError = true)] + private static extern IntPtr _CreateRectRgnIndirect([In] ref RECT lprc); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr CreateRectRgnIndirect(RECT lprc) + { + IntPtr intPtr = NativeMethods._CreateRectRgnIndirect(ref lprc); + if (IntPtr.Zero == intPtr) + { + throw new Win32Exception(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll")] + public static extern IntPtr CreateSolidBrush(int crColor); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "CreateWindowExW", SetLastError = true)] + private static extern IntPtr _CreateWindowEx(WS_EX dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName, [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr CreateWindowEx(WS_EX dwExStyle, string lpClassName, string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam) + { + IntPtr intPtr = NativeMethods._CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); + if (IntPtr.Zero == intPtr) + { + HRESULT.ThrowLastError(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "DefWindowProcW")] + public static extern IntPtr DefWindowProc(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeleteObject(IntPtr hObject); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DestroyIcon(IntPtr handle); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DestroyWindow(IntPtr hwnd); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool IsWindow(IntPtr hwnd); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS pMarInset); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("dwmapi.dll", EntryPoint = "DwmIsCompositionEnabled", PreserveSig = false)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _DwmIsCompositionEnabled(); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("dwmapi.dll", EntryPoint = "DwmGetColorizationColor")] + private static extern HRESULT _DwmGetColorizationColor(out uint pcrColorization, [MarshalAs(UnmanagedType.Bool)] out bool pfOpaqueBlend); + + public static bool DwmGetColorizationColor(out uint pcrColorization, out bool pfOpaqueBlend) + { + if (Utility.IsOSVistaOrNewer && NativeMethods.IsThemeActive() && NativeMethods._DwmGetColorizationColor(out pcrColorization, out pfOpaqueBlend).Succeeded) + { + return true; + } + pcrColorization = 4278190080u; + pfOpaqueBlend = true; + return false; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool DwmIsCompositionEnabled() + { + return Utility.IsOSVistaOrNewer && NativeMethods._DwmIsCompositionEnabled(); + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("dwmapi.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DwmDefWindowProc(IntPtr hwnd, WM msg, IntPtr wParam, IntPtr lParam, out IntPtr plResult); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("dwmapi.dll", EntryPoint = "DwmSetWindowAttribute")] + private static extern void _DwmSetWindowAttribute(IntPtr hwnd, DWMWA dwAttribute, ref int pvAttribute, int cbAttribute); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void DwmSetWindowAttributeFlip3DPolicy(IntPtr hwnd, DWMFLIP3D flip3dPolicy) + { + int num = (int) flip3dPolicy; + NativeMethods._DwmSetWindowAttribute(hwnd, DWMWA.FLIP3D_POLICY, ref num, 4); + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void DwmSetWindowAttributeDisallowPeek(IntPtr hwnd, bool disallowPeek) + { + int num = disallowPeek ? 1 : 0; + NativeMethods._DwmSetWindowAttribute(hwnd, DWMWA.DISALLOW_PEEK, ref num, 4); + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "EnableMenuItem")] + private static extern int _EnableMenuItem(IntPtr hMenu, SC uIDEnableItem, MF uEnable); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static MF EnableMenuItem(IntPtr hMenu, SC uIDEnableItem, MF uEnable) + { + return (MF) NativeMethods._EnableMenuItem(hMenu, uIDEnableItem, uEnable); + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "RemoveMenu", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _RemoveMenu(IntPtr hMenu, uint uPosition, uint uFlags); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void RemoveMenu(IntPtr hMenu, SC uPosition, MF uFlags) + { + if (!NativeMethods._RemoveMenu(hMenu, (uint) uPosition, (uint) uFlags)) + { + throw new Win32Exception(); + } + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "DrawMenuBar", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _DrawMenuBar(IntPtr hWnd); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void DrawMenuBar(IntPtr hWnd) + { + if (!NativeMethods._DrawMenuBar(hWnd)) + { + throw new Win32Exception(); + } + } + + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("kernel32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool FindClose(IntPtr handle); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern SafeFindHandle FindFirstFileW(string lpFileName, [MarshalAs(UnmanagedType.LPStruct)][In][Out] WIN32_FIND_DATAW lpFindFileData); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool FindNextFileW(SafeFindHandle hndFindFile, [MarshalAs(UnmanagedType.LPStruct)][In][Out] WIN32_FIND_DATAW lpFindFileData); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "GetClientRect", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _GetClientRect(IntPtr hwnd, out RECT lpRect); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static RECT GetClientRect(IntPtr hwnd) + { + RECT result; + if (!NativeMethods._GetClientRect(hwnd, out result)) + { + HRESULT.ThrowLastError(); + } + return result; + } + + [DllImport("uxtheme.dll", CharSet = CharSet.Unicode, EntryPoint = "GetCurrentThemeName")] + private static extern HRESULT _GetCurrentThemeName(StringBuilder pszThemeFileName, int dwMaxNameChars, StringBuilder pszColorBuff, int cchMaxColorChars, StringBuilder pszSizeBuff, int cchMaxSizeChars); + + public static void GetCurrentThemeName(out string themeFileName, out string color, out string size) + { + StringBuilder stringBuilder = new StringBuilder(260); + StringBuilder stringBuilder2 = new StringBuilder(260); + StringBuilder stringBuilder3 = new StringBuilder(260); + NativeMethods._GetCurrentThemeName(stringBuilder, stringBuilder.Capacity, stringBuilder2, stringBuilder2.Capacity, stringBuilder3, stringBuilder3.Capacity).ThrowIfFailed(); + themeFileName = stringBuilder.ToString(); + color = stringBuilder2.ToString(); + size = stringBuilder3.ToString(); + } + + [DllImport("uxtheme.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool IsThemeActive(); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [Obsolete("Use SafeDC.GetDC instead.", true)] + public static void GetDC() + { + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll")] + public static extern int GetDeviceCaps(SafeDC hdc, DeviceCap nIndex); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "GetModuleFileName", SetLastError = true)] + private static extern int _GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static string GetModuleFileName(IntPtr hModule) + { + StringBuilder stringBuilder = new StringBuilder(260); + for (; ; ) + { + int num = NativeMethods._GetModuleFileName(hModule, stringBuilder, stringBuilder.Capacity); + if (num == 0) + { + HRESULT.ThrowLastError(); + } + if (num != stringBuilder.Capacity) + { + break; + } + stringBuilder.EnsureCapacity(stringBuilder.Capacity * 2); + } + return stringBuilder.ToString(); + } + + [DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "GetModuleHandleW", SetLastError = true)] + private static extern IntPtr _GetModuleHandle([MarshalAs(UnmanagedType.LPWStr)] string lpModuleName); + + public static IntPtr GetModuleHandle(string lpModuleName) + { + IntPtr intPtr = NativeMethods._GetModuleHandle(lpModuleName); + if (intPtr == IntPtr.Zero) + { + HRESULT.ThrowLastError(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "GetMonitorInfo", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _GetMonitorInfo(IntPtr hMonitor, [In][Out] MONITORINFO lpmi); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static MONITORINFO GetMonitorInfo(IntPtr hMonitor) + { + MONITORINFO monitorinfo = new MONITORINFO(); + if (!NativeMethods._GetMonitorInfo(hMonitor, monitorinfo)) + { + throw new Win32Exception(); + } + return monitorinfo; + } + + [DllImport("gdi32.dll", EntryPoint = "GetStockObject", SetLastError = true)] + private static extern IntPtr _GetStockObject(StockObject fnObject); + + public static IntPtr GetStockObject(StockObject fnObject) + { + return NativeMethods._GetStockObject(fnObject); + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll")] + public static extern IntPtr GetSystemMenu(IntPtr hWnd, [MarshalAs(UnmanagedType.Bool)] bool bRevert); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll")] + public static extern int GetSystemMetrics(SM nIndex); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr GetWindowLongPtr(IntPtr hwnd, GWL nIndex) + { + IntPtr intPtr = IntPtr.Zero; + if (8 == IntPtr.Size) + { + intPtr = NativeMethods.GetWindowLongPtr64(hwnd, nIndex); + } + else + { + intPtr = new IntPtr(NativeMethods.GetWindowLongPtr32(hwnd, nIndex)); + } + if (IntPtr.Zero == intPtr) + { + throw new Win32Exception(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("uxtheme.dll", PreserveSig = false)] + public static extern void SetWindowThemeAttribute([In] IntPtr hwnd, [In] WINDOWTHEMEATTRIBUTETYPE eAttribute, [In] ref WTA_OPTIONS pvAttribute, [In] uint cbAttribute); + + [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "GetWindowLong", SetLastError = true)] + private static extern int GetWindowLongPtr32(IntPtr hWnd, GWL nIndex); + + [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr", SetLastError = true)] + private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, GWL nIndex); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool GetWindowPlacement(IntPtr hwnd, WINDOWPLACEMENT lpwndpl); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static WINDOWPLACEMENT GetWindowPlacement(IntPtr hwnd) + { + WINDOWPLACEMENT windowplacement = new WINDOWPLACEMENT(); + if (NativeMethods.GetWindowPlacement(hwnd, windowplacement)) + { + return windowplacement; + } + throw new Win32Exception(); + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "GetWindowRect", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _GetWindowRect(IntPtr hWnd, out RECT lpRect); + + public static RECT GetWindowRect(IntPtr hwnd) + { + RECT result; + if (!NativeMethods._GetWindowRect(hwnd, out result)) + { + HRESULT.ThrowLastError(); + } + return result; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdiplus.dll")] + public static extern Status GdipCreateBitmapFromStream(IStream stream, out IntPtr bitmap); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdiplus.dll")] + public static extern Status GdipCreateHBITMAPFromBitmap(IntPtr bitmap, out IntPtr hbmReturn, int background); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdiplus.dll")] + public static extern Status GdipCreateHICONFromBitmap(IntPtr bitmap, out IntPtr hbmReturn); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdiplus.dll")] + public static extern Status GdipDisposeImage(IntPtr image); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdiplus.dll")] + public static extern Status GdipImageForceValidation(IntPtr image); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdiplus.dll")] + public static extern Status GdiplusStartup(out IntPtr token, StartupInput input, out StartupOutput output); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdiplus.dll")] + public static extern Status GdiplusShutdown(IntPtr token); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool IsWindowVisible(IntPtr hwnd); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("kernel32.dll", EntryPoint = "LocalFree", SetLastError = true)] + private static extern IntPtr _LocalFree(IntPtr hMem); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll")] + public static extern IntPtr MonitorFromWindow(IntPtr hwnd, uint dwFlags); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "PostMessage", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _PostMessage(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void PostMessage(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam) + { + if (!NativeMethods._PostMessage(hWnd, Msg, wParam, lParam)) + { + throw new Win32Exception(); + } + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "RegisterClassExW", SetLastError = true)] + private static extern short _RegisterClassEx([In] ref WNDCLASSEX lpwcx); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static short RegisterClassEx(ref WNDCLASSEX lpwcx) + { + short num = NativeMethods._RegisterClassEx(ref lpwcx); + if (num == 0) + { + HRESULT.ThrowLastError(); + } + return num; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "RegisterWindowMessage", SetLastError = true)] + private static extern uint _RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static WM RegisterWindowMessage(string lpString) + { + uint num = NativeMethods._RegisterWindowMessage(lpString); + if (num == 0u) + { + HRESULT.ThrowLastError(); + } + return (WM) num; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "SetActiveWindow", SetLastError = true)] + private static extern IntPtr _SetActiveWindow(IntPtr hWnd); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr SetActiveWindow(IntPtr hwnd) + { + Verify.IsNotDefault(hwnd, "hwnd"); + IntPtr intPtr = NativeMethods._SetActiveWindow(hwnd); + if (intPtr == IntPtr.Zero) + { + HRESULT.ThrowLastError(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr SetClassLongPtr(IntPtr hwnd, GCLP nIndex, IntPtr dwNewLong) + { + if (8 == IntPtr.Size) + { + return NativeMethods.SetClassLongPtr64(hwnd, nIndex, dwNewLong); + } + return new IntPtr(NativeMethods.SetClassLongPtr32(hwnd, nIndex, dwNewLong.ToInt32())); + } + + [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "SetClassLong", SetLastError = true)] + private static extern int SetClassLongPtr32(IntPtr hWnd, GCLP nIndex, int dwNewLong); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] + [DllImport("user32.dll", EntryPoint = "SetClassLongPtr", SetLastError = true)] + private static extern IntPtr SetClassLongPtr64(IntPtr hWnd, GCLP nIndex, IntPtr dwNewLong); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("kernel32.dll", SetLastError = true)] + public static extern ErrorModes SetErrorMode(ErrorModes newMode); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _SetProcessWorkingSetSize(IntPtr hProcess, IntPtr dwMinimiumWorkingSetSize, IntPtr dwMaximumWorkingSetSize); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SetProcessWorkingSetSize(IntPtr hProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize) + { + if (!NativeMethods._SetProcessWorkingSetSize(hProcess, new IntPtr(dwMinimumWorkingSetSize), new IntPtr(dwMaximumWorkingSetSize))) + { + throw new Win32Exception(); + } + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr SetWindowLongPtr(IntPtr hwnd, GWL nIndex, IntPtr dwNewLong) + { + if (8 == IntPtr.Size) + { + return NativeMethods.SetWindowLongPtr64(hwnd, nIndex, dwNewLong); + } + return new IntPtr(NativeMethods.SetWindowLongPtr32(hwnd, nIndex, dwNewLong.ToInt32())); + } + + [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "SetWindowLong", SetLastError = true)] + private static extern int SetWindowLongPtr32(IntPtr hWnd, GWL nIndex, int dwNewLong); + + [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr", SetLastError = true)] + private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, GWL nIndex, IntPtr dwNewLong); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "SetWindowRgn", SetLastError = true)] + private static extern int _SetWindowRgn(IntPtr hWnd, IntPtr hRgn, [MarshalAs(UnmanagedType.Bool)] bool bRedraw); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw) + { + if (NativeMethods._SetWindowRgn(hWnd, hRgn, bRedraw) == 0) + { + throw new Win32Exception(); + } + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "SetWindowPos", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP uFlags); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP uFlags) + { + return NativeMethods._SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags); + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("shell32.dll")] + public static extern Win32Error SHFileOperation(ref SHFILEOPSTRUCT lpFileOp); + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool ShowWindow(IntPtr hwnd, SW nCmdShow); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "SystemParametersInfoW", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _SystemParametersInfo_String(SPI uiAction, int uiParam, [MarshalAs(UnmanagedType.LPWStr)] string pvParam, SPIF fWinIni); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "SystemParametersInfoW", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _SystemParametersInfo_NONCLIENTMETRICS(SPI uiAction, int uiParam, [In][Out] ref NONCLIENTMETRICS pvParam, SPIF fWinIni); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "SystemParametersInfoW", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _SystemParametersInfo_HIGHCONTRAST(SPI uiAction, int uiParam, [In][Out] ref HIGHCONTRAST pvParam, SPIF fWinIni); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SystemParametersInfo(SPI uiAction, int uiParam, string pvParam, SPIF fWinIni) + { + if (!NativeMethods._SystemParametersInfo_String(uiAction, uiParam, pvParam, fWinIni)) + { + HRESULT.ThrowLastError(); + } + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static NONCLIENTMETRICS SystemParameterInfo_GetNONCLIENTMETRICS() + { + NONCLIENTMETRICS result = Utility.IsOSVistaOrNewer ? NONCLIENTMETRICS.VistaMetricsStruct : NONCLIENTMETRICS.XPMetricsStruct; + if (!NativeMethods._SystemParametersInfo_NONCLIENTMETRICS(SPI.GETNONCLIENTMETRICS, result.cbSize, ref result, SPIF.None)) + { + HRESULT.ThrowLastError(); + } + return result; + } + + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public static HIGHCONTRAST SystemParameterInfo_GetHIGHCONTRAST() + { + HIGHCONTRAST result = new HIGHCONTRAST + { + cbSize = Marshal.SizeOf(typeof(HIGHCONTRAST)) + }; + if (!NativeMethods._SystemParametersInfo_HIGHCONTRAST(SPI.GETHIGHCONTRAST, result.cbSize, ref result, SPIF.None)) + { + HRESULT.ThrowLastError(); + } + return result; + } + + [DllImport("user32.dll")] + public static extern uint TrackPopupMenuEx(IntPtr hmenu, uint fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", EntryPoint = "SelectObject", SetLastError = true)] + private static extern IntPtr _SelectObject(SafeDC hdc, IntPtr hgdiobj); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr SelectObject(SafeDC hdc, IntPtr hgdiobj) + { + IntPtr intPtr = NativeMethods._SelectObject(hdc, hgdiobj); + if (intPtr == IntPtr.Zero) + { + HRESULT.ThrowLastError(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", EntryPoint = "SelectObject", SetLastError = true)] + private static extern IntPtr _SelectObjectSafeHBITMAP(SafeDC hdc, SafeHBITMAP hgdiobj); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static IntPtr SelectObject(SafeDC hdc, SafeHBITMAP hgdiobj) + { + IntPtr intPtr = NativeMethods._SelectObjectSafeHBITMAP(hdc, hgdiobj); + if (intPtr == IntPtr.Zero) + { + HRESULT.ThrowLastError(); + } + return intPtr; + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", SetLastError = true)] + public static extern int SendInput(int nInputs, ref INPUT pInputs, int cbSize); + + [DllImport("user32.dll", SetLastError = true)] + public static extern IntPtr SendMessage(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "UnregisterClass", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _UnregisterClassAtom(IntPtr lpClassName, IntPtr hInstance); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "UnregisterClass", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _UnregisterClassName(string lpClassName, IntPtr hInstance); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void UnregisterClass(short atom, IntPtr hinstance) + { + if (!NativeMethods._UnregisterClassAtom(new IntPtr((int) atom), hinstance)) + { + HRESULT.ThrowLastError(); + } + } + + public static void UnregisterClass(string lpClassName, IntPtr hInstance) + { + if (!NativeMethods._UnregisterClassName(lpClassName, hInstance)) + { + HRESULT.ThrowLastError(); + } + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "UpdateLayeredWindow", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _UpdateLayeredWindow(IntPtr hwnd, SafeDC hdcDst, [In] ref POINT pptDst, [In] ref SIZE psize, SafeDC hdcSrc, [In] ref POINT pptSrc, int crKey, ref BLENDFUNCTION pblend, ULW dwFlags); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll", EntryPoint = "UpdateLayeredWindow", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool _UpdateLayeredWindowIntPtr(IntPtr hwnd, IntPtr hdcDst, IntPtr pptDst, IntPtr psize, IntPtr hdcSrc, IntPtr pptSrc, int crKey, ref BLENDFUNCTION pblend, ULW dwFlags); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void UpdateLayeredWindow(IntPtr hwnd, SafeDC hdcDst, ref POINT pptDst, ref SIZE psize, SafeDC hdcSrc, ref POINT pptSrc, int crKey, ref BLENDFUNCTION pblend, ULW dwFlags) + { + if (!NativeMethods._UpdateLayeredWindow(hwnd, hdcDst, ref pptDst, ref psize, hdcSrc, ref pptSrc, crKey, ref pblend, dwFlags)) + { + HRESULT.ThrowLastError(); + } + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void UpdateLayeredWindow(IntPtr hwnd, int crKey, ref BLENDFUNCTION pblend, ULW dwFlags) + { + if (!NativeMethods._UpdateLayeredWindowIntPtr(hwnd, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, crKey, ref pblend, dwFlags)) + { + HRESULT.ThrowLastError(); + } + } + + [DllImport("shell32.dll", EntryPoint = "SHAddToRecentDocs")] + private static extern void _SHAddToRecentDocs_String(SHARD uFlags, [MarshalAs(UnmanagedType.LPWStr)] string pv); + + [DllImport("shell32.dll", EntryPoint = "SHAddToRecentDocs")] + private static extern void _SHAddToRecentDocs_ShellLink(SHARD uFlags, IShellLinkW pv); + + public static void SHAddToRecentDocs(string path) + { + NativeMethods._SHAddToRecentDocs_String(SHARD.PATHW, path); + } + + public static void SHAddToRecentDocs(IShellLinkW shellLink) + { + NativeMethods._SHAddToRecentDocs_ShellLink(SHARD.LINK, shellLink); + } + + [DllImport("dwmapi.dll", EntryPoint = "DwmGetCompositionTimingInfo")] + private static extern HRESULT _DwmGetCompositionTimingInfo(IntPtr hwnd, ref DWM_TIMING_INFO pTimingInfo); + + public static DWM_TIMING_INFO? DwmGetCompositionTimingInfo(IntPtr hwnd) + { + if (!Utility.IsOSVistaOrNewer) + { + return null; + } + DWM_TIMING_INFO value = new DWM_TIMING_INFO + { + cbSize = Marshal.SizeOf(typeof(DWM_TIMING_INFO)) + }; + HRESULT hrLeft = NativeMethods._DwmGetCompositionTimingInfo(hwnd, ref value); + if (hrLeft == HRESULT.E_PENDING) + { + return null; + } + hrLeft.ThrowIfFailed(); + return new DWM_TIMING_INFO?(value); + } + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmInvalidateIconicBitmaps(IntPtr hwnd); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmSetIconicThumbnail(IntPtr hwnd, IntPtr hbmp, DWM_SIT dwSITFlags); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmSetIconicLivePreviewBitmap(IntPtr hwnd, IntPtr hbmp, RefPOINT pptClient, DWM_SIT dwSITFlags); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("shell32.dll", PreserveSig = false)] + public static extern void SHGetItemFromDataObject(IDataObject pdtobj, DOGIF dwFlags, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("shell32.dll", PreserveSig = false)] + public static extern HRESULT SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IBindCtx pbc, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("shell32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool Shell_NotifyIcon(NIM dwMessage, [In] NOTIFYICONDATA lpdata); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("shell32.dll", PreserveSig = false)] + public static extern void SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID); + + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("shell32.dll")] + public static extern HRESULT GetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] out string AppID); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDEXECOPT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDEXECOPT.cs index 4cf3a93d..ba8cc1a0 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDEXECOPT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDEXECOPT.cs @@ -2,11 +2,11 @@ namespace Standard { - internal enum OLECMDEXECOPT - { - DODEFAULT, - PROMPTUSER, - DONTPROMPTUSER, - SHOWHELP - } + internal enum OLECMDEXECOPT + { + DODEFAULT, + PROMPTUSER, + DONTPROMPTUSER, + SHOWHELP + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDF.cs index ea50ced3..efea165f 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDF.cs @@ -2,13 +2,13 @@ namespace Standard { - internal enum OLECMDF - { - SUPPORTED = 1, - ENABLED, - LATCHED = 4, - NINCHED = 8, - INVISIBLE = 16, - DEFHIDEONCTXTMENU = 32 - } + internal enum OLECMDF + { + SUPPORTED = 1, + ENABLED, + LATCHED = 4, + NINCHED = 8, + INVISIBLE = 16, + DEFHIDEONCTXTMENU = 32 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDID.cs b/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDID.cs index e23edebb..f62af704 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDID.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/OLECMDID.cs @@ -2,64 +2,64 @@ namespace Standard { - internal enum OLECMDID - { - OPEN = 1, - NEW, - SAVE, - SAVEAS, - SAVECOPYAS, - PRINT, - PRINTPREVIEW, - PAGESETUP, - SPELL, - PROPERTIES, - CUT, - COPY, - PASTE, - PASTESPECIAL, - UNDO, - REDO, - SELECTALL, - CLEARSELECTION, - ZOOM, - GETZOOMRANGE, - UPDATECOMMANDS, - REFRESH, - STOP, - HIDETOOLBARS, - SETPROGRESSMAX, - SETPROGRESSPOS, - SETPROGRESSTEXT, - SETTITLE, - SETDOWNLOADSTATE, - STOPDOWNLOAD, - ONTOOLBARACTIVATED, - FIND, - DELETE, - HTTPEQUIV, - HTTPEQUIV_DONE, - ENABLE_INTERACTION, - ONUNLOAD, - PROPERTYBAG2, - PREREFRESH, - SHOWSCRIPTERROR, - SHOWMESSAGE, - SHOWFIND, - SHOWPAGESETUP, - SHOWPRINT, - CLOSE, - ALLOWUILESSSAVEAS, - DONTDOWNLOADCSS, - UPDATEPAGESTATUS, - PRINT2, - PRINTPREVIEW2, - SETPRINTTEMPLATE, - GETPRINTTEMPLATE, - PAGEACTIONBLOCKED = 55, - PAGEACTIONUIQUERY, - FOCUSVIEWCONTROLS, - FOCUSVIEWCONTROLSQUERY, - SHOWPAGEACTIONMENU - } + internal enum OLECMDID + { + OPEN = 1, + NEW, + SAVE, + SAVEAS, + SAVECOPYAS, + PRINT, + PRINTPREVIEW, + PAGESETUP, + SPELL, + PROPERTIES, + CUT, + COPY, + PASTE, + PASTESPECIAL, + UNDO, + REDO, + SELECTALL, + CLEARSELECTION, + ZOOM, + GETZOOMRANGE, + UPDATECOMMANDS, + REFRESH, + STOP, + HIDETOOLBARS, + SETPROGRESSMAX, + SETPROGRESSPOS, + SETPROGRESSTEXT, + SETTITLE, + SETDOWNLOADSTATE, + STOPDOWNLOAD, + ONTOOLBARACTIVATED, + FIND, + DELETE, + HTTPEQUIV, + HTTPEQUIV_DONE, + ENABLE_INTERACTION, + ONUNLOAD, + PROPERTYBAG2, + PREREFRESH, + SHOWSCRIPTERROR, + SHOWMESSAGE, + SHOWFIND, + SHOWPAGESETUP, + SHOWPRINT, + CLOSE, + ALLOWUILESSSAVEAS, + DONTDOWNLOADCSS, + UPDATEPAGESTATUS, + PRINT2, + PRINTPREVIEW2, + SETPRINTTEMPLATE, + GETPRINTTEMPLATE, + PAGEACTIONBLOCKED = 55, + PAGEACTIONUIQUERY, + FOCUSVIEWCONTROLS, + FOCUSVIEWCONTROLSQUERY, + SHOWPAGEACTIONMENU + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/PKEY.cs b/src/Shared/Microsoft.Windows.Shell/Standard/PKEY.cs index 1c208591..3b61796b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/PKEY.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/PKEY.cs @@ -3,29 +3,29 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential, Pack = 4)] - internal struct PKEY - { - public PKEY(Guid fmtid, uint pid) - { - this._fmtid = fmtid; - this._pid = pid; - } + [StructLayout(LayoutKind.Sequential, Pack = 4)] + internal struct PKEY + { + public PKEY(Guid fmtid, uint pid) + { + this._fmtid = fmtid; + this._pid = pid; + } - private readonly Guid _fmtid; + private readonly Guid _fmtid; - private readonly uint _pid; + private readonly uint _pid; - public static readonly PKEY Title = new PKEY(new Guid("F29F85E0-4FF9-1068-AB91-08002B27B3D9"), 2u); + public static readonly PKEY Title = new PKEY(new Guid("F29F85E0-4FF9-1068-AB91-08002B27B3D9"), 2u); - public static readonly PKEY AppUserModel_ID = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 5u); + public static readonly PKEY AppUserModel_ID = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 5u); - public static readonly PKEY AppUserModel_IsDestListSeparator = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 6u); + public static readonly PKEY AppUserModel_IsDestListSeparator = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 6u); - public static readonly PKEY AppUserModel_RelaunchCommand = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 2u); + public static readonly PKEY AppUserModel_RelaunchCommand = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 2u); - public static readonly PKEY AppUserModel_RelaunchDisplayNameResource = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 4u); + public static readonly PKEY AppUserModel_RelaunchDisplayNameResource = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 4u); - public static readonly PKEY AppUserModel_RelaunchIconResource = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 3u); - } + public static readonly PKEY AppUserModel_RelaunchIconResource = new PKEY(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 3u); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/POINT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/POINT.cs index 84f2b439..d48e8117 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/POINT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/POINT.cs @@ -2,10 +2,10 @@ namespace Standard { - internal struct POINT - { - public int x; + internal struct POINT + { + public int x; - public int y; - } + public int y; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/PROPVARIANT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/PROPVARIANT.cs index 03e3a463..bef4f077 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/PROPVARIANT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/PROPVARIANT.cs @@ -4,91 +4,91 @@ using System.Runtime.InteropServices; namespace Standard { - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - [StructLayout(LayoutKind.Explicit)] - internal class PROPVARIANT : IDisposable - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public VarEnum VarType - { - get - { - return (VarEnum)this.vt; - } - } + [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] + [StructLayout(LayoutKind.Explicit)] + internal class PROPVARIANT : IDisposable + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public VarEnum VarType + { + get + { + return (VarEnum) this.vt; + } + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public string GetValue() - { - if (this.vt == 31) - { - return Marshal.PtrToStringUni(this.pointerVal); - } - return null; - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public string GetValue() + { + if (this.vt == 31) + { + return Marshal.PtrToStringUni(this.pointerVal); + } + return null; + } - public void SetValue(bool f) - { - this.Clear(); - this.vt = 11; - this.boolVal = (short)(f ? -1 : 0); - } + public void SetValue(bool f) + { + this.Clear(); + this.vt = 11; + this.boolVal = (short) (f ? -1 : 0); + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public void SetValue(string val) - { - this.Clear(); - this.vt = 31; - this.pointerVal = Marshal.StringToCoTaskMemUni(val); - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public void SetValue(string val) + { + this.Clear(); + this.vt = 31; + this.pointerVal = Marshal.StringToCoTaskMemUni(val); + } - public void Clear() - { - PROPVARIANT.NativeMethods.PropVariantClear(this); - } + public void Clear() + { + PROPVARIANT.NativeMethods.PropVariantClear(this); + } - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } - ~PROPVARIANT() - { - this.Dispose(false); - } + ~PROPVARIANT() + { + this.Dispose(false); + } - [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "disposing")] - private void Dispose(bool disposing) - { - this.Clear(); - } + [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "disposing")] + private void Dispose(bool disposing) + { + this.Clear(); + } - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [FieldOffset(0)] - private ushort vt; + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + [FieldOffset(0)] + private ushort vt; - [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [FieldOffset(8)] - private IntPtr pointerVal; + [SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + [FieldOffset(8)] + private IntPtr pointerVal; - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [FieldOffset(8)] - private byte byteVal; + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + [FieldOffset(8)] + private byte byteVal; - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [FieldOffset(8)] - private long longVal; + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + [FieldOffset(8)] + private long longVal; - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [FieldOffset(8)] - private short boolVal; + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + [FieldOffset(8)] + private short boolVal; - private static class NativeMethods - { - [DllImport("ole32.dll")] - internal static extern HRESULT PropVariantClear(PROPVARIANT pvar); - } - } + private static class NativeMethods + { + [DllImport("ole32.dll")] + internal static extern HRESULT PropVariantClear(PROPVARIANT pvar); + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/READYSTATE.cs b/src/Shared/Microsoft.Windows.Shell/Standard/READYSTATE.cs index e565a879..e88926fe 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/READYSTATE.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/READYSTATE.cs @@ -2,12 +2,12 @@ namespace Standard { - internal enum READYSTATE - { - UNINITIALIZED, - LOADING, - LOADED, - INTERACTIVE, - COMPLETE - } + internal enum READYSTATE + { + UNINITIALIZED, + LOADING, + LOADED, + INTERACTIVE, + COMPLETE + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/RECT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/RECT.cs index 4057f3bc..3009193e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/RECT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/RECT.cs @@ -3,150 +3,150 @@ using System.Diagnostics.CodeAnalysis; namespace Standard { - internal struct RECT - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public void Offset(int dx, int dy) - { - this._left += dx; - this._top += dy; - this._right += dx; - this._bottom += dy; - } + internal struct RECT + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public void Offset(int dx, int dy) + { + this._left += dx; + this._top += dy; + this._right += dx; + this._bottom += dy; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Left - { - get - { - return this._left; - } - set - { - this._left = value; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Left + { + get + { + return this._left; + } + set + { + this._left = value; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Right - { - get - { - return this._right; - } - set - { - this._right = value; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Right + { + get + { + return this._right; + } + set + { + this._right = value; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Top - { - get - { - return this._top; - } - set - { - this._top = value; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Top + { + get + { + return this._top; + } + set + { + this._top = value; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Bottom - { - get - { - return this._bottom; - } - set - { - this._bottom = value; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Bottom + { + get + { + return this._bottom; + } + set + { + this._bottom = value; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Width - { - get - { - return this._right - this._left; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Width + { + get + { + return this._right - this._left; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Height - { - get - { - return this._bottom - this._top; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Height + { + get + { + return this._bottom - this._top; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public POINT Position - { - get - { - return new POINT - { - x = this._left, - y = this._top - }; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public POINT Position + { + get + { + return new POINT + { + x = this._left, + y = this._top + }; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public SIZE Size - { - get - { - return new SIZE - { - cx = this.Width, - cy = this.Height - }; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public SIZE Size + { + get + { + return new SIZE + { + cx = this.Width, + cy = this.Height + }; + } + } - public static RECT Union(RECT rect1, RECT rect2) - { - return new RECT - { - Left = Math.Min(rect1.Left, rect2.Left), - Top = Math.Min(rect1.Top, rect2.Top), - Right = Math.Max(rect1.Right, rect2.Right), - Bottom = Math.Max(rect1.Bottom, rect2.Bottom) - }; - } + public static RECT Union(RECT rect1, RECT rect2) + { + return new RECT + { + Left = Math.Min(rect1.Left, rect2.Left), + Top = Math.Min(rect1.Top, rect2.Top), + Right = Math.Max(rect1.Right, rect2.Right), + Bottom = Math.Max(rect1.Bottom, rect2.Bottom) + }; + } - public override bool Equals(object obj) - { - bool result; - try - { - RECT rect = (RECT)obj; - result = (rect._bottom == this._bottom && rect._left == this._left && rect._right == this._right && rect._top == this._top); - } - catch (InvalidCastException) - { - result = false; - } - return result; - } + public override bool Equals(object obj) + { + bool result; + try + { + RECT rect = (RECT) obj; + result = (rect._bottom == this._bottom && rect._left == this._left && rect._right == this._right && rect._top == this._top); + } + catch (InvalidCastException) + { + result = false; + } + return result; + } - public override int GetHashCode() - { - return (this._left << 16 | Utility.LOWORD(this._right)) ^ (this._top << 16 | Utility.LOWORD(this._bottom)); - } + public override int GetHashCode() + { + return (this._left << 16 | Utility.LOWORD(this._right)) ^ (this._top << 16 | Utility.LOWORD(this._bottom)); + } - private int _left; + private int _left; - private int _top; + private int _top; - private int _right; + private int _right; - private int _bottom; - } + private int _bottom; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/RGBQUAD.cs b/src/Shared/Microsoft.Windows.Shell/Standard/RGBQUAD.cs index 083300ef..49ff877c 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/RGBQUAD.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/RGBQUAD.cs @@ -2,14 +2,14 @@ namespace Standard { - internal struct RGBQUAD - { - public byte rgbBlue; + internal struct RGBQUAD + { + public byte rgbBlue; - public byte rgbGreen; + public byte rgbGreen; - public byte rgbRed; + public byte rgbRed; - public byte rgbReserved; - } + public byte rgbReserved; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/RGN.cs b/src/Shared/Microsoft.Windows.Shell/Standard/RGN.cs index fc89b41d..b9bd3394 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/RGN.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/RGN.cs @@ -2,12 +2,12 @@ namespace Standard { - internal enum RGN - { - AND = 1, - OR, - XOR, - DIFF, - COPY - } + internal enum RGN + { + AND = 1, + OR, + XOR, + DIFF, + COPY + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/RefPOINT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/RefPOINT.cs index fe9182ff..db48cfa4 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/RefPOINT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/RefPOINT.cs @@ -4,12 +4,12 @@ using System.Runtime.InteropServices; namespace Standard { - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - [StructLayout(LayoutKind.Sequential)] - internal class RefPOINT - { - public int x; + [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] + [StructLayout(LayoutKind.Sequential)] + internal class RefPOINT + { + public int x; - public int y; - } + public int y; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/RefRECT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/RefRECT.cs index e4dc2530..e1a9bfe1 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/RefRECT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/RefRECT.cs @@ -4,104 +4,104 @@ using System.Runtime.InteropServices; namespace Standard { - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - [StructLayout(LayoutKind.Sequential)] - internal class RefRECT - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public RefRECT(int left, int top, int right, int bottom) - { - this._left = left; - this._top = top; - this._right = right; - this._bottom = bottom; - } + [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] + [StructLayout(LayoutKind.Sequential)] + internal class RefRECT + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public RefRECT(int left, int top, int right, int bottom) + { + this._left = left; + this._top = top; + this._right = right; + this._bottom = bottom; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Width - { - get - { - return this._right - this._left; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Width + { + get + { + return this._right - this._left; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Height - { - get - { - return this._bottom - this._top; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Height + { + get + { + return this._bottom - this._top; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Left - { - get - { - return this._left; - } - set - { - this._left = value; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Left + { + get + { + return this._left; + } + set + { + this._left = value; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Right - { - get - { - return this._right; - } - set - { - this._right = value; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Right + { + get + { + return this._right; + } + set + { + this._right = value; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Top - { - get - { - return this._top; - } - set - { - this._top = value; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Top + { + get + { + return this._top; + } + set + { + this._top = value; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public int Bottom - { - get - { - return this._bottom; - } - set - { - this._bottom = value; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public int Bottom + { + get + { + return this._bottom; + } + set + { + this._bottom = value; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public void Offset(int dx, int dy) - { - this._left += dx; - this._top += dy; - this._right += dx; - this._bottom += dy; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public void Offset(int dx, int dy) + { + this._left += dx; + this._top += dy; + this._right += dx; + this._bottom += dy; + } - private int _left; + private int _left; - private int _top; + private int _top; - private int _right; + private int _right; - private int _bottom; - } + private int _bottom; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SC.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SC.cs index f3d3e92e..e43b895b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SC.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SC.cs @@ -2,30 +2,30 @@ namespace Standard { - internal enum SC - { - SIZE = 61440, - MOVE = 61456, - MINIMIZE = 61472, - MAXIMIZE = 61488, - NEXTWINDOW = 61504, - PREVWINDOW = 61520, - CLOSE = 61536, - VSCROLL = 61552, - HSCROLL = 61568, - MOUSEMENU = 61584, - KEYMENU = 61696, - ARRANGE = 61712, - RESTORE = 61728, - TASKLIST = 61744, - SCREENSAVE = 61760, - HOTKEY = 61776, - DEFAULT = 61792, - MONITORPOWER = 61808, - CONTEXTHELP = 61824, - SEPARATOR = 61455, - F_ISSECURE = 1, - ICON = 61472, - ZOOM = 61488 - } + internal enum SC + { + SIZE = 61440, + MOVE = 61456, + MINIMIZE = 61472, + MAXIMIZE = 61488, + NEXTWINDOW = 61504, + PREVWINDOW = 61520, + CLOSE = 61536, + VSCROLL = 61552, + HSCROLL = 61568, + MOUSEMENU = 61584, + KEYMENU = 61696, + ARRANGE = 61712, + RESTORE = 61728, + TASKLIST = 61744, + SCREENSAVE = 61760, + HOTKEY = 61776, + DEFAULT = 61792, + MONITORPOWER = 61808, + CONTEXTHELP = 61824, + SEPARATOR = 61455, + F_ISSECURE = 1, + ICON = 61472, + ZOOM = 61488 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SFGAO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SFGAO.cs index 62b64c48..26e160d1 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SFGAO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SFGAO.cs @@ -2,42 +2,42 @@ namespace Standard { - [Flags] - internal enum SFGAO : uint - { - CANCOPY = 1u, - CANMOVE = 2u, - CANLINK = 4u, - STORAGE = 8u, - CANRENAME = 16u, - CANDELETE = 32u, - HASPROPSHEET = 64u, - DROPTARGET = 256u, - CAPABILITYMASK = 375u, - ENCRYPTED = 8192u, - ISSLOW = 16384u, - GHOSTED = 32768u, - LINK = 65536u, - SHARE = 131072u, - READONLY = 262144u, - HIDDEN = 524288u, - DISPLAYATTRMASK = 1032192u, - FILESYSANCESTOR = 268435456u, - FOLDER = 536870912u, - FILESYSTEM = 1073741824u, - HASSUBFOLDER = 2147483648u, - CONTENTSMASK = 2147483648u, - VALIDATE = 16777216u, - REMOVABLE = 33554432u, - COMPRESSED = 67108864u, - BROWSABLE = 134217728u, - NONENUMERATED = 1048576u, - NEWCONTENT = 2097152u, - CANMONIKER = 4194304u, - HASSTORAGE = 4194304u, - STREAM = 4194304u, - STORAGEANCESTOR = 8388608u, - STORAGECAPMASK = 1891958792u, - PKEYSFGAOMASK = 2164539392u - } + [Flags] + internal enum SFGAO : uint + { + CANCOPY = 1u, + CANMOVE = 2u, + CANLINK = 4u, + STORAGE = 8u, + CANRENAME = 16u, + CANDELETE = 32u, + HASPROPSHEET = 64u, + DROPTARGET = 256u, + CAPABILITYMASK = 375u, + ENCRYPTED = 8192u, + ISSLOW = 16384u, + GHOSTED = 32768u, + LINK = 65536u, + SHARE = 131072u, + READONLY = 262144u, + HIDDEN = 524288u, + DISPLAYATTRMASK = 1032192u, + FILESYSANCESTOR = 268435456u, + FOLDER = 536870912u, + FILESYSTEM = 1073741824u, + HASSUBFOLDER = 2147483648u, + CONTENTSMASK = 2147483648u, + VALIDATE = 16777216u, + REMOVABLE = 33554432u, + COMPRESSED = 67108864u, + BROWSABLE = 134217728u, + NONENUMERATED = 1048576u, + NEWCONTENT = 2097152u, + CANMONIKER = 4194304u, + HASSTORAGE = 4194304u, + STREAM = 4194304u, + STORAGEANCESTOR = 8388608u, + STORAGECAPMASK = 1891958792u, + PKEYSFGAOMASK = 2164539392u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SHARD.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SHARD.cs index 9b4d33b3..8556b1a5 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SHARD.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SHARD.cs @@ -2,14 +2,14 @@ namespace Standard { - internal enum SHARD - { - PIDL = 1, - PATHA, - PATHW, - APPIDINFO, - APPIDINFOIDLIST, - LINK, - APPIDINFOLINK - } + internal enum SHARD + { + PIDL = 1, + PATHA, + PATHW, + APPIDINFO, + APPIDINFOIDLIST, + LINK, + APPIDINFOLINK + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFO.cs index 559499b1..da8226ea 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFO.cs @@ -4,14 +4,14 @@ using System.Runtime.InteropServices; namespace Standard { - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - [StructLayout(LayoutKind.Sequential, Pack = 4)] - internal class SHARDAPPIDINFO - { - [MarshalAs(UnmanagedType.Interface)] - private object psi; + [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] + [StructLayout(LayoutKind.Sequential, Pack = 4)] + internal class SHARDAPPIDINFO + { + [MarshalAs(UnmanagedType.Interface)] + private object psi; - [MarshalAs(UnmanagedType.LPWStr)] - private string pszAppID; - } + [MarshalAs(UnmanagedType.LPWStr)] + private string pszAppID; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFOIDLIST.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFOIDLIST.cs index 014b4ae2..39fc2b05 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFOIDLIST.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFOIDLIST.cs @@ -4,13 +4,13 @@ using System.Runtime.InteropServices; namespace Standard { - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - [StructLayout(LayoutKind.Sequential, Pack = 4)] - internal class SHARDAPPIDINFOIDLIST - { - private IntPtr pidl; + [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] + [StructLayout(LayoutKind.Sequential, Pack = 4)] + internal class SHARDAPPIDINFOIDLIST + { + private IntPtr pidl; - [MarshalAs(UnmanagedType.LPWStr)] - private string pszAppID; - } + [MarshalAs(UnmanagedType.LPWStr)] + private string pszAppID; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFOLINK.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFOLINK.cs index 0ec2386a..e40ad2f2 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFOLINK.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SHARDAPPIDINFOLINK.cs @@ -4,13 +4,13 @@ using System.Runtime.InteropServices; namespace Standard { - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - [StructLayout(LayoutKind.Sequential, Pack = 4)] - internal class SHARDAPPIDINFOLINK - { - private IntPtr psl; + [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] + [StructLayout(LayoutKind.Sequential, Pack = 4)] + internal class SHARDAPPIDINFOLINK + { + private IntPtr psl; - [MarshalAs(UnmanagedType.LPWStr)] - private string pszAppID; - } + [MarshalAs(UnmanagedType.LPWStr)] + private string pszAppID; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SHCONTF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SHCONTF.cs index 73de0c95..05971ce1 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SHCONTF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SHCONTF.cs @@ -2,19 +2,19 @@ namespace Standard { - internal enum SHCONTF - { - CHECKING_FOR_CHILDREN = 16, - FOLDERS = 32, - NONFOLDERS = 64, - INCLUDEHIDDEN = 128, - INIT_ON_FIRST_NEXT = 256, - NETPRINTERSRCH = 512, - SHAREABLE = 1024, - STORAGE = 2048, - NAVIGATION_ENUM = 4096, - FASTITEMS = 8192, - FLATLIST = 16384, - ENABLE_ASYNC = 32768 - } + internal enum SHCONTF + { + CHECKING_FOR_CHILDREN = 16, + FOLDERS = 32, + NONFOLDERS = 64, + INCLUDEHIDDEN = 128, + INIT_ON_FIRST_NEXT = 256, + NETPRINTERSRCH = 512, + SHAREABLE = 1024, + STORAGE = 2048, + NAVIGATION_ENUM = 4096, + FASTITEMS = 8192, + FLATLIST = 16384, + ENABLE_ASYNC = 32768 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SHFILEOPSTRUCT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SHFILEOPSTRUCT.cs index 019f9166..5c79b575 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SHFILEOPSTRUCT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SHFILEOPSTRUCT.cs @@ -3,26 +3,26 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)] - internal struct SHFILEOPSTRUCT - { - public IntPtr hwnd; + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)] + internal struct SHFILEOPSTRUCT + { + public IntPtr hwnd; - [MarshalAs(UnmanagedType.U4)] - public FO wFunc; + [MarshalAs(UnmanagedType.U4)] + public FO wFunc; - public string pFrom; + public string pFrom; - public string pTo; + public string pTo; - [MarshalAs(UnmanagedType.U2)] - public FOF fFlags; + [MarshalAs(UnmanagedType.U2)] + public FOF fFlags; - [MarshalAs(UnmanagedType.Bool)] - public int fAnyOperationsAborted; + [MarshalAs(UnmanagedType.Bool)] + public int fAnyOperationsAborted; - public IntPtr hNameMappings; + public IntPtr hNameMappings; - public string lpszProgressTitle; - } + public string lpszProgressTitle; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SHGDN.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SHGDN.cs index 54cce536..e984fa7e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SHGDN.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SHGDN.cs @@ -2,13 +2,13 @@ namespace Standard { - [Flags] - internal enum SHGDN - { - SHGDN_NORMAL = 0, - SHGDN_INFOLDER = 1, - SHGDN_FOREDITING = 4096, - SHGDN_FORADDRESSBAR = 16384, - SHGDN_FORPARSING = 32768 - } + [Flags] + internal enum SHGDN + { + SHGDN_NORMAL = 0, + SHGDN_INFOLDER = 1, + SHGDN_FOREDITING = 4096, + SHGDN_FORADDRESSBAR = 16384, + SHGDN_FORPARSING = 32768 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SIATTRIBFLAGS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SIATTRIBFLAGS.cs index 822220b0..075d879b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SIATTRIBFLAGS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SIATTRIBFLAGS.cs @@ -2,10 +2,10 @@ namespace Standard { - internal enum SIATTRIBFLAGS - { - AND = 1, - OR, - APPCOMPAT - } + internal enum SIATTRIBFLAGS + { + AND = 1, + OR, + APPCOMPAT + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SICHINT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SICHINT.cs index 9d878b95..ff7ceeb2 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SICHINT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SICHINT.cs @@ -2,11 +2,11 @@ namespace Standard { - internal enum SICHINT : uint - { - DISPLAY, - ALLFIELDS = 2147483648u, - CANONICAL = 268435456u, - TEST_FILESYSPATH_IF_NOT_EQUAL = 536870912u - } + internal enum SICHINT : uint + { + DISPLAY, + ALLFIELDS = 2147483648u, + CANONICAL = 268435456u, + TEST_FILESYSPATH_IF_NOT_EQUAL = 536870912u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SIGDN.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SIGDN.cs index 076b8517..28d2455b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SIGDN.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SIGDN.cs @@ -2,16 +2,16 @@ namespace Standard { - internal enum SIGDN : uint - { - NORMALDISPLAY, - PARENTRELATIVEPARSING = 2147581953u, - DESKTOPABSOLUTEPARSING = 2147647488u, - PARENTRELATIVEEDITING = 2147684353u, - DESKTOPABSOLUTEEDITING = 2147794944u, - FILESYSPATH = 2147844096u, - URL = 2147909632u, - PARENTRELATIVEFORADDRESSBAR = 2147991553u, - PARENTRELATIVE = 2148007937u - } + internal enum SIGDN : uint + { + NORMALDISPLAY, + PARENTRELATIVEPARSING = 2147581953u, + DESKTOPABSOLUTEPARSING = 2147647488u, + PARENTRELATIVEEDITING = 2147684353u, + DESKTOPABSOLUTEEDITING = 2147794944u, + FILESYSPATH = 2147844096u, + URL = 2147909632u, + PARENTRELATIVEFORADDRESSBAR = 2147991553u, + PARENTRELATIVE = 2148007937u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SIZE.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SIZE.cs index 9ba7cbda..abf57f01 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SIZE.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SIZE.cs @@ -2,10 +2,10 @@ namespace Standard { - internal struct SIZE - { - public int cx; + internal struct SIZE + { + public int cx; - public int cy; - } + public int cy; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SLGP.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SLGP.cs index 59b24c3b..eeac2c2f 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SLGP.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SLGP.cs @@ -2,11 +2,11 @@ namespace Standard { - [Flags] - internal enum SLGP - { - SHORTPATH = 1, - UNCPRIORITY = 2, - RAWPATH = 4 - } + [Flags] + internal enum SLGP + { + SHORTPATH = 1, + UNCPRIORITY = 2, + RAWPATH = 4 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SM.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SM.cs index 50612bc8..f69b5dd8 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SM.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SM.cs @@ -2,91 +2,91 @@ namespace Standard { - internal enum SM - { - CXSCREEN, - CYSCREEN, - CXVSCROLL, - CYHSCROLL, - CYCAPTION, - CXBORDER, - CYBORDER, - CXFIXEDFRAME, - CYFIXEDFRAME, - CYVTHUMB, - CXHTHUMB, - CXICON, - CYICON, - CXCURSOR, - CYCURSOR, - CYMENU, - CXFULLSCREEN, - CYFULLSCREEN, - CYKANJIWINDOW, - MOUSEPRESENT, - CYVSCROLL, - CXHSCROLL, - DEBUG, - SWAPBUTTON, - CXMIN = 28, - CYMIN, - CXSIZE, - CYSIZE, - CXFRAME, - CXSIZEFRAME = 32, - CYFRAME, - CYSIZEFRAME = 33, - CXMINTRACK, - CYMINTRACK, - CXDOUBLECLK, - CYDOUBLECLK, - CXICONSPACING, - CYICONSPACING, - MENUDROPALIGNMENT, - PENWINDOWS, - DBCSENABLED, - CMOUSEBUTTONS, - SECURE, - CXEDGE, - CYEDGE, - CXMINSPACING, - CYMINSPACING, - CXSMICON, - CYSMICON, - CYSMCAPTION, - CXSMSIZE, - CYSMSIZE, - CXMENUSIZE, - CYMENUSIZE, - ARRANGE, - CXMINIMIZED, - CYMINIMIZED, - CXMAXTRACK, - CYMAXTRACK, - CXMAXIMIZED, - CYMAXIMIZED, - NETWORK, - CLEANBOOT = 67, - CXDRAG, - CYDRAG, - SHOWSOUNDS, - CXMENUCHECK, - CYMENUCHECK, - SLOWMACHINE, - MIDEASTENABLED, - MOUSEWHEELPRESENT, - XVIRTUALSCREEN, - YVIRTUALSCREEN, - CXVIRTUALSCREEN, - CYVIRTUALSCREEN, - CMONITORS, - SAMEDISPLAYFORMAT, - IMMENABLED, - CXFOCUSBORDER, - CYFOCUSBORDER, - TABLETPC = 86, - MEDIACENTER, - REMOTESESSION = 4096, - REMOTECONTROL = 8193 - } + internal enum SM + { + CXSCREEN, + CYSCREEN, + CXVSCROLL, + CYHSCROLL, + CYCAPTION, + CXBORDER, + CYBORDER, + CXFIXEDFRAME, + CYFIXEDFRAME, + CYVTHUMB, + CXHTHUMB, + CXICON, + CYICON, + CXCURSOR, + CYCURSOR, + CYMENU, + CXFULLSCREEN, + CYFULLSCREEN, + CYKANJIWINDOW, + MOUSEPRESENT, + CYVSCROLL, + CXHSCROLL, + DEBUG, + SWAPBUTTON, + CXMIN = 28, + CYMIN, + CXSIZE, + CYSIZE, + CXFRAME, + CXSIZEFRAME = 32, + CYFRAME, + CYSIZEFRAME = 33, + CXMINTRACK, + CYMINTRACK, + CXDOUBLECLK, + CYDOUBLECLK, + CXICONSPACING, + CYICONSPACING, + MENUDROPALIGNMENT, + PENWINDOWS, + DBCSENABLED, + CMOUSEBUTTONS, + SECURE, + CXEDGE, + CYEDGE, + CXMINSPACING, + CYMINSPACING, + CXSMICON, + CYSMICON, + CYSMCAPTION, + CXSMSIZE, + CYSMSIZE, + CXMENUSIZE, + CYMENUSIZE, + ARRANGE, + CXMINIMIZED, + CYMINIMIZED, + CXMAXTRACK, + CYMAXTRACK, + CXMAXIMIZED, + CYMAXIMIZED, + NETWORK, + CLEANBOOT = 67, + CXDRAG, + CYDRAG, + SHOWSOUNDS, + CXMENUCHECK, + CYMENUCHECK, + SLOWMACHINE, + MIDEASTENABLED, + MOUSEWHEELPRESENT, + XVIRTUALSCREEN, + YVIRTUALSCREEN, + CXVIRTUALSCREEN, + CYVIRTUALSCREEN, + CMONITORS, + SAMEDISPLAYFORMAT, + IMMENABLED, + CXFOCUSBORDER, + CYFOCUSBORDER, + TABLETPC = 86, + MEDIACENTER, + REMOTESESSION = 4096, + REMOTECONTROL = 8193 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SPI.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SPI.cs index e500d147..1a6f828b 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SPI.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SPI.cs @@ -2,222 +2,222 @@ namespace Standard { - internal enum SPI - { - GETBEEP = 1, - SETBEEP, - GETMOUSE, - SETMOUSE, - GETBORDER, - SETBORDER, - GETKEYBOARDSPEED = 10, - SETKEYBOARDSPEED, - LANGDRIVER, - ICONHORIZONTALSPACING, - GETSCREENSAVETIMEOUT, - SETSCREENSAVETIMEOUT, - GETSCREENSAVEACTIVE, - SETSCREENSAVEACTIVE, - GETGRIDGRANULARITY, - SETGRIDGRANULARITY, - SETDESKWALLPAPER, - SETDESKPATTERN, - GETKEYBOARDDELAY, - SETKEYBOARDDELAY, - ICONVERTICALSPACING, - GETICONTITLEWRAP, - SETICONTITLEWRAP, - GETMENUDROPALIGNMENT, - SETMENUDROPALIGNMENT, - SETDOUBLECLKWIDTH, - SETDOUBLECLKHEIGHT, - GETICONTITLELOGFONT, - SETDOUBLECLICKTIME, - SETMOUSEBUTTONSWAP, - SETICONTITLELOGFONT, - GETFASTTASKSWITCH, - SETFASTTASKSWITCH, - SETDRAGFULLWINDOWS, - GETDRAGFULLWINDOWS, - GETNONCLIENTMETRICS = 41, - SETNONCLIENTMETRICS, - GETMINIMIZEDMETRICS, - SETMINIMIZEDMETRICS, - GETICONMETRICS, - SETICONMETRICS, - SETWORKAREA, - GETWORKAREA, - SETPENWINDOWS, - GETHIGHCONTRAST = 66, - SETHIGHCONTRAST, - GETKEYBOARDPREF, - SETKEYBOARDPREF, - GETSCREENREADER, - SETSCREENREADER, - GETANIMATION, - SETANIMATION, - GETFONTSMOOTHING, - SETFONTSMOOTHING, - SETDRAGWIDTH, - SETDRAGHEIGHT, - SETHANDHELD, - GETLOWPOWERTIMEOUT, - GETPOWEROFFTIMEOUT, - SETLOWPOWERTIMEOUT, - SETPOWEROFFTIMEOUT, - GETLOWPOWERACTIVE, - GETPOWEROFFACTIVE, - SETLOWPOWERACTIVE, - SETPOWEROFFACTIVE, - SETCURSORS, - SETICONS, - GETDEFAULTINPUTLANG, - SETDEFAULTINPUTLANG, - SETLANGTOGGLE, - GETWINDOWSEXTENSION, - SETMOUSETRAILS, - GETMOUSETRAILS, - SETSCREENSAVERRUNNING = 97, - SCREENSAVERRUNNING = 97, - GETFILTERKEYS = 50, - SETFILTERKEYS, - GETTOGGLEKEYS, - SETTOGGLEKEYS, - GETMOUSEKEYS, - SETMOUSEKEYS, - GETSHOWSOUNDS, - SETSHOWSOUNDS, - GETSTICKYKEYS, - SETSTICKYKEYS, - GETACCESSTIMEOUT, - SETACCESSTIMEOUT, - GETSERIALKEYS, - SETSERIALKEYS, - GETSOUNDSENTRY, - SETSOUNDSENTRY, - GETSNAPTODEFBUTTON = 95, - SETSNAPTODEFBUTTON, - GETMOUSEHOVERWIDTH = 98, - SETMOUSEHOVERWIDTH, - GETMOUSEHOVERHEIGHT, - SETMOUSEHOVERHEIGHT, - GETMOUSEHOVERTIME, - SETMOUSEHOVERTIME, - GETWHEELSCROLLLINES, - SETWHEELSCROLLLINES, - GETMENUSHOWDELAY, - SETMENUSHOWDELAY, - GETWHEELSCROLLCHARS, - SETWHEELSCROLLCHARS, - GETSHOWIMEUI, - SETSHOWIMEUI, - GETMOUSESPEED, - SETMOUSESPEED, - GETSCREENSAVERRUNNING, - GETDESKWALLPAPER, - GETAUDIODESCRIPTION, - SETAUDIODESCRIPTION, - GETSCREENSAVESECURE, - SETSCREENSAVESECURE, - GETHUNGAPPTIMEOUT, - SETHUNGAPPTIMEOUT, - GETWAITTOKILLTIMEOUT, - SETWAITTOKILLTIMEOUT, - GETWAITTOKILLSERVICETIMEOUT, - SETWAITTOKILLSERVICETIMEOUT, - GETMOUSEDOCKTHRESHOLD, - SETMOUSEDOCKTHRESHOLD, - GETPENDOCKTHRESHOLD, - SETPENDOCKTHRESHOLD, - GETWINARRANGING, - SETWINARRANGING, - GETMOUSEDRAGOUTTHRESHOLD, - SETMOUSEDRAGOUTTHRESHOLD, - GETPENDRAGOUTTHRESHOLD, - SETPENDRAGOUTTHRESHOLD, - GETMOUSESIDEMOVETHRESHOLD, - SETMOUSESIDEMOVETHRESHOLD, - GETPENSIDEMOVETHRESHOLD, - SETPENSIDEMOVETHRESHOLD, - GETDRAGFROMMAXIMIZE, - SETDRAGFROMMAXIMIZE, - GETSNAPSIZING, - SETSNAPSIZING, - GETDOCKMOVING, - SETDOCKMOVING, - GETACTIVEWINDOWTRACKING = 4096, - SETACTIVEWINDOWTRACKING, - GETMENUANIMATION, - SETMENUANIMATION, - GETCOMBOBOXANIMATION, - SETCOMBOBOXANIMATION, - GETLISTBOXSMOOTHSCROLLING, - SETLISTBOXSMOOTHSCROLLING, - GETGRADIENTCAPTIONS, - SETGRADIENTCAPTIONS, - GETKEYBOARDCUES, - SETKEYBOARDCUES, - GETMENUUNDERLINES = 4106, - SETMENUUNDERLINES, - GETACTIVEWNDTRKZORDER, - SETACTIVEWNDTRKZORDER, - GETHOTTRACKING, - SETHOTTRACKING, - GETMENUFADE = 4114, - SETMENUFADE, - GETSELECTIONFADE, - SETSELECTIONFADE, - GETTOOLTIPANIMATION, - SETTOOLTIPANIMATION, - GETTOOLTIPFADE, - SETTOOLTIPFADE, - GETCURSORSHADOW, - SETCURSORSHADOW, - GETMOUSESONAR, - SETMOUSESONAR, - GETMOUSECLICKLOCK, - SETMOUSECLICKLOCK, - GETMOUSEVANISH, - SETMOUSEVANISH, - GETFLATMENU, - SETFLATMENU, - GETDROPSHADOW, - SETDROPSHADOW, - GETBLOCKSENDINPUTRESETS, - SETBLOCKSENDINPUTRESETS, - GETUIEFFECTS = 4158, - SETUIEFFECTS, - GETDISABLEOVERLAPPEDCONTENT, - SETDISABLEOVERLAPPEDCONTENT, - GETCLIENTAREAANIMATION, - SETCLIENTAREAANIMATION, - GETCLEARTYPE = 4168, - SETCLEARTYPE, - GETSPEECHRECOGNITION, - SETSPEECHRECOGNITION, - GETFOREGROUNDLOCKTIMEOUT = 8192, - SETFOREGROUNDLOCKTIMEOUT, - GETACTIVEWNDTRKTIMEOUT, - SETACTIVEWNDTRKTIMEOUT, - GETFOREGROUNDFLASHCOUNT, - SETFOREGROUNDFLASHCOUNT, - GETCARETWIDTH, - SETCARETWIDTH, - GETMOUSECLICKLOCKTIME, - SETMOUSECLICKLOCKTIME, - GETFONTSMOOTHINGTYPE, - SETFONTSMOOTHINGTYPE, - GETFONTSMOOTHINGCONTRAST, - SETFONTSMOOTHINGCONTRAST, - GETFOCUSBORDERWIDTH, - SETFOCUSBORDERWIDTH, - GETFOCUSBORDERHEIGHT, - SETFOCUSBORDERHEIGHT, - GETFONTSMOOTHINGORIENTATION, - SETFONTSMOOTHINGORIENTATION, - GETMINIMUMHITRADIUS, - SETMINIMUMHITRADIUS, - GETMESSAGEDURATION, - SETMESSAGEDURATION - } + internal enum SPI + { + GETBEEP = 1, + SETBEEP, + GETMOUSE, + SETMOUSE, + GETBORDER, + SETBORDER, + GETKEYBOARDSPEED = 10, + SETKEYBOARDSPEED, + LANGDRIVER, + ICONHORIZONTALSPACING, + GETSCREENSAVETIMEOUT, + SETSCREENSAVETIMEOUT, + GETSCREENSAVEACTIVE, + SETSCREENSAVEACTIVE, + GETGRIDGRANULARITY, + SETGRIDGRANULARITY, + SETDESKWALLPAPER, + SETDESKPATTERN, + GETKEYBOARDDELAY, + SETKEYBOARDDELAY, + ICONVERTICALSPACING, + GETICONTITLEWRAP, + SETICONTITLEWRAP, + GETMENUDROPALIGNMENT, + SETMENUDROPALIGNMENT, + SETDOUBLECLKWIDTH, + SETDOUBLECLKHEIGHT, + GETICONTITLELOGFONT, + SETDOUBLECLICKTIME, + SETMOUSEBUTTONSWAP, + SETICONTITLELOGFONT, + GETFASTTASKSWITCH, + SETFASTTASKSWITCH, + SETDRAGFULLWINDOWS, + GETDRAGFULLWINDOWS, + GETNONCLIENTMETRICS = 41, + SETNONCLIENTMETRICS, + GETMINIMIZEDMETRICS, + SETMINIMIZEDMETRICS, + GETICONMETRICS, + SETICONMETRICS, + SETWORKAREA, + GETWORKAREA, + SETPENWINDOWS, + GETHIGHCONTRAST = 66, + SETHIGHCONTRAST, + GETKEYBOARDPREF, + SETKEYBOARDPREF, + GETSCREENREADER, + SETSCREENREADER, + GETANIMATION, + SETANIMATION, + GETFONTSMOOTHING, + SETFONTSMOOTHING, + SETDRAGWIDTH, + SETDRAGHEIGHT, + SETHANDHELD, + GETLOWPOWERTIMEOUT, + GETPOWEROFFTIMEOUT, + SETLOWPOWERTIMEOUT, + SETPOWEROFFTIMEOUT, + GETLOWPOWERACTIVE, + GETPOWEROFFACTIVE, + SETLOWPOWERACTIVE, + SETPOWEROFFACTIVE, + SETCURSORS, + SETICONS, + GETDEFAULTINPUTLANG, + SETDEFAULTINPUTLANG, + SETLANGTOGGLE, + GETWINDOWSEXTENSION, + SETMOUSETRAILS, + GETMOUSETRAILS, + SETSCREENSAVERRUNNING = 97, + SCREENSAVERRUNNING = 97, + GETFILTERKEYS = 50, + SETFILTERKEYS, + GETTOGGLEKEYS, + SETTOGGLEKEYS, + GETMOUSEKEYS, + SETMOUSEKEYS, + GETSHOWSOUNDS, + SETSHOWSOUNDS, + GETSTICKYKEYS, + SETSTICKYKEYS, + GETACCESSTIMEOUT, + SETACCESSTIMEOUT, + GETSERIALKEYS, + SETSERIALKEYS, + GETSOUNDSENTRY, + SETSOUNDSENTRY, + GETSNAPTODEFBUTTON = 95, + SETSNAPTODEFBUTTON, + GETMOUSEHOVERWIDTH = 98, + SETMOUSEHOVERWIDTH, + GETMOUSEHOVERHEIGHT, + SETMOUSEHOVERHEIGHT, + GETMOUSEHOVERTIME, + SETMOUSEHOVERTIME, + GETWHEELSCROLLLINES, + SETWHEELSCROLLLINES, + GETMENUSHOWDELAY, + SETMENUSHOWDELAY, + GETWHEELSCROLLCHARS, + SETWHEELSCROLLCHARS, + GETSHOWIMEUI, + SETSHOWIMEUI, + GETMOUSESPEED, + SETMOUSESPEED, + GETSCREENSAVERRUNNING, + GETDESKWALLPAPER, + GETAUDIODESCRIPTION, + SETAUDIODESCRIPTION, + GETSCREENSAVESECURE, + SETSCREENSAVESECURE, + GETHUNGAPPTIMEOUT, + SETHUNGAPPTIMEOUT, + GETWAITTOKILLTIMEOUT, + SETWAITTOKILLTIMEOUT, + GETWAITTOKILLSERVICETIMEOUT, + SETWAITTOKILLSERVICETIMEOUT, + GETMOUSEDOCKTHRESHOLD, + SETMOUSEDOCKTHRESHOLD, + GETPENDOCKTHRESHOLD, + SETPENDOCKTHRESHOLD, + GETWINARRANGING, + SETWINARRANGING, + GETMOUSEDRAGOUTTHRESHOLD, + SETMOUSEDRAGOUTTHRESHOLD, + GETPENDRAGOUTTHRESHOLD, + SETPENDRAGOUTTHRESHOLD, + GETMOUSESIDEMOVETHRESHOLD, + SETMOUSESIDEMOVETHRESHOLD, + GETPENSIDEMOVETHRESHOLD, + SETPENSIDEMOVETHRESHOLD, + GETDRAGFROMMAXIMIZE, + SETDRAGFROMMAXIMIZE, + GETSNAPSIZING, + SETSNAPSIZING, + GETDOCKMOVING, + SETDOCKMOVING, + GETACTIVEWINDOWTRACKING = 4096, + SETACTIVEWINDOWTRACKING, + GETMENUANIMATION, + SETMENUANIMATION, + GETCOMBOBOXANIMATION, + SETCOMBOBOXANIMATION, + GETLISTBOXSMOOTHSCROLLING, + SETLISTBOXSMOOTHSCROLLING, + GETGRADIENTCAPTIONS, + SETGRADIENTCAPTIONS, + GETKEYBOARDCUES, + SETKEYBOARDCUES, + GETMENUUNDERLINES = 4106, + SETMENUUNDERLINES, + GETACTIVEWNDTRKZORDER, + SETACTIVEWNDTRKZORDER, + GETHOTTRACKING, + SETHOTTRACKING, + GETMENUFADE = 4114, + SETMENUFADE, + GETSELECTIONFADE, + SETSELECTIONFADE, + GETTOOLTIPANIMATION, + SETTOOLTIPANIMATION, + GETTOOLTIPFADE, + SETTOOLTIPFADE, + GETCURSORSHADOW, + SETCURSORSHADOW, + GETMOUSESONAR, + SETMOUSESONAR, + GETMOUSECLICKLOCK, + SETMOUSECLICKLOCK, + GETMOUSEVANISH, + SETMOUSEVANISH, + GETFLATMENU, + SETFLATMENU, + GETDROPSHADOW, + SETDROPSHADOW, + GETBLOCKSENDINPUTRESETS, + SETBLOCKSENDINPUTRESETS, + GETUIEFFECTS = 4158, + SETUIEFFECTS, + GETDISABLEOVERLAPPEDCONTENT, + SETDISABLEOVERLAPPEDCONTENT, + GETCLIENTAREAANIMATION, + SETCLIENTAREAANIMATION, + GETCLEARTYPE = 4168, + SETCLEARTYPE, + GETSPEECHRECOGNITION, + SETSPEECHRECOGNITION, + GETFOREGROUNDLOCKTIMEOUT = 8192, + SETFOREGROUNDLOCKTIMEOUT, + GETACTIVEWNDTRKTIMEOUT, + SETACTIVEWNDTRKTIMEOUT, + GETFOREGROUNDFLASHCOUNT, + SETFOREGROUNDFLASHCOUNT, + GETCARETWIDTH, + SETCARETWIDTH, + GETMOUSECLICKLOCKTIME, + SETMOUSECLICKLOCKTIME, + GETFONTSMOOTHINGTYPE, + SETFONTSMOOTHINGTYPE, + GETFONTSMOOTHINGCONTRAST, + SETFONTSMOOTHINGCONTRAST, + GETFOCUSBORDERWIDTH, + SETFOCUSBORDERWIDTH, + GETFOCUSBORDERHEIGHT, + SETFOCUSBORDERHEIGHT, + GETFONTSMOOTHINGORIENTATION, + SETFONTSMOOTHINGORIENTATION, + GETMINIMUMHITRADIUS, + SETMINIMUMHITRADIUS, + GETMESSAGEDURATION, + SETMESSAGEDURATION + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SPIF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SPIF.cs index 72a28d09..8727f3ad 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SPIF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SPIF.cs @@ -2,12 +2,12 @@ namespace Standard { - [Flags] - internal enum SPIF - { - None = 0, - UPDATEINIFILE = 1, - SENDCHANGE = 2, - SENDWININICHANGE = 2 - } + [Flags] + internal enum SPIF + { + None = 0, + UPDATEINIFILE = 1, + SENDCHANGE = 2, + SENDWININICHANGE = 2 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/STATE_SYSTEM.cs b/src/Shared/Microsoft.Windows.Shell/Standard/STATE_SYSTEM.cs index 4b725df9..678ad5d6 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/STATE_SYSTEM.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/STATE_SYSTEM.cs @@ -2,40 +2,40 @@ namespace Standard { - [Flags] - internal enum STATE_SYSTEM - { - UNAVAILABLE = 1, - SELECTED = 2, - FOCUSED = 4, - PRESSED = 8, - CHECKED = 16, - MIXED = 32, - INDETERMINATE = 32, - READONLY = 64, - HOTTRACKED = 128, - DEFAULT = 256, - EXPANDED = 512, - COLLAPSED = 1024, - BUSY = 2048, - FLOATING = 4096, - MARQUEED = 8192, - ANIMATED = 16384, - INVISIBLE = 32768, - OFFSCREEN = 65536, - SIZEABLE = 131072, - MOVEABLE = 262144, - SELFVOICING = 524288, - FOCUSABLE = 1048576, - SELECTABLE = 2097152, - LINKED = 4194304, - TRAVERSED = 8388608, - MULTISELECTABLE = 16777216, - EXTSELECTABLE = 33554432, - ALERT_LOW = 67108864, - ALERT_MEDIUM = 134217728, - ALERT_HIGH = 268435456, - PROTECTED = 536870912, - VALID = 1073741823 - } + [Flags] + internal enum STATE_SYSTEM + { + UNAVAILABLE = 1, + SELECTED = 2, + FOCUSED = 4, + PRESSED = 8, + CHECKED = 16, + MIXED = 32, + INDETERMINATE = 32, + READONLY = 64, + HOTTRACKED = 128, + DEFAULT = 256, + EXPANDED = 512, + COLLAPSED = 1024, + BUSY = 2048, + FLOATING = 4096, + MARQUEED = 8192, + ANIMATED = 16384, + INVISIBLE = 32768, + OFFSCREEN = 65536, + SIZEABLE = 131072, + MOVEABLE = 262144, + SELFVOICING = 524288, + FOCUSABLE = 1048576, + SELECTABLE = 2097152, + LINKED = 4194304, + TRAVERSED = 8388608, + MULTISELECTABLE = 16777216, + EXTSELECTABLE = 33554432, + ALERT_LOW = 67108864, + ALERT_MEDIUM = 134217728, + ALERT_HIGH = 268435456, + PROTECTED = 536870912, + VALID = 1073741823 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/STPF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/STPF.cs index 2e6b438d..cfb9ff36 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/STPF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/STPF.cs @@ -2,13 +2,13 @@ namespace Standard { - [Flags] - internal enum STPF - { - NONE = 0, - USEAPPTHUMBNAILALWAYS = 1, - USEAPPTHUMBNAILWHENACTIVE = 2, - USEAPPPEEKALWAYS = 4, - USEAPPPEEKWHENACTIVE = 8 - } + [Flags] + internal enum STPF + { + NONE = 0, + USEAPPTHUMBNAILALWAYS = 1, + USEAPPTHUMBNAILWHENACTIVE = 2, + USEAPPPEEKALWAYS = 4, + USEAPPPEEKWHENACTIVE = 8 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/STR_GPS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/STR_GPS.cs index 865ba4f2..f25c6ebd 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/STR_GPS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/STR_GPS.cs @@ -2,18 +2,18 @@ namespace Standard { - internal static class STR_GPS - { - public const string HANDLERPROPERTIESONLY = "GPS_HANDLERPROPERTIESONLY"; + internal static class STR_GPS + { + public const string HANDLERPROPERTIESONLY = "GPS_HANDLERPROPERTIESONLY"; - public const string FASTPROPERTIESONLY = "GPS_FASTPROPERTIESONLY"; + public const string FASTPROPERTIESONLY = "GPS_FASTPROPERTIESONLY"; - public const string OPENSLOWITEM = "GPS_OPENSLOWITEM"; + public const string OPENSLOWITEM = "GPS_OPENSLOWITEM"; - public const string DELAYCREATION = "GPS_DELAYCREATION"; + public const string DELAYCREATION = "GPS_DELAYCREATION"; - public const string BESTEFFORT = "GPS_BESTEFFORT"; + public const string BESTEFFORT = "GPS_BESTEFFORT"; - public const string NO_OPLOCK = "GPS_NO_OPLOCK"; - } + public const string NO_OPLOCK = "GPS_NO_OPLOCK"; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SW.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SW.cs index 96a6662e..034e7fc9 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SW.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SW.cs @@ -2,21 +2,21 @@ namespace Standard { - internal enum SW - { - HIDE, - SHOWNORMAL, - NORMAL = 1, - SHOWMINIMIZED, - SHOWMAXIMIZED, - MAXIMIZE = 3, - SHOWNOACTIVATE, - SHOW, - MINIMIZE, - SHOWMINNOACTIVE, - SHOWNA, - RESTORE, - SHOWDEFAULT, - FORCEMINIMIZE - } + internal enum SW + { + HIDE, + SHOWNORMAL, + NORMAL = 1, + SHOWMINIMIZED, + SHOWMAXIMIZED, + MAXIMIZE = 3, + SHOWNOACTIVATE, + SHOW, + MINIMIZE, + SHOWMINNOACTIVE, + SHOWNA, + RESTORE, + SHOWDEFAULT, + FORCEMINIMIZE + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SWP.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SWP.cs index 02079a58..796e9c56 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SWP.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SWP.cs @@ -2,23 +2,23 @@ namespace Standard { - [Flags] - internal enum SWP - { - ASYNCWINDOWPOS = 16384, - DEFERERASE = 8192, - DRAWFRAME = 32, - FRAMECHANGED = 32, - HIDEWINDOW = 128, - NOACTIVATE = 16, - NOCOPYBITS = 256, - NOMOVE = 2, - NOOWNERZORDER = 512, - NOREDRAW = 8, - NOREPOSITION = 512, - NOSENDCHANGING = 1024, - NOSIZE = 1, - NOZORDER = 4, - SHOWWINDOW = 64 - } + [Flags] + internal enum SWP + { + ASYNCWINDOWPOS = 16384, + DEFERERASE = 8192, + DRAWFRAME = 32, + FRAMECHANGED = 32, + HIDEWINDOW = 128, + NOACTIVATE = 16, + NOCOPYBITS = 256, + NOMOVE = 2, + NOOWNERZORDER = 512, + NOREDRAW = 8, + NOREPOSITION = 512, + NOSENDCHANGING = 1024, + NOSIZE = 1, + NOZORDER = 4, + SHOWWINDOW = 64 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SafeConnectionPointCookie.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SafeConnectionPointCookie.cs index d8c94527..3331e4a3 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SafeConnectionPointCookie.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SafeConnectionPointCookie.cs @@ -6,71 +6,71 @@ using Microsoft.Win32.SafeHandles; namespace Standard { - internal sealed class SafeConnectionPointCookie : SafeHandleZeroOrMinusOneIsInvalid - { - [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "IConnectionPoint")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public SafeConnectionPointCookie(IConnectionPointContainer target, object sink, Guid eventId) : base(true) - { - Verify.IsNotNull(target, "target"); - Verify.IsNotNull(sink, "sink"); - Verify.IsNotDefault(eventId, "eventId"); - this.handle = IntPtr.Zero; - IConnectionPoint connectionPoint = null; - try - { - target.FindConnectionPoint(ref eventId, out connectionPoint); - int num; - connectionPoint.Advise(sink, out num); - if (num == 0) - { - throw new InvalidOperationException("IConnectionPoint::Advise returned an invalid cookie."); - } - this.handle = new IntPtr(num); - this._cp = connectionPoint; - connectionPoint = null; - } - finally - { - Utility.SafeRelease(ref connectionPoint); - } - } + internal sealed class SafeConnectionPointCookie : SafeHandleZeroOrMinusOneIsInvalid + { + [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "IConnectionPoint")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public SafeConnectionPointCookie(IConnectionPointContainer target, object sink, Guid eventId) : base(true) + { + Verify.IsNotNull(target, "target"); + Verify.IsNotNull(sink, "sink"); + Verify.IsNotDefault(eventId, "eventId"); + this.handle = IntPtr.Zero; + IConnectionPoint connectionPoint = null; + try + { + target.FindConnectionPoint(ref eventId, out connectionPoint); + int num; + connectionPoint.Advise(sink, out num); + if (num == 0) + { + throw new InvalidOperationException("IConnectionPoint::Advise returned an invalid cookie."); + } + this.handle = new IntPtr(num); + this._cp = connectionPoint; + connectionPoint = null; + } + finally + { + Utility.SafeRelease(ref connectionPoint); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public void Disconnect() - { - this.ReleaseHandle(); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public void Disconnect() + { + this.ReleaseHandle(); + } - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - protected override bool ReleaseHandle() - { - bool result; - try - { - if (!this.IsInvalid) - { - int dwCookie = this.handle.ToInt32(); - this.handle = IntPtr.Zero; - try - { - this._cp.Unadvise(dwCookie); - } - finally - { - Utility.SafeRelease(ref this._cp); - } - } - result = true; - } - catch - { - result = false; - } - return result; - } + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + protected override bool ReleaseHandle() + { + bool result; + try + { + if (!this.IsInvalid) + { + int dwCookie = this.handle.ToInt32(); + this.handle = IntPtr.Zero; + try + { + this._cp.Unadvise(dwCookie); + } + finally + { + Utility.SafeRelease(ref this._cp); + } + } + result = true; + } + catch + { + result = false; + } + return result; + } - private IConnectionPoint _cp; - } + private IConnectionPoint _cp; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SafeDC.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SafeDC.cs index a015802b..124a461c 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SafeDC.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SafeDC.cs @@ -6,151 +6,151 @@ using Microsoft.Win32.SafeHandles; namespace Standard { - internal sealed class SafeDC : SafeHandleZeroOrMinusOneIsInvalid - { - public IntPtr Hwnd - { - set - { - this._hwnd = new IntPtr?(value); - } - } + internal sealed class SafeDC : SafeHandleZeroOrMinusOneIsInvalid + { + public IntPtr Hwnd + { + set + { + this._hwnd = new IntPtr?(value); + } + } - private SafeDC() : base(true) - { - } + private SafeDC() : base(true) + { + } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - protected override bool ReleaseHandle() - { - if (this._created) - { - return SafeDC.NativeMethods.DeleteDC(this.handle); - } - return this._hwnd == null || this._hwnd.Value == IntPtr.Zero || SafeDC.NativeMethods.ReleaseDC(this._hwnd.Value, this.handle) == 1; - } + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + protected override bool ReleaseHandle() + { + if (this._created) + { + return SafeDC.NativeMethods.DeleteDC(this.handle); + } + return this._hwnd == null || this._hwnd.Value == IntPtr.Zero || SafeDC.NativeMethods.ReleaseDC(this._hwnd.Value, this.handle) == 1; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] - public static SafeDC CreateDC(string deviceName) - { - SafeDC safeDC = null; - try - { - safeDC = SafeDC.NativeMethods.CreateDC(deviceName, null, IntPtr.Zero, IntPtr.Zero); - } - finally - { - if (safeDC != null) - { - safeDC._created = true; - } - } - if (safeDC.IsInvalid) - { - safeDC.Dispose(); - throw new SystemException("Unable to create a device context from the specified device information."); - } - return safeDC; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] + public static SafeDC CreateDC(string deviceName) + { + SafeDC safeDC = null; + try + { + safeDC = SafeDC.NativeMethods.CreateDC(deviceName, null, IntPtr.Zero, IntPtr.Zero); + } + finally + { + if (safeDC != null) + { + safeDC._created = true; + } + } + if (safeDC.IsInvalid) + { + safeDC.Dispose(); + throw new SystemException("Unable to create a device context from the specified device information."); + } + return safeDC; + } - [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static SafeDC CreateCompatibleDC(SafeDC hdc) - { - SafeDC safeDC = null; - try - { - IntPtr hdc2 = IntPtr.Zero; - if (hdc != null) - { - hdc2 = hdc.handle; - } - safeDC = SafeDC.NativeMethods.CreateCompatibleDC(hdc2); - if (safeDC == null) - { - HRESULT.ThrowLastError(); - } - } - finally - { - if (safeDC != null) - { - safeDC._created = true; - } - } - if (safeDC.IsInvalid) - { - safeDC.Dispose(); - throw new SystemException("Unable to create a device context from the specified device information."); - } - return safeDC; - } + [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static SafeDC CreateCompatibleDC(SafeDC hdc) + { + SafeDC safeDC = null; + try + { + IntPtr hdc2 = IntPtr.Zero; + if (hdc != null) + { + hdc2 = hdc.handle; + } + safeDC = SafeDC.NativeMethods.CreateCompatibleDC(hdc2); + if (safeDC == null) + { + HRESULT.ThrowLastError(); + } + } + finally + { + if (safeDC != null) + { + safeDC._created = true; + } + } + if (safeDC.IsInvalid) + { + safeDC.Dispose(); + throw new SystemException("Unable to create a device context from the specified device information."); + } + return safeDC; + } - public static SafeDC GetDC(IntPtr hwnd) - { - SafeDC safeDC = null; - try - { - safeDC = SafeDC.NativeMethods.GetDC(hwnd); - } - finally - { - if (safeDC != null) - { - safeDC.Hwnd = hwnd; - } - } - if (safeDC.IsInvalid) - { - HRESULT.E_FAIL.ThrowIfFailed(); - } - return safeDC; - } + public static SafeDC GetDC(IntPtr hwnd) + { + SafeDC safeDC = null; + try + { + safeDC = SafeDC.NativeMethods.GetDC(hwnd); + } + finally + { + if (safeDC != null) + { + safeDC.Hwnd = hwnd; + } + } + if (safeDC.IsInvalid) + { + HRESULT.E_FAIL.ThrowIfFailed(); + } + return safeDC; + } - public static SafeDC GetDesktop() - { - return SafeDC.GetDC(IntPtr.Zero); - } + public static SafeDC GetDesktop() + { + return SafeDC.GetDC(IntPtr.Zero); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] - public static SafeDC WrapDC(IntPtr hdc) - { - return new SafeDC - { - handle = hdc, - _created = false, - _hwnd = new IntPtr?(IntPtr.Zero) - }; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] + public static SafeDC WrapDC(IntPtr hdc) + { + return new SafeDC + { + handle = hdc, + _created = false, + _hwnd = new IntPtr?(IntPtr.Zero) + }; + } - private IntPtr? _hwnd; + private IntPtr? _hwnd; - private bool _created; + private bool _created; - private static class NativeMethods - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll")] - public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); + private static class NativeMethods + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll")] + public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("user32.dll")] - public static extern SafeDC GetDC(IntPtr hwnd); + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("user32.dll")] + public static extern SafeDC GetDC(IntPtr hwnd); - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", CharSet = CharSet.Unicode)] - public static extern SafeDC CreateDC([MarshalAs(UnmanagedType.LPWStr)] string lpszDriver, [MarshalAs(UnmanagedType.LPWStr)] string lpszDevice, IntPtr lpszOutput, IntPtr lpInitData); + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", CharSet = CharSet.Unicode)] + public static extern SafeDC CreateDC([MarshalAs(UnmanagedType.LPWStr)] string lpszDriver, [MarshalAs(UnmanagedType.LPWStr)] string lpszDevice, IntPtr lpszOutput, IntPtr lpInitData); - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern SafeDC CreateCompatibleDC(IntPtr hdc); + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern SafeDC CreateCompatibleDC(IntPtr hdc); - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DllImport("gdi32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool DeleteDC(IntPtr hdc); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DllImport("gdi32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeleteDC(IntPtr hdc); + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SafeFindHandle.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SafeFindHandle.cs index f7cf61bc..29880d01 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SafeFindHandle.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SafeFindHandle.cs @@ -4,16 +4,16 @@ using Microsoft.Win32.SafeHandles; namespace Standard { - internal sealed class SafeFindHandle : SafeHandleZeroOrMinusOneIsInvalid - { - [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] - private SafeFindHandle() : base(true) - { - } + internal sealed class SafeFindHandle : SafeHandleZeroOrMinusOneIsInvalid + { + [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] + private SafeFindHandle() : base(true) + { + } - protected override bool ReleaseHandle() - { - return NativeMethods.FindClose(this.handle); - } - } + protected override bool ReleaseHandle() + { + return NativeMethods.FindClose(this.handle); + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SafeGdiplusStartupToken.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SafeGdiplusStartupToken.cs index 915025ba..a4e3e38c 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SafeGdiplusStartupToken.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SafeGdiplusStartupToken.cs @@ -5,34 +5,34 @@ using Microsoft.Win32.SafeHandles; namespace Standard { - internal sealed class SafeGdiplusStartupToken : SafeHandleZeroOrMinusOneIsInvalid - { - private SafeGdiplusStartupToken() : base(true) - { - } + internal sealed class SafeGdiplusStartupToken : SafeHandleZeroOrMinusOneIsInvalid + { + private SafeGdiplusStartupToken() : base(true) + { + } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - protected override bool ReleaseHandle() - { - Status status = NativeMethods.GdiplusShutdown(this.handle); - return status == Status.Ok; - } + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + protected override bool ReleaseHandle() + { + Status status = NativeMethods.GdiplusShutdown(this.handle); + return status == Status.Ok; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] - [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] - public static SafeGdiplusStartupToken Startup() - { - SafeGdiplusStartupToken safeGdiplusStartupToken = new SafeGdiplusStartupToken(); - IntPtr handle; - StartupOutput startupOutput; - if (NativeMethods.GdiplusStartup(out handle, new StartupInput(), out startupOutput) == Status.Ok) - { - safeGdiplusStartupToken.handle = handle; - return safeGdiplusStartupToken; - } - safeGdiplusStartupToken.Dispose(); - throw new Exception("Unable to initialize GDI+"); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] + [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] + public static SafeGdiplusStartupToken Startup() + { + SafeGdiplusStartupToken safeGdiplusStartupToken = new SafeGdiplusStartupToken(); + IntPtr handle; + StartupOutput startupOutput; + if (NativeMethods.GdiplusStartup(out handle, new StartupInput(), out startupOutput) == Status.Ok) + { + safeGdiplusStartupToken.handle = handle; + return safeGdiplusStartupToken; + } + safeGdiplusStartupToken.Dispose(); + throw new Exception("Unable to initialize GDI+"); + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/SafeHBITMAP.cs b/src/Shared/Microsoft.Windows.Shell/Standard/SafeHBITMAP.cs index 508af7aa..de8e1a92 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/SafeHBITMAP.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/SafeHBITMAP.cs @@ -4,16 +4,16 @@ using Microsoft.Win32.SafeHandles; namespace Standard { - internal sealed class SafeHBITMAP : SafeHandleZeroOrMinusOneIsInvalid - { - private SafeHBITMAP() : base(true) - { - } + internal sealed class SafeHBITMAP : SafeHandleZeroOrMinusOneIsInvalid + { + private SafeHBITMAP() : base(true) + { + } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - protected override bool ReleaseHandle() - { - return NativeMethods.DeleteObject(this.handle); - } - } + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + protected override bool ReleaseHandle() + { + return NativeMethods.DeleteObject(this.handle); + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/StartupInput.cs b/src/Shared/Microsoft.Windows.Shell/Standard/StartupInput.cs index 1bfe859d..71ed7a9d 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/StartupInput.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/StartupInput.cs @@ -3,15 +3,15 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential)] - internal class StartupInput - { - public int GdiplusVersion = 1; + [StructLayout(LayoutKind.Sequential)] + internal class StartupInput + { + public int GdiplusVersion = 1; - public IntPtr DebugEventCallback; + public IntPtr DebugEventCallback; - public bool SuppressBackgroundThread; + public bool SuppressBackgroundThread; - public bool SuppressExternalCodecs; - } + public bool SuppressExternalCodecs; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/StartupOutput.cs b/src/Shared/Microsoft.Windows.Shell/Standard/StartupOutput.cs index 29c9243d..83a59f76 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/StartupOutput.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/StartupOutput.cs @@ -2,10 +2,10 @@ namespace Standard { - internal struct StartupOutput - { - public IntPtr hook; + internal struct StartupOutput + { + public IntPtr hook; - public IntPtr unhook; - } + public IntPtr unhook; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/Status.cs b/src/Shared/Microsoft.Windows.Shell/Standard/Status.cs index c84e8ffe..a90412d0 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/Status.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/Status.cs @@ -2,29 +2,29 @@ namespace Standard { - internal enum Status - { - Ok, - GenericError, - InvalidParameter, - OutOfMemory, - ObjectBusy, - InsufficientBuffer, - NotImplemented, - Win32Error, - WrongState, - Aborted, - FileNotFound, - ValueOverflow, - AccessDenied, - UnknownImageFormat, - FontFamilyNotFound, - FontStyleNotFound, - NotTrueTypeFont, - UnsupportedGdiplusVersion, - GdiplusNotInitialized, - PropertyNotFound, - PropertyNotSupported, - ProfileNotFound - } + internal enum Status + { + Ok, + GenericError, + InvalidParameter, + OutOfMemory, + ObjectBusy, + InsufficientBuffer, + NotImplemented, + Win32Error, + WrongState, + Aborted, + FileNotFound, + ValueOverflow, + AccessDenied, + UnknownImageFormat, + FontFamilyNotFound, + FontStyleNotFound, + NotTrueTypeFont, + UnsupportedGdiplusVersion, + GdiplusNotInitialized, + PropertyNotFound, + PropertyNotSupported, + ProfileNotFound + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/StockObject.cs b/src/Shared/Microsoft.Windows.Shell/Standard/StockObject.cs index 09060902..9c2de960 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/StockObject.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/StockObject.cs @@ -2,19 +2,19 @@ namespace Standard { - internal enum StockObject - { - WHITE_BRUSH, - LTGRAY_BRUSH, - GRAY_BRUSH, - DKGRAY_BRUSH, - BLACK_BRUSH, - NULL_BRUSH, - HOLLOW_BRUSH = 5, - WHITE_PEN, - BLACK_PEN, - NULL_PEN, - SYSTEM_FONT = 13, - DEFAULT_PALETTE = 15 - } + internal enum StockObject + { + WHITE_BRUSH, + LTGRAY_BRUSH, + GRAY_BRUSH, + DKGRAY_BRUSH, + BLACK_BRUSH, + NULL_BRUSH, + HOLLOW_BRUSH = 5, + WHITE_PEN, + BLACK_PEN, + NULL_PEN, + SYSTEM_FONT = 13, + DEFAULT_PALETTE = 15 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/TBPF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/TBPF.cs index 40e1c70c..06c0573c 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/TBPF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/TBPF.cs @@ -2,12 +2,12 @@ namespace Standard { - internal enum TBPF - { - NOPROGRESS, - INDETERMINATE, - NORMAL, - ERROR = 4, - PAUSED = 8 - } + internal enum TBPF + { + NOPROGRESS, + INDETERMINATE, + NORMAL, + ERROR = 4, + PAUSED = 8 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/THB.cs b/src/Shared/Microsoft.Windows.Shell/Standard/THB.cs index 6d59bd3f..0354bbfa 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/THB.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/THB.cs @@ -2,12 +2,12 @@ namespace Standard { - [Flags] - internal enum THB : uint - { - BITMAP = 1u, - ICON = 2u, - TOOLTIP = 4u, - FLAGS = 8u - } + [Flags] + internal enum THB : uint + { + BITMAP = 1u, + ICON = 2u, + TOOLTIP = 4u, + FLAGS = 8u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/THBF.cs b/src/Shared/Microsoft.Windows.Shell/Standard/THBF.cs index ac17b593..ced924aa 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/THBF.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/THBF.cs @@ -2,14 +2,14 @@ namespace Standard { - [Flags] - internal enum THBF : uint - { - ENABLED = 0u, - DISABLED = 1u, - DISMISSONCLICK = 2u, - NOBACKGROUND = 4u, - HIDDEN = 8u, - NONINTERACTIVE = 16u - } + [Flags] + internal enum THBF : uint + { + ENABLED = 0u, + DISABLED = 1u, + DISMISSONCLICK = 2u, + NOBACKGROUND = 4u, + HIDDEN = 8u, + NONINTERACTIVE = 16u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/THUMBBUTTON.cs b/src/Shared/Microsoft.Windows.Shell/Standard/THUMBBUTTON.cs index a938d3fd..4385af13 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/THUMBBUTTON.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/THUMBBUTTON.cs @@ -3,22 +3,22 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 8)] - internal struct THUMBBUTTON - { - public const int THBN_CLICKED = 6144; + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 8)] + internal struct THUMBBUTTON + { + public const int THBN_CLICKED = 6144; - public THB dwMask; + public THB dwMask; - public uint iId; + public uint iId; - public uint iBitmap; + public uint iBitmap; - public IntPtr hIcon; + public IntPtr hIcon; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string szTip; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string szTip; - public THBF dwFlags; - } + public THBF dwFlags; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/TITLEBARINFO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/TITLEBARINFO.cs index da93a117..50bc1a7a 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/TITLEBARINFO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/TITLEBARINFO.cs @@ -2,22 +2,22 @@ namespace Standard { - internal struct TITLEBARINFO - { - public int cbSize; + internal struct TITLEBARINFO + { + public int cbSize; - public RECT rcTitleBar; + public RECT rcTitleBar; - public STATE_SYSTEM rgstate_TitleBar; + public STATE_SYSTEM rgstate_TitleBar; - public STATE_SYSTEM rgstate_Reserved; + public STATE_SYSTEM rgstate_Reserved; - public STATE_SYSTEM rgstate_MinimizeButton; + public STATE_SYSTEM rgstate_MinimizeButton; - public STATE_SYSTEM rgstate_MaximizeButton; + public STATE_SYSTEM rgstate_MaximizeButton; - public STATE_SYSTEM rgstate_HelpButton; + public STATE_SYSTEM rgstate_HelpButton; - public STATE_SYSTEM rgstate_CloseButton; - } + public STATE_SYSTEM rgstate_CloseButton; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/TITLEBARINFOEX.cs b/src/Shared/Microsoft.Windows.Shell/Standard/TITLEBARINFOEX.cs index ea7b28db..182c9867 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/TITLEBARINFOEX.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/TITLEBARINFOEX.cs @@ -2,34 +2,34 @@ namespace Standard { - internal struct TITLEBARINFOEX - { - public int cbSize; + internal struct TITLEBARINFOEX + { + public int cbSize; - public RECT rcTitleBar; + public RECT rcTitleBar; - public STATE_SYSTEM rgstate_TitleBar; + public STATE_SYSTEM rgstate_TitleBar; - public STATE_SYSTEM rgstate_Reserved; + public STATE_SYSTEM rgstate_Reserved; - public STATE_SYSTEM rgstate_MinimizeButton; + public STATE_SYSTEM rgstate_MinimizeButton; - public STATE_SYSTEM rgstate_MaximizeButton; + public STATE_SYSTEM rgstate_MaximizeButton; - public STATE_SYSTEM rgstate_HelpButton; + public STATE_SYSTEM rgstate_HelpButton; - public STATE_SYSTEM rgstate_CloseButton; + public STATE_SYSTEM rgstate_CloseButton; - public RECT rgrect_TitleBar; + public RECT rgrect_TitleBar; - public RECT rgrect_Reserved; + public RECT rgrect_Reserved; - public RECT rgrect_MinimizeButton; + public RECT rgrect_MinimizeButton; - public RECT rgrect_MaximizeButton; + public RECT rgrect_MaximizeButton; - public RECT rgrect_HelpButton; + public RECT rgrect_HelpButton; - public RECT rgrect_CloseButton; - } + public RECT rgrect_CloseButton; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/ULW.cs b/src/Shared/Microsoft.Windows.Shell/Standard/ULW.cs index c69d1286..81753600 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/ULW.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/ULW.cs @@ -2,10 +2,10 @@ namespace Standard { - internal enum ULW - { - ALPHA = 2, - COLORKEY = 1, - OPAQUE = 4 - } + internal enum ULW + { + ALPHA = 2, + COLORKEY = 1, + OPAQUE = 4 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/UNSIGNED_RATIO.cs b/src/Shared/Microsoft.Windows.Shell/Standard/UNSIGNED_RATIO.cs index 98db9fd2..879eee0a 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/UNSIGNED_RATIO.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/UNSIGNED_RATIO.cs @@ -2,10 +2,10 @@ namespace Standard { - internal struct UNSIGNED_RATIO - { - public uint uiNumerator; + internal struct UNSIGNED_RATIO + { + public uint uiNumerator; - public uint uiDenominator; - } + public uint uiDenominator; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/Utility.cs b/src/Shared/Microsoft.Windows.Shell/Standard/Utility.cs index 3e1a566c..44591365 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/Utility.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/Utility.cs @@ -14,809 +14,809 @@ using System.Windows.Media.Imaging; namespace Standard { - internal static class Utility - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private static bool _MemCmp(IntPtr left, IntPtr right, long cb) - { - int num = 0; - while ((long)num < cb - 8L) - { - long num2 = Marshal.ReadInt64(left, num); - long num3 = Marshal.ReadInt64(right, num); - if (num2 != num3) - { - return false; - } - num += 8; - } - while ((long)num < cb) - { - byte b = Marshal.ReadByte(left, num); - byte b2 = Marshal.ReadByte(right, num); - if (b != b2) - { - return false; - } - num++; - } - return true; - } + internal static class Utility + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + private static bool _MemCmp(IntPtr left, IntPtr right, long cb) + { + int num = 0; + while ((long) num < cb - 8L) + { + long num2 = Marshal.ReadInt64(left, num); + long num3 = Marshal.ReadInt64(right, num); + if (num2 != num3) + { + return false; + } + num += 8; + } + while ((long) num < cb) + { + byte b = Marshal.ReadByte(left, num); + byte b2 = Marshal.ReadByte(right, num); + if (b != b2) + { + return false; + } + num++; + } + return true; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static int RGB(Color c) - { - return (int)c.R | (int)c.G << 8 | (int)c.B << 16; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static int RGB(Color c) + { + return (int) c.R | (int) c.G << 8 | (int) c.B << 16; + } - public static Color ColorFromArgbDword(uint color) - { - return Color.FromArgb((byte)((color & 4278190080u) >> 24), (byte)((color & 16711680u) >> 16), (byte)((color & 65280u) >> 8), (byte)(color & 255u)); - } + public static Color ColorFromArgbDword(uint color) + { + return Color.FromArgb((byte) ((color & 4278190080u) >> 24), (byte) ((color & 16711680u) >> 16), (byte) ((color & 65280u) >> 8), (byte) (color & 255u)); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static int GET_X_LPARAM(IntPtr lParam) - { - return Utility.LOWORD(lParam.ToInt32()); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static int GET_X_LPARAM(IntPtr lParam) + { + return Utility.LOWORD(lParam.ToInt32()); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static int GET_Y_LPARAM(IntPtr lParam) - { - return Utility.HIWORD(lParam.ToInt32()); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static int GET_Y_LPARAM(IntPtr lParam) + { + return Utility.HIWORD(lParam.ToInt32()); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static int HIWORD(int i) - { - return (int)((short)(i >> 16)); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static int HIWORD(int i) + { + return (int) ((short) (i >> 16)); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static int LOWORD(int i) - { - return (int)((short)(i & 65535)); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static int LOWORD(int i) + { + return (int) ((short) (i & 65535)); + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool AreStreamsEqual(Stream left, Stream right) - { - if (left == null) - { - return right == null; - } - if (right == null) - { - return false; - } - if (!left.CanRead || !right.CanRead) - { - throw new NotSupportedException("The streams can't be read for comparison"); - } - if (left.Length != right.Length) - { - return false; - } - int num = (int)left.Length; - left.Position = 0L; - right.Position = 0L; - int i = 0; - int num2 = 0; - byte[] array = new byte[512]; - byte[] array2 = new byte[512]; - GCHandle gchandle = GCHandle.Alloc(array, GCHandleType.Pinned); - IntPtr left2 = gchandle.AddrOfPinnedObject(); - GCHandle gchandle2 = GCHandle.Alloc(array2, GCHandleType.Pinned); - IntPtr right2 = gchandle2.AddrOfPinnedObject(); - bool result; - try - { - while (i < num) - { - int num3 = left.Read(array, 0, array.Length); - int num4 = right.Read(array2, 0, array2.Length); - if (num3 != num4) - { - return false; - } - if (!Utility._MemCmp(left2, right2, (long)num3)) - { - return false; - } - i += num3; - num2 += num4; - } - result = true; - } - finally - { - gchandle.Free(); - gchandle2.Free(); - } - return result; - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool AreStreamsEqual(Stream left, Stream right) + { + if (left == null) + { + return right == null; + } + if (right == null) + { + return false; + } + if (!left.CanRead || !right.CanRead) + { + throw new NotSupportedException("The streams can't be read for comparison"); + } + if (left.Length != right.Length) + { + return false; + } + int num = (int) left.Length; + left.Position = 0L; + right.Position = 0L; + int i = 0; + int num2 = 0; + byte[] array = new byte[512]; + byte[] array2 = new byte[512]; + GCHandle gchandle = GCHandle.Alloc(array, GCHandleType.Pinned); + IntPtr left2 = gchandle.AddrOfPinnedObject(); + GCHandle gchandle2 = GCHandle.Alloc(array2, GCHandleType.Pinned); + IntPtr right2 = gchandle2.AddrOfPinnedObject(); + bool result; + try + { + while (i < num) + { + int num3 = left.Read(array, 0, array.Length); + int num4 = right.Read(array2, 0, array2.Length); + if (num3 != num4) + { + return false; + } + if (!Utility._MemCmp(left2, right2, (long) num3)) + { + return false; + } + i += num3; + num2 += num4; + } + result = true; + } + finally + { + gchandle.Free(); + gchandle2.Free(); + } + return result; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool GuidTryParse(string guidString, out Guid guid) - { - Verify.IsNeitherNullNorEmpty(guidString, "guidString"); - try - { - guid = new Guid(guidString); - return true; - } - catch (FormatException) - { - } - catch (OverflowException) - { - } - guid = default(Guid); - return false; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool GuidTryParse(string guidString, out Guid guid) + { + Verify.IsNeitherNullNorEmpty(guidString, "guidString"); + try + { + guid = new Guid(guidString); + return true; + } + catch (FormatException) + { + } + catch (OverflowException) + { + } + guid = default(Guid); + return false; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool IsFlagSet(int value, int mask) - { - return 0 != (value & mask); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool IsFlagSet(int value, int mask) + { + return 0 != (value & mask); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool IsFlagSet(uint value, uint mask) - { - return 0u != (value & mask); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool IsFlagSet(uint value, uint mask) + { + return 0u != (value & mask); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool IsFlagSet(long value, long mask) - { - return 0L != (value & mask); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool IsFlagSet(long value, long mask) + { + return 0L != (value & mask); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool IsFlagSet(ulong value, ulong mask) - { - return 0UL != (value & mask); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool IsFlagSet(ulong value, ulong mask) + { + return 0UL != (value & mask); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool IsOSVistaOrNewer - { - get - { - return Utility._osVersion >= new Version(6, 0); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool IsOSVistaOrNewer + { + get + { + return Utility._osVersion >= new Version(6, 0); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool IsOSWindows7OrNewer - { - get - { - return Utility._osVersion >= new Version(6, 1); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool IsOSWindows7OrNewer + { + get + { + return Utility._osVersion >= new Version(6, 1); + } + } - public static bool IsPresentationFrameworkVersionLessThan4 - { - get - { - return Utility._presentationFrameworkVersion < new Version(4, 0); - } - } + public static bool IsPresentationFrameworkVersionLessThan4 + { + get + { + return Utility._presentationFrameworkVersion < new Version(4, 0); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")] - public static IntPtr GenerateHICON(ImageSource image, Size dimensions) - { - if (image == null) - { - return IntPtr.Zero; - } - BitmapFrame bitmapFrame = image as BitmapFrame; - if (bitmapFrame != null) - { - bitmapFrame = Utility.GetBestMatch(bitmapFrame.Decoder.Frames, (int)dimensions.Width, (int)dimensions.Height); - } - else - { - Rect rectangle = new Rect(0.0, 0.0, dimensions.Width, dimensions.Height); - double num = dimensions.Width / dimensions.Height; - double num2 = image.Width / image.Height; - if (image.Width <= dimensions.Width && image.Height <= dimensions.Height) - { - rectangle = new Rect((dimensions.Width - image.Width) / 2.0, (dimensions.Height - image.Height) / 2.0, image.Width, image.Height); - } - else if (num > num2) - { - double num3 = image.Width / image.Height * dimensions.Width; - rectangle = new Rect((dimensions.Width - num3) / 2.0, 0.0, num3, dimensions.Height); - } - else if (num < num2) - { - double num4 = image.Height / image.Width * dimensions.Height; - rectangle = new Rect(0.0, (dimensions.Height - num4) / 2.0, dimensions.Width, num4); - } - DrawingVisual drawingVisual = new DrawingVisual(); - DrawingContext drawingContext = drawingVisual.RenderOpen(); - drawingContext.DrawImage(image, rectangle); - drawingContext.Close(); - RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap((int)dimensions.Width, (int)dimensions.Height, 96.0, 96.0, PixelFormats.Pbgra32); - renderTargetBitmap.Render(drawingVisual); - bitmapFrame = BitmapFrame.Create(renderTargetBitmap); - } - IntPtr result; - using (MemoryStream memoryStream = new MemoryStream()) - { - new PngBitmapEncoder - { - Frames = - { - bitmapFrame - } - }.Save(memoryStream); - using (ManagedIStream managedIStream = new ManagedIStream(memoryStream)) - { - IntPtr zero = IntPtr.Zero; - try - { - Status status = NativeMethods.GdipCreateBitmapFromStream(managedIStream, out zero); - if (status != Status.Ok) - { - result = IntPtr.Zero; - } - else - { - IntPtr intPtr; - status = NativeMethods.GdipCreateHICONFromBitmap(zero, out intPtr); - if (status != Status.Ok) - { - result = IntPtr.Zero; - } - else - { - result = intPtr; - } - } - } - finally - { - Utility.SafeDisposeImage(ref zero); - } - } - } - return result; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")] + public static IntPtr GenerateHICON(ImageSource image, Size dimensions) + { + if (image == null) + { + return IntPtr.Zero; + } + BitmapFrame bitmapFrame = image as BitmapFrame; + if (bitmapFrame != null) + { + bitmapFrame = Utility.GetBestMatch(bitmapFrame.Decoder.Frames, (int) dimensions.Width, (int) dimensions.Height); + } + else + { + Rect rectangle = new Rect(0.0, 0.0, dimensions.Width, dimensions.Height); + double num = dimensions.Width / dimensions.Height; + double num2 = image.Width / image.Height; + if (image.Width <= dimensions.Width && image.Height <= dimensions.Height) + { + rectangle = new Rect((dimensions.Width - image.Width) / 2.0, (dimensions.Height - image.Height) / 2.0, image.Width, image.Height); + } + else if (num > num2) + { + double num3 = image.Width / image.Height * dimensions.Width; + rectangle = new Rect((dimensions.Width - num3) / 2.0, 0.0, num3, dimensions.Height); + } + else if (num < num2) + { + double num4 = image.Height / image.Width * dimensions.Height; + rectangle = new Rect(0.0, (dimensions.Height - num4) / 2.0, dimensions.Width, num4); + } + DrawingVisual drawingVisual = new DrawingVisual(); + DrawingContext drawingContext = drawingVisual.RenderOpen(); + drawingContext.DrawImage(image, rectangle); + drawingContext.Close(); + RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap((int) dimensions.Width, (int) dimensions.Height, 96.0, 96.0, PixelFormats.Pbgra32); + renderTargetBitmap.Render(drawingVisual); + bitmapFrame = BitmapFrame.Create(renderTargetBitmap); + } + IntPtr result; + using (MemoryStream memoryStream = new MemoryStream()) + { + new PngBitmapEncoder + { + Frames = + { + bitmapFrame + } + }.Save(memoryStream); + using (ManagedIStream managedIStream = new ManagedIStream(memoryStream)) + { + IntPtr zero = IntPtr.Zero; + try + { + Status status = NativeMethods.GdipCreateBitmapFromStream(managedIStream, out zero); + if (status != Status.Ok) + { + result = IntPtr.Zero; + } + else + { + IntPtr intPtr; + status = NativeMethods.GdipCreateHICONFromBitmap(zero, out intPtr); + if (status != Status.Ok) + { + result = IntPtr.Zero; + } + else + { + result = intPtr; + } + } + } + finally + { + Utility.SafeDisposeImage(ref zero); + } + } + } + return result; + } - public static BitmapFrame GetBestMatch(IList frames, int width, int height) - { - return Utility._GetBestMatch(frames, Utility._GetBitDepth(), width, height); - } + public static BitmapFrame GetBestMatch(IList frames, int width, int height) + { + return Utility._GetBestMatch(frames, Utility._GetBitDepth(), width, height); + } - private static int _MatchImage(BitmapFrame frame, int bitDepth, int width, int height, int bpp) - { - return 2 * Utility._WeightedAbs(bpp, bitDepth, false) + Utility._WeightedAbs(frame.PixelWidth, width, true) + Utility._WeightedAbs(frame.PixelHeight, height, true); - } + private static int _MatchImage(BitmapFrame frame, int bitDepth, int width, int height, int bpp) + { + return 2 * Utility._WeightedAbs(bpp, bitDepth, false) + Utility._WeightedAbs(frame.PixelWidth, width, true) + Utility._WeightedAbs(frame.PixelHeight, height, true); + } - private static int _WeightedAbs(int valueHave, int valueWant, bool fPunish) - { - int num = valueHave - valueWant; - if (num < 0) - { - num = (fPunish ? -2 : -1) * num; - } - return num; - } + private static int _WeightedAbs(int valueHave, int valueWant, bool fPunish) + { + int num = valueHave - valueWant; + if (num < 0) + { + num = (fPunish ? -2 : -1) * num; + } + return num; + } - private static BitmapFrame _GetBestMatch(IList frames, int bitDepth, int width, int height) - { - int num = int.MaxValue; - int num2 = 0; - int index = 0; - bool flag = frames[0].Decoder is IconBitmapDecoder; - int num3 = 0; - while (num3 < frames.Count && num != 0) - { - int num4 = flag ? frames[num3].Thumbnail.Format.BitsPerPixel : frames[num3].Format.BitsPerPixel; - if (num4 == 0) - { - num4 = 8; - } - int num5 = Utility._MatchImage(frames[num3], bitDepth, width, height, num4); - if (num5 < num) - { - index = num3; - num2 = num4; - num = num5; - } - else if (num5 == num && num2 < num4) - { - index = num3; - num2 = num4; - } - num3++; - } - return frames[index]; - } + private static BitmapFrame _GetBestMatch(IList frames, int bitDepth, int width, int height) + { + int num = int.MaxValue; + int num2 = 0; + int index = 0; + bool flag = frames[0].Decoder is IconBitmapDecoder; + int num3 = 0; + while (num3 < frames.Count && num != 0) + { + int num4 = flag ? frames[num3].Thumbnail.Format.BitsPerPixel : frames[num3].Format.BitsPerPixel; + if (num4 == 0) + { + num4 = 8; + } + int num5 = Utility._MatchImage(frames[num3], bitDepth, width, height, num4); + if (num5 < num) + { + index = num3; + num2 = num4; + num = num5; + } + else if (num5 == num && num2 < num4) + { + index = num3; + num2 = num4; + } + num3++; + } + return frames[index]; + } - private static int _GetBitDepth() - { - if (Utility.s_bitDepth == 0) - { - using (SafeDC desktop = SafeDC.GetDesktop()) - { - Utility.s_bitDepth = NativeMethods.GetDeviceCaps(desktop, DeviceCap.BITSPIXEL) * NativeMethods.GetDeviceCaps(desktop, DeviceCap.PLANES); - } - } - return Utility.s_bitDepth; - } + private static int _GetBitDepth() + { + if (Utility.s_bitDepth == 0) + { + using (SafeDC desktop = SafeDC.GetDesktop()) + { + Utility.s_bitDepth = NativeMethods.GetDeviceCaps(desktop, DeviceCap.BITSPIXEL) * NativeMethods.GetDeviceCaps(desktop, DeviceCap.PLANES); + } + } + return Utility.s_bitDepth; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SafeDeleteFile(string path) - { - if (!string.IsNullOrEmpty(path)) - { - File.Delete(path); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SafeDeleteFile(string path) + { + if (!string.IsNullOrEmpty(path)) + { + File.Delete(path); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SafeDeleteObject(ref IntPtr gdiObject) - { - IntPtr intPtr = gdiObject; - gdiObject = IntPtr.Zero; - if (IntPtr.Zero != intPtr) - { - NativeMethods.DeleteObject(intPtr); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SafeDeleteObject(ref IntPtr gdiObject) + { + IntPtr intPtr = gdiObject; + gdiObject = IntPtr.Zero; + if (IntPtr.Zero != intPtr) + { + NativeMethods.DeleteObject(intPtr); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SafeDestroyIcon(ref IntPtr hicon) - { - IntPtr intPtr = hicon; - hicon = IntPtr.Zero; - if (IntPtr.Zero != intPtr) - { - NativeMethods.DestroyIcon(intPtr); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SafeDestroyIcon(ref IntPtr hicon) + { + IntPtr intPtr = hicon; + hicon = IntPtr.Zero; + if (IntPtr.Zero != intPtr) + { + NativeMethods.DestroyIcon(intPtr); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SafeDestroyWindow(ref IntPtr hwnd) - { - IntPtr hwnd2 = hwnd; - hwnd = IntPtr.Zero; - if (NativeMethods.IsWindow(hwnd2)) - { - NativeMethods.DestroyWindow(hwnd2); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SafeDestroyWindow(ref IntPtr hwnd) + { + IntPtr hwnd2 = hwnd; + hwnd = IntPtr.Zero; + if (NativeMethods.IsWindow(hwnd2)) + { + NativeMethods.DestroyWindow(hwnd2); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SafeDispose(ref T disposable) where T : IDisposable - { - IDisposable disposable2 = disposable; - disposable = default(T); - if (disposable2 != null) - { - disposable2.Dispose(); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SafeDispose(ref T disposable) where T : IDisposable + { + IDisposable disposable2 = disposable; + disposable = default(T); + if (disposable2 != null) + { + disposable2.Dispose(); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SafeDisposeImage(ref IntPtr gdipImage) - { - IntPtr intPtr = gdipImage; - gdipImage = IntPtr.Zero; - if (IntPtr.Zero != intPtr) - { - NativeMethods.GdipDisposeImage(intPtr); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SafeDisposeImage(ref IntPtr gdipImage) + { + IntPtr intPtr = gdipImage; + gdipImage = IntPtr.Zero; + if (IntPtr.Zero != intPtr) + { + NativeMethods.GdipDisposeImage(intPtr); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public static void SafeCoTaskMemFree(ref IntPtr ptr) - { - IntPtr intPtr = ptr; - ptr = IntPtr.Zero; - if (IntPtr.Zero != intPtr) - { - Marshal.FreeCoTaskMem(intPtr); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public static void SafeCoTaskMemFree(ref IntPtr ptr) + { + IntPtr intPtr = ptr; + ptr = IntPtr.Zero; + if (IntPtr.Zero != intPtr) + { + Marshal.FreeCoTaskMem(intPtr); + } + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SafeFreeHGlobal(ref IntPtr hglobal) - { - IntPtr intPtr = hglobal; - hglobal = IntPtr.Zero; - if (IntPtr.Zero != intPtr) - { - Marshal.FreeHGlobal(intPtr); - } - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void SafeFreeHGlobal(ref IntPtr hglobal) + { + IntPtr intPtr = hglobal; + hglobal = IntPtr.Zero; + if (IntPtr.Zero != intPtr) + { + Marshal.FreeHGlobal(intPtr); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public static void SafeRelease(ref T comObject) where T : class - { - T t = comObject; - comObject = default(T); - if (t != null) - { - Marshal.ReleaseComObject(t); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public static void SafeRelease(ref T comObject) where T : class + { + T t = comObject; + comObject = default(T); + if (t != null) + { + Marshal.ReleaseComObject(t); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void GeneratePropertyString(StringBuilder source, string propertyName, string value) - { - if (source.Length != 0) - { - source.Append(' '); - } - source.Append(propertyName); - source.Append(": "); - if (string.IsNullOrEmpty(value)) - { - source.Append(""); - return; - } - source.Append('"'); - source.Append(value); - source.Append('"'); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void GeneratePropertyString(StringBuilder source, string propertyName, string value) + { + if (source.Length != 0) + { + source.Append(' '); + } + source.Append(propertyName); + source.Append(": "); + if (string.IsNullOrEmpty(value)) + { + source.Append(""); + return; + } + source.Append('"'); + source.Append(value); + source.Append('"'); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [Obsolete] - public static string GenerateToString(T @object) where T : struct - { - StringBuilder stringBuilder = new StringBuilder(); - foreach (PropertyInfo propertyInfo in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public)) - { - if (stringBuilder.Length != 0) - { - stringBuilder.Append(", "); - } - object value = propertyInfo.GetValue(@object, null); - string format = (value == null) ? "{0}: " : "{0}: \"{1}\""; - stringBuilder.AppendFormat(format, propertyInfo.Name, value); - } - return stringBuilder.ToString(); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [Obsolete] + public static string GenerateToString(T @object) where T : struct + { + StringBuilder stringBuilder = new StringBuilder(); + foreach (PropertyInfo propertyInfo in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public)) + { + if (stringBuilder.Length != 0) + { + stringBuilder.Append(", "); + } + object value = propertyInfo.GetValue(@object, null); + string format = (value == null) ? "{0}: " : "{0}: \"{1}\""; + stringBuilder.AppendFormat(format, propertyInfo.Name, value); + } + return stringBuilder.ToString(); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void CopyStream(Stream destination, Stream source) - { - destination.Position = 0L; - if (source.CanSeek) - { - source.Position = 0L; - destination.SetLength(source.Length); - } - byte[] array = new byte[4096]; - int num; - do - { - num = source.Read(array, 0, array.Length); - if (num != 0) - { - destination.Write(array, 0, num); - } - } - while (array.Length == num); - destination.Position = 0L; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void CopyStream(Stream destination, Stream source) + { + destination.Position = 0L; + if (source.CanSeek) + { + source.Position = 0L; + destination.SetLength(source.Length); + } + byte[] array = new byte[4096]; + int num; + do + { + num = source.Read(array, 0, array.Length); + if (num != 0) + { + destination.Write(array, 0, num); + } + } + while (array.Length == num); + destination.Position = 0L; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static string HashStreamMD5(Stream stm) - { - stm.Position = 0L; - StringBuilder stringBuilder = new StringBuilder(); - using (MD5 md = MD5.Create()) - { - foreach (byte b in md.ComputeHash(stm)) - { - stringBuilder.Append(b.ToString("x2", CultureInfo.InvariantCulture)); - } - } - return stringBuilder.ToString(); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static string HashStreamMD5(Stream stm) + { + stm.Position = 0L; + StringBuilder stringBuilder = new StringBuilder(); + using (MD5 md = MD5.Create()) + { + foreach (byte b in md.ComputeHash(stm)) + { + stringBuilder.Append(b.ToString("x2", CultureInfo.InvariantCulture)); + } + } + return stringBuilder.ToString(); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void EnsureDirectory(string path) - { - if (!Directory.Exists(Path.GetDirectoryName(path))) - { - Directory.CreateDirectory(Path.GetDirectoryName(path)); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void EnsureDirectory(string path) + { + if (!Directory.Exists(Path.GetDirectoryName(path))) + { + Directory.CreateDirectory(Path.GetDirectoryName(path)); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static bool MemCmp(byte[] left, byte[] right, int cb) - { - GCHandle gchandle = GCHandle.Alloc(left, GCHandleType.Pinned); - IntPtr left2 = gchandle.AddrOfPinnedObject(); - GCHandle gchandle2 = GCHandle.Alloc(right, GCHandleType.Pinned); - IntPtr right2 = gchandle2.AddrOfPinnedObject(); - bool result = Utility._MemCmp(left2, right2, (long)cb); - gchandle.Free(); - gchandle2.Free(); - return result; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static bool MemCmp(byte[] left, byte[] right, int cb) + { + GCHandle gchandle = GCHandle.Alloc(left, GCHandleType.Pinned); + IntPtr left2 = gchandle.AddrOfPinnedObject(); + GCHandle gchandle2 = GCHandle.Alloc(right, GCHandleType.Pinned); + IntPtr right2 = gchandle2.AddrOfPinnedObject(); + bool result = Utility._MemCmp(left2, right2, (long) cb); + gchandle.Free(); + gchandle2.Free(); + return result; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static string UrlDecode(string url) - { - if (url == null) - { - return null; - } - Utility._UrlDecoder urlDecoder = new Utility._UrlDecoder(url.Length, Encoding.UTF8); - int length = url.Length; - for (int i = 0; i < length; i++) - { - char c = url[i]; - if (c == '+') - { - urlDecoder.AddByte(32); - } - else - { - if (c == '%' && i < length - 2) - { - if (url[i + 1] == 'u' && i < length - 5) - { - int num = Utility._HexToInt(url[i + 2]); - int num2 = Utility._HexToInt(url[i + 3]); - int num3 = Utility._HexToInt(url[i + 4]); - int num4 = Utility._HexToInt(url[i + 5]); - if (num >= 0 && num2 >= 0 && num3 >= 0 && num4 >= 0) - { - urlDecoder.AddChar((char)(num << 12 | num2 << 8 | num3 << 4 | num4)); - i += 5; - goto IL_12D; - } - } - else - { - int num5 = Utility._HexToInt(url[i + 1]); - int num6 = Utility._HexToInt(url[i + 2]); - if (num5 >= 0 && num6 >= 0) - { - urlDecoder.AddByte((byte)(num5 << 4 | num6)); - i += 2; - goto IL_12D; - } - } - } - if ((c & 'ï¾€') == '\0') - { - urlDecoder.AddByte((byte)c); - } - else - { - urlDecoder.AddChar(c); - } - } - IL_12D:; - } - return urlDecoder.GetString(); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static string UrlDecode(string url) + { + if (url == null) + { + return null; + } + Utility._UrlDecoder urlDecoder = new Utility._UrlDecoder(url.Length, Encoding.UTF8); + int length = url.Length; + for (int i = 0; i < length; i++) + { + char c = url[i]; + if (c == '+') + { + urlDecoder.AddByte(32); + } + else + { + if (c == '%' && i < length - 2) + { + if (url[i + 1] == 'u' && i < length - 5) + { + int num = Utility._HexToInt(url[i + 2]); + int num2 = Utility._HexToInt(url[i + 3]); + int num3 = Utility._HexToInt(url[i + 4]); + int num4 = Utility._HexToInt(url[i + 5]); + if (num >= 0 && num2 >= 0 && num3 >= 0 && num4 >= 0) + { + urlDecoder.AddChar((char) (num << 12 | num2 << 8 | num3 << 4 | num4)); + i += 5; + goto IL_12D; + } + } + else + { + int num5 = Utility._HexToInt(url[i + 1]); + int num6 = Utility._HexToInt(url[i + 2]); + if (num5 >= 0 && num6 >= 0) + { + urlDecoder.AddByte((byte) (num5 << 4 | num6)); + i += 2; + goto IL_12D; + } + } + } + if ((c & 'ï¾€') == '\0') + { + urlDecoder.AddByte((byte) c); + } + else + { + urlDecoder.AddChar(c); + } + } +IL_12D:; + } + return urlDecoder.GetString(); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static string UrlEncode(string url) - { - if (url == null) - { - return null; - } - byte[] array = Encoding.UTF8.GetBytes(url); - bool flag = false; - int num = 0; - foreach (byte b in array) - { - if (b == 32) - { - flag = true; - } - else if (!Utility._UrlEncodeIsSafe(b)) - { - num++; - flag = true; - } - } - if (flag) - { - byte[] array3 = new byte[array.Length + num * 2]; - int num2 = 0; - foreach (byte b2 in array) - { - if (Utility._UrlEncodeIsSafe(b2)) - { - array3[num2++] = b2; - } - else if (b2 == 32) - { - array3[num2++] = 43; - } - else - { - array3[num2++] = 37; - array3[num2++] = Utility._IntToHex(b2 >> 4 & 15); - array3[num2++] = Utility._IntToHex((int)(b2 & 15)); - } - } - array = array3; - } - return Encoding.ASCII.GetString(array); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static string UrlEncode(string url) + { + if (url == null) + { + return null; + } + byte[] array = Encoding.UTF8.GetBytes(url); + bool flag = false; + int num = 0; + foreach (byte b in array) + { + if (b == 32) + { + flag = true; + } + else if (!Utility._UrlEncodeIsSafe(b)) + { + num++; + flag = true; + } + } + if (flag) + { + byte[] array3 = new byte[array.Length + num * 2]; + int num2 = 0; + foreach (byte b2 in array) + { + if (Utility._UrlEncodeIsSafe(b2)) + { + array3[num2++] = b2; + } + else if (b2 == 32) + { + array3[num2++] = 43; + } + else + { + array3[num2++] = 37; + array3[num2++] = Utility._IntToHex(b2 >> 4 & 15); + array3[num2++] = Utility._IntToHex((int) (b2 & 15)); + } + } + array = array3; + } + return Encoding.ASCII.GetString(array); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private static bool _UrlEncodeIsSafe(byte b) - { - if (Utility._IsAsciiAlphaNumeric(b)) - { - return true; - } - if (b != 33) - { - switch (b) - { - case 39: - case 40: - case 41: - case 42: - case 45: - case 46: - return true; - case 43: - case 44: - break; - default: - if (b == 95) - { - return true; - } - break; - } - return false; - } - return true; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + private static bool _UrlEncodeIsSafe(byte b) + { + if (Utility._IsAsciiAlphaNumeric(b)) + { + return true; + } + if (b != 33) + { + switch (b) + { + case 39: + case 40: + case 41: + case 42: + case 45: + case 46: + return true; + case 43: + case 44: + break; + default: + if (b == 95) + { + return true; + } + break; + } + return false; + } + return true; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private static bool _IsAsciiAlphaNumeric(byte b) - { - return (b >= 97 && b <= 122) || (b >= 65 && b <= 90) || (b >= 48 && b <= 57); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + private static bool _IsAsciiAlphaNumeric(byte b) + { + return (b >= 97 && b <= 122) || (b >= 65 && b <= 90) || (b >= 48 && b <= 57); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private static byte _IntToHex(int n) - { - if (n <= 9) - { - return (byte)(n + 48); - } - return (byte)(n - 10 + 65); - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + private static byte _IntToHex(int n) + { + if (n <= 9) + { + return (byte) (n + 48); + } + return (byte) (n - 10 + 65); + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private static int _HexToInt(char h) - { - if (h >= '0' && h <= '9') - { - return (int)(h - '0'); - } - if (h >= 'a' && h <= 'f') - { - return (int)(h - 'a' + '\n'); - } - if (h >= 'A' && h <= 'F') - { - return (int)(h - 'A' + '\n'); - } - return -1; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + private static int _HexToInt(char h) + { + if (h >= '0' && h <= '9') + { + return (int) (h - '0'); + } + if (h >= 'a' && h <= 'f') + { + return (int) (h - 'a' + '\n'); + } + if (h >= 'A' && h <= 'F') + { + return (int) (h - 'A' + '\n'); + } + return -1; + } - public static void AddDependencyPropertyChangeListener(object component, DependencyProperty property, EventHandler listener) - { - if (component == null) - { - return; - } - DependencyPropertyDescriptor dependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(property, component.GetType()); - dependencyPropertyDescriptor.AddValueChanged(component, listener); - } + public static void AddDependencyPropertyChangeListener(object component, DependencyProperty property, EventHandler listener) + { + if (component == null) + { + return; + } + DependencyPropertyDescriptor dependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(property, component.GetType()); + dependencyPropertyDescriptor.AddValueChanged(component, listener); + } - public static void RemoveDependencyPropertyChangeListener(object component, DependencyProperty property, EventHandler listener) - { - if (component == null) - { - return; - } - DependencyPropertyDescriptor dependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(property, component.GetType()); - dependencyPropertyDescriptor.RemoveValueChanged(component, listener); - } + public static void RemoveDependencyPropertyChangeListener(object component, DependencyProperty property, EventHandler listener) + { + if (component == null) + { + return; + } + DependencyPropertyDescriptor dependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(property, component.GetType()); + dependencyPropertyDescriptor.RemoveValueChanged(component, listener); + } - public static bool IsThicknessNonNegative(Thickness thickness) - { - return Utility.IsDoubleFiniteAndNonNegative(thickness.Top) && Utility.IsDoubleFiniteAndNonNegative(thickness.Left) && Utility.IsDoubleFiniteAndNonNegative(thickness.Bottom) && Utility.IsDoubleFiniteAndNonNegative(thickness.Right); - } + public static bool IsThicknessNonNegative(Thickness thickness) + { + return Utility.IsDoubleFiniteAndNonNegative(thickness.Top) && Utility.IsDoubleFiniteAndNonNegative(thickness.Left) && Utility.IsDoubleFiniteAndNonNegative(thickness.Bottom) && Utility.IsDoubleFiniteAndNonNegative(thickness.Right); + } - public static bool IsCornerRadiusValid(CornerRadius cornerRadius) - { - return Utility.IsDoubleFiniteAndNonNegative(cornerRadius.TopLeft) && Utility.IsDoubleFiniteAndNonNegative(cornerRadius.TopRight) && Utility.IsDoubleFiniteAndNonNegative(cornerRadius.BottomLeft) && Utility.IsDoubleFiniteAndNonNegative(cornerRadius.BottomRight); - } + public static bool IsCornerRadiusValid(CornerRadius cornerRadius) + { + return Utility.IsDoubleFiniteAndNonNegative(cornerRadius.TopLeft) && Utility.IsDoubleFiniteAndNonNegative(cornerRadius.TopRight) && Utility.IsDoubleFiniteAndNonNegative(cornerRadius.BottomLeft) && Utility.IsDoubleFiniteAndNonNegative(cornerRadius.BottomRight); + } - public static bool IsDoubleFiniteAndNonNegative(double d) - { - return !double.IsNaN(d) && !double.IsInfinity(d) && d >= 0.0; - } + public static bool IsDoubleFiniteAndNonNegative(double d) + { + return !double.IsNaN(d) && !double.IsInfinity(d) && d >= 0.0; + } - private static readonly Version _osVersion = Environment.OSVersion.Version; + private static readonly Version _osVersion = Environment.OSVersion.Version; - private static readonly Version _presentationFrameworkVersion = Assembly.GetAssembly(typeof(Window)).GetName().Version; + private static readonly Version _presentationFrameworkVersion = Assembly.GetAssembly(typeof(Window)).GetName().Version; - private static int s_bitDepth; + private static int s_bitDepth; - private class _UrlDecoder - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public _UrlDecoder(int size, Encoding encoding) - { - this._encoding = encoding; - this._charBuffer = new char[size]; - this._byteBuffer = new byte[size]; - } + private class _UrlDecoder + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public _UrlDecoder(int size, Encoding encoding) + { + this._encoding = encoding; + this._charBuffer = new char[size]; + this._byteBuffer = new byte[size]; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public void AddByte(byte b) - { - this._byteBuffer[this._byteCount++] = b; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public void AddByte(byte b) + { + this._byteBuffer[this._byteCount++] = b; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public void AddChar(char ch) - { - this._FlushBytes(); - this._charBuffer[this._charCount++] = ch; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public void AddChar(char ch) + { + this._FlushBytes(); + this._charBuffer[this._charCount++] = ch; + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private void _FlushBytes() - { - if (this._byteCount > 0) - { - this._charCount += this._encoding.GetChars(this._byteBuffer, 0, this._byteCount, this._charBuffer, this._charCount); - this._byteCount = 0; - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + private void _FlushBytes() + { + if (this._byteCount > 0) + { + this._charCount += this._encoding.GetChars(this._byteBuffer, 0, this._byteCount, this._charBuffer, this._charCount); + this._byteCount = 0; + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public string GetString() - { - this._FlushBytes(); - if (this._charCount > 0) - { - return new string(this._charBuffer, 0, this._charCount); - } - return ""; - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public string GetString() + { + this._FlushBytes(); + if (this._charCount > 0) + { + return new string(this._charBuffer, 0, this._charCount); + } + return ""; + } - private readonly Encoding _encoding; + private readonly Encoding _encoding; - private readonly char[] _charBuffer; + private readonly char[] _charBuffer; - private readonly byte[] _byteBuffer; + private readonly byte[] _byteBuffer; - private int _byteCount; + private int _byteCount; - private int _charCount; - } - } + private int _charCount; + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/Verify.cs b/src/Shared/Microsoft.Windows.Shell/Standard/Verify.cs index 3c60c625..728825ca 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/Verify.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/Verify.cs @@ -7,240 +7,240 @@ using System.Threading; namespace Standard { - internal static class Verify - { - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DebuggerStepThrough] - public static void IsApartmentState(ApartmentState requiredState, string message) - { - if (Thread.CurrentThread.GetApartmentState() != requiredState) - { - throw new InvalidOperationException(message); - } - } + internal static class Verify + { + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DebuggerStepThrough] + public static void IsApartmentState(ApartmentState requiredState, string message) + { + if (Thread.CurrentThread.GetApartmentState() != requiredState) + { + throw new InvalidOperationException(message); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1820:TestForEmptyStringsUsingStringLength")] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void IsNeitherNullNorEmpty(string value, string name) - { - if (value == null) - { - throw new ArgumentNullException(name, "The parameter can not be either null or empty."); - } - if ("" == value) - { - throw new ArgumentException("The parameter can not be either null or empty.", name); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1820:TestForEmptyStringsUsingStringLength")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void IsNeitherNullNorEmpty(string value, string name) + { + if (value == null) + { + throw new ArgumentNullException(name, "The parameter can not be either null or empty."); + } + if ("" == value) + { + throw new ArgumentException("The parameter can not be either null or empty.", name); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [SuppressMessage("Microsoft.Performance", "CA1820:TestForEmptyStringsUsingStringLength")] - [DebuggerStepThrough] - public static void IsNeitherNullNorWhitespace(string value, string name) - { - if (value == null) - { - throw new ArgumentNullException(name, "The parameter can not be either null or empty or consist only of white space characters."); - } - if ("" == value.Trim()) - { - throw new ArgumentException("The parameter can not be either null or empty or consist only of white space characters.", name); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Performance", "CA1820:TestForEmptyStringsUsingStringLength")] + [DebuggerStepThrough] + public static void IsNeitherNullNorWhitespace(string value, string name) + { + if (value == null) + { + throw new ArgumentNullException(name, "The parameter can not be either null or empty or consist only of white space characters."); + } + if ("" == value.Trim()) + { + throw new ArgumentException("The parameter can not be either null or empty or consist only of white space characters.", name); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DebuggerStepThrough] - public static void IsNotDefault(T obj, string name) where T : struct - { - T t = default(T); - if (t.Equals(obj)) - { - throw new ArgumentException("The parameter must not be the default value.", name); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DebuggerStepThrough] + public static void IsNotDefault(T obj, string name) where T : struct + { + T t = default(T); + if (t.Equals(obj)) + { + throw new ArgumentException("The parameter must not be the default value.", name); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void IsNotNull(T obj, string name) where T : class - { - if (obj == null) - { - throw new ArgumentNullException(name); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void IsNotNull(T obj, string name) where T : class + { + if (obj == null) + { + throw new ArgumentNullException(name); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DebuggerStepThrough] - public static void IsNull(T obj, string name) where T : class - { - if (obj != null) - { - throw new ArgumentException("The parameter must be null.", name); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DebuggerStepThrough] + public static void IsNull(T obj, string name) where T : class + { + if (obj != null) + { + throw new ArgumentException("The parameter must be null.", name); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void PropertyIsNotNull(T obj, string name) where T : class - { - if (obj == null) - { - throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "The property {0} cannot be null at this time.", new object[] - { - name - })); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void PropertyIsNotNull(T obj, string name) where T : class + { + if (obj == null) + { + throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "The property {0} cannot be null at this time.", new object[] + { + name + })); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void PropertyIsNull(T obj, string name) where T : class - { - if (obj != null) - { - throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "The property {0} must be null at this time.", new object[] - { - name - })); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void PropertyIsNull(T obj, string name) where T : class + { + if (obj != null) + { + throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "The property {0} must be null at this time.", new object[] + { + name + })); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DebuggerStepThrough] - public static void IsTrue(bool statement, string name) - { - if (!statement) - { - throw new ArgumentException("", name); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DebuggerStepThrough] + public static void IsTrue(bool statement, string name) + { + if (!statement) + { + throw new ArgumentException("", name); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void IsTrue(bool statement, string name, string message) - { - if (!statement) - { - throw new ArgumentException(message, name); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void IsTrue(bool statement, string name, string message) + { + if (!statement) + { + throw new ArgumentException(message, name); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void AreEqual(T expected, T actual, string parameterName, string message) - { - if (expected == null) - { - if (actual != null && !actual.Equals(expected)) - { - throw new ArgumentException(message, parameterName); - } - } - else if (!expected.Equals(actual)) - { - throw new ArgumentException(message, parameterName); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void AreEqual(T expected, T actual, string parameterName, string message) + { + if (expected == null) + { + if (actual != null && !actual.Equals(expected)) + { + throw new ArgumentException(message, parameterName); + } + } + else if (!expected.Equals(actual)) + { + throw new ArgumentException(message, parameterName); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void AreNotEqual(T notExpected, T actual, string parameterName, string message) - { - if (notExpected == null) - { - if (actual == null || actual.Equals(notExpected)) - { - throw new ArgumentException(message, parameterName); - } - } - else if (notExpected.Equals(actual)) - { - throw new ArgumentException(message, parameterName); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void AreNotEqual(T notExpected, T actual, string parameterName, string message) + { + if (notExpected == null) + { + if (actual == null || actual.Equals(notExpected)) + { + throw new ArgumentException(message, parameterName); + } + } + else if (notExpected.Equals(actual)) + { + throw new ArgumentException(message, parameterName); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void UriIsAbsolute(Uri uri, string parameterName) - { - Verify.IsNotNull(uri, parameterName); - if (!uri.IsAbsoluteUri) - { - throw new ArgumentException("The URI must be absolute.", parameterName); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void UriIsAbsolute(Uri uri, string parameterName) + { + Verify.IsNotNull(uri, parameterName); + if (!uri.IsAbsoluteUri) + { + throw new ArgumentException("The URI must be absolute.", parameterName); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DebuggerStepThrough] - public static void BoundedInteger(int lowerBoundInclusive, int value, int upperBoundExclusive, string parameterName) - { - if (value < lowerBoundInclusive || value >= upperBoundExclusive) - { - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The integer value must be bounded with [{0}, {1})", new object[] - { - lowerBoundInclusive, - upperBoundExclusive - }), parameterName); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DebuggerStepThrough] + public static void BoundedInteger(int lowerBoundInclusive, int value, int upperBoundExclusive, string parameterName) + { + if (value < lowerBoundInclusive || value >= upperBoundExclusive) + { + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The integer value must be bounded with [{0}, {1})", new object[] + { + lowerBoundInclusive, + upperBoundExclusive + }), parameterName); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void BoundedDoubleInc(double lowerBoundInclusive, double value, double upperBoundInclusive, string message, string parameter) - { - if (value < lowerBoundInclusive || value > upperBoundInclusive) - { - throw new ArgumentException(message, parameter); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void BoundedDoubleInc(double lowerBoundInclusive, double value, double upperBoundInclusive, string message, string parameter) + { + if (value < lowerBoundInclusive || value > upperBoundInclusive) + { + throw new ArgumentException(message, parameter); + } + } - [DebuggerStepThrough] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void TypeSupportsInterface(Type type, Type interfaceType, string parameterName) - { - Verify.IsNotNull(type, "type"); - Verify.IsNotNull(interfaceType, "interfaceType"); - if (type.GetInterface(interfaceType.Name) == null) - { - throw new ArgumentException("The type of this parameter does not support a required interface", parameterName); - } - } + [DebuggerStepThrough] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public static void TypeSupportsInterface(Type type, Type interfaceType, string parameterName) + { + Verify.IsNotNull(type, "type"); + Verify.IsNotNull(interfaceType, "interfaceType"); + if (type.GetInterface(interfaceType.Name) == null) + { + throw new ArgumentException("The type of this parameter does not support a required interface", parameterName); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DebuggerStepThrough] - public static void FileExists(string filePath, string parameterName) - { - Verify.IsNeitherNullNorEmpty(filePath, parameterName); - if (!File.Exists(filePath)) - { - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "No file exists at \"{0}\"", new object[] - { - filePath - }), parameterName); - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DebuggerStepThrough] + public static void FileExists(string filePath, string parameterName) + { + Verify.IsNeitherNullNorEmpty(filePath, parameterName); + if (!File.Exists(filePath)) + { + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "No file exists at \"{0}\"", new object[] + { + filePath + }), parameterName); + } + } - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - [DebuggerStepThrough] - internal static void ImplementsInterface(object parameter, Type interfaceType, string parameterName) - { - bool flag = false; - foreach (Type left in parameter.GetType().GetInterfaces()) - { - if (left == interfaceType) - { - flag = true; - break; - } - } - if (!flag) - { - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The parameter must implement interface {0}.", new object[] - { - interfaceType.ToString() - }), parameterName); - } - } - } + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [DebuggerStepThrough] + internal static void ImplementsInterface(object parameter, Type interfaceType, string parameterName) + { + bool flag = false; + foreach (Type left in parameter.GetType().GetInterfaces()) + { + if (left == interfaceType) + { + flag = true; + break; + } + } + if (!flag) + { + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The parameter must implement interface {0}.", new object[] + { + interfaceType.ToString() + }), parameterName); + } + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WIN32_FIND_DATAW.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WIN32_FIND_DATAW.cs index 62ab3a7f..2fe843b7 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WIN32_FIND_DATAW.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WIN32_FIND_DATAW.cs @@ -6,31 +6,31 @@ using System.Runtime.InteropServices.ComTypes; namespace Standard { - [BestFitMapping(false)] - [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal class WIN32_FIND_DATAW - { - public FileAttributes dwFileAttributes; + [BestFitMapping(false)] + [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal class WIN32_FIND_DATAW + { + public FileAttributes dwFileAttributes; - public System.Runtime.InteropServices.ComTypes.FILETIME ftCreationTime; + public System.Runtime.InteropServices.ComTypes.FILETIME ftCreationTime; - public System.Runtime.InteropServices.ComTypes.FILETIME ftLastAccessTime; + public System.Runtime.InteropServices.ComTypes.FILETIME ftLastAccessTime; - public System.Runtime.InteropServices.ComTypes.FILETIME ftLastWriteTime; + public System.Runtime.InteropServices.ComTypes.FILETIME ftLastWriteTime; - public int nFileSizeHigh; + public int nFileSizeHigh; - public int nFileSizeLow; + public int nFileSizeLow; - public int dwReserved0; + public int dwReserved0; - public int dwReserved1; + public int dwReserved1; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string cFileName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string cFileName; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] - public string cAlternateFileName; - } + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] + public string cAlternateFileName; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWPLACEMENT.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWPLACEMENT.cs index b121d09a..fcecee51 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWPLACEMENT.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWPLACEMENT.cs @@ -3,19 +3,19 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential)] - internal class WINDOWPLACEMENT - { - public int length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); + [StructLayout(LayoutKind.Sequential)] + internal class WINDOWPLACEMENT + { + public int length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); - public int flags; + public int flags; - public SW showCmd; + public SW showCmd; - public POINT ptMinPosition; + public POINT ptMinPosition; - public POINT ptMaxPosition; + public POINT ptMaxPosition; - public RECT rcNormalPosition; - } + public RECT rcNormalPosition; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWPOS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWPOS.cs index 282b504f..a8d47c04 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWPOS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWPOS.cs @@ -2,20 +2,20 @@ namespace Standard { - internal struct WINDOWPOS - { - public IntPtr hwnd; + internal struct WINDOWPOS + { + public IntPtr hwnd; - public IntPtr hwndInsertAfter; + public IntPtr hwndInsertAfter; - public int x; + public int x; - public int y; + public int y; - public int cx; + public int cx; - public int cy; + public int cy; - public int flags; - } + public int flags; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWTHEMEATTRIBUTETYPE.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWTHEMEATTRIBUTETYPE.cs index 3aea556e..efb25c87 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWTHEMEATTRIBUTETYPE.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WINDOWTHEMEATTRIBUTETYPE.cs @@ -2,8 +2,8 @@ namespace Standard { - internal enum WINDOWTHEMEATTRIBUTETYPE : uint - { - WTA_NONCLIENT = 1u - } + internal enum WINDOWTHEMEATTRIBUTETYPE : uint + { + WTA_NONCLIENT = 1u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WM.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WM.cs index 38e0077d..74f72600 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WM.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WM.cs @@ -2,138 +2,138 @@ namespace Standard { - internal enum WM - { - NULL, - CREATE, - DESTROY, - MOVE, - SIZE = 5, - ACTIVATE, - SETFOCUS, - KILLFOCUS, - ENABLE = 10, - SETREDRAW, - SETTEXT, - GETTEXT, - GETTEXTLENGTH, - PAINT, - CLOSE, - QUERYENDSESSION, - QUIT, - QUERYOPEN, - ERASEBKGND, - SYSCOLORCHANGE, - SHOWWINDOW = 24, - CTLCOLOR, - WININICHANGE, - SETTINGCHANGE = 26, - ACTIVATEAPP = 28, - SETCURSOR = 32, - MOUSEACTIVATE, - CHILDACTIVATE, - QUEUESYNC, - GETMINMAXINFO, - WINDOWPOSCHANGING = 70, - WINDOWPOSCHANGED, - CONTEXTMENU = 123, - STYLECHANGING, - STYLECHANGED, - DISPLAYCHANGE, - GETICON, - SETICON, - NCCREATE, - NCDESTROY, - NCCALCSIZE, - NCHITTEST, - NCPAINT, - NCACTIVATE, - GETDLGCODE, - SYNCPAINT, - NCMOUSEMOVE = 160, - NCLBUTTONDOWN, - NCLBUTTONUP, - NCLBUTTONDBLCLK, - NCRBUTTONDOWN, - NCRBUTTONUP, - NCRBUTTONDBLCLK, - NCMBUTTONDOWN, - NCMBUTTONUP, - NCMBUTTONDBLCLK, - SYSKEYDOWN = 260, - SYSKEYUP, - SYSCHAR, - SYSDEADCHAR, - COMMAND = 273, - SYSCOMMAND, - MOUSEMOVE = 512, - LBUTTONDOWN, - LBUTTONUP, - LBUTTONDBLCLK, - RBUTTONDOWN, - RBUTTONUP, - RBUTTONDBLCLK, - MBUTTONDOWN, - MBUTTONUP, - MBUTTONDBLCLK, - MOUSEWHEEL, - XBUTTONDOWN, - XBUTTONUP, - XBUTTONDBLCLK, - MOUSEHWHEEL, - PARENTNOTIFY = 528, - CAPTURECHANGED = 533, - POWERBROADCAST = 536, - DEVICECHANGE, - ENTERSIZEMOVE = 561, - EXITSIZEMOVE, - IME_SETCONTEXT = 641, - IME_NOTIFY, - IME_CONTROL, - IME_COMPOSITIONFULL, - IME_SELECT, - IME_CHAR, - IME_REQUEST = 648, - IME_KEYDOWN = 656, - IME_KEYUP, - NCMOUSELEAVE = 674, - TABLET_DEFBASE = 704, - TABLET_ADDED = 712, - TABLET_DELETED, - TABLET_FLICK = 715, - TABLET_QUERYSYSTEMGESTURESTATUS, - CUT = 768, - COPY, - PASTE, - CLEAR, - UNDO, - RENDERFORMAT, - RENDERALLFORMATS, - DESTROYCLIPBOARD, - DRAWCLIPBOARD, - PAINTCLIPBOARD, - VSCROLLCLIPBOARD, - SIZECLIPBOARD, - ASKCBFORMATNAME, - CHANGECBCHAIN, - HSCROLLCLIPBOARD, - QUERYNEWPALETTE, - PALETTEISCHANGING, - PALETTECHANGED, - HOTKEY, - PRINT = 791, - PRINTCLIENT, - APPCOMMAND, - THEMECHANGED, - DWMCOMPOSITIONCHANGED = 798, - DWMNCRENDERINGCHANGED, - DWMCOLORIZATIONCOLORCHANGED, - DWMWINDOWMAXIMIZEDCHANGE, - GETTITLEBARINFOEX = 831, - DWMSENDICONICTHUMBNAIL = 803, - DWMSENDICONICLIVEPREVIEWBITMAP = 806, - USER = 1024, - TRAYMOUSEMESSAGE = 2048, - APP = 32768 - } + internal enum WM + { + NULL, + CREATE, + DESTROY, + MOVE, + SIZE = 5, + ACTIVATE, + SETFOCUS, + KILLFOCUS, + ENABLE = 10, + SETREDRAW, + SETTEXT, + GETTEXT, + GETTEXTLENGTH, + PAINT, + CLOSE, + QUERYENDSESSION, + QUIT, + QUERYOPEN, + ERASEBKGND, + SYSCOLORCHANGE, + SHOWWINDOW = 24, + CTLCOLOR, + WININICHANGE, + SETTINGCHANGE = 26, + ACTIVATEAPP = 28, + SETCURSOR = 32, + MOUSEACTIVATE, + CHILDACTIVATE, + QUEUESYNC, + GETMINMAXINFO, + WINDOWPOSCHANGING = 70, + WINDOWPOSCHANGED, + CONTEXTMENU = 123, + STYLECHANGING, + STYLECHANGED, + DISPLAYCHANGE, + GETICON, + SETICON, + NCCREATE, + NCDESTROY, + NCCALCSIZE, + NCHITTEST, + NCPAINT, + NCACTIVATE, + GETDLGCODE, + SYNCPAINT, + NCMOUSEMOVE = 160, + NCLBUTTONDOWN, + NCLBUTTONUP, + NCLBUTTONDBLCLK, + NCRBUTTONDOWN, + NCRBUTTONUP, + NCRBUTTONDBLCLK, + NCMBUTTONDOWN, + NCMBUTTONUP, + NCMBUTTONDBLCLK, + SYSKEYDOWN = 260, + SYSKEYUP, + SYSCHAR, + SYSDEADCHAR, + COMMAND = 273, + SYSCOMMAND, + MOUSEMOVE = 512, + LBUTTONDOWN, + LBUTTONUP, + LBUTTONDBLCLK, + RBUTTONDOWN, + RBUTTONUP, + RBUTTONDBLCLK, + MBUTTONDOWN, + MBUTTONUP, + MBUTTONDBLCLK, + MOUSEWHEEL, + XBUTTONDOWN, + XBUTTONUP, + XBUTTONDBLCLK, + MOUSEHWHEEL, + PARENTNOTIFY = 528, + CAPTURECHANGED = 533, + POWERBROADCAST = 536, + DEVICECHANGE, + ENTERSIZEMOVE = 561, + EXITSIZEMOVE, + IME_SETCONTEXT = 641, + IME_NOTIFY, + IME_CONTROL, + IME_COMPOSITIONFULL, + IME_SELECT, + IME_CHAR, + IME_REQUEST = 648, + IME_KEYDOWN = 656, + IME_KEYUP, + NCMOUSELEAVE = 674, + TABLET_DEFBASE = 704, + TABLET_ADDED = 712, + TABLET_DELETED, + TABLET_FLICK = 715, + TABLET_QUERYSYSTEMGESTURESTATUS, + CUT = 768, + COPY, + PASTE, + CLEAR, + UNDO, + RENDERFORMAT, + RENDERALLFORMATS, + DESTROYCLIPBOARD, + DRAWCLIPBOARD, + PAINTCLIPBOARD, + VSCROLLCLIPBOARD, + SIZECLIPBOARD, + ASKCBFORMATNAME, + CHANGECBCHAIN, + HSCROLLCLIPBOARD, + QUERYNEWPALETTE, + PALETTEISCHANGING, + PALETTECHANGED, + HOTKEY, + PRINT = 791, + PRINTCLIENT, + APPCOMMAND, + THEMECHANGED, + DWMCOMPOSITIONCHANGED = 798, + DWMNCRENDERINGCHANGED, + DWMCOLORIZATIONCOLORCHANGED, + DWMWINDOWMAXIMIZEDCHANGE, + GETTITLEBARINFOEX = 831, + DWMSENDICONICTHUMBNAIL = 803, + DWMSENDICONICLIVEPREVIEWBITMAP = 806, + USER = 1024, + TRAYMOUSEMESSAGE = 2048, + APP = 32768 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WNDCLASSEX.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WNDCLASSEX.cs index 24ef66cb..e51076fb 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WNDCLASSEX.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WNDCLASSEX.cs @@ -3,33 +3,33 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal struct WNDCLASSEX - { - public int cbSize; + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct WNDCLASSEX + { + public int cbSize; - public CS style; + public CS style; - public WndProc lpfnWndProc; + public WndProc lpfnWndProc; - public int cbClsExtra; + public int cbClsExtra; - public int cbWndExtra; + public int cbWndExtra; - public IntPtr hInstance; + public IntPtr hInstance; - public IntPtr hIcon; + public IntPtr hIcon; - public IntPtr hCursor; + public IntPtr hCursor; - public IntPtr hbrBackground; + public IntPtr hbrBackground; - [MarshalAs(UnmanagedType.LPWStr)] - public string lpszMenuName; + [MarshalAs(UnmanagedType.LPWStr)] + public string lpszMenuName; - [MarshalAs(UnmanagedType.LPWStr)] - public string lpszClassName; + [MarshalAs(UnmanagedType.LPWStr)] + public string lpszClassName; - public IntPtr hIconSm; - } + public IntPtr hIconSm; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WS.cs index 33745706..451158a6 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WS.cs @@ -2,35 +2,35 @@ namespace Standard { - [Flags] - internal enum WS : uint - { - OVERLAPPED = 0u, - POPUP = 2147483648u, - CHILD = 1073741824u, - MINIMIZE = 536870912u, - VISIBLE = 268435456u, - DISABLED = 134217728u, - CLIPSIBLINGS = 67108864u, - CLIPCHILDREN = 33554432u, - MAXIMIZE = 16777216u, - BORDER = 8388608u, - DLGFRAME = 4194304u, - VSCROLL = 2097152u, - HSCROLL = 1048576u, - SYSMENU = 524288u, - THICKFRAME = 262144u, - GROUP = 131072u, - TABSTOP = 65536u, - MINIMIZEBOX = 131072u, - MAXIMIZEBOX = 65536u, - CAPTION = 12582912u, - TILED = 0u, - ICONIC = 536870912u, - SIZEBOX = 262144u, - TILEDWINDOW = 13565952u, - OVERLAPPEDWINDOW = 13565952u, - POPUPWINDOW = 2156396544u, - CHILDWINDOW = 1073741824u - } + [Flags] + internal enum WS : uint + { + OVERLAPPED = 0u, + POPUP = 2147483648u, + CHILD = 1073741824u, + MINIMIZE = 536870912u, + VISIBLE = 268435456u, + DISABLED = 134217728u, + CLIPSIBLINGS = 67108864u, + CLIPCHILDREN = 33554432u, + MAXIMIZE = 16777216u, + BORDER = 8388608u, + DLGFRAME = 4194304u, + VSCROLL = 2097152u, + HSCROLL = 1048576u, + SYSMENU = 524288u, + THICKFRAME = 262144u, + GROUP = 131072u, + TABSTOP = 65536u, + MINIMIZEBOX = 131072u, + MAXIMIZEBOX = 65536u, + CAPTION = 12582912u, + TILED = 0u, + ICONIC = 536870912u, + SIZEBOX = 262144u, + TILEDWINDOW = 13565952u, + OVERLAPPEDWINDOW = 13565952u, + POPUPWINDOW = 2156396544u, + CHILDWINDOW = 1073741824u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WS_EX.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WS_EX.cs index 8a6ef563..48621f69 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WS_EX.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WS_EX.cs @@ -2,35 +2,35 @@ namespace Standard { - [Flags] - internal enum WS_EX : uint - { - None = 0u, - DLGMODALFRAME = 1u, - NOPARENTNOTIFY = 4u, - TOPMOST = 8u, - ACCEPTFILES = 16u, - TRANSPARENT = 32u, - MDICHILD = 64u, - TOOLWINDOW = 128u, - WINDOWEDGE = 256u, - CLIENTEDGE = 512u, - CONTEXTHELP = 1024u, - RIGHT = 4096u, - LEFT = 0u, - RTLREADING = 8192u, - LTRREADING = 0u, - LEFTSCROLLBAR = 16384u, - RIGHTSCROLLBAR = 0u, - CONTROLPARENT = 65536u, - STATICEDGE = 131072u, - APPWINDOW = 262144u, - LAYERED = 524288u, - NOINHERITLAYOUT = 1048576u, - LAYOUTRTL = 4194304u, - COMPOSITED = 33554432u, - NOACTIVATE = 134217728u, - OVERLAPPEDWINDOW = 768u, - PALETTEWINDOW = 392u - } + [Flags] + internal enum WS_EX : uint + { + None = 0u, + DLGMODALFRAME = 1u, + NOPARENTNOTIFY = 4u, + TOPMOST = 8u, + ACCEPTFILES = 16u, + TRANSPARENT = 32u, + MDICHILD = 64u, + TOOLWINDOW = 128u, + WINDOWEDGE = 256u, + CLIENTEDGE = 512u, + CONTEXTHELP = 1024u, + RIGHT = 4096u, + LEFT = 0u, + RTLREADING = 8192u, + LTRREADING = 0u, + LEFTSCROLLBAR = 16384u, + RIGHTSCROLLBAR = 0u, + CONTROLPARENT = 65536u, + STATICEDGE = 131072u, + APPWINDOW = 262144u, + LAYERED = 524288u, + NOINHERITLAYOUT = 1048576u, + LAYOUTRTL = 4194304u, + COMPOSITED = 33554432u, + NOACTIVATE = 134217728u, + OVERLAPPEDWINDOW = 768u, + PALETTEWINDOW = 392u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WTA_OPTIONS.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WTA_OPTIONS.cs index efb3cf04..b67825ba 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WTA_OPTIONS.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WTA_OPTIONS.cs @@ -4,17 +4,17 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Explicit)] - internal struct WTA_OPTIONS - { - public const uint Size = 8u; + [StructLayout(LayoutKind.Explicit)] + internal struct WTA_OPTIONS + { + public const uint Size = 8u; - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Used by native code.")] - [FieldOffset(0)] - public WTNCA dwFlags; + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Used by native code.")] + [FieldOffset(0)] + public WTNCA dwFlags; - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Used by native code.")] - [FieldOffset(4)] - public WTNCA dwMask; - } + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Used by native code.")] + [FieldOffset(4)] + public WTNCA dwMask; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WTNCA.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WTNCA.cs index bb1c19cc..968626da 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WTNCA.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WTNCA.cs @@ -2,13 +2,13 @@ namespace Standard { - [Flags] - internal enum WTNCA : uint - { - NODRAWCAPTION = 1u, - NODRAWICON = 2u, - NOSYSMENU = 4u, - NOMIRRORHELP = 8u, - VALIDBITS = 15u - } + [Flags] + internal enum WTNCA : uint + { + NODRAWCAPTION = 1u, + NODRAWICON = 2u, + NOSYSMENU = 4u, + NOMIRRORHELP = 8u, + VALIDBITS = 15u + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WVR.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WVR.cs index 175cf689..22d2ef1e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WVR.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WVR.cs @@ -2,15 +2,15 @@ namespace Standard { - internal enum WVR - { - ALIGNTOP = 16, - ALIGNLEFT = 32, - ALIGNBOTTOM = 64, - ALIGNRIGHT = 128, - HREDRAW = 256, - VREDRAW = 512, - VALIDRECTS = 1024, - REDRAW = 768 - } + internal enum WVR + { + ALIGNTOP = 16, + ALIGNLEFT = 32, + ALIGNBOTTOM = 64, + ALIGNRIGHT = 128, + HREDRAW = 256, + VREDRAW = 512, + VALIDRECTS = 1024, + REDRAW = 768 + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/Win32Error.cs b/src/Shared/Microsoft.Windows.Shell/Standard/Win32Error.cs index 983a9cd2..9de228e5 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/Win32Error.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/Win32Error.cs @@ -4,124 +4,124 @@ using System.Runtime.InteropServices; namespace Standard { - [StructLayout(LayoutKind.Explicit)] - internal struct Win32Error - { - public Win32Error(int i) - { - this._value = i; - } + [StructLayout(LayoutKind.Explicit)] + internal struct Win32Error + { + public Win32Error(int i) + { + this._value = i; + } - public static explicit operator HRESULT(Win32Error error) - { - if (error._value <= 0) - { - return new HRESULT((uint)error._value); - } - return HRESULT.Make(true, Facility.Win32, error._value & 65535); - } + public static explicit operator HRESULT(Win32Error error) + { + if (error._value <= 0) + { + return new HRESULT((uint) error._value); + } + return HRESULT.Make(true, Facility.Win32, error._value & 65535); + } - public HRESULT ToHRESULT() - { - return (HRESULT)this; - } + public HRESULT ToHRESULT() + { + return (HRESULT) this; + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - public static Win32Error GetLastError() - { - return new Win32Error(Marshal.GetLastWin32Error()); - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + public static Win32Error GetLastError() + { + return new Win32Error(Marshal.GetLastWin32Error()); + } - public override bool Equals(object obj) - { - bool result; - try - { - result = (((Win32Error)obj)._value == this._value); - } - catch (InvalidCastException) - { - result = false; - } - return result; - } + public override bool Equals(object obj) + { + bool result; + try + { + result = (((Win32Error) obj)._value == this._value); + } + catch (InvalidCastException) + { + result = false; + } + return result; + } - public override int GetHashCode() - { - return this._value.GetHashCode(); - } + public override int GetHashCode() + { + return this._value.GetHashCode(); + } - public static bool operator ==(Win32Error errLeft, Win32Error errRight) - { - return errLeft._value == errRight._value; - } + public static bool operator ==(Win32Error errLeft, Win32Error errRight) + { + return errLeft._value == errRight._value; + } - public static bool operator !=(Win32Error errLeft, Win32Error errRight) - { - return !(errLeft == errRight); - } + public static bool operator !=(Win32Error errLeft, Win32Error errRight) + { + return !(errLeft == errRight); + } - [FieldOffset(0)] - private readonly int _value; + [FieldOffset(0)] + private readonly int _value; - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_SUCCESS = new Win32Error(0); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_SUCCESS = new Win32Error(0); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_INVALID_FUNCTION = new Win32Error(1); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_INVALID_FUNCTION = new Win32Error(1); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_FILE_NOT_FOUND = new Win32Error(2); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_FILE_NOT_FOUND = new Win32Error(2); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_PATH_NOT_FOUND = new Win32Error(3); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_PATH_NOT_FOUND = new Win32Error(3); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_TOO_MANY_OPEN_FILES = new Win32Error(4); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_TOO_MANY_OPEN_FILES = new Win32Error(4); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_ACCESS_DENIED = new Win32Error(5); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_ACCESS_DENIED = new Win32Error(5); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_INVALID_HANDLE = new Win32Error(6); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_INVALID_HANDLE = new Win32Error(6); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_OUTOFMEMORY = new Win32Error(14); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_OUTOFMEMORY = new Win32Error(14); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_NO_MORE_FILES = new Win32Error(18); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_NO_MORE_FILES = new Win32Error(18); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_SHARING_VIOLATION = new Win32Error(32); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_SHARING_VIOLATION = new Win32Error(32); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_INVALID_PARAMETER = new Win32Error(87); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_INVALID_PARAMETER = new Win32Error(87); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_INSUFFICIENT_BUFFER = new Win32Error(122); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_INSUFFICIENT_BUFFER = new Win32Error(122); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_NESTING_NOT_ALLOWED = new Win32Error(215); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_NESTING_NOT_ALLOWED = new Win32Error(215); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_KEY_DELETED = new Win32Error(1018); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_KEY_DELETED = new Win32Error(1018); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_NOT_FOUND = new Win32Error(1168); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_NOT_FOUND = new Win32Error(1168); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_NO_MATCH = new Win32Error(1169); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_NO_MATCH = new Win32Error(1169); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_BAD_DEVICE = new Win32Error(1200); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_BAD_DEVICE = new Win32Error(1200); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_CANCELLED = new Win32Error(1223); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_CANCELLED = new Win32Error(1223); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_CLASS_ALREADY_EXISTS = new Win32Error(1410); + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_CLASS_ALREADY_EXISTS = new Win32Error(1410); - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - public static readonly Win32Error ERROR_INVALID_DATATYPE = new Win32Error(1804); - } + [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] + public static readonly Win32Error ERROR_INVALID_DATATYPE = new Win32Error(1804); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/Win32Value.cs b/src/Shared/Microsoft.Windows.Shell/Standard/Win32Value.cs index 3066201a..86de85ae 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/Win32Value.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/Win32Value.cs @@ -2,20 +2,20 @@ namespace Standard { - internal static class Win32Value - { - public const uint MAX_PATH = 260u; + internal static class Win32Value + { + public const uint MAX_PATH = 260u; - public const uint INFOTIPSIZE = 1024u; + public const uint INFOTIPSIZE = 1024u; - public const uint TRUE = 1u; + public const uint TRUE = 1u; - public const uint FALSE = 0u; + public const uint FALSE = 0u; - public const uint sizeof_WCHAR = 2u; + public const uint sizeof_WCHAR = 2u; - public const uint sizeof_CHAR = 1u; + public const uint sizeof_CHAR = 1u; - public const uint sizeof_BOOL = 4u; - } + public const uint sizeof_BOOL = 4u; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WndProc.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WndProc.cs index 788859ce..b6257520 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WndProc.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WndProc.cs @@ -2,5 +2,5 @@ namespace Standard { - internal delegate IntPtr WndProc(IntPtr hwnd, WM uMsg, IntPtr wParam, IntPtr lParam); + internal delegate IntPtr WndProc(IntPtr hwnd, WM uMsg, IntPtr wParam, IntPtr lParam); } diff --git a/src/Shared/Microsoft.Windows.Shell/Standard/WndProcHook.cs b/src/Shared/Microsoft.Windows.Shell/Standard/WndProcHook.cs index 4f2269bf..cd6c3a0e 100644 --- a/src/Shared/Microsoft.Windows.Shell/Standard/WndProcHook.cs +++ b/src/Shared/Microsoft.Windows.Shell/Standard/WndProcHook.cs @@ -2,5 +2,5 @@ namespace Standard { - internal delegate IntPtr WndProcHook(IntPtr hwnd, WM uMsg, IntPtr wParam, IntPtr lParam, ref bool handled); + internal delegate IntPtr WndProcHook(IntPtr hwnd, WM uMsg, IntPtr wParam, IntPtr lParam, ref bool handled); } diff --git a/src/Shared/Microsoft.Windows.Shell/SystemCommands.cs b/src/Shared/Microsoft.Windows.Shell/SystemCommands.cs index 1e12892c..03b78a1e 100644 --- a/src/Shared/Microsoft.Windows.Shell/SystemCommands.cs +++ b/src/Shared/Microsoft.Windows.Shell/SystemCommands.cs @@ -6,72 +6,72 @@ using Standard; namespace Microsoft.Windows.Shell { - public static class SystemCommands - { - public static RoutedCommand CloseWindowCommand { get; private set; } = new RoutedCommand("CloseWindow", typeof(SystemCommands)); + public static class SystemCommands + { + public static RoutedCommand CloseWindowCommand { get; private set; } = new RoutedCommand("CloseWindow", typeof(SystemCommands)); - public static RoutedCommand MaximizeWindowCommand { get; private set; } = new RoutedCommand("MaximizeWindow", typeof(SystemCommands)); + public static RoutedCommand MaximizeWindowCommand { get; private set; } = new RoutedCommand("MaximizeWindow", typeof(SystemCommands)); - public static RoutedCommand MinimizeWindowCommand { get; private set; } = new RoutedCommand("MinimizeWindow", typeof(SystemCommands)); + public static RoutedCommand MinimizeWindowCommand { get; private set; } = new RoutedCommand("MinimizeWindow", typeof(SystemCommands)); - public static RoutedCommand RestoreWindowCommand { get; private set; } = new RoutedCommand("RestoreWindow", typeof(SystemCommands)); + public static RoutedCommand RestoreWindowCommand { get; private set; } = new RoutedCommand("RestoreWindow", typeof(SystemCommands)); - public static RoutedCommand ShowSystemMenuCommand { get; private set; } = new RoutedCommand("ShowSystemMenu", typeof(SystemCommands)); + public static RoutedCommand ShowSystemMenuCommand { get; private set; } = new RoutedCommand("ShowSystemMenu", typeof(SystemCommands)); - private static void _PostSystemCommand(Window window, SC command) - { - IntPtr handle = new WindowInteropHelper(window).Handle; - if (handle == IntPtr.Zero || !NativeMethods.IsWindow(handle)) - { - return; - } - NativeMethods.PostMessage(handle, WM.SYSCOMMAND, new IntPtr((int)command), IntPtr.Zero); - } + private static void _PostSystemCommand(Window window, SC command) + { + IntPtr handle = new WindowInteropHelper(window).Handle; + if (handle == IntPtr.Zero || !NativeMethods.IsWindow(handle)) + { + return; + } + NativeMethods.PostMessage(handle, WM.SYSCOMMAND, new IntPtr((int) command), IntPtr.Zero); + } - public static void CloseWindow(Window window) - { - Verify.IsNotNull(window, "window"); - SystemCommands._PostSystemCommand(window, SC.CLOSE); - } + public static void CloseWindow(Window window) + { + Verify.IsNotNull(window, "window"); + SystemCommands._PostSystemCommand(window, SC.CLOSE); + } - public static void MaximizeWindow(Window window) - { - Verify.IsNotNull(window, "window"); - SystemCommands._PostSystemCommand(window, SC.MAXIMIZE); - } + public static void MaximizeWindow(Window window) + { + Verify.IsNotNull(window, "window"); + SystemCommands._PostSystemCommand(window, SC.MAXIMIZE); + } - public static void MinimizeWindow(Window window) - { - Verify.IsNotNull(window, "window"); - SystemCommands._PostSystemCommand(window, SC.MINIMIZE); - } + public static void MinimizeWindow(Window window) + { + Verify.IsNotNull(window, "window"); + SystemCommands._PostSystemCommand(window, SC.MINIMIZE); + } - public static void RestoreWindow(Window window) - { - Verify.IsNotNull(window, "window"); - SystemCommands._PostSystemCommand(window, SC.RESTORE); - } + public static void RestoreWindow(Window window) + { + Verify.IsNotNull(window, "window"); + SystemCommands._PostSystemCommand(window, SC.RESTORE); + } - public static void ShowSystemMenu(Window window, Point screenLocation) - { - Verify.IsNotNull(window, "window"); - SystemCommands.ShowSystemMenuPhysicalCoordinates(window, DpiHelper.LogicalPixelsToDevice(screenLocation)); - } + public static void ShowSystemMenu(Window window, Point screenLocation) + { + Verify.IsNotNull(window, "window"); + SystemCommands.ShowSystemMenuPhysicalCoordinates(window, DpiHelper.LogicalPixelsToDevice(screenLocation)); + } - internal static void ShowSystemMenuPhysicalCoordinates(Window window, Point physicalScreenLocation) - { - Verify.IsNotNull(window, "window"); - IntPtr handle = new WindowInteropHelper(window).Handle; - if (handle == IntPtr.Zero || !NativeMethods.IsWindow(handle)) - { - return; - } - IntPtr systemMenu = NativeMethods.GetSystemMenu(handle, false); - uint num = NativeMethods.TrackPopupMenuEx(systemMenu, 256u, (int)physicalScreenLocation.X, (int)physicalScreenLocation.Y, handle, IntPtr.Zero); - if (num != 0u) - { - NativeMethods.PostMessage(handle, WM.SYSCOMMAND, new IntPtr((long)((ulong)num)), IntPtr.Zero); - } - } - } + internal static void ShowSystemMenuPhysicalCoordinates(Window window, Point physicalScreenLocation) + { + Verify.IsNotNull(window, "window"); + IntPtr handle = new WindowInteropHelper(window).Handle; + if (handle == IntPtr.Zero || !NativeMethods.IsWindow(handle)) + { + return; + } + IntPtr systemMenu = NativeMethods.GetSystemMenu(handle, false); + uint num = NativeMethods.TrackPopupMenuEx(systemMenu, 256u, (int) physicalScreenLocation.X, (int) physicalScreenLocation.Y, handle, IntPtr.Zero); + if (num != 0u) + { + NativeMethods.PostMessage(handle, WM.SYSCOMMAND, new IntPtr((long) ((ulong) num)), IntPtr.Zero); + } + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/SystemParameters2.cs b/src/Shared/Microsoft.Windows.Shell/SystemParameters2.cs index 9fc0517c..ad372fd0 100644 --- a/src/Shared/Microsoft.Windows.Shell/SystemParameters2.cs +++ b/src/Shared/Microsoft.Windows.Shell/SystemParameters2.cs @@ -10,534 +10,534 @@ using Standard; namespace Microsoft.Windows.Shell { - [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")] - public class SystemParameters2 : INotifyPropertyChanged - { - private void _InitializeIsGlassEnabled() - { - this.IsGlassEnabled = NativeMethods.DwmIsCompositionEnabled(); - } + [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")] + public class SystemParameters2 : INotifyPropertyChanged + { + private void _InitializeIsGlassEnabled() + { + this.IsGlassEnabled = NativeMethods.DwmIsCompositionEnabled(); + } - private void _UpdateIsGlassEnabled(IntPtr wParam, IntPtr lParam) - { - this._InitializeIsGlassEnabled(); - } + private void _UpdateIsGlassEnabled(IntPtr wParam, IntPtr lParam) + { + this._InitializeIsGlassEnabled(); + } - private void _InitializeGlassColor() - { - uint num; - bool flag; - NativeMethods.DwmGetColorizationColor(out num, out flag); - num |= (flag ? 4278190080u : 0u); - this.WindowGlassColor = Utility.ColorFromArgbDword(num); - SolidColorBrush solidColorBrush = new SolidColorBrush(this.WindowGlassColor); - solidColorBrush.Freeze(); - this.WindowGlassBrush = solidColorBrush; - } + private void _InitializeGlassColor() + { + uint num; + bool flag; + NativeMethods.DwmGetColorizationColor(out num, out flag); + num |= (flag ? 4278190080u : 0u); + this.WindowGlassColor = Utility.ColorFromArgbDword(num); + SolidColorBrush solidColorBrush = new SolidColorBrush(this.WindowGlassColor); + solidColorBrush.Freeze(); + this.WindowGlassBrush = solidColorBrush; + } - private void _UpdateGlassColor(IntPtr wParam, IntPtr lParam) - { - bool flag = lParam != IntPtr.Zero; - uint num = (uint)((int)wParam.ToInt64()); - num |= (flag ? 4278190080u : 0u); - this.WindowGlassColor = Utility.ColorFromArgbDword(num); - SolidColorBrush solidColorBrush = new SolidColorBrush(this.WindowGlassColor); - solidColorBrush.Freeze(); - this.WindowGlassBrush = solidColorBrush; - } + private void _UpdateGlassColor(IntPtr wParam, IntPtr lParam) + { + bool flag = lParam != IntPtr.Zero; + uint num = (uint) ((int) wParam.ToInt64()); + num |= (flag ? 4278190080u : 0u); + this.WindowGlassColor = Utility.ColorFromArgbDword(num); + SolidColorBrush solidColorBrush = new SolidColorBrush(this.WindowGlassColor); + solidColorBrush.Freeze(); + this.WindowGlassBrush = solidColorBrush; + } - private void _InitializeCaptionHeight() - { - Point devicePoint = new Point(0.0, (double)NativeMethods.GetSystemMetrics(SM.CYCAPTION)); - this.WindowCaptionHeight = DpiHelper.DevicePixelsToLogical(devicePoint).Y; - } + private void _InitializeCaptionHeight() + { + Point devicePoint = new Point(0.0, (double) NativeMethods.GetSystemMetrics(SM.CYCAPTION)); + this.WindowCaptionHeight = DpiHelper.DevicePixelsToLogical(devicePoint).Y; + } - private void _UpdateCaptionHeight(IntPtr wParam, IntPtr lParam) - { - this._InitializeCaptionHeight(); - } + private void _UpdateCaptionHeight(IntPtr wParam, IntPtr lParam) + { + this._InitializeCaptionHeight(); + } - private void _InitializeWindowResizeBorderThickness() - { - Size deviceSize = new Size((double)NativeMethods.GetSystemMetrics(SM.CXFRAME), (double)NativeMethods.GetSystemMetrics(SM.CYFRAME)); - Size size = DpiHelper.DeviceSizeToLogical(deviceSize); - this.WindowResizeBorderThickness = new Thickness(size.Width, size.Height, size.Width, size.Height); - } + private void _InitializeWindowResizeBorderThickness() + { + Size deviceSize = new Size((double) NativeMethods.GetSystemMetrics(SM.CXFRAME), (double) NativeMethods.GetSystemMetrics(SM.CYFRAME)); + Size size = DpiHelper.DeviceSizeToLogical(deviceSize); + this.WindowResizeBorderThickness = new Thickness(size.Width, size.Height, size.Width, size.Height); + } - private void _UpdateWindowResizeBorderThickness(IntPtr wParam, IntPtr lParam) - { - this._InitializeWindowResizeBorderThickness(); - } + private void _UpdateWindowResizeBorderThickness(IntPtr wParam, IntPtr lParam) + { + this._InitializeWindowResizeBorderThickness(); + } - private void _InitializeWindowNonClientFrameThickness() - { - Size deviceSize = new Size((double)NativeMethods.GetSystemMetrics(SM.CXFRAME), (double)NativeMethods.GetSystemMetrics(SM.CYFRAME)); - Size size = DpiHelper.DeviceSizeToLogical(deviceSize); - int systemMetrics = NativeMethods.GetSystemMetrics(SM.CYCAPTION); - double y = DpiHelper.DevicePixelsToLogical(new Point(0.0, (double)systemMetrics)).Y; - this.WindowNonClientFrameThickness = new Thickness(size.Width, size.Height + y, size.Width, size.Height); - } + private void _InitializeWindowNonClientFrameThickness() + { + Size deviceSize = new Size((double) NativeMethods.GetSystemMetrics(SM.CXFRAME), (double) NativeMethods.GetSystemMetrics(SM.CYFRAME)); + Size size = DpiHelper.DeviceSizeToLogical(deviceSize); + int systemMetrics = NativeMethods.GetSystemMetrics(SM.CYCAPTION); + double y = DpiHelper.DevicePixelsToLogical(new Point(0.0, (double) systemMetrics)).Y; + this.WindowNonClientFrameThickness = new Thickness(size.Width, size.Height + y, size.Width, size.Height); + } - private void _UpdateWindowNonClientFrameThickness(IntPtr wParam, IntPtr lParam) - { - this._InitializeWindowNonClientFrameThickness(); - } + private void _UpdateWindowNonClientFrameThickness(IntPtr wParam, IntPtr lParam) + { + this._InitializeWindowNonClientFrameThickness(); + } - private void _InitializeSmallIconSize() - { - this.SmallIconSize = new Size((double)NativeMethods.GetSystemMetrics(SM.CXSMICON), (double)NativeMethods.GetSystemMetrics(SM.CYSMICON)); - } + private void _InitializeSmallIconSize() + { + this.SmallIconSize = new Size((double) NativeMethods.GetSystemMetrics(SM.CXSMICON), (double) NativeMethods.GetSystemMetrics(SM.CYSMICON)); + } - private void _UpdateSmallIconSize(IntPtr wParam, IntPtr lParam) - { - this._InitializeSmallIconSize(); - } + private void _UpdateSmallIconSize(IntPtr wParam, IntPtr lParam) + { + this._InitializeSmallIconSize(); + } - private void _LegacyInitializeCaptionButtonLocation() - { - int systemMetrics = NativeMethods.GetSystemMetrics(SM.CXSIZE); - int systemMetrics2 = NativeMethods.GetSystemMetrics(SM.CYSIZE); - int num = NativeMethods.GetSystemMetrics(SM.CXFRAME) + NativeMethods.GetSystemMetrics(SM.CXEDGE); - int num2 = NativeMethods.GetSystemMetrics(SM.CYFRAME) + NativeMethods.GetSystemMetrics(SM.CYEDGE); - Rect windowCaptionButtonsLocation = new Rect(0.0, 0.0, (double)(systemMetrics * 3), (double)systemMetrics2); - windowCaptionButtonsLocation.Offset((double)(-(double)num) - windowCaptionButtonsLocation.Width, (double)num2); - this.WindowCaptionButtonsLocation = windowCaptionButtonsLocation; - } + private void _LegacyInitializeCaptionButtonLocation() + { + int systemMetrics = NativeMethods.GetSystemMetrics(SM.CXSIZE); + int systemMetrics2 = NativeMethods.GetSystemMetrics(SM.CYSIZE); + int num = NativeMethods.GetSystemMetrics(SM.CXFRAME) + NativeMethods.GetSystemMetrics(SM.CXEDGE); + int num2 = NativeMethods.GetSystemMetrics(SM.CYFRAME) + NativeMethods.GetSystemMetrics(SM.CYEDGE); + Rect windowCaptionButtonsLocation = new Rect(0.0, 0.0, (double) (systemMetrics * 3), (double) systemMetrics2); + windowCaptionButtonsLocation.Offset((double) (-(double) num) - windowCaptionButtonsLocation.Width, (double) num2); + this.WindowCaptionButtonsLocation = windowCaptionButtonsLocation; + } - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] - private void _InitializeCaptionButtonLocation() - { - if (!Utility.IsOSVistaOrNewer || !NativeMethods.IsThemeActive()) - { - this._LegacyInitializeCaptionButtonLocation(); - return; - } - TITLEBARINFOEX titlebarinfoex = new TITLEBARINFOEX - { - cbSize = Marshal.SizeOf(typeof(TITLEBARINFOEX)) - }; - IntPtr intPtr = Marshal.AllocHGlobal(titlebarinfoex.cbSize); - try - { - Marshal.StructureToPtr(titlebarinfoex, intPtr, false); - NativeMethods.ShowWindow(this._messageHwnd.Handle, SW.SHOW); - NativeMethods.SendMessage(this._messageHwnd.Handle, WM.GETTITLEBARINFOEX, IntPtr.Zero, intPtr); - titlebarinfoex = (TITLEBARINFOEX)Marshal.PtrToStructure(intPtr, typeof(TITLEBARINFOEX)); - } - finally - { - NativeMethods.ShowWindow(this._messageHwnd.Handle, SW.HIDE); - Utility.SafeFreeHGlobal(ref intPtr); - } - RECT rect = RECT.Union(titlebarinfoex.rgrect_CloseButton, titlebarinfoex.rgrect_MinimizeButton); - RECT windowRect = NativeMethods.GetWindowRect(this._messageHwnd.Handle); - Rect deviceRectangle = new Rect((double)(rect.Left - windowRect.Width - windowRect.Left), (double)(rect.Top - windowRect.Top), (double)rect.Width, (double)rect.Height); - Rect windowCaptionButtonsLocation = DpiHelper.DeviceRectToLogical(deviceRectangle); - this.WindowCaptionButtonsLocation = windowCaptionButtonsLocation; - } + [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] + private void _InitializeCaptionButtonLocation() + { + if (!Utility.IsOSVistaOrNewer || !NativeMethods.IsThemeActive()) + { + this._LegacyInitializeCaptionButtonLocation(); + return; + } + TITLEBARINFOEX titlebarinfoex = new TITLEBARINFOEX + { + cbSize = Marshal.SizeOf(typeof(TITLEBARINFOEX)) + }; + IntPtr intPtr = Marshal.AllocHGlobal(titlebarinfoex.cbSize); + try + { + Marshal.StructureToPtr(titlebarinfoex, intPtr, false); + NativeMethods.ShowWindow(this._messageHwnd.Handle, SW.SHOW); + NativeMethods.SendMessage(this._messageHwnd.Handle, WM.GETTITLEBARINFOEX, IntPtr.Zero, intPtr); + titlebarinfoex = (TITLEBARINFOEX) Marshal.PtrToStructure(intPtr, typeof(TITLEBARINFOEX)); + } + finally + { + NativeMethods.ShowWindow(this._messageHwnd.Handle, SW.HIDE); + Utility.SafeFreeHGlobal(ref intPtr); + } + RECT rect = RECT.Union(titlebarinfoex.rgrect_CloseButton, titlebarinfoex.rgrect_MinimizeButton); + RECT windowRect = NativeMethods.GetWindowRect(this._messageHwnd.Handle); + Rect deviceRectangle = new Rect((double) (rect.Left - windowRect.Width - windowRect.Left), (double) (rect.Top - windowRect.Top), (double) rect.Width, (double) rect.Height); + Rect windowCaptionButtonsLocation = DpiHelper.DeviceRectToLogical(deviceRectangle); + this.WindowCaptionButtonsLocation = windowCaptionButtonsLocation; + } - private void _UpdateCaptionButtonLocation(IntPtr wParam, IntPtr lParam) - { - this._InitializeCaptionButtonLocation(); - } + private void _UpdateCaptionButtonLocation(IntPtr wParam, IntPtr lParam) + { + this._InitializeCaptionButtonLocation(); + } - private void _InitializeHighContrast() - { - this.HighContrast = ((NativeMethods.SystemParameterInfo_GetHIGHCONTRAST().dwFlags & HCF.HIGHCONTRASTON) != (HCF)0); - } + private void _InitializeHighContrast() + { + this.HighContrast = ((NativeMethods.SystemParameterInfo_GetHIGHCONTRAST().dwFlags & HCF.HIGHCONTRASTON) != (HCF) 0); + } - private void _UpdateHighContrast(IntPtr wParam, IntPtr lParam) - { - this._InitializeHighContrast(); - } + private void _UpdateHighContrast(IntPtr wParam, IntPtr lParam) + { + this._InitializeHighContrast(); + } - private void _InitializeThemeInfo() - { - if (!NativeMethods.IsThemeActive()) - { - this.UxThemeName = "Classic"; - this.UxThemeColor = ""; - return; - } - string path; - string uxThemeColor; - string text; - NativeMethods.GetCurrentThemeName(out path, out uxThemeColor, out text); - this.UxThemeName = Path.GetFileNameWithoutExtension(path); - this.UxThemeColor = uxThemeColor; - } + private void _InitializeThemeInfo() + { + if (!NativeMethods.IsThemeActive()) + { + this.UxThemeName = "Classic"; + this.UxThemeColor = ""; + return; + } + string path; + string uxThemeColor; + string text; + NativeMethods.GetCurrentThemeName(out path, out uxThemeColor, out text); + this.UxThemeName = Path.GetFileNameWithoutExtension(path); + this.UxThemeColor = uxThemeColor; + } - private void _UpdateThemeInfo(IntPtr wParam, IntPtr lParam) - { - this._InitializeThemeInfo(); - } + private void _UpdateThemeInfo(IntPtr wParam, IntPtr lParam) + { + this._InitializeThemeInfo(); + } - private void _InitializeWindowCornerRadius() - { - CornerRadius windowCornerRadius = default(CornerRadius); - string a; - if ((a = this.UxThemeName.ToUpperInvariant()) != null) - { - if (a == "LUNA") - { - windowCornerRadius = new CornerRadius(6.0, 6.0, 0.0, 0.0); - goto IL_E6; - } - if (!(a == "AERO")) - { - if (!(a == "CLASSIC") && !(a == "ZUNE") && !(a == "ROYALE")) - { - } - } - else - { - if (NativeMethods.DwmIsCompositionEnabled()) - { - windowCornerRadius = new CornerRadius(8.0); - goto IL_E6; - } - windowCornerRadius = new CornerRadius(6.0, 6.0, 0.0, 0.0); - goto IL_E6; - } - } - windowCornerRadius = new CornerRadius(0.0); - IL_E6: - this.WindowCornerRadius = windowCornerRadius; - } + private void _InitializeWindowCornerRadius() + { + CornerRadius windowCornerRadius = default(CornerRadius); + string a; + if ((a = this.UxThemeName.ToUpperInvariant()) != null) + { + if (a == "LUNA") + { + windowCornerRadius = new CornerRadius(6.0, 6.0, 0.0, 0.0); + goto IL_E6; + } + if (!(a == "AERO")) + { + if (!(a == "CLASSIC") && !(a == "ZUNE") && !(a == "ROYALE")) + { + } + } + else + { + if (NativeMethods.DwmIsCompositionEnabled()) + { + windowCornerRadius = new CornerRadius(8.0); + goto IL_E6; + } + windowCornerRadius = new CornerRadius(6.0, 6.0, 0.0, 0.0); + goto IL_E6; + } + } + windowCornerRadius = new CornerRadius(0.0); +IL_E6: + this.WindowCornerRadius = windowCornerRadius; + } - private void _UpdateWindowCornerRadius(IntPtr wParam, IntPtr lParam) - { - this._InitializeWindowCornerRadius(); - } + private void _UpdateWindowCornerRadius(IntPtr wParam, IntPtr lParam) + { + this._InitializeWindowCornerRadius(); + } - private SystemParameters2() - { - this._messageHwnd = new MessageWindow((CS)0u, WS.DISABLED | WS.BORDER | WS.DLGFRAME | WS.SYSMENU | WS.THICKFRAME | WS.GROUP | WS.TABSTOP, WS_EX.None, new Rect(-16000.0, -16000.0, 100.0, 100.0), "", new WndProc(this._WndProc)); - this._messageHwnd.Dispatcher.ShutdownStarted += delegate(object sender, EventArgs e) - { - Utility.SafeDispose(ref this._messageHwnd); - }; - this._InitializeIsGlassEnabled(); - this._InitializeGlassColor(); - this._InitializeCaptionHeight(); - this._InitializeWindowNonClientFrameThickness(); - this._InitializeWindowResizeBorderThickness(); - this._InitializeCaptionButtonLocation(); - this._InitializeSmallIconSize(); - this._InitializeHighContrast(); - this._InitializeThemeInfo(); - this._InitializeWindowCornerRadius(); - this._UpdateTable = new Dictionary> - { - { - WM.THEMECHANGED, - new List - { - new SystemParameters2._SystemMetricUpdate(this._UpdateThemeInfo), - new SystemParameters2._SystemMetricUpdate(this._UpdateHighContrast), - new SystemParameters2._SystemMetricUpdate(this._UpdateWindowCornerRadius), - new SystemParameters2._SystemMetricUpdate(this._UpdateCaptionButtonLocation) - } - }, - { - WM.WININICHANGE, - new List - { - new SystemParameters2._SystemMetricUpdate(this._UpdateCaptionHeight), - new SystemParameters2._SystemMetricUpdate(this._UpdateWindowResizeBorderThickness), - new SystemParameters2._SystemMetricUpdate(this._UpdateSmallIconSize), - new SystemParameters2._SystemMetricUpdate(this._UpdateHighContrast), - new SystemParameters2._SystemMetricUpdate(this._UpdateWindowNonClientFrameThickness), - new SystemParameters2._SystemMetricUpdate(this._UpdateCaptionButtonLocation) - } - }, - { - WM.DWMNCRENDERINGCHANGED, - new List - { - new SystemParameters2._SystemMetricUpdate(this._UpdateIsGlassEnabled) - } - }, - { - WM.DWMCOMPOSITIONCHANGED, - new List - { - new SystemParameters2._SystemMetricUpdate(this._UpdateIsGlassEnabled) - } - }, - { - WM.DWMCOLORIZATIONCOLORCHANGED, - new List - { - new SystemParameters2._SystemMetricUpdate(this._UpdateGlassColor) - } - } - }; - } + private SystemParameters2() + { + this._messageHwnd = new MessageWindow((CS) 0u, WS.DISABLED | WS.BORDER | WS.DLGFRAME | WS.SYSMENU | WS.THICKFRAME | WS.GROUP | WS.TABSTOP, WS_EX.None, new Rect(-16000.0, -16000.0, 100.0, 100.0), "", new WndProc(this._WndProc)); + this._messageHwnd.Dispatcher.ShutdownStarted += delegate (object sender, EventArgs e) + { + Utility.SafeDispose(ref this._messageHwnd); + }; + this._InitializeIsGlassEnabled(); + this._InitializeGlassColor(); + this._InitializeCaptionHeight(); + this._InitializeWindowNonClientFrameThickness(); + this._InitializeWindowResizeBorderThickness(); + this._InitializeCaptionButtonLocation(); + this._InitializeSmallIconSize(); + this._InitializeHighContrast(); + this._InitializeThemeInfo(); + this._InitializeWindowCornerRadius(); + this._UpdateTable = new Dictionary> + { + { + WM.THEMECHANGED, + new List + { + new SystemParameters2._SystemMetricUpdate(this._UpdateThemeInfo), + new SystemParameters2._SystemMetricUpdate(this._UpdateHighContrast), + new SystemParameters2._SystemMetricUpdate(this._UpdateWindowCornerRadius), + new SystemParameters2._SystemMetricUpdate(this._UpdateCaptionButtonLocation) + } + }, + { + WM.WININICHANGE, + new List + { + new SystemParameters2._SystemMetricUpdate(this._UpdateCaptionHeight), + new SystemParameters2._SystemMetricUpdate(this._UpdateWindowResizeBorderThickness), + new SystemParameters2._SystemMetricUpdate(this._UpdateSmallIconSize), + new SystemParameters2._SystemMetricUpdate(this._UpdateHighContrast), + new SystemParameters2._SystemMetricUpdate(this._UpdateWindowNonClientFrameThickness), + new SystemParameters2._SystemMetricUpdate(this._UpdateCaptionButtonLocation) + } + }, + { + WM.DWMNCRENDERINGCHANGED, + new List + { + new SystemParameters2._SystemMetricUpdate(this._UpdateIsGlassEnabled) + } + }, + { + WM.DWMCOMPOSITIONCHANGED, + new List + { + new SystemParameters2._SystemMetricUpdate(this._UpdateIsGlassEnabled) + } + }, + { + WM.DWMCOLORIZATIONCOLORCHANGED, + new List + { + new SystemParameters2._SystemMetricUpdate(this._UpdateGlassColor) + } + } + }; + } - public static SystemParameters2 Current - { - get - { - if (SystemParameters2._threadLocalSingleton == null) - { - SystemParameters2._threadLocalSingleton = new SystemParameters2(); - } - return SystemParameters2._threadLocalSingleton; - } - } + public static SystemParameters2 Current + { + get + { + if (SystemParameters2._threadLocalSingleton == null) + { + SystemParameters2._threadLocalSingleton = new SystemParameters2(); + } + return SystemParameters2._threadLocalSingleton; + } + } - private IntPtr _WndProc(IntPtr hwnd, WM msg, IntPtr wParam, IntPtr lParam) - { - List list; - if (this._UpdateTable != null && this._UpdateTable.TryGetValue(msg, out list)) - { - foreach (SystemParameters2._SystemMetricUpdate systemMetricUpdate in list) - { - systemMetricUpdate(wParam, lParam); - } - } - return NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam); - } + private IntPtr _WndProc(IntPtr hwnd, WM msg, IntPtr wParam, IntPtr lParam) + { + List list; + if (this._UpdateTable != null && this._UpdateTable.TryGetValue(msg, out list)) + { + foreach (SystemParameters2._SystemMetricUpdate systemMetricUpdate in list) + { + systemMetricUpdate(wParam, lParam); + } + } + return NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam); + } - public bool IsGlassEnabled - { - get - { - return NativeMethods.DwmIsCompositionEnabled(); - } - private set - { - if (value != this._isGlassEnabled) - { - this._isGlassEnabled = value; - this._NotifyPropertyChanged("IsGlassEnabled"); - } - } - } + public bool IsGlassEnabled + { + get + { + return NativeMethods.DwmIsCompositionEnabled(); + } + private set + { + if (value != this._isGlassEnabled) + { + this._isGlassEnabled = value; + this._NotifyPropertyChanged("IsGlassEnabled"); + } + } + } - public Color WindowGlassColor - { - get - { - return this._glassColor; - } - private set - { - if (value != this._glassColor) - { - this._glassColor = value; - this._NotifyPropertyChanged("WindowGlassColor"); - } - } - } + public Color WindowGlassColor + { + get + { + return this._glassColor; + } + private set + { + if (value != this._glassColor) + { + this._glassColor = value; + this._NotifyPropertyChanged("WindowGlassColor"); + } + } + } - public SolidColorBrush WindowGlassBrush - { - get - { - return this._glassColorBrush; - } - private set - { - if (this._glassColorBrush == null || value.Color != this._glassColorBrush.Color) - { - this._glassColorBrush = value; - this._NotifyPropertyChanged("WindowGlassBrush"); - } - } - } + public SolidColorBrush WindowGlassBrush + { + get + { + return this._glassColorBrush; + } + private set + { + if (this._glassColorBrush == null || value.Color != this._glassColorBrush.Color) + { + this._glassColorBrush = value; + this._NotifyPropertyChanged("WindowGlassBrush"); + } + } + } - public Thickness WindowResizeBorderThickness - { - get - { - return this._windowResizeBorderThickness; - } - private set - { - if (value != this._windowResizeBorderThickness) - { - this._windowResizeBorderThickness = value; - this._NotifyPropertyChanged("WindowResizeBorderThickness"); - } - } - } + public Thickness WindowResizeBorderThickness + { + get + { + return this._windowResizeBorderThickness; + } + private set + { + if (value != this._windowResizeBorderThickness) + { + this._windowResizeBorderThickness = value; + this._NotifyPropertyChanged("WindowResizeBorderThickness"); + } + } + } - public Thickness WindowNonClientFrameThickness - { - get - { - return this._windowNonClientFrameThickness; - } - private set - { - if (value != this._windowNonClientFrameThickness) - { - this._windowNonClientFrameThickness = value; - this._NotifyPropertyChanged("WindowNonClientFrameThickness"); - } - } - } + public Thickness WindowNonClientFrameThickness + { + get + { + return this._windowNonClientFrameThickness; + } + private set + { + if (value != this._windowNonClientFrameThickness) + { + this._windowNonClientFrameThickness = value; + this._NotifyPropertyChanged("WindowNonClientFrameThickness"); + } + } + } - public double WindowCaptionHeight - { - get - { - return this._captionHeight; - } - private set - { - if (value != this._captionHeight) - { - this._captionHeight = value; - this._NotifyPropertyChanged("WindowCaptionHeight"); - } - } - } + public double WindowCaptionHeight + { + get + { + return this._captionHeight; + } + private set + { + if (value != this._captionHeight) + { + this._captionHeight = value; + this._NotifyPropertyChanged("WindowCaptionHeight"); + } + } + } - public Size SmallIconSize - { - get - { - return new Size(this._smallIconSize.Width, this._smallIconSize.Height); - } - private set - { - if (value != this._smallIconSize) - { - this._smallIconSize = value; - this._NotifyPropertyChanged("SmallIconSize"); - } - } - } + public Size SmallIconSize + { + get + { + return new Size(this._smallIconSize.Width, this._smallIconSize.Height); + } + private set + { + if (value != this._smallIconSize) + { + this._smallIconSize = value; + this._NotifyPropertyChanged("SmallIconSize"); + } + } + } - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Ux")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ux")] - public string UxThemeName - { - get - { - return this._uxThemeName; - } - private set - { - if (value != this._uxThemeName) - { - this._uxThemeName = value; - this._NotifyPropertyChanged("UxThemeName"); - } - } - } + [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Ux")] + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ux")] + public string UxThemeName + { + get + { + return this._uxThemeName; + } + private set + { + if (value != this._uxThemeName) + { + this._uxThemeName = value; + this._NotifyPropertyChanged("UxThemeName"); + } + } + } - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Ux")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ux")] - public string UxThemeColor - { - get - { - return this._uxThemeColor; - } - private set - { - if (value != this._uxThemeColor) - { - this._uxThemeColor = value; - this._NotifyPropertyChanged("UxThemeColor"); - } - } - } + [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Ux")] + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ux")] + public string UxThemeColor + { + get + { + return this._uxThemeColor; + } + private set + { + if (value != this._uxThemeColor) + { + this._uxThemeColor = value; + this._NotifyPropertyChanged("UxThemeColor"); + } + } + } - public bool HighContrast - { - get - { - return this._isHighContrast; - } - private set - { - if (value != this._isHighContrast) - { - this._isHighContrast = value; - this._NotifyPropertyChanged("HighContrast"); - } - } - } + public bool HighContrast + { + get + { + return this._isHighContrast; + } + private set + { + if (value != this._isHighContrast) + { + this._isHighContrast = value; + this._NotifyPropertyChanged("HighContrast"); + } + } + } - public CornerRadius WindowCornerRadius - { - get - { - return this._windowCornerRadius; - } - private set - { - if (value != this._windowCornerRadius) - { - this._windowCornerRadius = value; - this._NotifyPropertyChanged("WindowCornerRadius"); - } - } - } + public CornerRadius WindowCornerRadius + { + get + { + return this._windowCornerRadius; + } + private set + { + if (value != this._windowCornerRadius) + { + this._windowCornerRadius = value; + this._NotifyPropertyChanged("WindowCornerRadius"); + } + } + } - public Rect WindowCaptionButtonsLocation - { - get - { - return this._captionButtonLocation; - } - private set - { - if (value != this._captionButtonLocation) - { - this._captionButtonLocation = value; - this._NotifyPropertyChanged("WindowCaptionButtonsLocation"); - } - } - } + public Rect WindowCaptionButtonsLocation + { + get + { + return this._captionButtonLocation; + } + private set + { + if (value != this._captionButtonLocation) + { + this._captionButtonLocation = value; + this._NotifyPropertyChanged("WindowCaptionButtonsLocation"); + } + } + } - private void _NotifyPropertyChanged(string propertyName) - { - PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if (propertyChanged != null) - { - propertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - } + private void _NotifyPropertyChanged(string propertyName) + { + PropertyChangedEventHandler propertyChanged = this.PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - [ThreadStatic] - private static SystemParameters2 _threadLocalSingleton; + [ThreadStatic] + private static SystemParameters2 _threadLocalSingleton; - private MessageWindow _messageHwnd; + private MessageWindow _messageHwnd; - private bool _isGlassEnabled; + private bool _isGlassEnabled; - private Color _glassColor; + private Color _glassColor; - private SolidColorBrush _glassColorBrush; + private SolidColorBrush _glassColorBrush; - private Thickness _windowResizeBorderThickness; + private Thickness _windowResizeBorderThickness; - private Thickness _windowNonClientFrameThickness; + private Thickness _windowNonClientFrameThickness; - private double _captionHeight; + private double _captionHeight; - private Size _smallIconSize; + private Size _smallIconSize; - private string _uxThemeName; + private string _uxThemeName; - private string _uxThemeColor; + private string _uxThemeColor; - private bool _isHighContrast; + private bool _isHighContrast; - private CornerRadius _windowCornerRadius; + private CornerRadius _windowCornerRadius; - private Rect _captionButtonLocation; + private Rect _captionButtonLocation; - private readonly Dictionary> _UpdateTable; + private readonly Dictionary> _UpdateTable; - private delegate void _SystemMetricUpdate(IntPtr wParam, IntPtr lParam); - } + private delegate void _SystemMetricUpdate(IntPtr wParam, IntPtr lParam); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/TaskbarItemInfo.cs b/src/Shared/Microsoft.Windows.Shell/TaskbarItemInfo.cs index a3bfdbdb..17332fb2 100644 --- a/src/Shared/Microsoft.Windows.Shell/TaskbarItemInfo.cs +++ b/src/Shared/Microsoft.Windows.Shell/TaskbarItemInfo.cs @@ -8,632 +8,632 @@ using Standard; namespace Microsoft.Windows.Shell { - public sealed class TaskbarItemInfo : Freezable - { - protected override Freezable CreateInstanceCore() - { - return new TaskbarItemInfo(); - } + public sealed class TaskbarItemInfo : Freezable + { + protected override Freezable CreateInstanceCore() + { + return new TaskbarItemInfo(); + } - [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] - public static TaskbarItemInfo GetTaskbarItemInfo(Window window) - { - Verify.IsNotNull(window, "window"); - return (TaskbarItemInfo)window.GetValue(TaskbarItemInfo.TaskbarItemInfoProperty); - } + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] + public static TaskbarItemInfo GetTaskbarItemInfo(Window window) + { + Verify.IsNotNull(window, "window"); + return (TaskbarItemInfo) window.GetValue(TaskbarItemInfo.TaskbarItemInfoProperty); + } - [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] - public static void SetTaskbarItemInfo(Window window, TaskbarItemInfo value) - { - Verify.IsNotNull(window, "window"); - window.SetValue(TaskbarItemInfo.TaskbarItemInfoProperty, value); - } + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] + public static void SetTaskbarItemInfo(Window window, TaskbarItemInfo value) + { + Verify.IsNotNull(window, "window"); + window.SetValue(TaskbarItemInfo.TaskbarItemInfoProperty, value); + } - private static void _OnTaskbarItemInfoChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (DesignerProperties.GetIsInDesignMode(d)) - { - return; - } - Window window = (Window)d; - TaskbarItemInfo taskbarItemInfo = (TaskbarItemInfo)e.OldValue; - TaskbarItemInfo taskbarItemInfo2 = (TaskbarItemInfo)e.NewValue; - if (taskbarItemInfo == taskbarItemInfo2) - { - return; - } - if (!Utility.IsOSWindows7OrNewer) - { - return; - } - if (taskbarItemInfo != null && taskbarItemInfo._window != null) - { - taskbarItemInfo._DetachWindow(); - } - if (taskbarItemInfo2 != null) - { - taskbarItemInfo2._SetWindow(window); - } - } + private static void _OnTaskbarItemInfoChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + if (DesignerProperties.GetIsInDesignMode(d)) + { + return; + } + Window window = (Window) d; + TaskbarItemInfo taskbarItemInfo = (TaskbarItemInfo) e.OldValue; + TaskbarItemInfo taskbarItemInfo2 = (TaskbarItemInfo) e.NewValue; + if (taskbarItemInfo == taskbarItemInfo2) + { + return; + } + if (!Utility.IsOSWindows7OrNewer) + { + return; + } + if (taskbarItemInfo != null && taskbarItemInfo._window != null) + { + taskbarItemInfo._DetachWindow(); + } + if (taskbarItemInfo2 != null) + { + taskbarItemInfo2._SetWindow(window); + } + } - private static object _CoerceTaskbarItemInfoValue(DependencyObject d, object value) - { - if (DesignerProperties.GetIsInDesignMode(d)) - { - return value; - } - Verify.IsNotNull(d, "d"); - Window window = (Window)d; - TaskbarItemInfo taskbarItemInfo = (TaskbarItemInfo)value; - if (taskbarItemInfo != null && taskbarItemInfo._window != null && taskbarItemInfo._window != window) - { - throw new NotSupportedException(); - } - window.VerifyAccess(); - return taskbarItemInfo; - } + private static object _CoerceTaskbarItemInfoValue(DependencyObject d, object value) + { + if (DesignerProperties.GetIsInDesignMode(d)) + { + return value; + } + Verify.IsNotNull(d, "d"); + Window window = (Window) d; + TaskbarItemInfo taskbarItemInfo = (TaskbarItemInfo) value; + if (taskbarItemInfo != null && taskbarItemInfo._window != null && taskbarItemInfo._window != window) + { + throw new NotSupportedException(); + } + window.VerifyAccess(); + return taskbarItemInfo; + } - public TaskbarItemProgressState ProgressState - { - get - { - return (TaskbarItemProgressState)base.GetValue(TaskbarItemInfo.ProgressStateProperty); - } - set - { - base.SetValue(TaskbarItemInfo.ProgressStateProperty, value); - } - } + public TaskbarItemProgressState ProgressState + { + get + { + return (TaskbarItemProgressState) base.GetValue(TaskbarItemInfo.ProgressStateProperty); + } + set + { + base.SetValue(TaskbarItemInfo.ProgressStateProperty, value); + } + } - private void _OnProgressStateChanged() - { - if (!this._isAttached) - { - return; - } - this._UpdateProgressState(true); - } + private void _OnProgressStateChanged() + { + if (!this._isAttached) + { + return; + } + this._UpdateProgressState(true); + } - private static TaskbarItemProgressState _CoerceProgressState(TaskbarItemProgressState value) - { - switch (value) - { - case TaskbarItemProgressState.None: - case TaskbarItemProgressState.Indeterminate: - case TaskbarItemProgressState.Normal: - case TaskbarItemProgressState.Error: - case TaskbarItemProgressState.Paused: - break; - default: - value = TaskbarItemProgressState.None; - break; - } - return value; - } + private static TaskbarItemProgressState _CoerceProgressState(TaskbarItemProgressState value) + { + switch (value) + { + case TaskbarItemProgressState.None: + case TaskbarItemProgressState.Indeterminate: + case TaskbarItemProgressState.Normal: + case TaskbarItemProgressState.Error: + case TaskbarItemProgressState.Paused: + break; + default: + value = TaskbarItemProgressState.None; + break; + } + return value; + } - public double ProgressValue - { - get - { - return (double)base.GetValue(TaskbarItemInfo.ProgressValueProperty); - } - set - { - base.SetValue(TaskbarItemInfo.ProgressValueProperty, value); - } - } + public double ProgressValue + { + get + { + return (double) base.GetValue(TaskbarItemInfo.ProgressValueProperty); + } + set + { + base.SetValue(TaskbarItemInfo.ProgressValueProperty, value); + } + } - private void _OnProgressValueChanged() - { - if (!this._isAttached) - { - return; - } - this._UpdateProgressValue(true); - } + private void _OnProgressValueChanged() + { + if (!this._isAttached) + { + return; + } + this._UpdateProgressValue(true); + } - private static double _CoerceProgressValue(double progressValue) - { - if (double.IsNaN(progressValue)) - { - progressValue = 0.0; - } - progressValue = Math.Max(progressValue, 0.0); - progressValue = Math.Min(1.0, progressValue); - return progressValue; - } + private static double _CoerceProgressValue(double progressValue) + { + if (double.IsNaN(progressValue)) + { + progressValue = 0.0; + } + progressValue = Math.Max(progressValue, 0.0); + progressValue = Math.Min(1.0, progressValue); + return progressValue; + } - public ImageSource Overlay - { - get - { - return (ImageSource)base.GetValue(TaskbarItemInfo.OverlayProperty); - } - set - { - base.SetValue(TaskbarItemInfo.OverlayProperty, value); - } - } + public ImageSource Overlay + { + get + { + return (ImageSource) base.GetValue(TaskbarItemInfo.OverlayProperty); + } + set + { + base.SetValue(TaskbarItemInfo.OverlayProperty, value); + } + } - private void _OnOverlayChanged() - { - if (!this._isAttached) - { - return; - } - this._UpdateOverlay(true); - } + private void _OnOverlayChanged() + { + if (!this._isAttached) + { + return; + } + this._UpdateOverlay(true); + } - public string Description - { - get - { - return (string)base.GetValue(TaskbarItemInfo.DescriptionProperty); - } - set - { - base.SetValue(TaskbarItemInfo.DescriptionProperty, value); - } - } + public string Description + { + get + { + return (string) base.GetValue(TaskbarItemInfo.DescriptionProperty); + } + set + { + base.SetValue(TaskbarItemInfo.DescriptionProperty, value); + } + } - private void _OnDescriptionChanged() - { - if (!this._isAttached) - { - return; - } - this._UpdateTooltip(true); - } + private void _OnDescriptionChanged() + { + if (!this._isAttached) + { + return; + } + this._UpdateTooltip(true); + } - public Thickness ThumbnailClipMargin - { - get - { - return (Thickness)base.GetValue(TaskbarItemInfo.ThumbnailClipMarginProperty); - } - set - { - base.SetValue(TaskbarItemInfo.ThumbnailClipMarginProperty, value); - } - } + public Thickness ThumbnailClipMargin + { + get + { + return (Thickness) base.GetValue(TaskbarItemInfo.ThumbnailClipMarginProperty); + } + set + { + base.SetValue(TaskbarItemInfo.ThumbnailClipMarginProperty, value); + } + } - private void _OnThumbnailClipMarginChanged() - { - if (!this._isAttached) - { - return; - } - this._UpdateThumbnailClipping(true); - } + private void _OnThumbnailClipMarginChanged() + { + if (!this._isAttached) + { + return; + } + this._UpdateThumbnailClipping(true); + } - private static Thickness _CoerceThumbnailClipMargin(Thickness margin) - { - if (margin.Left < 0.0 || margin.Right < 0.0 || margin.Top < 0.0 || margin.Bottom < 0.0) - { - return TaskbarItemInfo._EmptyThickness; - } - return margin; - } + private static Thickness _CoerceThumbnailClipMargin(Thickness margin) + { + if (margin.Left < 0.0 || margin.Right < 0.0 || margin.Top < 0.0 || margin.Bottom < 0.0) + { + return TaskbarItemInfo._EmptyThickness; + } + return margin; + } - [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Infos")] - public ThumbButtonInfoCollection ThumbButtonInfos - { - get - { - return (ThumbButtonInfoCollection)base.GetValue(TaskbarItemInfo.ThumbButtonInfosProperty); - } - set - { - base.SetValue(TaskbarItemInfo.ThumbButtonInfosProperty, value); - } - } + [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Infos")] + public ThumbButtonInfoCollection ThumbButtonInfos + { + get + { + return (ThumbButtonInfoCollection) base.GetValue(TaskbarItemInfo.ThumbButtonInfosProperty); + } + set + { + base.SetValue(TaskbarItemInfo.ThumbButtonInfosProperty, value); + } + } - private void _OnThumbButtonsChanged() - { - if (!this._isAttached) - { - return; - } - this._UpdateThumbButtons(true); - } + private void _OnThumbButtonsChanged() + { + if (!this._isAttached) + { + return; + } + this._UpdateThumbButtons(true); + } - private IntPtr _GetHICONFromImageSource(ImageSource image, Size dimensions) - { - if (this._gdipToken == null) - { - this._gdipToken = SafeGdiplusStartupToken.Startup(); - } - return Utility.GenerateHICON(image, dimensions); - } + private IntPtr _GetHICONFromImageSource(ImageSource image, Size dimensions) + { + if (this._gdipToken == null) + { + this._gdipToken = SafeGdiplusStartupToken.Startup(); + } + return Utility.GenerateHICON(image, dimensions); + } - public TaskbarItemInfo() - { - if (!DesignerProperties.GetIsInDesignMode(this)) - { - ITaskbarList taskbarList = null; - try - { - taskbarList = CLSID.CoCreateInstance("56FDF344-FD6D-11d0-958A-006097C9A090"); - taskbarList.HrInit(); - this._taskbarList = (taskbarList as ITaskbarList3); - taskbarList = null; - } - finally - { - Utility.SafeRelease(ref taskbarList); - } - this._overlaySize = new Size((double)NativeMethods.GetSystemMetrics(SM.CXSMICON), (double)NativeMethods.GetSystemMetrics(SM.CYSMICON)); - } - this.ThumbButtonInfos = new ThumbButtonInfoCollection(); - } + public TaskbarItemInfo() + { + if (!DesignerProperties.GetIsInDesignMode(this)) + { + ITaskbarList taskbarList = null; + try + { + taskbarList = CLSID.CoCreateInstance("56FDF344-FD6D-11d0-958A-006097C9A090"); + taskbarList.HrInit(); + this._taskbarList = (taskbarList as ITaskbarList3); + taskbarList = null; + } + finally + { + Utility.SafeRelease(ref taskbarList); + } + this._overlaySize = new Size((double) NativeMethods.GetSystemMetrics(SM.CXSMICON), (double) NativeMethods.GetSystemMetrics(SM.CYSMICON)); + } + this.ThumbButtonInfos = new ThumbButtonInfoCollection(); + } - private void _SetWindow(Window window) - { - if (window == null) - { - return; - } - this._window = window; - if (this._taskbarList == null) - { - return; - } - IntPtr handle = new WindowInteropHelper(this._window).Handle; - if (!(handle != IntPtr.Zero)) - { - this._window.SourceInitialized += this._OnWindowSourceInitialized; - return; - } - this._hwndSource = HwndSource.FromHwnd(handle); - this._hwndSource.AddHook(new HwndSourceHook(this._WndProc)); - this._OnIsAttachedChanged(true); - } + private void _SetWindow(Window window) + { + if (window == null) + { + return; + } + this._window = window; + if (this._taskbarList == null) + { + return; + } + IntPtr handle = new WindowInteropHelper(this._window).Handle; + if (!(handle != IntPtr.Zero)) + { + this._window.SourceInitialized += this._OnWindowSourceInitialized; + return; + } + this._hwndSource = HwndSource.FromHwnd(handle); + this._hwndSource.AddHook(new HwndSourceHook(this._WndProc)); + this._OnIsAttachedChanged(true); + } - private void _OnWindowSourceInitialized(object sender, EventArgs e) - { - this._window.SourceInitialized -= this._OnWindowSourceInitialized; - IntPtr handle = new WindowInteropHelper(this._window).Handle; - this._hwndSource = HwndSource.FromHwnd(handle); - this._hwndSource.AddHook(new HwndSourceHook(this._WndProc)); - MSGFLTINFO msgfltinfo; - NativeMethods.ChangeWindowMessageFilterEx(handle, TaskbarItemInfo.WM_TASKBARBUTTONCREATED, MSGFLT.ALLOW, out msgfltinfo); - NativeMethods.ChangeWindowMessageFilterEx(handle, WM.COMMAND, MSGFLT.ALLOW, out msgfltinfo); - } + private void _OnWindowSourceInitialized(object sender, EventArgs e) + { + this._window.SourceInitialized -= this._OnWindowSourceInitialized; + IntPtr handle = new WindowInteropHelper(this._window).Handle; + this._hwndSource = HwndSource.FromHwnd(handle); + this._hwndSource.AddHook(new HwndSourceHook(this._WndProc)); + MSGFLTINFO msgfltinfo; + NativeMethods.ChangeWindowMessageFilterEx(handle, TaskbarItemInfo.WM_TASKBARBUTTONCREATED, MSGFLT.ALLOW, out msgfltinfo); + NativeMethods.ChangeWindowMessageFilterEx(handle, WM.COMMAND, MSGFLT.ALLOW, out msgfltinfo); + } - private IntPtr _WndProc(IntPtr hwnd, int uMsg, IntPtr wParam, IntPtr lParam, ref bool handled) - { - if (uMsg == (int)TaskbarItemInfo.WM_TASKBARBUTTONCREATED) - { - this._OnIsAttachedChanged(true); - this._isAttached = true; - handled = false; - } - else if (uMsg != 5) - { - if (uMsg == 273 && Utility.HIWORD(wParam.ToInt32()) == 6144) - { - int index = Utility.LOWORD(wParam.ToInt32()); - this.ThumbButtonInfos[index].InvokeClick(); - handled = true; - } - } - else - { - this._UpdateThumbnailClipping(this._isAttached); - handled = false; - } - return IntPtr.Zero; - } + private IntPtr _WndProc(IntPtr hwnd, int uMsg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (uMsg == (int) TaskbarItemInfo.WM_TASKBARBUTTONCREATED) + { + this._OnIsAttachedChanged(true); + this._isAttached = true; + handled = false; + } + else if (uMsg != 5) + { + if (uMsg == 273 && Utility.HIWORD(wParam.ToInt32()) == 6144) + { + int index = Utility.LOWORD(wParam.ToInt32()); + this.ThumbButtonInfos[index].InvokeClick(); + handled = true; + } + } + else + { + this._UpdateThumbnailClipping(this._isAttached); + handled = false; + } + return IntPtr.Zero; + } - private void _OnIsAttachedChanged(bool attached) - { - this._haveAddedButtons = false; - if (!attached && this._hwndSource == null) - { - return; - } - this._UpdateOverlay(attached); - this._UpdateProgressState(attached); - this._UpdateProgressValue(attached); - this._UpdateTooltip(attached); - this._UpdateThumbnailClipping(attached); - this._UpdateThumbButtons(attached); - if (!attached) - { - this._hwndSource = null; - } - } + private void _OnIsAttachedChanged(bool attached) + { + this._haveAddedButtons = false; + if (!attached && this._hwndSource == null) + { + return; + } + this._UpdateOverlay(attached); + this._UpdateProgressState(attached); + this._UpdateProgressValue(attached); + this._UpdateTooltip(attached); + this._UpdateThumbnailClipping(attached); + this._UpdateThumbButtons(attached); + if (!attached) + { + this._hwndSource = null; + } + } - private void _DetachWindow() - { - this._window.SourceInitialized -= this._OnWindowSourceInitialized; - this._isAttached = false; - this._OnIsAttachedChanged(false); - this._window = null; - } + private void _DetachWindow() + { + this._window.SourceInitialized -= this._OnWindowSourceInitialized; + this._isAttached = false; + this._OnIsAttachedChanged(false); + this._window = null; + } - private HRESULT _UpdateOverlay(bool attached) - { - ImageSource overlay = this.Overlay; - if (overlay == null || !attached) - { - return this._taskbarList.SetOverlayIcon(this._hwndSource.Handle, IntPtr.Zero, null); - } - IntPtr hIcon = IntPtr.Zero; - HRESULT result; - try - { - hIcon = this._GetHICONFromImageSource(overlay, this._overlaySize); - result = this._taskbarList.SetOverlayIcon(this._hwndSource.Handle, hIcon, null); - } - finally - { - Utility.SafeDestroyIcon(ref hIcon); - } - return result; - } + private HRESULT _UpdateOverlay(bool attached) + { + ImageSource overlay = this.Overlay; + if (overlay == null || !attached) + { + return this._taskbarList.SetOverlayIcon(this._hwndSource.Handle, IntPtr.Zero, null); + } + IntPtr hIcon = IntPtr.Zero; + HRESULT result; + try + { + hIcon = this._GetHICONFromImageSource(overlay, this._overlaySize); + result = this._taskbarList.SetOverlayIcon(this._hwndSource.Handle, hIcon, null); + } + finally + { + Utility.SafeDestroyIcon(ref hIcon); + } + return result; + } - private HRESULT _UpdateTooltip(bool attached) - { - string pszTip = this.Description ?? ""; - if (!attached) - { - pszTip = ""; - } - return this._taskbarList.SetThumbnailTooltip(this._hwndSource.Handle, pszTip); - } + private HRESULT _UpdateTooltip(bool attached) + { + string pszTip = this.Description ?? ""; + if (!attached) + { + pszTip = ""; + } + return this._taskbarList.SetThumbnailTooltip(this._hwndSource.Handle, pszTip); + } - private HRESULT _UpdateProgressValue(bool attached) - { - if (!attached || this.ProgressState == TaskbarItemProgressState.None || this.ProgressState == TaskbarItemProgressState.Indeterminate) - { - return HRESULT.S_OK; - } - ulong ullCompleted = (ulong)(this.ProgressValue * 1000.0); - return this._taskbarList.SetProgressValue(this._hwndSource.Handle, ullCompleted, 1000UL); - } + private HRESULT _UpdateProgressValue(bool attached) + { + if (!attached || this.ProgressState == TaskbarItemProgressState.None || this.ProgressState == TaskbarItemProgressState.Indeterminate) + { + return HRESULT.S_OK; + } + ulong ullCompleted = (ulong) (this.ProgressValue * 1000.0); + return this._taskbarList.SetProgressValue(this._hwndSource.Handle, ullCompleted, 1000UL); + } - private HRESULT _UpdateProgressState(bool attached) - { - TaskbarItemProgressState progressState = this.ProgressState; - TBPF tbpFlags = TBPF.NOPROGRESS; - if (attached) - { - switch (progressState) - { - case TaskbarItemProgressState.None: - tbpFlags = TBPF.NOPROGRESS; - break; - case TaskbarItemProgressState.Indeterminate: - tbpFlags = TBPF.INDETERMINATE; - break; - case TaskbarItemProgressState.Normal: - tbpFlags = TBPF.NORMAL; - break; - case TaskbarItemProgressState.Error: - tbpFlags = TBPF.ERROR; - break; - case TaskbarItemProgressState.Paused: - tbpFlags = TBPF.PAUSED; - break; - default: - tbpFlags = TBPF.NOPROGRESS; - break; - } - } - HRESULT result = this._taskbarList.SetProgressState(this._hwndSource.Handle, tbpFlags); - if (result.Succeeded) - { - result = this._UpdateProgressValue(attached); - } - return result; - } + private HRESULT _UpdateProgressState(bool attached) + { + TaskbarItemProgressState progressState = this.ProgressState; + TBPF tbpFlags = TBPF.NOPROGRESS; + if (attached) + { + switch (progressState) + { + case TaskbarItemProgressState.None: + tbpFlags = TBPF.NOPROGRESS; + break; + case TaskbarItemProgressState.Indeterminate: + tbpFlags = TBPF.INDETERMINATE; + break; + case TaskbarItemProgressState.Normal: + tbpFlags = TBPF.NORMAL; + break; + case TaskbarItemProgressState.Error: + tbpFlags = TBPF.ERROR; + break; + case TaskbarItemProgressState.Paused: + tbpFlags = TBPF.PAUSED; + break; + default: + tbpFlags = TBPF.NOPROGRESS; + break; + } + } + HRESULT result = this._taskbarList.SetProgressState(this._hwndSource.Handle, tbpFlags); + if (result.Succeeded) + { + result = this._UpdateProgressValue(attached); + } + return result; + } - private HRESULT _UpdateThumbnailClipping(bool attached) - { - RefRECT prcClip = null; - if (attached && this.ThumbnailClipMargin != TaskbarItemInfo._EmptyThickness) - { - Thickness thumbnailClipMargin = this.ThumbnailClipMargin; - RECT clientRect = NativeMethods.GetClientRect(this._hwndSource.Handle); - Rect rect = DpiHelper.DeviceRectToLogical(new Rect((double)clientRect.Left, (double)clientRect.Top, (double)clientRect.Width, (double)clientRect.Height)); - if (thumbnailClipMargin.Left + thumbnailClipMargin.Right >= rect.Width || thumbnailClipMargin.Top + thumbnailClipMargin.Bottom >= rect.Height) - { - prcClip = new RefRECT(0, 0, 0, 0); - } - else - { - Rect logicalRectangle = new Rect(thumbnailClipMargin.Left, thumbnailClipMargin.Top, rect.Width - thumbnailClipMargin.Left - thumbnailClipMargin.Right, rect.Height - thumbnailClipMargin.Top - thumbnailClipMargin.Bottom); - Rect rect2 = DpiHelper.LogicalRectToDevice(logicalRectangle); - prcClip = new RefRECT((int)rect2.Left, (int)rect2.Top, (int)rect2.Right, (int)rect2.Bottom); - } - } - return this._taskbarList.SetThumbnailClip(this._hwndSource.Handle, prcClip); - } + private HRESULT _UpdateThumbnailClipping(bool attached) + { + RefRECT prcClip = null; + if (attached && this.ThumbnailClipMargin != TaskbarItemInfo._EmptyThickness) + { + Thickness thumbnailClipMargin = this.ThumbnailClipMargin; + RECT clientRect = NativeMethods.GetClientRect(this._hwndSource.Handle); + Rect rect = DpiHelper.DeviceRectToLogical(new Rect((double) clientRect.Left, (double) clientRect.Top, (double) clientRect.Width, (double) clientRect.Height)); + if (thumbnailClipMargin.Left + thumbnailClipMargin.Right >= rect.Width || thumbnailClipMargin.Top + thumbnailClipMargin.Bottom >= rect.Height) + { + prcClip = new RefRECT(0, 0, 0, 0); + } + else + { + Rect logicalRectangle = new Rect(thumbnailClipMargin.Left, thumbnailClipMargin.Top, rect.Width - thumbnailClipMargin.Left - thumbnailClipMargin.Right, rect.Height - thumbnailClipMargin.Top - thumbnailClipMargin.Bottom); + Rect rect2 = DpiHelper.LogicalRectToDevice(logicalRectangle); + prcClip = new RefRECT((int) rect2.Left, (int) rect2.Top, (int) rect2.Right, (int) rect2.Bottom); + } + } + return this._taskbarList.SetThumbnailClip(this._hwndSource.Handle, prcClip); + } - private HRESULT _RegisterThumbButtons() - { - HRESULT hresult = HRESULT.S_OK; - if (!this._haveAddedButtons) - { - THUMBBUTTON[] array = new THUMBBUTTON[7]; - for (int i = 0; i < 7; i++) - { - array[i] = new THUMBBUTTON - { - iId = (uint)i, - dwFlags = (THBF.DISABLED | THBF.NOBACKGROUND | THBF.HIDDEN), - dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) - }; - } - hresult = this._taskbarList.ThumbBarAddButtons(this._hwndSource.Handle, (uint)array.Length, array); - if (hresult == HRESULT.E_INVALIDARG) - { - hresult = HRESULT.S_FALSE; - } - this._haveAddedButtons = hresult.Succeeded; - } - return hresult; - } + private HRESULT _RegisterThumbButtons() + { + HRESULT hresult = HRESULT.S_OK; + if (!this._haveAddedButtons) + { + THUMBBUTTON[] array = new THUMBBUTTON[7]; + for (int i = 0; i < 7; i++) + { + array[i] = new THUMBBUTTON + { + iId = (uint) i, + dwFlags = (THBF.DISABLED | THBF.NOBACKGROUND | THBF.HIDDEN), + dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) + }; + } + hresult = this._taskbarList.ThumbBarAddButtons(this._hwndSource.Handle, (uint) array.Length, array); + if (hresult == HRESULT.E_INVALIDARG) + { + hresult = HRESULT.S_FALSE; + } + this._haveAddedButtons = hresult.Succeeded; + } + return hresult; + } - private HRESULT _UpdateThumbButtons(bool attached) - { - THUMBBUTTON[] array = new THUMBBUTTON[7]; - HRESULT result = this._RegisterThumbButtons(); - if (result.Failed) - { - return result; - } - ThumbButtonInfoCollection thumbButtonInfos = this.ThumbButtonInfos; - HRESULT result2; - try - { - uint num = 0u; - if (!attached || thumbButtonInfos == null) - { - goto IL_1AE; - } - using (FreezableCollection.Enumerator enumerator = thumbButtonInfos.GetEnumerator()) - { - while (enumerator.MoveNext()) - { - ThumbButtonInfo thumbButtonInfo = enumerator.Current; - THUMBBUTTON thumbbutton = new THUMBBUTTON - { - iId = num, - dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) - }; - switch (thumbButtonInfo.Visibility) - { - case Visibility.Visible: - goto IL_A5; - case Visibility.Hidden: - thumbbutton.dwFlags = (THBF.DISABLED | THBF.NOBACKGROUND); - thumbbutton.hIcon = IntPtr.Zero; - break; - case Visibility.Collapsed: - thumbbutton.dwFlags = THBF.HIDDEN; - break; - default: - goto IL_A5; - } - IL_146: - array[(int)((UIntPtr)num)] = thumbbutton; - num += 1u; - if (num != 7u) - { - continue; - } - break; - IL_A5: - thumbbutton.szTip = (thumbButtonInfo.Description ?? ""); - thumbbutton.hIcon = this._GetHICONFromImageSource(thumbButtonInfo.ImageSource, this._overlaySize); - if (!thumbButtonInfo.IsBackgroundVisible) - { - thumbbutton.dwFlags |= THBF.NOBACKGROUND; - } - if (!thumbButtonInfo.IsEnabled) - { - thumbbutton.dwFlags |= THBF.DISABLED; - } - else - { - thumbbutton.dwFlags = thumbbutton.dwFlags; - } - if (!thumbButtonInfo.IsInteractive) - { - thumbbutton.dwFlags |= THBF.NONINTERACTIVE; - } - if (thumbButtonInfo.DismissWhenClicked) - { - thumbbutton.dwFlags |= THBF.DISMISSONCLICK; - goto IL_146; - } - goto IL_146; - } - goto IL_1AE; - } - IL_179: - array[(int)((UIntPtr)num)] = new THUMBBUTTON - { - iId = num, - dwFlags = (THBF.DISABLED | THBF.NOBACKGROUND | THBF.HIDDEN), - dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) - }; - num += 1u; - IL_1AE: - if (num < 7u) - { - goto IL_179; - } - result2 = this._taskbarList.ThumbBarUpdateButtons(this._hwndSource.Handle, (uint)array.Length, array); - } - finally - { - foreach (THUMBBUTTON thumbbutton2 in array) - { - IntPtr hIcon = thumbbutton2.hIcon; - if (IntPtr.Zero != hIcon) - { - Utility.SafeDestroyIcon(ref hIcon); - } - } - } - return result2; - } + private HRESULT _UpdateThumbButtons(bool attached) + { + THUMBBUTTON[] array = new THUMBBUTTON[7]; + HRESULT result = this._RegisterThumbButtons(); + if (result.Failed) + { + return result; + } + ThumbButtonInfoCollection thumbButtonInfos = this.ThumbButtonInfos; + HRESULT result2; + try + { + uint num = 0u; + if (!attached || thumbButtonInfos == null) + { + goto IL_1AE; + } + using (FreezableCollection.Enumerator enumerator = thumbButtonInfos.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + ThumbButtonInfo thumbButtonInfo = enumerator.Current; + THUMBBUTTON thumbbutton = new THUMBBUTTON + { + iId = num, + dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) + }; + switch (thumbButtonInfo.Visibility) + { + case Visibility.Visible: + goto IL_A5; + case Visibility.Hidden: + thumbbutton.dwFlags = (THBF.DISABLED | THBF.NOBACKGROUND); + thumbbutton.hIcon = IntPtr.Zero; + break; + case Visibility.Collapsed: + thumbbutton.dwFlags = THBF.HIDDEN; + break; + default: + goto IL_A5; + } +IL_146: + array[(int) ((UIntPtr) num)] = thumbbutton; + num += 1u; + if (num != 7u) + { + continue; + } + break; +IL_A5: + thumbbutton.szTip = (thumbButtonInfo.Description ?? ""); + thumbbutton.hIcon = this._GetHICONFromImageSource(thumbButtonInfo.ImageSource, this._overlaySize); + if (!thumbButtonInfo.IsBackgroundVisible) + { + thumbbutton.dwFlags |= THBF.NOBACKGROUND; + } + if (!thumbButtonInfo.IsEnabled) + { + thumbbutton.dwFlags |= THBF.DISABLED; + } + else + { + thumbbutton.dwFlags = thumbbutton.dwFlags; + } + if (!thumbButtonInfo.IsInteractive) + { + thumbbutton.dwFlags |= THBF.NONINTERACTIVE; + } + if (thumbButtonInfo.DismissWhenClicked) + { + thumbbutton.dwFlags |= THBF.DISMISSONCLICK; + goto IL_146; + } + goto IL_146; + } + goto IL_1AE; + } +IL_179: + array[(int) ((UIntPtr) num)] = new THUMBBUTTON + { + iId = num, + dwFlags = (THBF.DISABLED | THBF.NOBACKGROUND | THBF.HIDDEN), + dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) + }; + num += 1u; +IL_1AE: + if (num < 7u) + { + goto IL_179; + } + result2 = this._taskbarList.ThumbBarUpdateButtons(this._hwndSource.Handle, (uint) array.Length, array); + } + finally + { + foreach (THUMBBUTTON thumbbutton2 in array) + { + IntPtr hIcon = thumbbutton2.hIcon; + if (IntPtr.Zero != hIcon) + { + Utility.SafeDestroyIcon(ref hIcon); + } + } + } + return result2; + } - private const int c_MaximumThumbButtons = 7; + private const int c_MaximumThumbButtons = 7; - private static readonly WM WM_TASKBARBUTTONCREATED = NativeMethods.RegisterWindowMessage("TaskbarButtonCreated"); + private static readonly WM WM_TASKBARBUTTONCREATED = NativeMethods.RegisterWindowMessage("TaskbarButtonCreated"); - private static readonly Thickness _EmptyThickness = default(Thickness); + private static readonly Thickness _EmptyThickness = default(Thickness); - private SafeGdiplusStartupToken _gdipToken; + private SafeGdiplusStartupToken _gdipToken; - private bool _haveAddedButtons; + private bool _haveAddedButtons; - private Window _window; + private Window _window; - private HwndSource _hwndSource; + private HwndSource _hwndSource; - private ITaskbarList3 _taskbarList; + private ITaskbarList3 _taskbarList; - private readonly Size _overlaySize; + private readonly Size _overlaySize; - private bool _isAttached; + private bool _isAttached; - public static readonly DependencyProperty TaskbarItemInfoProperty = DependencyProperty.RegisterAttached("TaskbarItemInfo", typeof(TaskbarItemInfo), typeof(TaskbarItemInfo), new PropertyMetadata(null, new PropertyChangedCallback(TaskbarItemInfo._OnTaskbarItemInfoChanged), new CoerceValueCallback(TaskbarItemInfo._CoerceTaskbarItemInfoValue))); + public static readonly DependencyProperty TaskbarItemInfoProperty = DependencyProperty.RegisterAttached("TaskbarItemInfo", typeof(TaskbarItemInfo), typeof(TaskbarItemInfo), new PropertyMetadata(null, new PropertyChangedCallback(TaskbarItemInfo._OnTaskbarItemInfoChanged), new CoerceValueCallback(TaskbarItemInfo._CoerceTaskbarItemInfoValue))); - public static readonly DependencyProperty ProgressStateProperty = DependencyProperty.Register("ProgressState", typeof(TaskbarItemProgressState), typeof(TaskbarItemInfo), new PropertyMetadata(TaskbarItemProgressState.None, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((TaskbarItemInfo)d)._OnProgressStateChanged(); - }, (DependencyObject d, object e) => TaskbarItemInfo._CoerceProgressState((TaskbarItemProgressState)e))); + public static readonly DependencyProperty ProgressStateProperty = DependencyProperty.Register("ProgressState", typeof(TaskbarItemProgressState), typeof(TaskbarItemInfo), new PropertyMetadata(TaskbarItemProgressState.None, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((TaskbarItemInfo) d)._OnProgressStateChanged(); + }, (DependencyObject d, object e) => TaskbarItemInfo._CoerceProgressState((TaskbarItemProgressState) e))); - public static readonly DependencyProperty ProgressValueProperty = DependencyProperty.Register("ProgressValue", typeof(double), typeof(TaskbarItemInfo), new PropertyMetadata(0.0, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((TaskbarItemInfo)d)._OnProgressValueChanged(); - }, (DependencyObject d, object e) => TaskbarItemInfo._CoerceProgressValue((double)e))); + public static readonly DependencyProperty ProgressValueProperty = DependencyProperty.Register("ProgressValue", typeof(double), typeof(TaskbarItemInfo), new PropertyMetadata(0.0, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((TaskbarItemInfo) d)._OnProgressValueChanged(); + }, (DependencyObject d, object e) => TaskbarItemInfo._CoerceProgressValue((double) e))); - public static readonly DependencyProperty OverlayProperty = DependencyProperty.Register("Overlay", typeof(ImageSource), typeof(TaskbarItemInfo), new PropertyMetadata(null, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((TaskbarItemInfo)d)._OnOverlayChanged(); - })); + public static readonly DependencyProperty OverlayProperty = DependencyProperty.Register("Overlay", typeof(ImageSource), typeof(TaskbarItemInfo), new PropertyMetadata(null, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((TaskbarItemInfo) d)._OnOverlayChanged(); + })); - public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register("Description", typeof(string), typeof(TaskbarItemInfo), new PropertyMetadata(string.Empty, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((TaskbarItemInfo)d)._OnDescriptionChanged(); - })); + public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register("Description", typeof(string), typeof(TaskbarItemInfo), new PropertyMetadata(string.Empty, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((TaskbarItemInfo) d)._OnDescriptionChanged(); + })); - public static readonly DependencyProperty ThumbnailClipMarginProperty = DependencyProperty.Register("ThumbnailClipMargin", typeof(Thickness), typeof(TaskbarItemInfo), new PropertyMetadata(default(Thickness), delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((TaskbarItemInfo)d)._OnThumbnailClipMarginChanged(); - }, (DependencyObject d, object e) => TaskbarItemInfo._CoerceThumbnailClipMargin((Thickness)e))); + public static readonly DependencyProperty ThumbnailClipMarginProperty = DependencyProperty.Register("ThumbnailClipMargin", typeof(Thickness), typeof(TaskbarItemInfo), new PropertyMetadata(default(Thickness), delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((TaskbarItemInfo) d)._OnThumbnailClipMarginChanged(); + }, (DependencyObject d, object e) => TaskbarItemInfo._CoerceThumbnailClipMargin((Thickness) e))); - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Infos")] - public static readonly DependencyProperty ThumbButtonInfosProperty = DependencyProperty.Register("ThumbButtonInfos", typeof(ThumbButtonInfoCollection), typeof(TaskbarItemInfo), new PropertyMetadata(null, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((TaskbarItemInfo)d)._OnThumbButtonsChanged(); - })); - } + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Infos")] + public static readonly DependencyProperty ThumbButtonInfosProperty = DependencyProperty.Register("ThumbButtonInfos", typeof(ThumbButtonInfoCollection), typeof(TaskbarItemInfo), new PropertyMetadata(null, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((TaskbarItemInfo) d)._OnThumbButtonsChanged(); + })); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/TaskbarItemProgressState.cs b/src/Shared/Microsoft.Windows.Shell/TaskbarItemProgressState.cs index 182986f3..33a5d286 100644 --- a/src/Shared/Microsoft.Windows.Shell/TaskbarItemProgressState.cs +++ b/src/Shared/Microsoft.Windows.Shell/TaskbarItemProgressState.cs @@ -2,12 +2,12 @@ namespace Microsoft.Windows.Shell { - public enum TaskbarItemProgressState - { - None, - Indeterminate, - Normal, - Error, - Paused - } + public enum TaskbarItemProgressState + { + None, + Indeterminate, + Normal, + Error, + Paused + } } diff --git a/src/Shared/Microsoft.Windows.Shell/ThumbButtonInfo.cs b/src/Shared/Microsoft.Windows.Shell/ThumbButtonInfo.cs index cc36e814..5bbff01f 100644 --- a/src/Shared/Microsoft.Windows.Shell/ThumbButtonInfo.cs +++ b/src/Shared/Microsoft.Windows.Shell/ThumbButtonInfo.cs @@ -6,284 +6,284 @@ using System.Windows.Media; namespace Microsoft.Windows.Shell { - [DefaultEvent("Click")] - public sealed class ThumbButtonInfo : Freezable, ICommandSource - { - protected override Freezable CreateInstanceCore() - { - return new ThumbButtonInfo(); - } + [DefaultEvent("Click")] + public sealed class ThumbButtonInfo : Freezable, ICommandSource + { + protected override Freezable CreateInstanceCore() + { + return new ThumbButtonInfo(); + } - public Visibility Visibility - { - get - { - return (Visibility)base.GetValue(ThumbButtonInfo.VisibilityProperty); - } - set - { - base.SetValue(ThumbButtonInfo.VisibilityProperty, value); - } - } + public Visibility Visibility + { + get + { + return (Visibility) base.GetValue(ThumbButtonInfo.VisibilityProperty); + } + set + { + base.SetValue(ThumbButtonInfo.VisibilityProperty, value); + } + } - public bool DismissWhenClicked - { - get - { - return (bool)base.GetValue(ThumbButtonInfo.DismissWhenClickedProperty); - } - set - { - base.SetValue(ThumbButtonInfo.DismissWhenClickedProperty, value); - } - } + public bool DismissWhenClicked + { + get + { + return (bool) base.GetValue(ThumbButtonInfo.DismissWhenClickedProperty); + } + set + { + base.SetValue(ThumbButtonInfo.DismissWhenClickedProperty, value); + } + } - public ImageSource ImageSource - { - get - { - return (ImageSource)base.GetValue(ThumbButtonInfo.ImageSourceProperty); - } - set - { - base.SetValue(ThumbButtonInfo.ImageSourceProperty, value); - } - } + public ImageSource ImageSource + { + get + { + return (ImageSource) base.GetValue(ThumbButtonInfo.ImageSourceProperty); + } + set + { + base.SetValue(ThumbButtonInfo.ImageSourceProperty, value); + } + } - public bool IsBackgroundVisible - { - get - { - return (bool)base.GetValue(ThumbButtonInfo.IsBackgroundVisibleProperty); - } - set - { - base.SetValue(ThumbButtonInfo.IsBackgroundVisibleProperty, value); - } - } + public bool IsBackgroundVisible + { + get + { + return (bool) base.GetValue(ThumbButtonInfo.IsBackgroundVisibleProperty); + } + set + { + base.SetValue(ThumbButtonInfo.IsBackgroundVisibleProperty, value); + } + } - public string Description - { - get - { - return (string)base.GetValue(ThumbButtonInfo.DescriptionProperty); - } - set - { - base.SetValue(ThumbButtonInfo.DescriptionProperty, value); - } - } + public string Description + { + get + { + return (string) base.GetValue(ThumbButtonInfo.DescriptionProperty); + } + set + { + base.SetValue(ThumbButtonInfo.DescriptionProperty, value); + } + } - private static object _CoerceDescription(DependencyObject d, object value) - { - string text = (string)value; - if (text != null && text.Length >= 260) - { - text = text.Substring(0, 259); - } - return text; - } + private static object _CoerceDescription(DependencyObject d, object value) + { + string text = (string) value; + if (text != null && text.Length >= 260) + { + text = text.Substring(0, 259); + } + return text; + } - private object _CoerceIsEnabledValue(object value) - { - bool flag = (bool)value; - return flag && this._CanExecute; - } + private object _CoerceIsEnabledValue(object value) + { + bool flag = (bool) value; + return flag && this._CanExecute; + } - public bool IsEnabled - { - get - { - return (bool)base.GetValue(ThumbButtonInfo.IsEnabledProperty); - } - set - { - base.SetValue(ThumbButtonInfo.IsEnabledProperty, value); - } - } + public bool IsEnabled + { + get + { + return (bool) base.GetValue(ThumbButtonInfo.IsEnabledProperty); + } + set + { + base.SetValue(ThumbButtonInfo.IsEnabledProperty, value); + } + } - public bool IsInteractive - { - get - { - return (bool)base.GetValue(ThumbButtonInfo.IsInteractiveProperty); - } - set - { - base.SetValue(ThumbButtonInfo.IsInteractiveProperty, value); - } - } + public bool IsInteractive + { + get + { + return (bool) base.GetValue(ThumbButtonInfo.IsInteractiveProperty); + } + set + { + base.SetValue(ThumbButtonInfo.IsInteractiveProperty, value); + } + } - private void _OnCommandChanged(DependencyPropertyChangedEventArgs e) - { - ICommand command = (ICommand)e.OldValue; - ICommand command2 = (ICommand)e.NewValue; - if (command == command2) - { - return; - } - if (command != null) - { - this._UnhookCommand(command); - } - if (command2 != null) - { - this._HookCommand(command2); - } - } + private void _OnCommandChanged(DependencyPropertyChangedEventArgs e) + { + ICommand command = (ICommand) e.OldValue; + ICommand command2 = (ICommand) e.NewValue; + if (command == command2) + { + return; + } + if (command != null) + { + this._UnhookCommand(command); + } + if (command2 != null) + { + this._HookCommand(command2); + } + } - private bool _CanExecute - { - get - { - return (bool)base.GetValue(ThumbButtonInfo._CanExecuteProperty); - } - set - { - base.SetValue(ThumbButtonInfo._CanExecuteProperty, value); - } - } + private bool _CanExecute + { + get + { + return (bool) base.GetValue(ThumbButtonInfo._CanExecuteProperty); + } + set + { + base.SetValue(ThumbButtonInfo._CanExecuteProperty, value); + } + } - public event EventHandler Click; + public event EventHandler Click; - internal void InvokeClick() - { - EventHandler click = this.Click; - if (click != null) - { - click(this, EventArgs.Empty); - } - this._InvokeCommand(); - } + internal void InvokeClick() + { + EventHandler click = this.Click; + if (click != null) + { + click(this, EventArgs.Empty); + } + this._InvokeCommand(); + } - private void _InvokeCommand() - { - ICommand command = this.Command; - if (command != null) - { - object commandParameter = this.CommandParameter; - IInputElement commandTarget = this.CommandTarget; - RoutedCommand routedCommand = command as RoutedCommand; - if (routedCommand != null) - { - if (routedCommand.CanExecute(commandParameter, commandTarget)) - { - routedCommand.Execute(commandParameter, commandTarget); - return; - } - } - else if (command.CanExecute(commandParameter)) - { - command.Execute(commandParameter); - } - } - } + private void _InvokeCommand() + { + ICommand command = this.Command; + if (command != null) + { + object commandParameter = this.CommandParameter; + IInputElement commandTarget = this.CommandTarget; + RoutedCommand routedCommand = command as RoutedCommand; + if (routedCommand != null) + { + if (routedCommand.CanExecute(commandParameter, commandTarget)) + { + routedCommand.Execute(commandParameter, commandTarget); + return; + } + } + else if (command.CanExecute(commandParameter)) + { + command.Execute(commandParameter); + } + } + } - private void _UnhookCommand(ICommand command) - { - command.CanExecuteChanged -= this._commandEvent; - this._commandEvent = null; - this._UpdateCanExecute(); - } + private void _UnhookCommand(ICommand command) + { + command.CanExecuteChanged -= this._commandEvent; + this._commandEvent = null; + this._UpdateCanExecute(); + } - private void _HookCommand(ICommand command) - { - this._commandEvent = delegate(object sender, EventArgs e) - { - this._UpdateCanExecute(); - }; - command.CanExecuteChanged += this._commandEvent; - this._UpdateCanExecute(); - } + private void _HookCommand(ICommand command) + { + this._commandEvent = delegate (object sender, EventArgs e) + { + this._UpdateCanExecute(); + }; + command.CanExecuteChanged += this._commandEvent; + this._UpdateCanExecute(); + } - private void _UpdateCanExecute() - { - if (this.Command == null) - { - this._CanExecute = true; - return; - } - object commandParameter = this.CommandParameter; - IInputElement commandTarget = this.CommandTarget; - RoutedCommand routedCommand = this.Command as RoutedCommand; - if (routedCommand != null) - { - this._CanExecute = routedCommand.CanExecute(commandParameter, commandTarget); - return; - } - this._CanExecute = this.Command.CanExecute(commandParameter); - } + private void _UpdateCanExecute() + { + if (this.Command == null) + { + this._CanExecute = true; + return; + } + object commandParameter = this.CommandParameter; + IInputElement commandTarget = this.CommandTarget; + RoutedCommand routedCommand = this.Command as RoutedCommand; + if (routedCommand != null) + { + this._CanExecute = routedCommand.CanExecute(commandParameter, commandTarget); + return; + } + this._CanExecute = this.Command.CanExecute(commandParameter); + } - public ICommand Command - { - get - { - return (ICommand)base.GetValue(ThumbButtonInfo.CommandProperty); - } - set - { - base.SetValue(ThumbButtonInfo.CommandProperty, value); - } - } + public ICommand Command + { + get + { + return (ICommand) base.GetValue(ThumbButtonInfo.CommandProperty); + } + set + { + base.SetValue(ThumbButtonInfo.CommandProperty, value); + } + } - public object CommandParameter - { - get - { - return base.GetValue(ThumbButtonInfo.CommandParameterProperty); - } - set - { - base.SetValue(ThumbButtonInfo.CommandParameterProperty, value); - } - } + public object CommandParameter + { + get + { + return base.GetValue(ThumbButtonInfo.CommandParameterProperty); + } + set + { + base.SetValue(ThumbButtonInfo.CommandParameterProperty, value); + } + } - public IInputElement CommandTarget - { - get - { - return (IInputElement)base.GetValue(ThumbButtonInfo.CommandTargetProperty); - } - set - { - base.SetValue(ThumbButtonInfo.CommandTargetProperty, value); - } - } + public IInputElement CommandTarget + { + get + { + return (IInputElement) base.GetValue(ThumbButtonInfo.CommandTargetProperty); + } + set + { + base.SetValue(ThumbButtonInfo.CommandTargetProperty, value); + } + } - private EventHandler _commandEvent; + private EventHandler _commandEvent; - public static readonly DependencyProperty VisibilityProperty = DependencyProperty.Register("Visibility", typeof(Visibility), typeof(ThumbButtonInfo), new PropertyMetadata(Visibility.Visible)); + public static readonly DependencyProperty VisibilityProperty = DependencyProperty.Register("Visibility", typeof(Visibility), typeof(ThumbButtonInfo), new PropertyMetadata(Visibility.Visible)); - public static readonly DependencyProperty DismissWhenClickedProperty = DependencyProperty.Register("DismissWhenClicked", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(false)); + public static readonly DependencyProperty DismissWhenClickedProperty = DependencyProperty.Register("DismissWhenClicked", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(false)); - public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ThumbButtonInfo), new PropertyMetadata(null)); + public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ThumbButtonInfo), new PropertyMetadata(null)); - public static readonly DependencyProperty IsBackgroundVisibleProperty = DependencyProperty.Register("IsBackgroundVisible", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(true)); + public static readonly DependencyProperty IsBackgroundVisibleProperty = DependencyProperty.Register("IsBackgroundVisible", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(true)); - public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register("Description", typeof(string), typeof(ThumbButtonInfo), new PropertyMetadata(string.Empty, null, new CoerceValueCallback(ThumbButtonInfo._CoerceDescription))); + public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register("Description", typeof(string), typeof(ThumbButtonInfo), new PropertyMetadata(string.Empty, null, new CoerceValueCallback(ThumbButtonInfo._CoerceDescription))); - public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.Register("IsEnabled", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(true, null, (DependencyObject d, object e) => ((ThumbButtonInfo)d)._CoerceIsEnabledValue(e))); + public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.Register("IsEnabled", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(true, null, (DependencyObject d, object e) => ((ThumbButtonInfo) d)._CoerceIsEnabledValue(e))); - public static readonly DependencyProperty IsInteractiveProperty = DependencyProperty.Register("IsInteractive", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(true)); + public static readonly DependencyProperty IsInteractiveProperty = DependencyProperty.Register("IsInteractive", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(true)); - public static readonly DependencyProperty CommandProperty = DependencyProperty.Register("Command", typeof(ICommand), typeof(ThumbButtonInfo), new PropertyMetadata(null, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((ThumbButtonInfo)d)._OnCommandChanged(e); - })); + public static readonly DependencyProperty CommandProperty = DependencyProperty.Register("Command", typeof(ICommand), typeof(ThumbButtonInfo), new PropertyMetadata(null, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((ThumbButtonInfo) d)._OnCommandChanged(e); + })); - public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register("CommandParameter", typeof(object), typeof(ThumbButtonInfo), new PropertyMetadata(null, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((ThumbButtonInfo)d)._UpdateCanExecute(); - })); + public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register("CommandParameter", typeof(object), typeof(ThumbButtonInfo), new PropertyMetadata(null, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((ThumbButtonInfo) d)._UpdateCanExecute(); + })); - public static readonly DependencyProperty CommandTargetProperty = DependencyProperty.Register("CommandTarget", typeof(IInputElement), typeof(ThumbButtonInfo), new PropertyMetadata(null, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((ThumbButtonInfo)d)._UpdateCanExecute(); - })); + public static readonly DependencyProperty CommandTargetProperty = DependencyProperty.Register("CommandTarget", typeof(IInputElement), typeof(ThumbButtonInfo), new PropertyMetadata(null, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((ThumbButtonInfo) d)._UpdateCanExecute(); + })); - private static readonly DependencyProperty _CanExecuteProperty = DependencyProperty.Register("_CanExecute", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(true, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - d.CoerceValue(ThumbButtonInfo.IsEnabledProperty); - })); - } + private static readonly DependencyProperty _CanExecuteProperty = DependencyProperty.Register("_CanExecute", typeof(bool), typeof(ThumbButtonInfo), new PropertyMetadata(true, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + d.CoerceValue(ThumbButtonInfo.IsEnabledProperty); + })); + } } diff --git a/src/Shared/Microsoft.Windows.Shell/ThumbButtonInfoCollection.cs b/src/Shared/Microsoft.Windows.Shell/ThumbButtonInfoCollection.cs index 5312c59f..cb08dc05 100644 --- a/src/Shared/Microsoft.Windows.Shell/ThumbButtonInfoCollection.cs +++ b/src/Shared/Microsoft.Windows.Shell/ThumbButtonInfoCollection.cs @@ -3,27 +3,27 @@ using System.Windows; namespace Microsoft.Windows.Shell { - public class ThumbButtonInfoCollection : FreezableCollection - { - protected override Freezable CreateInstanceCore() - { - return new ThumbButtonInfoCollection(); - } + public class ThumbButtonInfoCollection : FreezableCollection + { + protected override Freezable CreateInstanceCore() + { + return new ThumbButtonInfoCollection(); + } - internal static ThumbButtonInfoCollection Empty - { - get - { - if (ThumbButtonInfoCollection.s_empty == null) - { - ThumbButtonInfoCollection thumbButtonInfoCollection = new ThumbButtonInfoCollection(); - thumbButtonInfoCollection.Freeze(); - ThumbButtonInfoCollection.s_empty = thumbButtonInfoCollection; - } - return ThumbButtonInfoCollection.s_empty; - } - } + internal static ThumbButtonInfoCollection Empty + { + get + { + if (ThumbButtonInfoCollection.s_empty == null) + { + ThumbButtonInfoCollection thumbButtonInfoCollection = new ThumbButtonInfoCollection(); + thumbButtonInfoCollection.Freeze(); + ThumbButtonInfoCollection.s_empty = thumbButtonInfoCollection; + } + return ThumbButtonInfoCollection.s_empty; + } + } - private static ThumbButtonInfoCollection s_empty; - } + private static ThumbButtonInfoCollection s_empty; + } } diff --git a/src/Shared/Microsoft.Windows.Shell/WindowChrome.cs b/src/Shared/Microsoft.Windows.Shell/WindowChrome.cs index f3a14f87..34836f32 100644 --- a/src/Shared/Microsoft.Windows.Shell/WindowChrome.cs +++ b/src/Shared/Microsoft.Windows.Shell/WindowChrome.cs @@ -8,212 +8,212 @@ using Standard; namespace Microsoft.Windows.Shell { - public class WindowChrome : Freezable - { - public static Thickness GlassFrameCompleteThickness - { - get - { - return new Thickness(-1.0); - } - } + public class WindowChrome : Freezable + { + public static Thickness GlassFrameCompleteThickness + { + get + { + return new Thickness(-1.0); + } + } - private static void _OnChromeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (DesignerProperties.GetIsInDesignMode(d)) - { - return; - } - Window window = (Window)d; - WindowChrome windowChrome = (WindowChrome)e.NewValue; - WindowChromeWorker windowChromeWorker = WindowChromeWorker.GetWindowChromeWorker(window); - if (windowChromeWorker == null) - { - windowChromeWorker = new WindowChromeWorker(); - WindowChromeWorker.SetWindowChromeWorker(window, windowChromeWorker); - } - windowChromeWorker.SetWindowChrome(windowChrome); - } + private static void _OnChromeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + if (DesignerProperties.GetIsInDesignMode(d)) + { + return; + } + Window window = (Window) d; + WindowChrome windowChrome = (WindowChrome) e.NewValue; + WindowChromeWorker windowChromeWorker = WindowChromeWorker.GetWindowChromeWorker(window); + if (windowChromeWorker == null) + { + windowChromeWorker = new WindowChromeWorker(); + WindowChromeWorker.SetWindowChromeWorker(window, windowChromeWorker); + } + windowChromeWorker.SetWindowChrome(windowChrome); + } - [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] - public static WindowChrome GetWindowChrome(Window window) - { - Verify.IsNotNull(window, "window"); - return (WindowChrome)window.GetValue(WindowChrome.WindowChromeProperty); - } + [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] + public static WindowChrome GetWindowChrome(Window window) + { + Verify.IsNotNull(window, "window"); + return (WindowChrome) window.GetValue(WindowChrome.WindowChromeProperty); + } - [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] - public static void SetWindowChrome(Window window, WindowChrome chrome) - { - Verify.IsNotNull(window, "window"); - window.SetValue(WindowChrome.WindowChromeProperty, chrome); - } + [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] + public static void SetWindowChrome(Window window, WindowChrome chrome) + { + Verify.IsNotNull(window, "window"); + window.SetValue(WindowChrome.WindowChromeProperty, chrome); + } - [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] - public static bool GetIsHitTestVisibleInChrome(IInputElement inputElement) - { - Verify.IsNotNull(inputElement, "inputElement"); - DependencyObject dependencyObject = inputElement as DependencyObject; - if (dependencyObject == null) - { - throw new ArgumentException("The element must be a DependencyObject", "inputElement"); - } - return (bool)dependencyObject.GetValue(WindowChrome.IsHitTestVisibleInChromeProperty); - } + [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] + public static bool GetIsHitTestVisibleInChrome(IInputElement inputElement) + { + Verify.IsNotNull(inputElement, "inputElement"); + DependencyObject dependencyObject = inputElement as DependencyObject; + if (dependencyObject == null) + { + throw new ArgumentException("The element must be a DependencyObject", "inputElement"); + } + return (bool) dependencyObject.GetValue(WindowChrome.IsHitTestVisibleInChromeProperty); + } - [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] - public static void SetIsHitTestVisibleInChrome(IInputElement inputElement, bool hitTestVisible) - { - Verify.IsNotNull(inputElement, "inputElement"); - DependencyObject dependencyObject = inputElement as DependencyObject; - if (dependencyObject == null) - { - throw new ArgumentException("The element must be a DependencyObject", "inputElement"); - } - dependencyObject.SetValue(WindowChrome.IsHitTestVisibleInChromeProperty, hitTestVisible); - } + [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] + [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")] + public static void SetIsHitTestVisibleInChrome(IInputElement inputElement, bool hitTestVisible) + { + Verify.IsNotNull(inputElement, "inputElement"); + DependencyObject dependencyObject = inputElement as DependencyObject; + if (dependencyObject == null) + { + throw new ArgumentException("The element must be a DependencyObject", "inputElement"); + } + dependencyObject.SetValue(WindowChrome.IsHitTestVisibleInChromeProperty, hitTestVisible); + } - public double CaptionHeight - { - get - { - return (double)base.GetValue(WindowChrome.CaptionHeightProperty); - } - set - { - base.SetValue(WindowChrome.CaptionHeightProperty, value); - } - } + public double CaptionHeight + { + get + { + return (double) base.GetValue(WindowChrome.CaptionHeightProperty); + } + set + { + base.SetValue(WindowChrome.CaptionHeightProperty, value); + } + } - public Thickness ResizeBorderThickness - { - get - { - return (Thickness)base.GetValue(WindowChrome.ResizeBorderThicknessProperty); - } - set - { - base.SetValue(WindowChrome.ResizeBorderThicknessProperty, value); - } - } + public Thickness ResizeBorderThickness + { + get + { + return (Thickness) base.GetValue(WindowChrome.ResizeBorderThicknessProperty); + } + set + { + base.SetValue(WindowChrome.ResizeBorderThicknessProperty, value); + } + } - private static object _CoerceGlassFrameThickness(Thickness thickness) - { - if (!Utility.IsThicknessNonNegative(thickness)) - { - return WindowChrome.GlassFrameCompleteThickness; - } - return thickness; - } + private static object _CoerceGlassFrameThickness(Thickness thickness) + { + if (!Utility.IsThicknessNonNegative(thickness)) + { + return WindowChrome.GlassFrameCompleteThickness; + } + return thickness; + } - public Thickness GlassFrameThickness - { - get - { - return (Thickness)base.GetValue(WindowChrome.GlassFrameThicknessProperty); - } - set - { - base.SetValue(WindowChrome.GlassFrameThicknessProperty, value); - } - } + public Thickness GlassFrameThickness + { + get + { + return (Thickness) base.GetValue(WindowChrome.GlassFrameThicknessProperty); + } + set + { + base.SetValue(WindowChrome.GlassFrameThicknessProperty, value); + } + } - public CornerRadius CornerRadius - { - get - { - return (CornerRadius)base.GetValue(WindowChrome.CornerRadiusProperty); - } - set - { - base.SetValue(WindowChrome.CornerRadiusProperty, value); - } - } + public CornerRadius CornerRadius + { + get + { + return (CornerRadius) base.GetValue(WindowChrome.CornerRadiusProperty); + } + set + { + base.SetValue(WindowChrome.CornerRadiusProperty, value); + } + } - protected override Freezable CreateInstanceCore() - { - return new WindowChrome(); - } + protected override Freezable CreateInstanceCore() + { + return new WindowChrome(); + } - public WindowChrome() - { - foreach (WindowChrome._SystemParameterBoundProperty systemParameterBoundProperty in WindowChrome._BoundProperties) - { - BindingOperations.SetBinding(this, systemParameterBoundProperty.DependencyProperty, new Binding - { - Source = SystemParameters2.Current, - Path = new PropertyPath(systemParameterBoundProperty.SystemParameterPropertyName, new object[0]), - Mode = BindingMode.OneWay, - UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged - }); - } - } + public WindowChrome() + { + foreach (WindowChrome._SystemParameterBoundProperty systemParameterBoundProperty in WindowChrome._BoundProperties) + { + BindingOperations.SetBinding(this, systemParameterBoundProperty.DependencyProperty, new Binding + { + Source = SystemParameters2.Current, + Path = new PropertyPath(systemParameterBoundProperty.SystemParameterPropertyName, new object[0]), + Mode = BindingMode.OneWay, + UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged + }); + } + } - private void _OnPropertyChangedThatRequiresRepaint() - { - EventHandler propertyChangedThatRequiresRepaint = this.PropertyChangedThatRequiresRepaint; - if (propertyChangedThatRequiresRepaint != null) - { - propertyChangedThatRequiresRepaint(this, EventArgs.Empty); - } - } + private void _OnPropertyChangedThatRequiresRepaint() + { + EventHandler propertyChangedThatRequiresRepaint = this.PropertyChangedThatRequiresRepaint; + if (propertyChangedThatRequiresRepaint != null) + { + propertyChangedThatRequiresRepaint(this, EventArgs.Empty); + } + } - internal event EventHandler PropertyChangedThatRequiresRepaint; + internal event EventHandler PropertyChangedThatRequiresRepaint; - public static readonly DependencyProperty WindowChromeProperty = DependencyProperty.RegisterAttached("WindowChrome", typeof(WindowChrome), typeof(WindowChrome), new PropertyMetadata(null, new PropertyChangedCallback(WindowChrome._OnChromeChanged))); + public static readonly DependencyProperty WindowChromeProperty = DependencyProperty.RegisterAttached("WindowChrome", typeof(WindowChrome), typeof(WindowChrome), new PropertyMetadata(null, new PropertyChangedCallback(WindowChrome._OnChromeChanged))); - public static readonly DependencyProperty IsHitTestVisibleInChromeProperty = DependencyProperty.RegisterAttached("IsHitTestVisibleInChrome", typeof(bool), typeof(WindowChrome), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits)); + public static readonly DependencyProperty IsHitTestVisibleInChromeProperty = DependencyProperty.RegisterAttached("IsHitTestVisibleInChrome", typeof(bool), typeof(WindowChrome), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits)); - public static readonly DependencyProperty CaptionHeightProperty = DependencyProperty.Register("CaptionHeight", typeof(double), typeof(WindowChrome), new PropertyMetadata(0.0, delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((WindowChrome)d)._OnPropertyChangedThatRequiresRepaint(); - }), (object value) => (double)value >= 0.0); + public static readonly DependencyProperty CaptionHeightProperty = DependencyProperty.Register("CaptionHeight", typeof(double), typeof(WindowChrome), new PropertyMetadata(0.0, delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((WindowChrome) d)._OnPropertyChangedThatRequiresRepaint(); + }), (object value) => (double) value >= 0.0); - public static readonly DependencyProperty ResizeBorderThicknessProperty = DependencyProperty.Register("ResizeBorderThickness", typeof(Thickness), typeof(WindowChrome), new PropertyMetadata(default(Thickness)), (object value) => Utility.IsThicknessNonNegative((Thickness)value)); + public static readonly DependencyProperty ResizeBorderThicknessProperty = DependencyProperty.Register("ResizeBorderThickness", typeof(Thickness), typeof(WindowChrome), new PropertyMetadata(default(Thickness)), (object value) => Utility.IsThicknessNonNegative((Thickness) value)); - public static readonly DependencyProperty GlassFrameThicknessProperty = DependencyProperty.Register("GlassFrameThickness", typeof(Thickness), typeof(WindowChrome), new PropertyMetadata(default(Thickness), delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((WindowChrome)d)._OnPropertyChangedThatRequiresRepaint(); - }, (DependencyObject d, object o) => WindowChrome._CoerceGlassFrameThickness((Thickness)o))); + public static readonly DependencyProperty GlassFrameThicknessProperty = DependencyProperty.Register("GlassFrameThickness", typeof(Thickness), typeof(WindowChrome), new PropertyMetadata(default(Thickness), delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((WindowChrome) d)._OnPropertyChangedThatRequiresRepaint(); + }, (DependencyObject d, object o) => WindowChrome._CoerceGlassFrameThickness((Thickness) o))); - public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(WindowChrome), new PropertyMetadata(default(CornerRadius), delegate(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((WindowChrome)d)._OnPropertyChangedThatRequiresRepaint(); - }), (object value) => Utility.IsCornerRadiusValid((CornerRadius)value)); + public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(WindowChrome), new PropertyMetadata(default(CornerRadius), delegate (DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((WindowChrome) d)._OnPropertyChangedThatRequiresRepaint(); + }), (object value) => Utility.IsCornerRadiusValid((CornerRadius) value)); - private static readonly List _BoundProperties = new List - { - new WindowChrome._SystemParameterBoundProperty - { - DependencyProperty = WindowChrome.CornerRadiusProperty, - SystemParameterPropertyName = "WindowCornerRadius" - }, - new WindowChrome._SystemParameterBoundProperty - { - DependencyProperty = WindowChrome.CaptionHeightProperty, - SystemParameterPropertyName = "WindowCaptionHeight" - }, - new WindowChrome._SystemParameterBoundProperty - { - DependencyProperty = WindowChrome.ResizeBorderThicknessProperty, - SystemParameterPropertyName = "WindowResizeBorderThickness" - }, - new WindowChrome._SystemParameterBoundProperty - { - DependencyProperty = WindowChrome.GlassFrameThicknessProperty, - SystemParameterPropertyName = "WindowNonClientFrameThickness" - } - }; + private static readonly List _BoundProperties = new List + { + new WindowChrome._SystemParameterBoundProperty + { + DependencyProperty = WindowChrome.CornerRadiusProperty, + SystemParameterPropertyName = "WindowCornerRadius" + }, + new WindowChrome._SystemParameterBoundProperty + { + DependencyProperty = WindowChrome.CaptionHeightProperty, + SystemParameterPropertyName = "WindowCaptionHeight" + }, + new WindowChrome._SystemParameterBoundProperty + { + DependencyProperty = WindowChrome.ResizeBorderThicknessProperty, + SystemParameterPropertyName = "WindowResizeBorderThickness" + }, + new WindowChrome._SystemParameterBoundProperty + { + DependencyProperty = WindowChrome.GlassFrameThicknessProperty, + SystemParameterPropertyName = "WindowNonClientFrameThickness" + } + }; - private struct _SystemParameterBoundProperty - { - public string SystemParameterPropertyName { get; set; } + private struct _SystemParameterBoundProperty + { + public string SystemParameterPropertyName { get; set; } - public DependencyProperty DependencyProperty { get; set; } - } - } + public DependencyProperty DependencyProperty { get; set; } + } + } } diff --git a/src/Shared/Microsoft.Windows.Shell/WindowChromeWorker.cs b/src/Shared/Microsoft.Windows.Shell/WindowChromeWorker.cs index ed3d2bd2..d780d67d 100644 --- a/src/Shared/Microsoft.Windows.Shell/WindowChromeWorker.cs +++ b/src/Shared/Microsoft.Windows.Shell/WindowChromeWorker.cs @@ -11,806 +11,806 @@ using Standard; namespace Microsoft.Windows.Shell { - internal class WindowChromeWorker : DependencyObject - { - public WindowChromeWorker() - { - this._messageTable = new List> - { - new KeyValuePair(WM.SETTEXT, new MessageHandler(this._HandleSetTextOrIcon)), - new KeyValuePair(WM.SETICON, new MessageHandler(this._HandleSetTextOrIcon)), - new KeyValuePair(WM.NCACTIVATE, new MessageHandler(this._HandleNCActivate)), - new KeyValuePair(WM.NCCALCSIZE, new MessageHandler(this._HandleNCCalcSize)), - new KeyValuePair(WM.NCHITTEST, new MessageHandler(this._HandleNCHitTest)), - new KeyValuePair(WM.NCRBUTTONUP, new MessageHandler(this._HandleNCRButtonUp)), - new KeyValuePair(WM.SIZE, new MessageHandler(this._HandleSize)), - new KeyValuePair(WM.WINDOWPOSCHANGED, new MessageHandler(this._HandleWindowPosChanged)), - new KeyValuePair(WM.DWMCOMPOSITIONCHANGED, new MessageHandler(this._HandleDwmCompositionChanged)) - }; - if (Utility.IsPresentationFrameworkVersionLessThan4) - { - this._messageTable.AddRange(new KeyValuePair[] - { - new KeyValuePair(WM.WININICHANGE, new MessageHandler(this._HandleSettingChange)), - new KeyValuePair(WM.ENTERSIZEMOVE, new MessageHandler(this._HandleEnterSizeMove)), - new KeyValuePair(WM.EXITSIZEMOVE, new MessageHandler(this._HandleExitSizeMove)), - new KeyValuePair(WM.MOVE, new MessageHandler(this._HandleMove)) - }); - } - } + internal class WindowChromeWorker : DependencyObject + { + public WindowChromeWorker() + { + this._messageTable = new List> + { + new KeyValuePair(WM.SETTEXT, new MessageHandler(this._HandleSetTextOrIcon)), + new KeyValuePair(WM.SETICON, new MessageHandler(this._HandleSetTextOrIcon)), + new KeyValuePair(WM.NCACTIVATE, new MessageHandler(this._HandleNCActivate)), + new KeyValuePair(WM.NCCALCSIZE, new MessageHandler(this._HandleNCCalcSize)), + new KeyValuePair(WM.NCHITTEST, new MessageHandler(this._HandleNCHitTest)), + new KeyValuePair(WM.NCRBUTTONUP, new MessageHandler(this._HandleNCRButtonUp)), + new KeyValuePair(WM.SIZE, new MessageHandler(this._HandleSize)), + new KeyValuePair(WM.WINDOWPOSCHANGED, new MessageHandler(this._HandleWindowPosChanged)), + new KeyValuePair(WM.DWMCOMPOSITIONCHANGED, new MessageHandler(this._HandleDwmCompositionChanged)) + }; + if (Utility.IsPresentationFrameworkVersionLessThan4) + { + this._messageTable.AddRange(new KeyValuePair[] + { + new KeyValuePair(WM.WININICHANGE, new MessageHandler(this._HandleSettingChange)), + new KeyValuePair(WM.ENTERSIZEMOVE, new MessageHandler(this._HandleEnterSizeMove)), + new KeyValuePair(WM.EXITSIZEMOVE, new MessageHandler(this._HandleExitSizeMove)), + new KeyValuePair(WM.MOVE, new MessageHandler(this._HandleMove)) + }); + } + } - public void SetWindowChrome(WindowChrome newChrome) - { - base.VerifyAccess(); - if (newChrome == this._chromeInfo) - { - return; - } - if (this._chromeInfo != null) - { - this._chromeInfo.PropertyChangedThatRequiresRepaint -= this._OnChromePropertyChangedThatRequiresRepaint; - } - this._chromeInfo = newChrome; - if (this._chromeInfo != null) - { - this._chromeInfo.PropertyChangedThatRequiresRepaint += this._OnChromePropertyChangedThatRequiresRepaint; - } - this._ApplyNewCustomChrome(); - } + public void SetWindowChrome(WindowChrome newChrome) + { + base.VerifyAccess(); + if (newChrome == this._chromeInfo) + { + return; + } + if (this._chromeInfo != null) + { + this._chromeInfo.PropertyChangedThatRequiresRepaint -= this._OnChromePropertyChangedThatRequiresRepaint; + } + this._chromeInfo = newChrome; + if (this._chromeInfo != null) + { + this._chromeInfo.PropertyChangedThatRequiresRepaint += this._OnChromePropertyChangedThatRequiresRepaint; + } + this._ApplyNewCustomChrome(); + } - private void _OnChromePropertyChangedThatRequiresRepaint(object sender, EventArgs e) - { - this._UpdateFrameState(true); - } + private void _OnChromePropertyChangedThatRequiresRepaint(object sender, EventArgs e) + { + this._UpdateFrameState(true); + } - private static void _OnChromeWorkerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - Window window = (Window)d; - WindowChromeWorker windowChromeWorker = (WindowChromeWorker)e.NewValue; - windowChromeWorker._SetWindow(window); - } + private static void _OnChromeWorkerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + Window window = (Window) d; + WindowChromeWorker windowChromeWorker = (WindowChromeWorker) e.NewValue; + windowChromeWorker._SetWindow(window); + } - private void _SetWindow(Window window) - { - this._window = window; - this._hwnd = new WindowInteropHelper(this._window).Handle; - if (Utility.IsPresentationFrameworkVersionLessThan4) - { - Utility.AddDependencyPropertyChangeListener(this._window, Control.TemplateProperty, new EventHandler(this._OnWindowPropertyChangedThatRequiresTemplateFixup)); - Utility.AddDependencyPropertyChangeListener(this._window, FrameworkElement.FlowDirectionProperty, new EventHandler(this._OnWindowPropertyChangedThatRequiresTemplateFixup)); - } - this._window.Closed += this._UnsetWindow; - if (IntPtr.Zero != this._hwnd) - { - this._hwndSource = HwndSource.FromHwnd(this._hwnd); - this._window.ApplyTemplate(); - if (this._chromeInfo != null) - { - this._ApplyNewCustomChrome(); - return; - } - } - else - { - this._window.SourceInitialized += delegate(object sender, EventArgs e) - { - this._hwnd = new WindowInteropHelper(this._window).Handle; - this._hwndSource = HwndSource.FromHwnd(this._hwnd); - if (this._chromeInfo != null) - { - this._ApplyNewCustomChrome(); - } - }; - } - } + private void _SetWindow(Window window) + { + this._window = window; + this._hwnd = new WindowInteropHelper(this._window).Handle; + if (Utility.IsPresentationFrameworkVersionLessThan4) + { + Utility.AddDependencyPropertyChangeListener(this._window, Control.TemplateProperty, new EventHandler(this._OnWindowPropertyChangedThatRequiresTemplateFixup)); + Utility.AddDependencyPropertyChangeListener(this._window, FrameworkElement.FlowDirectionProperty, new EventHandler(this._OnWindowPropertyChangedThatRequiresTemplateFixup)); + } + this._window.Closed += this._UnsetWindow; + if (IntPtr.Zero != this._hwnd) + { + this._hwndSource = HwndSource.FromHwnd(this._hwnd); + this._window.ApplyTemplate(); + if (this._chromeInfo != null) + { + this._ApplyNewCustomChrome(); + return; + } + } + else + { + this._window.SourceInitialized += delegate (object sender, EventArgs e) + { + this._hwnd = new WindowInteropHelper(this._window).Handle; + this._hwndSource = HwndSource.FromHwnd(this._hwnd); + if (this._chromeInfo != null) + { + this._ApplyNewCustomChrome(); + } + }; + } + } - private void _UnsetWindow(object sender, EventArgs e) - { - if (Utility.IsPresentationFrameworkVersionLessThan4) - { - Utility.RemoveDependencyPropertyChangeListener(this._window, Control.TemplateProperty, new EventHandler(this._OnWindowPropertyChangedThatRequiresTemplateFixup)); - Utility.RemoveDependencyPropertyChangeListener(this._window, FrameworkElement.FlowDirectionProperty, new EventHandler(this._OnWindowPropertyChangedThatRequiresTemplateFixup)); - } - if (this._chromeInfo != null) - { - this._chromeInfo.PropertyChangedThatRequiresRepaint -= this._OnChromePropertyChangedThatRequiresRepaint; - } - this._RestoreStandardChromeState(true); - } + private void _UnsetWindow(object sender, EventArgs e) + { + if (Utility.IsPresentationFrameworkVersionLessThan4) + { + Utility.RemoveDependencyPropertyChangeListener(this._window, Control.TemplateProperty, new EventHandler(this._OnWindowPropertyChangedThatRequiresTemplateFixup)); + Utility.RemoveDependencyPropertyChangeListener(this._window, FrameworkElement.FlowDirectionProperty, new EventHandler(this._OnWindowPropertyChangedThatRequiresTemplateFixup)); + } + if (this._chromeInfo != null) + { + this._chromeInfo.PropertyChangedThatRequiresRepaint -= this._OnChromePropertyChangedThatRequiresRepaint; + } + this._RestoreStandardChromeState(true); + } - [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - public static WindowChromeWorker GetWindowChromeWorker(Window window) - { - Verify.IsNotNull(window, "window"); - return (WindowChromeWorker)window.GetValue(WindowChromeWorker.WindowChromeWorkerProperty); - } + [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] + public static WindowChromeWorker GetWindowChromeWorker(Window window) + { + Verify.IsNotNull(window, "window"); + return (WindowChromeWorker) window.GetValue(WindowChromeWorker.WindowChromeWorkerProperty); + } - [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - public static void SetWindowChromeWorker(Window window, WindowChromeWorker chrome) - { - Verify.IsNotNull(window, "window"); - window.SetValue(WindowChromeWorker.WindowChromeWorkerProperty, chrome); - } + [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] + public static void SetWindowChromeWorker(Window window, WindowChromeWorker chrome) + { + Verify.IsNotNull(window, "window"); + window.SetValue(WindowChromeWorker.WindowChromeWorkerProperty, chrome); + } - private void _OnWindowPropertyChangedThatRequiresTemplateFixup(object sender, EventArgs e) - { - if (this._chromeInfo != null && this._hwnd != IntPtr.Zero) - { - this._window.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new WindowChromeWorker._Action(this._FixupFrameworkIssues)); - } - } + private void _OnWindowPropertyChangedThatRequiresTemplateFixup(object sender, EventArgs e) + { + if (this._chromeInfo != null && this._hwnd != IntPtr.Zero) + { + this._window.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new WindowChromeWorker._Action(this._FixupFrameworkIssues)); + } + } - private void _ApplyNewCustomChrome() - { - if (this._hwnd == IntPtr.Zero) - { - return; - } - if (this._chromeInfo == null) - { - this._RestoreStandardChromeState(false); - return; - } - if (!this._isHooked) - { - this._hwndSource.AddHook(new HwndSourceHook(this._WndProc)); - this._isHooked = true; - } - this._FixupFrameworkIssues(); - this._UpdateSystemMenu(new WindowState?(this._window.WindowState)); - this._UpdateFrameState(true); - NativeMethods.SetWindowPos(this._hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP.DRAWFRAME | SWP.NOACTIVATE | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSIZE | SWP.NOZORDER); - } + private void _ApplyNewCustomChrome() + { + if (this._hwnd == IntPtr.Zero) + { + return; + } + if (this._chromeInfo == null) + { + this._RestoreStandardChromeState(false); + return; + } + if (!this._isHooked) + { + this._hwndSource.AddHook(new HwndSourceHook(this._WndProc)); + this._isHooked = true; + } + this._FixupFrameworkIssues(); + this._UpdateSystemMenu(new WindowState?(this._window.WindowState)); + this._UpdateFrameState(true); + NativeMethods.SetWindowPos(this._hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP.DRAWFRAME | SWP.NOACTIVATE | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSIZE | SWP.NOZORDER); + } - private void _FixupFrameworkIssues() - { - if (!Utility.IsPresentationFrameworkVersionLessThan4) - { - return; - } - if (this._window.Template == null) - { - return; - } - if (VisualTreeHelper.GetChildrenCount(this._window) == 0) - { - this._window.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new WindowChromeWorker._Action(this._FixupFrameworkIssues)); - return; - } - FrameworkElement frameworkElement = (FrameworkElement)VisualTreeHelper.GetChild(this._window, 0); - RECT windowRect = NativeMethods.GetWindowRect(this._hwnd); - RECT rect = this._GetAdjustedWindowRect(windowRect); - Rect rect2 = DpiHelper.DeviceRectToLogical(new Rect((double)windowRect.Left, (double)windowRect.Top, (double)windowRect.Width, (double)windowRect.Height)); - Rect rect3 = DpiHelper.DeviceRectToLogical(new Rect((double)rect.Left, (double)rect.Top, (double)rect.Width, (double)rect.Height)); - Thickness thickness = new Thickness(rect2.Left - rect3.Left, rect2.Top - rect3.Top, rect3.Right - rect2.Right, rect3.Bottom - rect2.Bottom); - frameworkElement.Margin = new Thickness(0.0, 0.0, -(thickness.Left + thickness.Right), -(thickness.Top + thickness.Bottom)); - if (this._window.FlowDirection == FlowDirection.RightToLeft) - { - frameworkElement.RenderTransform = new MatrixTransform(1.0, 0.0, 0.0, 1.0, -(thickness.Left + thickness.Right), 0.0); - } - else - { - frameworkElement.RenderTransform = null; - } - if (!this._isFixedUp) - { - this._hasUserMovedWindow = false; - this._window.StateChanged += this._FixupRestoreBounds; - this._isFixedUp = true; - } - } + private void _FixupFrameworkIssues() + { + if (!Utility.IsPresentationFrameworkVersionLessThan4) + { + return; + } + if (this._window.Template == null) + { + return; + } + if (VisualTreeHelper.GetChildrenCount(this._window) == 0) + { + this._window.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new WindowChromeWorker._Action(this._FixupFrameworkIssues)); + return; + } + FrameworkElement frameworkElement = (FrameworkElement) VisualTreeHelper.GetChild(this._window, 0); + RECT windowRect = NativeMethods.GetWindowRect(this._hwnd); + RECT rect = this._GetAdjustedWindowRect(windowRect); + Rect rect2 = DpiHelper.DeviceRectToLogical(new Rect((double) windowRect.Left, (double) windowRect.Top, (double) windowRect.Width, (double) windowRect.Height)); + Rect rect3 = DpiHelper.DeviceRectToLogical(new Rect((double) rect.Left, (double) rect.Top, (double) rect.Width, (double) rect.Height)); + Thickness thickness = new Thickness(rect2.Left - rect3.Left, rect2.Top - rect3.Top, rect3.Right - rect2.Right, rect3.Bottom - rect2.Bottom); + frameworkElement.Margin = new Thickness(0.0, 0.0, -(thickness.Left + thickness.Right), -(thickness.Top + thickness.Bottom)); + if (this._window.FlowDirection == FlowDirection.RightToLeft) + { + frameworkElement.RenderTransform = new MatrixTransform(1.0, 0.0, 0.0, 1.0, -(thickness.Left + thickness.Right), 0.0); + } + else + { + frameworkElement.RenderTransform = null; + } + if (!this._isFixedUp) + { + this._hasUserMovedWindow = false; + this._window.StateChanged += this._FixupRestoreBounds; + this._isFixedUp = true; + } + } - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - private void _FixupWindows7Issues() - { - if (this._blackGlassFixupAttemptCount > 5) - { - return; - } - if (Utility.IsOSWindows7OrNewer && NativeMethods.DwmIsCompositionEnabled()) - { - this._blackGlassFixupAttemptCount++; - bool flag = false; - try - { - flag = (NativeMethods.DwmGetCompositionTimingInfo(this._hwnd) != null); - } - catch (Exception) - { - } - if (!flag) - { - base.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new WindowChromeWorker._Action(this._FixupWindows7Issues)); - return; - } - this._blackGlassFixupAttemptCount = 0; - } - } + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] + private void _FixupWindows7Issues() + { + if (this._blackGlassFixupAttemptCount > 5) + { + return; + } + if (Utility.IsOSWindows7OrNewer && NativeMethods.DwmIsCompositionEnabled()) + { + this._blackGlassFixupAttemptCount++; + bool flag = false; + try + { + flag = (NativeMethods.DwmGetCompositionTimingInfo(this._hwnd) != null); + } + catch (Exception) + { + } + if (!flag) + { + base.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new WindowChromeWorker._Action(this._FixupWindows7Issues)); + return; + } + this._blackGlassFixupAttemptCount = 0; + } + } - private void _FixupRestoreBounds(object sender, EventArgs e) - { - if ((this._window.WindowState == WindowState.Maximized || this._window.WindowState == WindowState.Minimized) && this._hasUserMovedWindow) - { - this._hasUserMovedWindow = false; - WINDOWPLACEMENT windowPlacement = NativeMethods.GetWindowPlacement(this._hwnd); - RECT rect = this._GetAdjustedWindowRect(new RECT - { - Bottom = 100, - Right = 100 - }); - Point point = DpiHelper.DevicePixelsToLogical(new Point((double)(windowPlacement.rcNormalPosition.Left - rect.Left), (double)(windowPlacement.rcNormalPosition.Top - rect.Top))); - this._window.Top = point.Y; - this._window.Left = point.X; - } - } + private void _FixupRestoreBounds(object sender, EventArgs e) + { + if ((this._window.WindowState == WindowState.Maximized || this._window.WindowState == WindowState.Minimized) && this._hasUserMovedWindow) + { + this._hasUserMovedWindow = false; + WINDOWPLACEMENT windowPlacement = NativeMethods.GetWindowPlacement(this._hwnd); + RECT rect = this._GetAdjustedWindowRect(new RECT + { + Bottom = 100, + Right = 100 + }); + Point point = DpiHelper.DevicePixelsToLogical(new Point((double) (windowPlacement.rcNormalPosition.Left - rect.Left), (double) (windowPlacement.rcNormalPosition.Top - rect.Top))); + this._window.Top = point.Y; + this._window.Left = point.X; + } + } - private RECT _GetAdjustedWindowRect(RECT rcWindow) - { - WS dwStyle = (WS)((int)NativeMethods.GetWindowLongPtr(this._hwnd, GWL.STYLE)); - WS_EX dwExStyle = (WS_EX)((int)NativeMethods.GetWindowLongPtr(this._hwnd, GWL.EXSTYLE)); - return NativeMethods.AdjustWindowRectEx(rcWindow, dwStyle, false, dwExStyle); - } + private RECT _GetAdjustedWindowRect(RECT rcWindow) + { + WS dwStyle = (WS) ((int) NativeMethods.GetWindowLongPtr(this._hwnd, GWL.STYLE)); + WS_EX dwExStyle = (WS_EX) ((int) NativeMethods.GetWindowLongPtr(this._hwnd, GWL.EXSTYLE)); + return NativeMethods.AdjustWindowRectEx(rcWindow, dwStyle, false, dwExStyle); + } - private bool _IsWindowDocked - { - get - { - if (this._window.WindowState != WindowState.Normal) - { - return false; - } - RECT rect = this._GetAdjustedWindowRect(new RECT - { - Bottom = 100, - Right = 100 - }); - Point point = new Point(this._window.Left, this._window.Top); - point -= (Vector)DpiHelper.DevicePixelsToLogical(new Point((double)rect.Left, (double)rect.Top)); - return this._window.RestoreBounds.Location != point; - } - } + private bool _IsWindowDocked + { + get + { + if (this._window.WindowState != WindowState.Normal) + { + return false; + } + RECT rect = this._GetAdjustedWindowRect(new RECT + { + Bottom = 100, + Right = 100 + }); + Point point = new Point(this._window.Left, this._window.Top); + point -= (Vector) DpiHelper.DevicePixelsToLogical(new Point((double) rect.Left, (double) rect.Top)); + return this._window.RestoreBounds.Location != point; + } + } - private IntPtr _WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) - { - foreach (KeyValuePair keyValuePair in this._messageTable) - { - if (keyValuePair.Key == (WM)msg) - { - return keyValuePair.Value((WM)msg, wParam, lParam, out handled); - } - } - return IntPtr.Zero; - } + private IntPtr _WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + foreach (KeyValuePair keyValuePair in this._messageTable) + { + if (keyValuePair.Key == (WM) msg) + { + return keyValuePair.Value((WM) msg, wParam, lParam, out handled); + } + } + return IntPtr.Zero; + } - private IntPtr _HandleSetTextOrIcon(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - bool flag = this._ModifyStyle(WS.VISIBLE, WS.OVERLAPPED); - IntPtr result = NativeMethods.DefWindowProc(this._hwnd, uMsg, wParam, lParam); - if (flag) - { - this._ModifyStyle(WS.OVERLAPPED, WS.VISIBLE); - } - handled = true; - return result; - } + private IntPtr _HandleSetTextOrIcon(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + bool flag = this._ModifyStyle(WS.VISIBLE, WS.OVERLAPPED); + IntPtr result = NativeMethods.DefWindowProc(this._hwnd, uMsg, wParam, lParam); + if (flag) + { + this._ModifyStyle(WS.OVERLAPPED, WS.VISIBLE); + } + handled = true; + return result; + } - private IntPtr _HandleNCActivate(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - IntPtr result = NativeMethods.DefWindowProc(this._hwnd, WM.NCACTIVATE, wParam, new IntPtr(-1)); - handled = true; - return result; - } + private IntPtr _HandleNCActivate(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + IntPtr result = NativeMethods.DefWindowProc(this._hwnd, WM.NCACTIVATE, wParam, new IntPtr(-1)); + handled = true; + return result; + } - private IntPtr _HandleNCCalcSize(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - handled = true; - return new IntPtr(768); - } + private IntPtr _HandleNCCalcSize(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + handled = true; + return new IntPtr(768); + } - private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - IntPtr intPtr = IntPtr.Zero; - handled = false; - if (Utility.IsOSVistaOrNewer && this._chromeInfo.GlassFrameThickness != default(Thickness) && this._isGlassEnabled) - { - handled = NativeMethods.DwmDefWindowProc(this._hwnd, uMsg, wParam, lParam, out intPtr); - } - if (IntPtr.Zero == intPtr) - { - Point point = new Point((double)Utility.GET_X_LPARAM(lParam), (double)Utility.GET_Y_LPARAM(lParam)); - Rect deviceRectangle = this._GetWindowRect(); - HT ht = this._HitTestNca(DpiHelper.DeviceRectToLogical(deviceRectangle), DpiHelper.DevicePixelsToLogical(point)); - if (ht != HT.CLIENT) - { - Point point2 = point; - point2.Offset(-deviceRectangle.X, -deviceRectangle.Y); - point2 = DpiHelper.DevicePixelsToLogical(point2); - IInputElement inputElement = this._window.InputHitTest(point2); - if (inputElement != null && WindowChrome.GetIsHitTestVisibleInChrome(inputElement)) - { - ht = HT.CLIENT; - } - } - handled = true; - intPtr = new IntPtr((int)ht); - } - return intPtr; - } + private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + IntPtr intPtr = IntPtr.Zero; + handled = false; + if (Utility.IsOSVistaOrNewer && this._chromeInfo.GlassFrameThickness != default(Thickness) && this._isGlassEnabled) + { + handled = NativeMethods.DwmDefWindowProc(this._hwnd, uMsg, wParam, lParam, out intPtr); + } + if (IntPtr.Zero == intPtr) + { + Point point = new Point((double) Utility.GET_X_LPARAM(lParam), (double) Utility.GET_Y_LPARAM(lParam)); + Rect deviceRectangle = this._GetWindowRect(); + HT ht = this._HitTestNca(DpiHelper.DeviceRectToLogical(deviceRectangle), DpiHelper.DevicePixelsToLogical(point)); + if (ht != HT.CLIENT) + { + Point point2 = point; + point2.Offset(-deviceRectangle.X, -deviceRectangle.Y); + point2 = DpiHelper.DevicePixelsToLogical(point2); + IInputElement inputElement = this._window.InputHitTest(point2); + if (inputElement != null && WindowChrome.GetIsHitTestVisibleInChrome(inputElement)) + { + ht = HT.CLIENT; + } + } + handled = true; + intPtr = new IntPtr((int) ht); + } + return intPtr; + } - private IntPtr _HandleNCRButtonUp(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - if (2 == wParam.ToInt32()) - { - SystemCommands.ShowSystemMenuPhysicalCoordinates(this._window, new Point((double)Utility.GET_X_LPARAM(lParam), (double)Utility.GET_Y_LPARAM(lParam))); - } - handled = false; - return IntPtr.Zero; - } + private IntPtr _HandleNCRButtonUp(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + if (2 == wParam.ToInt32()) + { + SystemCommands.ShowSystemMenuPhysicalCoordinates(this._window, new Point((double) Utility.GET_X_LPARAM(lParam), (double) Utility.GET_Y_LPARAM(lParam))); + } + handled = false; + return IntPtr.Zero; + } - private IntPtr _HandleSize(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - WindowState? assumeState = null; - if (wParam.ToInt32() == 2) - { - assumeState = new WindowState?(WindowState.Maximized); - } - this._UpdateSystemMenu(assumeState); - handled = false; - return IntPtr.Zero; - } + private IntPtr _HandleSize(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + WindowState? assumeState = null; + if (wParam.ToInt32() == 2) + { + assumeState = new WindowState?(WindowState.Maximized); + } + this._UpdateSystemMenu(assumeState); + handled = false; + return IntPtr.Zero; + } - private IntPtr _HandleWindowPosChanged(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - this._UpdateSystemMenu(null); - if (!this._isGlassEnabled) - { - WINDOWPOS value = (WINDOWPOS)Marshal.PtrToStructure(lParam, typeof(WINDOWPOS)); - this._SetRoundingRegion(new WINDOWPOS?(value)); - } - handled = false; - return IntPtr.Zero; - } + private IntPtr _HandleWindowPosChanged(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + this._UpdateSystemMenu(null); + if (!this._isGlassEnabled) + { + WINDOWPOS value = (WINDOWPOS) Marshal.PtrToStructure(lParam, typeof(WINDOWPOS)); + this._SetRoundingRegion(new WINDOWPOS?(value)); + } + handled = false; + return IntPtr.Zero; + } - private IntPtr _HandleDwmCompositionChanged(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - this._UpdateFrameState(false); - handled = false; - return IntPtr.Zero; - } + private IntPtr _HandleDwmCompositionChanged(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + this._UpdateFrameState(false); + handled = false; + return IntPtr.Zero; + } - private IntPtr _HandleSettingChange(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - this._FixupFrameworkIssues(); - handled = false; - return IntPtr.Zero; - } + private IntPtr _HandleSettingChange(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + this._FixupFrameworkIssues(); + handled = false; + return IntPtr.Zero; + } - private IntPtr _HandleEnterSizeMove(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - this._isUserResizing = true; - if (this._window.WindowState != WindowState.Maximized && !this._IsWindowDocked) - { - this._windowPosAtStartOfUserMove = new Point(this._window.Left, this._window.Top); - } - handled = false; - return IntPtr.Zero; - } + private IntPtr _HandleEnterSizeMove(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + this._isUserResizing = true; + if (this._window.WindowState != WindowState.Maximized && !this._IsWindowDocked) + { + this._windowPosAtStartOfUserMove = new Point(this._window.Left, this._window.Top); + } + handled = false; + return IntPtr.Zero; + } - private IntPtr _HandleExitSizeMove(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - this._isUserResizing = false; - if (this._window.WindowState == WindowState.Maximized) - { - this._window.Top = this._windowPosAtStartOfUserMove.Y; - this._window.Left = this._windowPosAtStartOfUserMove.X; - } - handled = false; - return IntPtr.Zero; - } + private IntPtr _HandleExitSizeMove(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + this._isUserResizing = false; + if (this._window.WindowState == WindowState.Maximized) + { + this._window.Top = this._windowPosAtStartOfUserMove.Y; + this._window.Left = this._windowPosAtStartOfUserMove.X; + } + handled = false; + return IntPtr.Zero; + } - private IntPtr _HandleMove(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) - { - if (this._isUserResizing) - { - this._hasUserMovedWindow = true; - } - handled = false; - return IntPtr.Zero; - } + private IntPtr _HandleMove(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) + { + if (this._isUserResizing) + { + this._hasUserMovedWindow = true; + } + handled = false; + return IntPtr.Zero; + } - private bool _ModifyStyle(WS removeStyle, WS addStyle) - { - WS ws = (WS)NativeMethods.GetWindowLongPtr(this._hwnd, GWL.STYLE).ToInt32(); - WS ws2 = (ws & ~removeStyle) | addStyle; - if (ws == ws2) - { - return false; - } - NativeMethods.SetWindowLongPtr(this._hwnd, GWL.STYLE, new IntPtr((int)ws2)); - return true; - } + private bool _ModifyStyle(WS removeStyle, WS addStyle) + { + WS ws = (WS) NativeMethods.GetWindowLongPtr(this._hwnd, GWL.STYLE).ToInt32(); + WS ws2 = (ws & ~removeStyle) | addStyle; + if (ws == ws2) + { + return false; + } + NativeMethods.SetWindowLongPtr(this._hwnd, GWL.STYLE, new IntPtr((int) ws2)); + return true; + } - private WindowState _GetHwndState() - { - WINDOWPLACEMENT windowPlacement = NativeMethods.GetWindowPlacement(this._hwnd); - switch (windowPlacement.showCmd) - { - case SW.SHOWMINIMIZED: - return WindowState.Minimized; - case SW.SHOWMAXIMIZED: - return WindowState.Maximized; - default: - return WindowState.Normal; - } - } + private WindowState _GetHwndState() + { + WINDOWPLACEMENT windowPlacement = NativeMethods.GetWindowPlacement(this._hwnd); + switch (windowPlacement.showCmd) + { + case SW.SHOWMINIMIZED: + return WindowState.Minimized; + case SW.SHOWMAXIMIZED: + return WindowState.Maximized; + default: + return WindowState.Normal; + } + } - private Rect _GetWindowRect() - { - RECT windowRect = NativeMethods.GetWindowRect(this._hwnd); - return new Rect((double)windowRect.Left, (double)windowRect.Top, (double)windowRect.Width, (double)windowRect.Height); - } + private Rect _GetWindowRect() + { + RECT windowRect = NativeMethods.GetWindowRect(this._hwnd); + return new Rect((double) windowRect.Left, (double) windowRect.Top, (double) windowRect.Width, (double) windowRect.Height); + } - private void _UpdateSystemMenu(WindowState? assumeState) - { - WindowState windowState = assumeState ?? this._GetHwndState(); - if (assumeState != null || this._lastMenuState != windowState) - { - this._lastMenuState = windowState; - bool flag = this._ModifyStyle(WS.VISIBLE, WS.OVERLAPPED); - IntPtr systemMenu = NativeMethods.GetSystemMenu(this._hwnd, false); - if (IntPtr.Zero != systemMenu) - { - WS value = (WS)NativeMethods.GetWindowLongPtr(this._hwnd, GWL.STYLE).ToInt32(); - bool flag2 = Utility.IsFlagSet((int)value, 131072); - bool flag3 = Utility.IsFlagSet((int)value, 65536); - bool flag4 = Utility.IsFlagSet((int)value, 262144); - switch (windowState) - { - case WindowState.Minimized: - NativeMethods.EnableMenuItem(systemMenu, SC.RESTORE, MF.ENABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.MOVE, MF.GRAYED | MF.DISABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.SIZE, MF.GRAYED | MF.DISABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.MINIMIZE, MF.GRAYED | MF.DISABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.MAXIMIZE, flag3 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); - break; - case WindowState.Maximized: - NativeMethods.EnableMenuItem(systemMenu, SC.RESTORE, MF.ENABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.MOVE, MF.GRAYED | MF.DISABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.SIZE, MF.GRAYED | MF.DISABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.MINIMIZE, flag2 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); - NativeMethods.EnableMenuItem(systemMenu, SC.MAXIMIZE, MF.GRAYED | MF.DISABLED); - break; - default: - NativeMethods.EnableMenuItem(systemMenu, SC.RESTORE, MF.GRAYED | MF.DISABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.MOVE, MF.ENABLED); - NativeMethods.EnableMenuItem(systemMenu, SC.SIZE, flag4 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); - NativeMethods.EnableMenuItem(systemMenu, SC.MINIMIZE, flag2 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); - NativeMethods.EnableMenuItem(systemMenu, SC.MAXIMIZE, flag3 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); - break; - } - } - if (flag) - { - this._ModifyStyle(WS.OVERLAPPED, WS.VISIBLE); - } - } - } + private void _UpdateSystemMenu(WindowState? assumeState) + { + WindowState windowState = assumeState ?? this._GetHwndState(); + if (assumeState != null || this._lastMenuState != windowState) + { + this._lastMenuState = windowState; + bool flag = this._ModifyStyle(WS.VISIBLE, WS.OVERLAPPED); + IntPtr systemMenu = NativeMethods.GetSystemMenu(this._hwnd, false); + if (IntPtr.Zero != systemMenu) + { + WS value = (WS) NativeMethods.GetWindowLongPtr(this._hwnd, GWL.STYLE).ToInt32(); + bool flag2 = Utility.IsFlagSet((int) value, 131072); + bool flag3 = Utility.IsFlagSet((int) value, 65536); + bool flag4 = Utility.IsFlagSet((int) value, 262144); + switch (windowState) + { + case WindowState.Minimized: + NativeMethods.EnableMenuItem(systemMenu, SC.RESTORE, MF.ENABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.MOVE, MF.GRAYED | MF.DISABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.SIZE, MF.GRAYED | MF.DISABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.MINIMIZE, MF.GRAYED | MF.DISABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.MAXIMIZE, flag3 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); + break; + case WindowState.Maximized: + NativeMethods.EnableMenuItem(systemMenu, SC.RESTORE, MF.ENABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.MOVE, MF.GRAYED | MF.DISABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.SIZE, MF.GRAYED | MF.DISABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.MINIMIZE, flag2 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); + NativeMethods.EnableMenuItem(systemMenu, SC.MAXIMIZE, MF.GRAYED | MF.DISABLED); + break; + default: + NativeMethods.EnableMenuItem(systemMenu, SC.RESTORE, MF.GRAYED | MF.DISABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.MOVE, MF.ENABLED); + NativeMethods.EnableMenuItem(systemMenu, SC.SIZE, flag4 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); + NativeMethods.EnableMenuItem(systemMenu, SC.MINIMIZE, flag2 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); + NativeMethods.EnableMenuItem(systemMenu, SC.MAXIMIZE, flag3 ? MF.ENABLED : (MF.GRAYED | MF.DISABLED)); + break; + } + } + if (flag) + { + this._ModifyStyle(WS.OVERLAPPED, WS.VISIBLE); + } + } + } - private void _UpdateFrameState(bool force) - { - if (IntPtr.Zero == this._hwnd) - { - return; - } - bool flag = NativeMethods.DwmIsCompositionEnabled(); - if (force || flag != this._isGlassEnabled) - { - this._isGlassEnabled = (flag && this._chromeInfo.GlassFrameThickness != default(Thickness)); - if (!this._isGlassEnabled) - { - this._SetRoundingRegion(null); - } - else - { - this._ClearRoundingRegion(); - this._ExtendGlassFrame(); - this._FixupWindows7Issues(); - } - NativeMethods.SetWindowPos(this._hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP.DRAWFRAME | SWP.NOACTIVATE | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSIZE | SWP.NOZORDER); - } - } + private void _UpdateFrameState(bool force) + { + if (IntPtr.Zero == this._hwnd) + { + return; + } + bool flag = NativeMethods.DwmIsCompositionEnabled(); + if (force || flag != this._isGlassEnabled) + { + this._isGlassEnabled = (flag && this._chromeInfo.GlassFrameThickness != default(Thickness)); + if (!this._isGlassEnabled) + { + this._SetRoundingRegion(null); + } + else + { + this._ClearRoundingRegion(); + this._ExtendGlassFrame(); + this._FixupWindows7Issues(); + } + NativeMethods.SetWindowPos(this._hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP.DRAWFRAME | SWP.NOACTIVATE | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSIZE | SWP.NOZORDER); + } + } - private void _ClearRoundingRegion() - { - NativeMethods.SetWindowRgn(this._hwnd, IntPtr.Zero, NativeMethods.IsWindowVisible(this._hwnd)); - } + private void _ClearRoundingRegion() + { + NativeMethods.SetWindowRgn(this._hwnd, IntPtr.Zero, NativeMethods.IsWindowVisible(this._hwnd)); + } - private void _SetRoundingRegion(WINDOWPOS? wp) - { - WINDOWPLACEMENT windowPlacement = NativeMethods.GetWindowPlacement(this._hwnd); - if (windowPlacement.showCmd == SW.SHOWMAXIMIZED) - { - int num; - int num2; - if (wp != null) - { - num = wp.Value.x; - num2 = wp.Value.y; - } - else - { - Rect rect = this._GetWindowRect(); - num = (int)rect.Left; - num2 = (int)rect.Top; - } - IntPtr hMonitor = NativeMethods.MonitorFromWindow(this._hwnd, 2u); - MONITORINFO monitorInfo = NativeMethods.GetMonitorInfo(hMonitor); - RECT rcWork = monitorInfo.rcWork; - rcWork.Offset(-num, -num2); - IntPtr hRgn = IntPtr.Zero; - try - { - hRgn = NativeMethods.CreateRectRgnIndirect(rcWork); - NativeMethods.SetWindowRgn(this._hwnd, hRgn, NativeMethods.IsWindowVisible(this._hwnd)); - hRgn = IntPtr.Zero; - return; - } - finally - { - Utility.SafeDeleteObject(ref hRgn); - } - } - Size size; - if (wp != null && !Utility.IsFlagSet(wp.Value.flags, 1)) - { - size = new Size((double)wp.Value.cx, (double)wp.Value.cy); - } - else - { - if (wp != null && this._lastRoundingState == this._window.WindowState) - { - return; - } - size = this._GetWindowRect().Size; - } - this._lastRoundingState = this._window.WindowState; - IntPtr intPtr = IntPtr.Zero; - try - { - double num3 = Math.Min(size.Width, size.Height); - double num4 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.TopLeft, 0.0)).X; - num4 = Math.Min(num4, num3 / 2.0); - if (WindowChromeWorker._IsUniform(this._chromeInfo.CornerRadius)) - { - intPtr = WindowChromeWorker._CreateRoundRectRgn(new Rect(size), num4); - } - else - { - intPtr = WindowChromeWorker._CreateRoundRectRgn(new Rect(0.0, 0.0, size.Width / 2.0 + num4, size.Height / 2.0 + num4), num4); - double num5 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.TopRight, 0.0)).X; - num5 = Math.Min(num5, num3 / 2.0); - Rect region = new Rect(0.0, 0.0, size.Width / 2.0 + num5, size.Height / 2.0 + num5); - region.Offset(size.Width / 2.0 - num5, 0.0); - WindowChromeWorker._CreateAndCombineRoundRectRgn(intPtr, region, num5); - double num6 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.BottomLeft, 0.0)).X; - num6 = Math.Min(num6, num3 / 2.0); - Rect region2 = new Rect(0.0, 0.0, size.Width / 2.0 + num6, size.Height / 2.0 + num6); - region2.Offset(0.0, size.Height / 2.0 - num6); - WindowChromeWorker._CreateAndCombineRoundRectRgn(intPtr, region2, num6); - double num7 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.BottomRight, 0.0)).X; - num7 = Math.Min(num7, num3 / 2.0); - Rect region3 = new Rect(0.0, 0.0, size.Width / 2.0 + num7, size.Height / 2.0 + num7); - region3.Offset(size.Width / 2.0 - num7, size.Height / 2.0 - num7); - WindowChromeWorker._CreateAndCombineRoundRectRgn(intPtr, region3, num7); - } - NativeMethods.SetWindowRgn(this._hwnd, intPtr, NativeMethods.IsWindowVisible(this._hwnd)); - intPtr = IntPtr.Zero; - } - finally - { - Utility.SafeDeleteObject(ref intPtr); - } - } + private void _SetRoundingRegion(WINDOWPOS? wp) + { + WINDOWPLACEMENT windowPlacement = NativeMethods.GetWindowPlacement(this._hwnd); + if (windowPlacement.showCmd == SW.SHOWMAXIMIZED) + { + int num; + int num2; + if (wp != null) + { + num = wp.Value.x; + num2 = wp.Value.y; + } + else + { + Rect rect = this._GetWindowRect(); + num = (int) rect.Left; + num2 = (int) rect.Top; + } + IntPtr hMonitor = NativeMethods.MonitorFromWindow(this._hwnd, 2u); + MONITORINFO monitorInfo = NativeMethods.GetMonitorInfo(hMonitor); + RECT rcWork = monitorInfo.rcWork; + rcWork.Offset(-num, -num2); + IntPtr hRgn = IntPtr.Zero; + try + { + hRgn = NativeMethods.CreateRectRgnIndirect(rcWork); + NativeMethods.SetWindowRgn(this._hwnd, hRgn, NativeMethods.IsWindowVisible(this._hwnd)); + hRgn = IntPtr.Zero; + return; + } + finally + { + Utility.SafeDeleteObject(ref hRgn); + } + } + Size size; + if (wp != null && !Utility.IsFlagSet(wp.Value.flags, 1)) + { + size = new Size((double) wp.Value.cx, (double) wp.Value.cy); + } + else + { + if (wp != null && this._lastRoundingState == this._window.WindowState) + { + return; + } + size = this._GetWindowRect().Size; + } + this._lastRoundingState = this._window.WindowState; + IntPtr intPtr = IntPtr.Zero; + try + { + double num3 = Math.Min(size.Width, size.Height); + double num4 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.TopLeft, 0.0)).X; + num4 = Math.Min(num4, num3 / 2.0); + if (WindowChromeWorker._IsUniform(this._chromeInfo.CornerRadius)) + { + intPtr = WindowChromeWorker._CreateRoundRectRgn(new Rect(size), num4); + } + else + { + intPtr = WindowChromeWorker._CreateRoundRectRgn(new Rect(0.0, 0.0, size.Width / 2.0 + num4, size.Height / 2.0 + num4), num4); + double num5 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.TopRight, 0.0)).X; + num5 = Math.Min(num5, num3 / 2.0); + Rect region = new Rect(0.0, 0.0, size.Width / 2.0 + num5, size.Height / 2.0 + num5); + region.Offset(size.Width / 2.0 - num5, 0.0); + WindowChromeWorker._CreateAndCombineRoundRectRgn(intPtr, region, num5); + double num6 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.BottomLeft, 0.0)).X; + num6 = Math.Min(num6, num3 / 2.0); + Rect region2 = new Rect(0.0, 0.0, size.Width / 2.0 + num6, size.Height / 2.0 + num6); + region2.Offset(0.0, size.Height / 2.0 - num6); + WindowChromeWorker._CreateAndCombineRoundRectRgn(intPtr, region2, num6); + double num7 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.BottomRight, 0.0)).X; + num7 = Math.Min(num7, num3 / 2.0); + Rect region3 = new Rect(0.0, 0.0, size.Width / 2.0 + num7, size.Height / 2.0 + num7); + region3.Offset(size.Width / 2.0 - num7, size.Height / 2.0 - num7); + WindowChromeWorker._CreateAndCombineRoundRectRgn(intPtr, region3, num7); + } + NativeMethods.SetWindowRgn(this._hwnd, intPtr, NativeMethods.IsWindowVisible(this._hwnd)); + intPtr = IntPtr.Zero; + } + finally + { + Utility.SafeDeleteObject(ref intPtr); + } + } - private static IntPtr _CreateRoundRectRgn(Rect region, double radius) - { - if (DoubleUtilities.AreClose(0.0, radius)) - { - return NativeMethods.CreateRectRgn((int)Math.Floor(region.Left), (int)Math.Floor(region.Top), (int)Math.Ceiling(region.Right), (int)Math.Ceiling(region.Bottom)); - } - return NativeMethods.CreateRoundRectRgn((int)Math.Floor(region.Left), (int)Math.Floor(region.Top), (int)Math.Ceiling(region.Right) + 1, (int)Math.Ceiling(region.Bottom) + 1, (int)Math.Ceiling(radius), (int)Math.Ceiling(radius)); - } + private static IntPtr _CreateRoundRectRgn(Rect region, double radius) + { + if (DoubleUtilities.AreClose(0.0, radius)) + { + return NativeMethods.CreateRectRgn((int) Math.Floor(region.Left), (int) Math.Floor(region.Top), (int) Math.Ceiling(region.Right), (int) Math.Ceiling(region.Bottom)); + } + return NativeMethods.CreateRoundRectRgn((int) Math.Floor(region.Left), (int) Math.Floor(region.Top), (int) Math.Ceiling(region.Right) + 1, (int) Math.Ceiling(region.Bottom) + 1, (int) Math.Ceiling(radius), (int) Math.Ceiling(radius)); + } - [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "HRGNs")] - private static void _CreateAndCombineRoundRectRgn(IntPtr hrgnSource, Rect region, double radius) - { - IntPtr hrgnSrc = IntPtr.Zero; - try - { - hrgnSrc = WindowChromeWorker._CreateRoundRectRgn(region, radius); - if (NativeMethods.CombineRgn(hrgnSource, hrgnSource, hrgnSrc, RGN.OR) == CombineRgnResult.ERROR) - { - throw new InvalidOperationException("Unable to combine two HRGNs."); - } - } - catch - { - Utility.SafeDeleteObject(ref hrgnSrc); - throw; - } - } + [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "HRGNs")] + private static void _CreateAndCombineRoundRectRgn(IntPtr hrgnSource, Rect region, double radius) + { + IntPtr hrgnSrc = IntPtr.Zero; + try + { + hrgnSrc = WindowChromeWorker._CreateRoundRectRgn(region, radius); + if (NativeMethods.CombineRgn(hrgnSource, hrgnSource, hrgnSrc, RGN.OR) == CombineRgnResult.ERROR) + { + throw new InvalidOperationException("Unable to combine two HRGNs."); + } + } + catch + { + Utility.SafeDeleteObject(ref hrgnSrc); + throw; + } + } - private static bool _IsUniform(CornerRadius cornerRadius) - { - return DoubleUtilities.AreClose(cornerRadius.BottomLeft, cornerRadius.BottomRight) && DoubleUtilities.AreClose(cornerRadius.TopLeft, cornerRadius.TopRight) && DoubleUtilities.AreClose(cornerRadius.BottomLeft, cornerRadius.TopRight); - } + private static bool _IsUniform(CornerRadius cornerRadius) + { + return DoubleUtilities.AreClose(cornerRadius.BottomLeft, cornerRadius.BottomRight) && DoubleUtilities.AreClose(cornerRadius.TopLeft, cornerRadius.TopRight) && DoubleUtilities.AreClose(cornerRadius.BottomLeft, cornerRadius.TopRight); + } - private void _ExtendGlassFrame() - { - if (!Utility.IsOSVistaOrNewer) - { - return; - } - if (IntPtr.Zero == this._hwnd) - { - return; - } - if (!NativeMethods.DwmIsCompositionEnabled()) - { - this._hwndSource.CompositionTarget.BackgroundColor = SystemColors.WindowColor; - return; - } - this._hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent; - Point point = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.GlassFrameThickness.Left, this._chromeInfo.GlassFrameThickness.Top)); - Point point2 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.GlassFrameThickness.Right, this._chromeInfo.GlassFrameThickness.Bottom)); - MARGINS margins = new MARGINS - { - cxLeftWidth = (int)Math.Ceiling(point.X), - cxRightWidth = (int)Math.Ceiling(point2.X), - cyTopHeight = (int)Math.Ceiling(point.Y), - cyBottomHeight = (int)Math.Ceiling(point2.Y) - }; - NativeMethods.DwmExtendFrameIntoClientArea(this._hwnd, ref margins); - } + private void _ExtendGlassFrame() + { + if (!Utility.IsOSVistaOrNewer) + { + return; + } + if (IntPtr.Zero == this._hwnd) + { + return; + } + if (!NativeMethods.DwmIsCompositionEnabled()) + { + this._hwndSource.CompositionTarget.BackgroundColor = SystemColors.WindowColor; + return; + } + this._hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent; + Point point = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.GlassFrameThickness.Left, this._chromeInfo.GlassFrameThickness.Top)); + Point point2 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.GlassFrameThickness.Right, this._chromeInfo.GlassFrameThickness.Bottom)); + MARGINS margins = new MARGINS + { + cxLeftWidth = (int) Math.Ceiling(point.X), + cxRightWidth = (int) Math.Ceiling(point2.X), + cyTopHeight = (int) Math.Ceiling(point.Y), + cyBottomHeight = (int) Math.Ceiling(point2.Y) + }; + NativeMethods.DwmExtendFrameIntoClientArea(this._hwnd, ref margins); + } - private HT _HitTestNca(Rect windowPosition, Point mousePosition) - { - int num = 1; - int num2 = 1; - bool flag = false; - if (mousePosition.Y >= windowPosition.Top && mousePosition.Y < windowPosition.Top + this._chromeInfo.ResizeBorderThickness.Top + this._chromeInfo.CaptionHeight) - { - flag = (mousePosition.Y < windowPosition.Top + this._chromeInfo.ResizeBorderThickness.Top); - num = 0; - } - else if (mousePosition.Y < windowPosition.Bottom && mousePosition.Y >= windowPosition.Bottom - (double)((int)this._chromeInfo.ResizeBorderThickness.Bottom)) - { - num = 2; - } - if (mousePosition.X >= windowPosition.Left && mousePosition.X < windowPosition.Left + (double)((int)this._chromeInfo.ResizeBorderThickness.Left)) - { - num2 = 0; - } - else if (mousePosition.X < windowPosition.Right && mousePosition.X >= windowPosition.Right - this._chromeInfo.ResizeBorderThickness.Right) - { - num2 = 2; - } - if (num == 0 && num2 != 1 && !flag) - { - num = 1; - } - HT ht = WindowChromeWorker._HitTestBorders[num, num2]; - if (ht == HT.TOP && !flag) - { - ht = HT.CAPTION; - } - return ht; - } + private HT _HitTestNca(Rect windowPosition, Point mousePosition) + { + int num = 1; + int num2 = 1; + bool flag = false; + if (mousePosition.Y >= windowPosition.Top && mousePosition.Y < windowPosition.Top + this._chromeInfo.ResizeBorderThickness.Top + this._chromeInfo.CaptionHeight) + { + flag = (mousePosition.Y < windowPosition.Top + this._chromeInfo.ResizeBorderThickness.Top); + num = 0; + } + else if (mousePosition.Y < windowPosition.Bottom && mousePosition.Y >= windowPosition.Bottom - (double) ((int) this._chromeInfo.ResizeBorderThickness.Bottom)) + { + num = 2; + } + if (mousePosition.X >= windowPosition.Left && mousePosition.X < windowPosition.Left + (double) ((int) this._chromeInfo.ResizeBorderThickness.Left)) + { + num2 = 0; + } + else if (mousePosition.X < windowPosition.Right && mousePosition.X >= windowPosition.Right - this._chromeInfo.ResizeBorderThickness.Right) + { + num2 = 2; + } + if (num == 0 && num2 != 1 && !flag) + { + num = 1; + } + HT ht = WindowChromeWorker._HitTestBorders[num, num2]; + if (ht == HT.TOP && !flag) + { + ht = HT.CAPTION; + } + return ht; + } - private void _RestoreStandardChromeState(bool isClosing) - { - base.VerifyAccess(); - this._UnhookCustomChrome(); - if (!isClosing) - { - this._RestoreFrameworkIssueFixups(); - this._RestoreGlassFrame(); - this._RestoreHrgn(); - this._window.InvalidateMeasure(); - } - } + private void _RestoreStandardChromeState(bool isClosing) + { + base.VerifyAccess(); + this._UnhookCustomChrome(); + if (!isClosing) + { + this._RestoreFrameworkIssueFixups(); + this._RestoreGlassFrame(); + this._RestoreHrgn(); + this._window.InvalidateMeasure(); + } + } - private void _UnhookCustomChrome() - { - if (this._isHooked) - { - this._hwndSource.RemoveHook(new HwndSourceHook(this._WndProc)); - this._isHooked = false; - } - } + private void _UnhookCustomChrome() + { + if (this._isHooked) + { + this._hwndSource.RemoveHook(new HwndSourceHook(this._WndProc)); + this._isHooked = false; + } + } - private void _RestoreFrameworkIssueFixups() - { - if (Utility.IsPresentationFrameworkVersionLessThan4) - { - FrameworkElement frameworkElement = (FrameworkElement)VisualTreeHelper.GetChild(this._window, 0); - frameworkElement.Margin = default(Thickness); - this._window.StateChanged -= this._FixupRestoreBounds; - this._isFixedUp = false; - } - } + private void _RestoreFrameworkIssueFixups() + { + if (Utility.IsPresentationFrameworkVersionLessThan4) + { + FrameworkElement frameworkElement = (FrameworkElement) VisualTreeHelper.GetChild(this._window, 0); + frameworkElement.Margin = default(Thickness); + this._window.StateChanged -= this._FixupRestoreBounds; + this._isFixedUp = false; + } + } - private void _RestoreGlassFrame() - { - if (!Utility.IsOSVistaOrNewer || this._hwnd == IntPtr.Zero) - { - return; - } - this._hwndSource.CompositionTarget.BackgroundColor = SystemColors.WindowColor; - if (NativeMethods.DwmIsCompositionEnabled()) - { - MARGINS margins = default(MARGINS); - NativeMethods.DwmExtendFrameIntoClientArea(this._hwnd, ref margins); - } - } + private void _RestoreGlassFrame() + { + if (!Utility.IsOSVistaOrNewer || this._hwnd == IntPtr.Zero) + { + return; + } + this._hwndSource.CompositionTarget.BackgroundColor = SystemColors.WindowColor; + if (NativeMethods.DwmIsCompositionEnabled()) + { + MARGINS margins = default(MARGINS); + NativeMethods.DwmExtendFrameIntoClientArea(this._hwnd, ref margins); + } + } - private void _RestoreHrgn() - { - this._ClearRoundingRegion(); - NativeMethods.SetWindowPos(this._hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP.DRAWFRAME | SWP.NOACTIVATE | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSIZE | SWP.NOZORDER); - } + private void _RestoreHrgn() + { + this._ClearRoundingRegion(); + NativeMethods.SetWindowPos(this._hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP.DRAWFRAME | SWP.NOACTIVATE | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSIZE | SWP.NOZORDER); + } - // Note: this type is marked as 'beforefieldinit'. - static WindowChromeWorker() - { - HT[,] array = new HT[3, 3]; - array[0, 0] = HT.TOPLEFT; - array[0, 1] = HT.TOP; - array[0, 2] = HT.TOPRIGHT; - array[1, 0] = HT.LEFT; - array[1, 1] = HT.CLIENT; - array[1, 2] = HT.RIGHT; - array[2, 0] = HT.BOTTOMLEFT; - array[2, 1] = HT.BOTTOM; - array[2, 2] = HT.BOTTOMRIGHT; - WindowChromeWorker._HitTestBorders = array; - } + // Note: this type is marked as 'beforefieldinit'. + static WindowChromeWorker() + { + HT[,] array = new HT[3, 3]; + array[0, 0] = HT.TOPLEFT; + array[0, 1] = HT.TOP; + array[0, 2] = HT.TOPRIGHT; + array[1, 0] = HT.LEFT; + array[1, 1] = HT.CLIENT; + array[1, 2] = HT.RIGHT; + array[2, 0] = HT.BOTTOMLEFT; + array[2, 1] = HT.BOTTOM; + array[2, 2] = HT.BOTTOMRIGHT; + WindowChromeWorker._HitTestBorders = array; + } - private const SWP _SwpFlags = SWP.DRAWFRAME | SWP.NOACTIVATE | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSIZE | SWP.NOZORDER; + private const SWP _SwpFlags = SWP.DRAWFRAME | SWP.NOACTIVATE | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSIZE | SWP.NOZORDER; - private readonly List> _messageTable; + private readonly List> _messageTable; - private Window _window; + private Window _window; - private IntPtr _hwnd; + private IntPtr _hwnd; - private HwndSource _hwndSource; + private HwndSource _hwndSource; - private bool _isHooked; + private bool _isHooked; - private bool _isFixedUp; + private bool _isFixedUp; - private bool _isUserResizing; + private bool _isUserResizing; - private bool _hasUserMovedWindow; + private bool _hasUserMovedWindow; - private Point _windowPosAtStartOfUserMove = default(Point); + private Point _windowPosAtStartOfUserMove = default(Point); - private int _blackGlassFixupAttemptCount; + private int _blackGlassFixupAttemptCount; - private WindowChrome _chromeInfo; + private WindowChrome _chromeInfo; - private WindowState _lastRoundingState; + private WindowState _lastRoundingState; - private WindowState _lastMenuState; + private WindowState _lastMenuState; - private bool _isGlassEnabled; + private bool _isGlassEnabled; - public static readonly DependencyProperty WindowChromeWorkerProperty = DependencyProperty.RegisterAttached("WindowChromeWorker", typeof(WindowChromeWorker), typeof(WindowChromeWorker), new PropertyMetadata(null, new PropertyChangedCallback(WindowChromeWorker._OnChromeWorkerChanged))); + public static readonly DependencyProperty WindowChromeWorkerProperty = DependencyProperty.RegisterAttached("WindowChromeWorker", typeof(WindowChromeWorker), typeof(WindowChromeWorker), new PropertyMetadata(null, new PropertyChangedCallback(WindowChromeWorker._OnChromeWorkerChanged))); - [SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", MessageId = "Member")] - private static readonly HT[,] _HitTestBorders; + [SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", MessageId = "Member")] + private static readonly HT[,] _HitTestBorders; - private delegate void _Action(); - } + private delegate void _Action(); + } }