From d97c9e701bfd5291d2d960216e5140b2cceca3ac Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 26 Jul 2018 22:14:09 +0500 Subject: [PATCH] Bulk update format for files in Management folder with `codeformatter` (#7346) --- .../cmdletization/SessionBasedWrapper.cs | 2 +- .../cmdletization/cim/cimConverter.cs | 6 +- .../management/ClearPropertyCommand.cs | 2 +- .../commands/management/Computer.cs | 90 +++++++++--------- .../commands/management/ContentCommandBase.cs | 2 +- .../commands/management/ConvertPathCommand.cs | 2 +- .../management/CopyPropertyCommand.cs | 2 +- .../commands/management/GetChildrenCommand.cs | 2 +- .../management/GetComputerInfoCommand.cs | 3 +- .../commands/management/GetPropertyCommand.cs | 4 +- .../management/MovePropertyCommand.cs | 2 +- .../commands/management/Navigation.cs | 36 ++++--- .../commands/management/NewPropertyCommand.cs | 2 +- .../commands/management/ParsePathCommand.cs | 2 +- .../commands/management/PingPathCommand.cs | 2 +- .../commands/management/Process.cs | 7 +- .../management/RemovePropertyCommand.cs | 2 +- .../management/RenamePropertyCommand.cs | 2 +- .../commands/management/ResolvePathCommand.cs | 2 +- .../commands/management/Service.cs | 38 +++++--- .../commands/management/SetPropertyCommand.cs | 2 +- .../management/TestConnectionCommand.cs | 94 +++++++++---------- .../commands/management/TimeZoneCommands.cs | 40 ++++---- 23 files changed, 178 insertions(+), 168 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/SessionBasedWrapper.cs b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/SessionBasedWrapper.cs index b878633b75..8c10a2dfbb 100644 --- a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/SessionBasedWrapper.cs +++ b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/SessionBasedWrapper.cs @@ -74,7 +74,7 @@ namespace Microsoft.PowerShell.Cmdletization [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] protected TSession[] Session { - get { return _session ?? (_session = new TSession[] {this.DefaultSession}); } + get { return _session ?? (_session = new TSession[] { this.DefaultSession }); } set { if (value == null) diff --git a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimConverter.cs b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimConverter.cs index c51de701a7..6c6e7b9554 100644 --- a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimConverter.cs +++ b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimConverter.cs @@ -58,9 +58,11 @@ namespace Microsoft.PowerShell.Cim } fixed (char* target = _string) - for (int i = 0; i < charsToCopy; i++) { - target[offset + i] = source[i]; + for (int i = 0; i < charsToCopy; i++) + { + target[offset + i] = source[i]; + } } } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ClearPropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ClearPropertyCommand.cs index 85e97e28fa..7678125019 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ClearPropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ClearPropertyCommand.cs @@ -39,7 +39,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs index bf00769c72..df91bd42c2 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs @@ -35,7 +35,7 @@ using Microsoft.PowerShell.CoreClr.Stubs; namespace Microsoft.PowerShell.Commands { -#region Restart-Computer + #region Restart-Computer /// /// This exception is thrown when the timeout expires before a computer finishes restarting @@ -96,7 +96,7 @@ namespace Microsoft.PowerShell.Commands /// public RestartComputerTimeoutException(string message, Exception innerException) : base(message, innerException) { } -#region Serialization + #region Serialization /// /// Serialization constructor for class RestartComputerTimeoutException /// @@ -143,7 +143,7 @@ namespace Microsoft.PowerShell.Commands info.AddValue("ComputerName", ComputerName); info.AddValue("Timeout", Timeout); } -#endregion Serialization + #endregion Serialization } /// @@ -175,7 +175,7 @@ namespace Microsoft.PowerShell.Commands HelpUri = "https://go.microsoft.com/fwlink/?LinkID=135253", RemotingCapability = RemotingCapability.OwnedByCommand)] public class RestartComputerCommand : PSCmdlet, IDisposable { -#region "Parameters and PrivateData" + #region "Parameters and PrivateData" private const string DefaultParameterSet = "DefaultSet"; private const int forcedReboot = 6; // see https://msdn.microsoft.com/library/aa394058(v=vs.85).aspx @@ -365,9 +365,9 @@ $result private const string WinrmConnectionTest = "WinRM"; private const string PowerShellConnectionTest = "PowerShell"; -#endregion "parameters and PrivateData" + #endregion "parameters and PrivateData" -#region "IDisposable Members" + #region "IDisposable Members" /// /// Dispose Method @@ -402,9 +402,9 @@ $result } } -#endregion "IDisposable Members" + #endregion "IDisposable Members" -#region "Private Methods" + #region "Private Methods" /// /// Validate parameters for 'DefaultSet' @@ -441,7 +441,7 @@ $result } // Force wait with a test hook even if we're on the local computer - if (! InternalTestHooks.TestWaitStopComputer && Wait && containLocalhost) + if (!InternalTestHooks.TestWaitStopComputer && Wait && containLocalhost) { // The local machine will be ignored, and an error will be emitted. InvalidOperationException ex = new InvalidOperationException(ComputerResources.CannotWaitLocalComputer); @@ -650,15 +650,16 @@ $result string errorMsg = StringUtil.Format(ComputerResources.RestartcomputerFailed, computer, ComputerResources.TimeoutError); var exception = new RestartComputerTimeoutException(computer, Timeout, errorMsg, errorId); var error = new ErrorRecord(exception, errorId, ErrorCategory.OperationTimeout, computer); - if (! InternalTestHooks.TestWaitStopComputer ) { - WriteError(error); + if (!InternalTestHooks.TestWaitStopComputer) + { + WriteError(error); } } } -#endregion "Private Methods" + #endregion "Private Methods" -#region "Internal Methods" + #region "Internal Methods" internal static List TestWmiConnectionUsingWsman(List computerNames, List nextTestList, CancellationToken token, PSCredential credential, string wsmanAuthentication, PSCmdlet cmdlet) { @@ -771,9 +772,9 @@ $result return psList; } -#endregion "Internal Methods" + #endregion "Internal Methods" -#region "Overrides" + #region "Overrides" /// /// BeginProcessing method. @@ -1089,12 +1090,12 @@ $result } } -#endregion "Overrides" + #endregion "Overrides" } -#endregion Restart-Computer + #endregion Restart-Computer -#region Stop-Computer + #region Stop-Computer /// /// cmdlet to stop computer @@ -1103,14 +1104,14 @@ $result HelpUri = "https://go.microsoft.com/fwlink/?LinkID=135263", RemotingCapability = RemotingCapability.SupportedByCommand)] public sealed class StopComputerCommand : PSCmdlet, IDisposable { -#region Private Members + #region Private Members private readonly CancellationTokenSource _cancel = new CancellationTokenSource(); private const int forcedShutdown = 5; // See https://msdn.microsoft.com/library/aa394058(v=vs.85).aspx -#endregion + #endregion -#region "Parameters" + #region "Parameters" /// /// The authentication options for CIM_WSMan connection @@ -1157,7 +1158,7 @@ $result #endregion "parameters" -#region "IDisposable Members" + #region "IDisposable Members" /// /// Dispose Method @@ -1171,9 +1172,9 @@ $result catch (ObjectDisposedException) { } } -#endregion "IDisposable Members" + #endregion "IDisposable Members" -#region "Overrides" + #region "Overrides" /// /// ProcessRecord @@ -1201,9 +1202,9 @@ $result catch (AggregateException) { } } -#endregion "Overrides" + #endregion "Overrides" -#region Private Methods + #region Private Methods private void ProcessWSManProtocol(object[] flags) { @@ -1246,12 +1247,12 @@ $result } } -#endregion + #endregion } -#endregion + #endregion -#region Rename-Computer + #region Rename-Computer /// /// Renames a domain computer and its corresponding domain account or a @@ -1263,7 +1264,7 @@ $result HelpUri = "https://go.microsoft.com/fwlink/?LinkID=219990", RemotingCapability = RemotingCapability.SupportedByCommand)] public class RenameComputerCommand : PSCmdlet { -#region Private Members + #region Private Members private bool _containsLocalHost = false; private string _newNameForLocalHost = null; @@ -1271,9 +1272,9 @@ $result private readonly string _shortLocalMachineName = Dns.GetHostName(); private readonly string _fullLocalMachineName = Dns.GetHostEntryAsync(string.Empty).Result.HostName; -#endregion + #endregion -#region Parameters + #region Parameters /// /// Target computers to rename @@ -1348,9 +1349,9 @@ $result [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] public string WsmanAuthentication { get; set; } = "Default"; -#endregion + #endregion -#region "Private Methods" + #region "Private Methods" /// /// Check to see if the target computer is the local machine @@ -1479,7 +1480,7 @@ $result Microsoft.Management.Infrastructure.CimType.String, (dPassword == null) ? CimFlags.NullValue : CimFlags.None)); - if ( ! InternalTestHooks.TestRenameComputer ) + if (!InternalTestHooks.TestRenameComputer) { CimMethodResult result = cimSession.InvokeMethod( ComputerWMIHelper.CimOperatingSystemNamespace, @@ -1553,9 +1554,9 @@ $result } } -#endregion "Private Methods" + #endregion "Private Methods" -#region "Override Methods" + #region "Override Methods" /// /// ProcessRecord method. @@ -1588,12 +1589,12 @@ $result DoRenameComputerAction("localhost", _newNameForLocalHost, true); } -#endregion "Override Methods" + #endregion "Override Methods" } -#endregion Rename-Computer + #endregion Rename-Computer -#region "Public API" + #region "Public API" /// /// The object returned by SAM Computer cmdlets representing the status of the target machine. /// @@ -1675,9 +1676,9 @@ $result return StringUtil.Format(MatchFormat, HasSucceeded, newcomputername, oldcomputername); } } -#endregion "Public API" + #endregion "Public API" -#region Helper + #region Helper /// /// Helper Class used by Stop-Computer,Restart-Computer and Test-Connection /// Also Contain constants used by System Restore related Cmdlets. @@ -2103,7 +2104,7 @@ $result Microsoft.Management.Infrastructure.CimType.SInt32, CimFlags.None)); - if ( ! InternalTestHooks.TestStopComputer ) + if (!InternalTestHooks.TestStopComputer) { CimMethodResult result = cimSession.InvokeMethod( ComputerWMIHelper.CimOperatingSystemNamespace, @@ -2226,8 +2227,7 @@ $result return validatedComputerName; } } -#endregion Helper - + #endregion Helper }//End namespace #endif diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs index 2fbfeb9a61..2905ae3269 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ContentCommandBase.cs @@ -30,7 +30,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get { return Path; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ConvertPathCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ConvertPathCommand.cs index 6bc58d2587..a2f9d27c1a 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ConvertPathCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ConvertPathCommand.cs @@ -41,7 +41,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/CopyPropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/CopyPropertyCommand.cs index 11ade7016f..09a5023890 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/CopyPropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/CopyPropertyCommand.cs @@ -31,7 +31,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get { return paths; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs index 9ac3a521cb..17898bf346 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs @@ -53,7 +53,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = literalChildrenSet, Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs index f94c119074..8fefb0334b 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs @@ -435,7 +435,8 @@ namespace Microsoft.PowerShell.Commands var wmiGuard = session.GetFirst(CIMHelper.DeviceGuardNamespace, CIMHelper.ClassNames.DeviceGuard); - if (wmiGuard != null) { + if (wmiGuard != null) + { var smartStatus = EnumConverter.Convert((int?)wmiGuard.VirtualizationBasedSecurityStatus ?? 0); if (smartStatus != null) { diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetPropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetPropertyCommand.cs index bd6966443d..e61ac1de0f 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetPropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetPropertyCommand.cs @@ -39,7 +39,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get @@ -197,7 +197,7 @@ namespace Microsoft.PowerShell.Commands /// Gets or sets the literal path parameter to the command /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] LiteralPath { diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/MovePropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/MovePropertyCommand.cs index ff4924958f..aa92f02070 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/MovePropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/MovePropertyCommand.cs @@ -32,7 +32,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get { return paths; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs index 53d1519ed9..b959360c20 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs @@ -215,14 +215,12 @@ namespace Microsoft.PowerShell.Commands /// the base class to simplify the creation of the CmdletProviderContext. /// /// - public virtual string[] Include { get; -// get + public virtual string[] Include + { + get; set; -// set } = new string[0]; -// Include - /// /// Gets or sets the exclude property /// @@ -233,14 +231,12 @@ namespace Microsoft.PowerShell.Commands /// the base class to simplify the creation of the CmdletProviderContext. /// /// - public virtual string[] Exclude { get; -// get + public virtual string[] Exclude + { + get; set; -// set } = new string[0]; -// Exclude - /// /// Gets or sets the force property /// @@ -757,7 +753,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = literalPathSet, Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string LiteralPath { get @@ -937,7 +933,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string LiteralPath { get @@ -2059,7 +2055,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get @@ -2426,7 +2422,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get { return _paths; } @@ -2643,7 +2639,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get @@ -3117,7 +3113,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get { return _paths; } @@ -3507,7 +3503,7 @@ namespace Microsoft.PowerShell.Commands /// Gets or sets the literal path property /// [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = "ByLiteralPath")] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string LiteralPath { get { return _path; } @@ -3801,7 +3797,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get { return _paths; } @@ -4074,7 +4070,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get @@ -4305,7 +4301,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/NewPropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/NewPropertyCommand.cs index f80b4d2124..9c4c7ec9d8 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/NewPropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/NewPropertyCommand.cs @@ -37,7 +37,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs index 1fdf0c941b..3e09901219 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs @@ -83,7 +83,7 @@ namespace Microsoft.PowerShell.Commands /// Gets or sets the literal path parameter to the command /// [Parameter(ParameterSetName = "LiteralPathSet", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/PingPathCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/PingPathCommand.cs index acafed4f5d..52656e117f 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/PingPathCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/PingPathCommand.cs @@ -52,7 +52,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get { return _paths; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs index 4d67c5740f..092c232dd4 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs @@ -642,7 +642,8 @@ namespace Microsoft.PowerShell.Commands try { ProcessModule mainModule = PsUtils.GetMainModule(process); - if (mainModule != null) { + if (mainModule != null) + { WriteObject(mainModule.FileVersionInfo, true); } } @@ -1269,7 +1270,7 @@ namespace Microsoft.PowerShell.Commands /// /// Boolean variables to display the warning using ShouldContinue. /// - private bool _yesToAll,_noToAll; + private bool _yesToAll, _noToAll; /// /// Current windows user name. @@ -1587,7 +1588,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(Mandatory = true, Position = 0)] [ValidateNotNullOrEmpty] - [Alias("PSPath","Path")] + [Alias("PSPath", "Path")] public string FilePath { get; set; } /// diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/RemovePropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/RemovePropertyCommand.cs index c04c9db780..7280668209 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/RemovePropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/RemovePropertyCommand.cs @@ -38,7 +38,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/RenamePropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/RenamePropertyCommand.cs index 5854b096ca..2741c8b36e 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/RenamePropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/RenamePropertyCommand.cs @@ -38,7 +38,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs index 6d4c051305..b38bf8ed41 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs @@ -41,7 +41,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(ParameterSetName = "LiteralPath", Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs index 54e117cdd7..648ecf46cd 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs @@ -599,7 +599,8 @@ namespace Microsoft.PowerShell.Commands /// /// /// ServiceController as PSObject with UserName, Description and StartupType added - private PSObject AddProperties(ServiceController service) { + private PSObject AddProperties(ServiceController service) + { NakedWin32Handle hScManager = IntPtr.Zero; NakedWin32Handle hService = IntPtr.Zero; int lastError = 0; @@ -611,7 +612,8 @@ namespace Microsoft.PowerShell.Commands lpDatabaseName: null, dwDesiredAccess: NativeMethods.SC_MANAGER_CONNECT ); - if (IntPtr.Zero == hScManager) { + if (IntPtr.Zero == hScManager) + { lastError = Marshal.GetLastWin32Error(); Win32Exception exception = new Win32Exception(lastError); WriteNonTerminatingError( @@ -626,7 +628,8 @@ namespace Microsoft.PowerShell.Commands service.ServiceName, NativeMethods.SERVICE_QUERY_CONFIG ); - if (IntPtr.Zero == hService) { + if (IntPtr.Zero == hService) + { lastError = Marshal.GetLastWin32Error(); Win32Exception exception = new Win32Exception(lastError); WriteNonTerminatingError( @@ -646,7 +649,8 @@ namespace Microsoft.PowerShell.Commands NativeMethods.QUERY_SERVICE_CONFIG serviceInfo = new NativeMethods.QUERY_SERVICE_CONFIG(); querySuccessful = querySuccessful && NativeMethods.QueryServiceConfig(hService, out serviceInfo); - if(!querySuccessful) { + if (!querySuccessful) + { WriteNonTerminatingError( service: service, innerException: null, @@ -678,16 +682,20 @@ namespace Microsoft.PowerShell.Commands } finally { - if (IntPtr.Zero != hService) { + if (IntPtr.Zero != hService) + { bool succeeded = NativeMethods.CloseServiceHandle(hService); - if (!succeeded) { + if (!succeeded) + { Diagnostics.Assert(lastError != 0, "ErrorCode not success"); } } - if (IntPtr.Zero != hScManager) { + if (IntPtr.Zero != hScManager) + { bool succeeded = NativeMethods.CloseServiceHandle(hScManager); - if (!succeeded) { + if (!succeeded) + { Diagnostics.Assert(lastError != 0, "ErrorCode not success"); } } @@ -2116,7 +2124,8 @@ namespace Microsoft.PowerShell.Commands } // Set the delayed auto start - if(StartupType == ServiceStartupType.AutomaticDelayedStart) { + if (StartupType == ServiceStartupType.AutomaticDelayedStart) + { NativeMethods.SERVICE_DELAYED_AUTO_START_INFO ds = new NativeMethods.SERVICE_DELAYED_AUTO_START_INFO(); ds.fDelayedAutostart = true; size = Marshal.SizeOf(ds); @@ -2675,7 +2684,8 @@ namespace Microsoft.PowerShell.Commands cbBufSize: 0, pcbBytesNeeded: out bufferSizeNeeded); - if (status != true && Marshal.GetLastWin32Error() != ERROR_INSUFFICIENT_BUFFER) { + if (status != true && Marshal.GetLastWin32Error() != ERROR_INSUFFICIENT_BUFFER) + { return status; } @@ -2711,7 +2721,8 @@ namespace Microsoft.PowerShell.Commands cbBufSize: 0, pcbBytesNeeded: out bufferSizeNeeded); - if (status != true && Marshal.GetLastWin32Error() != ERROR_INSUFFICIENT_BUFFER) { + if (status != true && Marshal.GetLastWin32Error() != ERROR_INSUFFICIENT_BUFFER) + { return status; } @@ -2776,7 +2787,7 @@ namespace Microsoft.PowerShell.Commands internal static ServiceStartupType GetServiceStartupType(ServiceStartMode startMode, bool delayedAutoStart) { ServiceStartupType result = ServiceStartupType.Disabled; - switch(startMode) + switch (startMode) { case ServiceStartMode.Automatic: result = delayedAutoStart ? ServiceStartupType.AutomaticDelayedStart : ServiceStartupType.Automatic; @@ -2797,7 +2808,8 @@ namespace Microsoft.PowerShell.Commands /// ///Enum for usage with StartupType. Automatic, Manual and Disabled index matched from System.ServiceProcess.ServiceStartMode /// - public enum ServiceStartupType { + public enum ServiceStartupType + { ///Invalid service InvalidValue = -1, ///Automatic service diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs index 0d36a12b10..f570710ce5 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetPropertyCommand.cs @@ -41,7 +41,7 @@ namespace Microsoft.PowerShell.Commands Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] [Parameter(ParameterSetName = propertyPSObjectLiteralPathSet, Mandatory = true, ValueFromPipeline = false, ValueFromPipelineByPropertyName = true)] - [Alias("PSPath","LP")] + [Alias("PSPath", "LP")] public string[] LiteralPath { get { return paths; } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs index 17acc9b1db..110be4b62b 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs @@ -17,10 +17,10 @@ namespace Microsoft.PowerShell.Commands /// The implementation of the "Test-Connection" cmdlet. /// [Cmdlet(VerbsDiagnostic.Test, "Connection", DefaultParameterSetName = ParameterSetPingCount, HelpUri = "https://go.microsoft.com/fwlink/?LinkID=135266")] - [OutputType(typeof(PingReport), ParameterSetName = new string[] { ParameterSetPingCount })] - [OutputType(typeof(PingReply), ParameterSetName = new string[] { ParameterSetPingContinues, ParameterSetDetectionOfMTUSize })] - [OutputType(typeof(Boolean), ParameterSetName = new string[] { ParameterSetPingCount, ParameterSetPingContinues, ParameterSetConnectionByTCPPort })] - [OutputType(typeof(Int32), ParameterSetName = new string[] { ParameterSetDetectionOfMTUSize })] + [OutputType(typeof(PingReport), ParameterSetName = new string[] { ParameterSetPingCount })] + [OutputType(typeof(PingReply), ParameterSetName = new string[] { ParameterSetPingContinues, ParameterSetDetectionOfMTUSize })] + [OutputType(typeof(Boolean), ParameterSetName = new string[] { ParameterSetPingCount, ParameterSetPingContinues, ParameterSetConnectionByTCPPort })] + [OutputType(typeof(Int32), ParameterSetName = new string[] { ParameterSetDetectionOfMTUSize })] [OutputType(typeof(TraceRouteReply), ParameterSetName = new string[] { ParameterSetTraceRoute })] public class TestConnectionCommand : PSCmdlet { @@ -32,7 +32,7 @@ namespace Microsoft.PowerShell.Commands //private const string ParameterSetDetectionOfBlackHole = "DetectionOfBlackHole"; private const string ParameterSetDetectionOfMTUSize = "DetectionOfMTUSize"; -#region Parameters + #region Parameters /// /// Do ping test. @@ -187,7 +187,7 @@ namespace Microsoft.PowerShell.Commands [Parameter(Mandatory = true, ParameterSetName = ParameterSetConnectionByTCPPort)] public int TCPPort { get; set; } -#endregion Parameters + #endregion Parameters /// /// Init the cmdlet. @@ -230,7 +230,7 @@ namespace Microsoft.PowerShell.Commands } } -#region ConnectionTest + #region ConnectionTest private void ProcessConnectionByTCPPort(String targetNameOrAddress) { @@ -251,7 +251,7 @@ namespace Microsoft.PowerShell.Commands Task connectionTask = client.ConnectAsync(targetAddress, TCPPort); String targetString = targetAddress.ToString(); - for (var i=1; i <= TimeoutSeconds; i++) + for (var i = 1; i <= TimeoutSeconds; i++) { WriteConnectionTestProgress(targetNameOrAddress, targetString, i); @@ -287,8 +287,8 @@ namespace Microsoft.PowerShell.Commands private void WriteConnectionTestHeader(string resolvedTargetName, string targetAddress) { - TestConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.ConnectionTestStart, resolvedTargetName, targetAddress); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, ProgressRecordSpace); + _testConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.ConnectionTestStart, resolvedTargetName, targetAddress); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace); WriteProgress(record); } @@ -298,20 +298,20 @@ namespace Microsoft.PowerShell.Commands targetNameOrAddress, targetAddress, timeout); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, msg); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg); WriteProgress(record); } private void WriteConnectionTestFooter() { - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, ProgressRecordSpace); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace); record.RecordType = ProgressRecordType.Completed; WriteProgress(record); } -#endregion ConnectionTest + #endregion ConnectionTest -#region TracerouteTest + #region TracerouteTest private void ProcessTraceroute(String targetNameOrAddress) { String resolvedTargetName = null; @@ -344,7 +344,6 @@ namespace Microsoft.PowerShell.Commands // If we change 'DefaultTraceRoutePingCount' we should change 'ConsoleTraceRouteReply' resource string. for (int i = 1; i <= DefaultTraceRoutePingCount; i++) { - try { reply = sender.Send(targetAddress, timeout, buffer, pingOptions); @@ -384,7 +383,6 @@ namespace Microsoft.PowerShell.Commands WriteTraceRouteProgress(traceRouteReply); traceRouteResult.Replies.Add(traceRouteReply); - } while (reply != null && currentHop <= sMaxHops && (reply.Status == IPStatus.TtlExpired || reply.Status == IPStatus.TimedOut)); WriteTraceRouteFooter(); @@ -401,16 +399,16 @@ namespace Microsoft.PowerShell.Commands private void WriteConsoleTraceRouteHeader(string resolvedTargetName, string targetAddress) { - TestConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.TraceRouteStart, resolvedTargetName, targetAddress, MaxHops); + _testConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.TraceRouteStart, resolvedTargetName, targetAddress, MaxHops); - WriteInformation(TestConnectionProgressBarActivity, PSHostTag); + WriteInformation(_testConnectionProgressBarActivity, s_PSHostTag); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, ProgressRecordSpace); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace); WriteProgress(record); } - private string TestConnectionProgressBarActivity; - private static string[] PSHostTag = new string[] { "PSHOST" }; + private string _testConnectionProgressBarActivity; + private static string[] s_PSHostTag = new string[] { "PSHOST" }; private void WriteTraceRouteProgress(TraceRouteReply traceRouteReply) { @@ -431,17 +429,17 @@ namespace Microsoft.PowerShell.Commands msg = StringUtil.Format(TestConnectionResources.TraceRouteTimeOut, traceRouteReply.Hop); } - WriteInformation(msg, PSHostTag); + WriteInformation(msg, s_PSHostTag); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, msg); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg); WriteProgress(record); } private void WriteTraceRouteFooter() { - WriteInformation(TestConnectionResources.TraceRouteComplete, PSHostTag); + WriteInformation(TestConnectionResources.TraceRouteComplete, s_PSHostTag); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, ProgressRecordSpace); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace); record.RecordType = ProgressRecordType.Completed; WriteProgress(record); } @@ -511,9 +509,9 @@ namespace Microsoft.PowerShell.Commands public List Replies { get; } } -#endregion TracerouteTest + #endregion TracerouteTest -#region MTUSizeTest + #region MTUSizeTest private void ProcessMTUSize(String targetNameOrAddress) { PingReply reply, replyResult = null; @@ -540,7 +538,7 @@ namespace Microsoft.PowerShell.Commands PingOptions pingOptions = new PingOptions(MaxHops, true); int retry = 1; - while (LowMTUSize < (HighMTUSize-1)) + while (LowMTUSize < (HighMTUSize - 1)) { byte[] buffer = GetSendBuffer(CurrentMTUSize); @@ -585,7 +583,7 @@ namespace Microsoft.PowerShell.Commands } } - CurrentMTUSize = (LowMTUSize + HighMTUSize) /2; + CurrentMTUSize = (LowMTUSize + HighMTUSize) / 2; // Prevent DoS attack. Thread.Sleep(100); @@ -627,12 +625,12 @@ namespace Microsoft.PowerShell.Commands private void WriteMTUSizeHeader(string resolvedTargetName, string targetAddress) { - TestConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.MTUSizeDetectStart, + _testConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.MTUSizeDetectStart, resolvedTargetName, targetAddress, BufferSize); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, ProgressRecordSpace); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace); WriteProgress(record); } @@ -640,20 +638,20 @@ namespace Microsoft.PowerShell.Commands { var msg = StringUtil.Format(TestConnectionResources.MTUSizeDetectDescription, currentMTUSize, retry); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, msg); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg); WriteProgress(record); } private void WriteMTUSizeFooter() { - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, ProgressRecordSpace); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace); record.RecordType = ProgressRecordType.Completed; WriteProgress(record); } -#endregion MTUSizeTest + #endregion MTUSizeTest -#region PingTest + #region PingTest private void ProcessPing(String targetNameOrAddress) { @@ -743,15 +741,15 @@ namespace Microsoft.PowerShell.Commands private void WritePingHeader(string resolvedTargetName, string targetAddress) { - TestConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.MTUSizeDetectStart, + _testConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.MTUSizeDetectStart, resolvedTargetName, targetAddress, BufferSize); - WriteInformation(TestConnectionProgressBarActivity, PSHostTag); + WriteInformation(_testConnectionProgressBarActivity, s_PSHostTag); ProgressRecord record = new ProgressRecord(s_ProgressId, - TestConnectionProgressBarActivity, + _testConnectionProgressBarActivity, ProgressRecordSpace); WriteProgress(record); } @@ -772,17 +770,17 @@ namespace Microsoft.PowerShell.Commands reply.Options?.Ttl); } - WriteInformation(msg, PSHostTag); + WriteInformation(msg, s_PSHostTag); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, msg); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg); WriteProgress(record); } private void WritePingFooter() { - WriteInformation(TestConnectionResources.PingComplete, PSHostTag); + WriteInformation(TestConnectionResources.PingComplete, s_PSHostTag); - ProgressRecord record = new ProgressRecord(s_ProgressId, TestConnectionProgressBarActivity, ProgressRecordSpace); + ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace); record.RecordType = ProgressRecordType.Completed; WriteProgress(record); } @@ -815,7 +813,7 @@ namespace Microsoft.PowerShell.Commands public List Replies { get; } } -#endregion PingTest + #endregion PingTest private bool InitProcessPing(String targetNameOrAddress, out String resolvedTargetName, out IPAddress targetAddress) { @@ -859,9 +857,9 @@ namespace Microsoft.PowerShell.Commands if (IPv6 || IPv4) { - AddressFamily addressFamily = IPv6 ? AddressFamily.InterNetworkV6 :AddressFamily.InterNetwork; + AddressFamily addressFamily = IPv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork; - foreach(var address in hostEntry.AddressList) + foreach (var address in hostEntry.AddressList) { if (address.AddressFamily == addressFamily) { @@ -911,7 +909,7 @@ namespace Microsoft.PowerShell.Commands if (bufferSize == DefaultSendBufferSize && s_DefaultSendBuffer == null) { - s_DefaultSendBuffer= sendBuffer; + s_DefaultSendBuffer = sendBuffer; } return sendBuffer; @@ -924,7 +922,7 @@ namespace Microsoft.PowerShell.Commands /// Create the default send buffer once and cache it. private const int DefaultSendBufferSize = 32; - private static byte[] s_DefaultSendBuffer= null; + private static byte[] s_DefaultSendBuffer = null; // Random value for WriteProgress Activity Id. private static readonly int s_ProgressId = 174593053; @@ -933,5 +931,5 @@ namespace Microsoft.PowerShell.Commands private const string ProgressRecordSpace = " "; private const string TestConnectionExceptionId = "TestConnectionException"; - } + } } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TimeZoneCommands.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TimeZoneCommands.cs index 776dfe5c41..158ccff569 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TimeZoneCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TimeZoneCommands.cs @@ -20,7 +20,7 @@ namespace Microsoft.PowerShell.Commands [Alias("gtz")] public class GetTimeZoneCommand : PSCmdlet { -#region Parameters + #region Parameters /// /// A list of the local time zone ids that the cmdlet should look up. @@ -43,7 +43,7 @@ namespace Microsoft.PowerShell.Commands [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] Name { get; set; } -#endregion Parameters + #endregion Parameters /// /// Implementation of the ProcessRecord method for Get-TimeZone @@ -124,13 +124,13 @@ namespace Microsoft.PowerShell.Commands [Alias("stz")] public class SetTimeZoneCommand : PSCmdlet { -#region string constants + #region string constants private const string TimeZoneTarget = "Local System"; -#endregion string constants + #endregion string constants -#region Parameters + #region Parameters /// /// The name of the local time zone that the system should use. @@ -156,7 +156,7 @@ namespace Microsoft.PowerShell.Commands [Parameter] public SwitchParameter PassThru { get; set; } -#endregion Parameters + #endregion Parameters /// /// Implementation of the ProcessRecord method for Get-TimeZone @@ -320,7 +320,7 @@ namespace Microsoft.PowerShell.Commands } } -#region Helper functions + #region Helper functions /// /// True if the current process has access to change the time zone setting. @@ -424,9 +424,9 @@ namespace Microsoft.PowerShell.Commands throw new Win32Exception(error); } -#endregion Helper functions + #endregion Helper functions -#region Win32 interop helper + #region Win32 interop helper internal class NativeMethods { @@ -437,7 +437,7 @@ namespace Microsoft.PowerShell.Commands { } -#region Native DLL locations + #region Native DLL locations private const string SetDynamicTimeZoneApiDllName = "api-ms-win-core-timezone-l1-1-0.dll"; private const string GetTimeZoneInformationForYearApiDllName = "api-ms-win-core-timezone-l1-1-0.dll"; @@ -449,9 +449,9 @@ namespace Microsoft.PowerShell.Commands private const string CloseHandleApiDllName = "api-ms-win-downlevel-kernel32-l1-1-0.dll"; private const string SendMessageTimeoutApiDllName = "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll"; -#endregion Native DLL locations + #endregion Native DLL locations -#region Win32 SetDynamicTimeZoneInformation imports + #region Win32 SetDynamicTimeZoneInformation imports /// /// Used to marshal win32 SystemTime structure to managed code layer @@ -604,9 +604,9 @@ namespace Microsoft.PowerShell.Commands [DllImport(GetTimeZoneInformationForYearApiDllName, SetLastError = true)] public static extern bool GetTimeZoneInformationForYear([In] ushort wYear, [In] ref DYNAMIC_TIME_ZONE_INFORMATION pdtzi, ref TIME_ZONE_INFORMATION ptzi); -#endregion Win32 SetDynamicTimeZoneInformation imports + #endregion Win32 SetDynamicTimeZoneInformation imports -#region Win32 AdjustTokenPrivilege imports + #region Win32 AdjustTokenPrivilege imports /// /// Definition of TOKEN_QUERY constant from Win32 API @@ -715,9 +715,9 @@ namespace Microsoft.PowerShell.Commands public int Attributes; } -#endregion Win32 AdjustTokenPrivilege imports + #endregion Win32 AdjustTokenPrivilege imports -#region Win32 SendMessage imports + #region Win32 SendMessage imports /// /// Definition of WM_SETTINGCHANGE constant from Win32 API @@ -748,10 +748,10 @@ namespace Microsoft.PowerShell.Commands [DllImport(SendMessageTimeoutApiDllName, SetLastError = true, CharSet = CharSet.Unicode)] public static extern IntPtr SendMessageTimeout(IntPtr hWnd, int Msg, IntPtr wParam, string lParam, int fuFlags, int uTimeout, ref int lpdwResult); -#endregion Win32 SendMessage imports + #endregion Win32 SendMessage imports } -#endregion Win32 interop helper + #endregion Win32 interop helper } #endif @@ -760,14 +760,14 @@ namespace Microsoft.PowerShell.Commands /// internal static class TimeZoneHelper { -#region Error Ids + #region Error Ids internal const string TimeZoneNotFoundError = "TimeZoneNotFound"; internal const string MultipleMatchingTimeZonesError = "MultipleMatchingTimeZones"; internal const string InsufficientPermissionsError = "InsufficientPermissions"; internal const string SetTimeZoneFailedError = "SetTimeZoneFailed"; -#endregion Error Ids + #endregion Error Ids /// /// Find the system time zone by checking first against StandardName and then,