From 2c5ef7a69d6e394cfaf3473f6450a22af9ea01ec Mon Sep 17 00:00:00 2001 From: xtqqczze Date: Thu, 12 Nov 2020 08:52:41 +0000 Subject: [PATCH 1/2] Sort usings --- .../host/msh/ConsoleHost.cs | 10 ++++------ .../host/msh/ConsoleHostRawUserInterface.cs | 10 +++++----- .../msh/ConsoleHostUserInterfacePromptForChoice.cs | 3 +-- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 3a1986b1226..9bc5ab04f11 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -23,16 +23,14 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading; -using Microsoft.PowerShell.Telemetry; using Microsoft.PowerShell.Commands; - -using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle; -using Dbg = System.Management.Automation.Diagnostics; -using Debugger = System.Management.Automation.Debugger; - +using Microsoft.PowerShell.Telemetry; #if LEGACYTELEMETRY using Microsoft.PowerShell.Telemetry.Internal; #endif +using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle; +using Dbg = System.Management.Automation.Diagnostics; +using Debugger = System.Management.Automation.Debugger; namespace Microsoft.PowerShell { diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs index 722bd19effb..aeefda83302 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs @@ -4,18 +4,18 @@ #if !UNIX using System; -using System.Management.Automation; -using System.Management.Automation.Internal; -using System.Management.Automation.Host; using System.ComponentModel; using System.Globalization; +using System.Management.Automation; +using System.Management.Automation.Host; +using System.Management.Automation.Internal; using System.Security.Principal; using System.Text.RegularExpressions; using System.Threading.Tasks; -using Dbg = System.Management.Automation.Diagnostics; using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle; -using WORD = System.UInt16; +using Dbg = System.Management.Automation.Diagnostics; using DWORD = System.UInt32; +using WORD = System.UInt16; namespace Microsoft.PowerShell { diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs index b22845c2d56..a8db5fe14a8 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs @@ -9,9 +9,8 @@ using System.Management.Automation.Host; using System.Management.Automation.Internal; using System.Text; - -using Dbg = System.Management.Automation.Diagnostics; using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle; +using Dbg = System.Management.Automation.Diagnostics; using NakedWin32Handle = System.IntPtr; namespace Microsoft.PowerShell From b107f1d28705302d3e90a8ed3582cfc1255df433 Mon Sep 17 00:00:00 2001 From: xtqqczze Date: Thu, 12 Nov 2020 08:56:05 +0000 Subject: [PATCH 2/2] Fix IDE0005: Remove unnecessary import src\Microsoft.PowerShell.ConsoleHost\Microsoft.PowerShell.ConsoleHost.csproj https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005 --- .../WindowsTaskbarJumpList/ComInterfaces.cs | 1 - .../host/msh/ConsoleHostRawUserInterface.cs | 1 - .../host/msh/ConsoleHostTranscript.cs | 2 -- .../host/msh/ConsoleHostUserInterfacePromptForChoice.cs | 2 -- .../host/msh/ConsoleHostUserInterfaceSecurity.cs | 4 ---- .../host/msh/ConsoleTextWriter.cs | 5 ----- src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs | 2 -- 7 files changed, 17 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/ComInterfaces.cs b/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/ComInterfaces.cs index 761c6f6e26f..51efc6c2564 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/ComInterfaces.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/ComInterfaces.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs index aeefda83302..c4946b5431e 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs @@ -14,7 +14,6 @@ using System.Threading.Tasks; using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle; using Dbg = System.Management.Automation.Diagnostics; -using DWORD = System.UInt32; using WORD = System.UInt16; namespace Microsoft.PowerShell diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostTranscript.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostTranscript.cs index 0931abbf1cd..12df5ff6955 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostTranscript.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostTranscript.cs @@ -6,8 +6,6 @@ using System.Management.Automation.Host; using System.Management.Automation.Internal; -using Dbg = System.Management.Automation.Diagnostics; - namespace Microsoft.PowerShell { internal sealed partial class ConsoleHost : PSHost, IDisposable diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs index a8db5fe14a8..a3711200971 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfacePromptForChoice.cs @@ -9,9 +9,7 @@ using System.Management.Automation.Host; using System.Management.Automation.Internal; using System.Text; -using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle; using Dbg = System.Management.Automation.Diagnostics; -using NakedWin32Handle = System.IntPtr; namespace Microsoft.PowerShell { diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceSecurity.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceSecurity.cs index 7f34c789fc7..da12dd342df 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceSecurity.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceSecurity.cs @@ -1,14 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System; -using System.Globalization; using System.Management.Automation; using System.Management.Automation.Internal; using System.Security; -using Microsoft.Win32; - namespace Microsoft.PowerShell { /// diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleTextWriter.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleTextWriter.cs index 2acb7ab3061..7313a40e139 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleTextWriter.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleTextWriter.cs @@ -4,12 +4,7 @@ using System; using System.IO; using System.Text; - -using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle; using Dbg = System.Management.Automation.Diagnostics; -using DWORD = System.UInt32; -using HRESULT = System.UInt32; -using NakedWin32Handle = System.IntPtr; namespace Microsoft.PowerShell { diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs index 306cd38b717..f566bb4c470 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs @@ -2,12 +2,10 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Management.Automation; -using System.Management.Automation.Language; using System.Management.Automation.Runspaces; using Dbg = System.Management.Automation.Diagnostics;