Reformat code according to EditorConfig rules (#11681)

This commit is contained in:
xtqqczze 2020-01-31 22:56:22 +00:00 committed by GitHub
parent 0eaa41b705
commit a34d0f3e80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 320 additions and 307 deletions

View file

@ -3,4 +3,4 @@
using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("Microsoft.Windows.DSC.CoreConfProviders,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleTo("Microsoft.Windows.DSC.CoreConfProviders,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]

View file

@ -52,7 +52,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
foreach (string computerName in computerNames)
{
CimSessionProxy proxy = CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet);
proxys.Add(proxy);
proxys.Add(proxy);
}
break;

View file

@ -385,7 +385,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
proxy.KeyOnly = getCimInstance.KeyOnly;
proxy.Shallow = getCimInstance.Shallow;
proxy.OperationTimeout = getCimInstance.OperationTimeoutSec;
if(getCimInstance.ResourceUri != null )
if (getCimInstance.ResourceUri != null)
{
proxy.ResourceUri = getCimInstance.ResourceUri;
}
@ -394,7 +394,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
{
RemoveCimInstanceCommand removeCimInstance = cmdlet as RemoveCimInstanceCommand;
proxy.OperationTimeout = removeCimInstance.OperationTimeoutSec;
if(removeCimInstance.ResourceUri != null )
if (removeCimInstance.ResourceUri != null)
{
proxy.ResourceUri = removeCimInstance.ResourceUri;
}
@ -408,7 +408,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
{
SetCimInstanceCommand setCimInstance = cmdlet as SetCimInstanceCommand;
proxy.OperationTimeout = setCimInstance.OperationTimeoutSec;
if(setCimInstance.ResourceUri != null )
if (setCimInstance.ResourceUri != null)
{
proxy.ResourceUri = setCimInstance.ResourceUri;
}

View file

@ -288,7 +288,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
{
DebugHelper.WriteLogEx();
lock(myLock)
lock (myLock)
{
if (status == Status.Default)
{

View file

@ -143,7 +143,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
case CimBaseCommand.ResourceUriComputerSet:
{
string target = string.Format(CultureInfo.CurrentUICulture, targetClass, cmdlet.ClassName);
if(cmdlet.ResourceUri != null )
if (cmdlet.ResourceUri != null)
{
nameSpace = cmdlet.Namespace;
}
@ -210,7 +210,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
case CimBaseCommand.CimInstanceSessionSet:
{
string target = cmdlet.CimInstance.ToString();
if(cmdlet.ResourceUri != null )
if (cmdlet.ResourceUri != null)
{
nameSpace = cmdlet.Namespace;
}
@ -280,7 +280,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
InvokeCimMethodCommand cmdlet)
{
proxy.OperationTimeout = cmdlet.OperationTimeoutSec;
if(cmdlet.ResourceUri != null )
if (cmdlet.ResourceUri != null)
{
proxy.ResourceUri = cmdlet.ResourceUri;
}

View file

@ -211,7 +211,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
NewCimInstanceCommand cmdlet)
{
proxy.OperationTimeout = cmdlet.OperationTimeoutSec;
if(cmdlet.ResourceUri != null)
if (cmdlet.ResourceUri != null)
{
proxy.ResourceUri = cmdlet.ResourceUri;
}
@ -270,7 +270,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
IDictionary properties,
NewCimInstanceCommand cmdlet)
{
CimInstance cimInstance = new CimInstance(className,cimNamespace);
CimInstance cimInstance = new CimInstance(className, cimNamespace);
if (properties == null)
{
return cimInstance;
@ -299,8 +299,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
DebugHelper.WriteLog("Create and add new property to ciminstance: name = {0}; value = {1}; flags = {2}", 5, propertyName, propertyValue, flag);
PSReference cimReference = propertyValue as PSReference;
if( cimReference != null )
PSReference cimReference = propertyValue as PSReference;
if (cimReference != null)
{
CimProperty newProperty = CimProperty.Create(propertyName, GetBaseObject(cimReference.Value), CimType.Reference, flag);
cimInstance.CimInstanceProperties.Add(newProperty);

View file

@ -88,7 +88,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
case CimBaseCommand.CimInstanceComputerSet:
case CimBaseCommand.CimInstanceSessionSet:
string nameSpace = null;
if(cmdlet.ResourceUri != null )
if (cmdlet.ResourceUri != null)
{
nameSpace = GetCimInstanceParameter(cmdlet).CimSystemProperties.Namespace;
}

View file

@ -787,7 +787,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
{
this.sessionState = cimSessions.GetOrAdd(
CurrentRunspaceId,
delegate(Guid instanceId)
delegate (Guid instanceId)
{
if (Runspace.DefaultRunspace != null)
{
@ -974,7 +974,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
CimTestCimSessionContext context = new CimTestCimSessionContext(proxy, wrapper);
proxy.ContextObject = context;
// Skip test the connection if user intend to
if(cmdlet.SkipTestConnection.IsPresent)
if (cmdlet.SkipTestConnection.IsPresent)
{
AddSessionToCache(proxy.CimSession, context, new CmdletOperationBase(cmdlet));
}
@ -1171,7 +1171,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
if (sessionToGet != null)
{
foreach(PSObject psobject in sessionToGet)
foreach (PSObject psobject in sessionToGet)
{
cmdlet.WriteObject(psobject);
}

View file

@ -419,7 +419,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
string cimsessionComputerName = cimInstance.GetCimSessionComputerName();
CreateSetSession(cimsessionComputerName, null, null, null, false);
this.isDefaultSession = (cimsessionComputerName == ConstValue.NullComputerName);
this.isDefaultSession = (cimsessionComputerName == ConstValue.NullComputerName);
DebugHelper.WriteLogEx("Create a temp session with computerName = {0}.", 0, cimsessionComputerName);
}
@ -570,7 +570,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
{
DebugHelper.WriteLogEx("ResourceUri {0},", 0, value);
this.options.ResourceUri= value;
this.options.ResourceUri = value;
}
get
@ -606,7 +606,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
set
{
DebugHelper.WriteLogEx("EnablePromptUser {0}", 0, value);
if(value)
if (value)
{
this.options.PromptUser = this.PromptUser;
}
@ -1876,10 +1876,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
CimResultContext cimResultContext)
{
CimMethodResultObserver observer = new CimMethodResultObserver(this.session, asyncResult, cimResultContext)
{
ClassName = className,
MethodName = methodName
};
{
ClassName = className,
MethodName = methodName
};
observer.OnNewResult += this.ResultEventHandler;
this.operationID = Interlocked.Increment(ref gOperationCounter);

View file

@ -243,7 +243,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
else // For dynamic instance, it is valid to add a new property
{
CimProperty newProperty;
if( value == null )
if (value == null)
{
newProperty = CimProperty.Create(
key,

View file

@ -49,7 +49,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
if (containsErrorRecord != null)
{
return InitializeErrorRecord(context,
exception : inner,
exception: inner,
errorId: "CimCmdlet_" + containsErrorRecord.ErrorRecord.FullyQualifiedErrorId,
errorCategory: containsErrorRecord.ErrorRecord.CategoryInfo.Category,
cimResultContext: cimResultContext);
@ -57,7 +57,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
else
{
return InitializeErrorRecord(context,
exception :inner,
exception: inner,
errorId: "CimCmdlet_" + inner.GetType().Name,
errorCategory: ErrorCategory.NotSpecified,
cimResultContext: cimResultContext);

View file

@ -94,7 +94,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[Parameter(ValueFromPipelineByPropertyName = true)]
public UInt32 OperationTimeoutSec
{
get { return operationTimeout;}
get { return operationTimeout; }
set { operationTimeout = value; }
}
@ -112,7 +112,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public CimSession[] CimSession
{
get { return cimSession;}
get { return cimSession; }
set
{

View file

@ -58,7 +58,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] ComputerName
{
get { return computername;}
get { return computername; }
set
{
@ -80,7 +80,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public UInt32[] Id
{
get { return id;}
get { return id; }
set
{
@ -101,7 +101,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public Guid[] InstanceId
{
get { return instanceid;}
get { return instanceid; }
set
{
@ -123,7 +123,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] Name
{
get { return name;}
get { return name; }
set
{

View file

@ -306,10 +306,11 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
{
get { return clientOnly; }
set {
set
{
clientOnly = value;
base.SetParameter(value, nameClientOnly);
}
}
}
private SwitchParameter clientOnly;

View file

@ -32,7 +32,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
ParameterSetName = CredentialParameterSet)]
public PasswordAuthenticationMechanism Authentication
{
get { return authentication;}
get { return authentication; }
set
{
@ -88,7 +88,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] ComputerName
{
get { return computername;}
get { return computername; }
set { computername = value; }
}
@ -109,7 +109,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[Parameter(ValueFromPipelineByPropertyName = true)]
public string Name
{
get { return name;}
get { return name; }
set { name = value; }
}

View file

@ -18,7 +18,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[Cmdlet(
VerbsCommon.Remove,
"CimInstance",
SupportsShouldProcess=true,
SupportsShouldProcess = true,
DefaultParameterSetName = CimBaseCommand.CimInstanceComputerSet,
HelpUri = "https://go.microsoft.com/fwlink/?LinkId=227964")]
public class RemoveCimInstanceCommand : CimBaseCommand
@ -143,7 +143,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[Parameter]
public UInt32 OperationTimeoutSec
{
get { return operationTimeout;}
get { return operationTimeout; }
set { operationTimeout = value; }
}
@ -201,7 +201,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
ParameterSetName = CimBaseCommand.QuerySessionSet)]
public string Query
{
get { return query;}
get { return query; }
set
{
@ -223,7 +223,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
ParameterSetName = CimBaseCommand.QueryComputerSet)]
public string QueryDialect
{
get { return querydialect;}
get { return querydialect; }
set
{

View file

@ -54,7 +54,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public CimSession[] CimSession
{
get { return cimsession;}
get { return cimsession; }
set
{
@ -104,7 +104,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public UInt32[] Id
{
get { return id;}
get { return id; }
set
{
@ -127,7 +127,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public Guid[] InstanceId
{
get { return instanceid;}
get { return instanceid; }
set
{
@ -150,7 +150,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] Name
{
get { return name;}
get { return name; }
set
{

View file

@ -2,7 +2,7 @@
// Licensed under the MIT License.
// #define LOGENABLE // uncomment this line to enable the log,
// create c:\temp\cim.log before invoking cimcmdlets
// create c:\temp\cim.log before invoking cimcmdlets
using System;
using System.Collections.Generic;
@ -27,7 +27,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// Default computername
/// </para>
/// </summary>
internal static string[] DefaultSessionName = {@"*"};
internal static string[] DefaultSessionName = { @"*" };
/// <summary>
/// <para>
@ -364,7 +364,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
lock (logLock)
{
using (FileStream fs = new FileStream(logFile,FileMode.OpenOrCreate))
using (FileStream fs = new FileStream(logFile, FileMode.OpenOrCreate))
using (StreamWriter writer = new StreamWriter(fs))
{
writer.WriteLineAsync(spaces[indent] + sourceInformation + @" " + message);

View file

@ -74,7 +74,7 @@ namespace Microsoft.Management.UI.Internal
textBlock.FontWeight,
textBlock.FontStretch);
#pragma warning disable 612, 618
#pragma warning disable 612, 618
// FormattedText is used to measure the whole width of the text held up by TextBlock container
FormattedText formattedText = new FormattedText(
textBlock.Text,
@ -83,7 +83,7 @@ namespace Microsoft.Management.UI.Internal
typeface,
textBlock.FontSize,
textBlock.Foreground);
#pragma warning restore 612, 618
#pragma warning restore 612, 618
return formattedText.Width > textBlock.ActualWidth;
}

View file

@ -1,14 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace Microsoft.Management.UI.Internal
{

View file

@ -37,7 +37,7 @@ namespace Microsoft.PowerShell.Commands.ShowCommandInternal
/// </summary>
public Window Owner
{
get { return this.owner; }
get { return this.owner; }
set { this.owner = value; }
}

View file

@ -279,7 +279,7 @@ namespace Microsoft.PowerShell.Commands.ShowCommandInternal
{
get
{
return this.IsImported ? Visibility.Collapsed : Visibility.Visible;
return this.IsImported ? Visibility.Collapsed : Visibility.Visible;
}
}

View file

@ -1004,7 +1004,7 @@ Function PSGetSerializedShowCommandInfo
{
this.window.Dispatcher.Invoke(
new SendOrPostCallback(
delegate(object ignored)
delegate (object ignored)
{
this.allModulesViewModel = ShowCommandHelper.GetNewAllModulesViewModel(
this.allModulesViewModel,
@ -1054,7 +1054,7 @@ Function PSGetSerializedShowCommandInfo
{
this.window.Dispatcher.Invoke(
new SendOrPostCallback(
delegate(object ignored)
delegate (object ignored)
{
HelpWindow help = new HelpWindow(getHelpResults[0]);
help.Owner = this.window;

View file

@ -270,10 +270,11 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
// We access those fields directly. The struct is here for reference only.
//
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
struct PDH_COUNTER_INFO {
[FieldOffset(0)] public UInt32 dwLength;
[FieldOffset(4)] public UInt32 dwType;
[FieldOffset(8)] public UInt32 CVersion;
struct PDH_COUNTER_INFO
{
[FieldOffset(0)] public UInt32 dwLength;
[FieldOffset(4)] public UInt32 dwType;
[FieldOffset(8)] public UInt32 CVersion;
[FieldOffset(12)] public UInt32 CStatus;
[FieldOffset(16)] public UInt32 lScale;
[FieldOffset(20)] public UInt32 lDefaultScale;
@ -289,7 +290,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
[FieldOffset(88)] public string szCounterName;
[FieldOffset(96)] public string szExplainText;
[FieldOffset(104)]public IntPtr DataBuffer;
[FieldOffset(104)] public IntPtr DataBuffer;
}
[DllImport("pdh.dll", CharSet = CharSet.Unicode)]

View file

@ -1181,7 +1181,7 @@ $result
/// </summary>
public void Dispose()
{
_cancel.Dispose();
_cancel.Dispose();
}
#endregion "IDisposable Members"

View file

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
namespace Microsoft.PowerShell.Commands
{
#region Stop-Computer
#region Stop-Computer
/// <summary>
/// Cmdlet to stop computer.
@ -19,15 +19,15 @@ namespace Microsoft.PowerShell.Commands
HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2097151", RemotingCapability = RemotingCapability.SupportedByCommand)]
public sealed class StopComputerCommand : PSCmdlet, IDisposable
{
#region Private Members
#region Private Members
private Process _process = null;
#endregion
#endregion
// TODO: Support remote computers?
#region "IDisposable Members"
#region "IDisposable Members"
/// <summary>
/// Dispose Method.
@ -37,9 +37,9 @@ namespace Microsoft.PowerShell.Commands
_process.Dispose();
}
#endregion "IDisposable Members"
#endregion "IDisposable Members"
#region "Overrides"
#region "Overrides"
/// <summary>
/// BeginProcessing.
@ -68,9 +68,9 @@ namespace Microsoft.PowerShell.Commands
catch (NotSupportedException) {}
}
#endregion "Overrides"
#endregion "Overrides"
#region "Internals"
#region "Internals"
private void doShutdown() {
String cmd = "";
@ -96,8 +96,8 @@ namespace Microsoft.PowerShell.Commands
};
_process.Start();
}
#endregion
#endregion
}
#endregion
#endregion
}
#endif

View file

@ -66,7 +66,7 @@ namespace Microsoft.PowerShell.Commands
private ManagementObjectSearcher _searchProcess;
private bool _inputContainsWildcard = false;
private readonly ConnectionOptions _connectionOptions = new ConnectionOptions { };
private readonly ConnectionOptions _connectionOptions = new ConnectionOptions { };
/// <summary>
/// Sets connection options.

View file

@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Commands
{
var rawSecurityDescriptor = new RawSecurityDescriptor(securityDescriptorSddl);
RawAcl rawDiscretionaryAcl = rawSecurityDescriptor.DiscretionaryAcl;
var discretionaryAcl = new DiscretionaryAcl (false, false, rawDiscretionaryAcl);
var discretionaryAcl = new DiscretionaryAcl(false, false, rawDiscretionaryAcl);
byte[] rawDacl = new byte[discretionaryAcl.BinaryLength];
discretionaryAcl.GetBinaryForm(rawDacl, 0);
@ -1920,7 +1920,7 @@ namespace Microsoft.PowerShell.Commands
}
}
if(!string.IsNullOrEmpty(SecurityDescriptorSddl))
if (!string.IsNullOrEmpty(SecurityDescriptorSddl))
{
SetServiceSecurityDescriptor(service, SecurityDescriptorSddl, hService);
}
@ -2640,7 +2640,7 @@ namespace Microsoft.PowerShell.Commands
internal const DWORD SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3;
internal const DWORD SERVICE_CONFIG_SERVICE_SID_INFO = 5;
internal const DWORD WRITE_DAC = 262144;
internal const DWORD WRITE_OWNER =524288;
internal const DWORD WRITE_OWNER = 524288;
internal const DWORD SERVICE_WIN32_OWN_PROCESS = 0x10;
internal const DWORD SERVICE_ERROR_NORMAL = 1;

View file

@ -1089,26 +1089,26 @@ namespace Microsoft.PowerShell.Commands
{
case StringComparison.Ordinal:
case StringComparison.OrdinalIgnoreCase:
{
return OrdinalCultureName;
}
{
return OrdinalCultureName;
}
case StringComparison.InvariantCulture:
case StringComparison.InvariantCultureIgnoreCase:
{
return InvariantCultureName;
}
{
return InvariantCultureName;
}
case StringComparison.CurrentCulture:
case StringComparison.CurrentCultureIgnoreCase:
{
return CurrentCultureName;
}
{
return CurrentCultureName;
}
default:
{
break;
}
{
break;
}
}
return _cultureName;
@ -1126,8 +1126,8 @@ namespace Microsoft.PowerShell.Commands
internal const string CurrentCultureName = "Current";
private string _cultureName = CultureInfo.CurrentCulture.Name;
private StringComparison _stringComparison = StringComparison.CurrentCultureIgnoreCase;
private CompareOptions _compareOptions = CompareOptions.IgnoreCase;
private StringComparison _stringComparison = StringComparison.CurrentCultureIgnoreCase;
private CompareOptions _compareOptions = CompareOptions.IgnoreCase;
private delegate int CultureInfoIndexOf(string source, string value, int startIndex, int count, CompareOptions options);
@ -1140,36 +1140,36 @@ namespace Microsoft.PowerShell.Commands
switch (_cultureName)
{
case OrdinalCultureName:
{
_stringComparison = CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
_compareOptions = CaseSensitive ? CompareOptions.Ordinal : CompareOptions.OrdinalIgnoreCase;
_cultureInfoIndexOf = CultureInfo.InvariantCulture.CompareInfo.IndexOf;
break;
}
{
_stringComparison = CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
_compareOptions = CaseSensitive ? CompareOptions.Ordinal : CompareOptions.OrdinalIgnoreCase;
_cultureInfoIndexOf = CultureInfo.InvariantCulture.CompareInfo.IndexOf;
break;
}
case InvariantCultureName:
{
_stringComparison = CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase;
_compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase;
_cultureInfoIndexOf = CultureInfo.InvariantCulture.CompareInfo.IndexOf;
break;
}
{
_stringComparison = CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase;
_compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase;
_cultureInfoIndexOf = CultureInfo.InvariantCulture.CompareInfo.IndexOf;
break;
}
case CurrentCultureName:
{
_stringComparison = CaseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;
_compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase;
_cultureInfoIndexOf = CultureInfo.CurrentCulture.CompareInfo.IndexOf;
break;
}
{
_stringComparison = CaseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;
_compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase;
_cultureInfoIndexOf = CultureInfo.CurrentCulture.CompareInfo.IndexOf;
break;
}
default:
{
var _cultureInfo = CultureInfo.GetCultureInfo(_cultureName);
_compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase;
_cultureInfoIndexOf = _cultureInfo.CompareInfo.IndexOf;
break;
}
{
var _cultureInfo = CultureInfo.GetCultureInfo(_cultureName);
_compareOptions = CaseSensitive ? CompareOptions.None : CompareOptions.IgnoreCase;
_cultureInfoIndexOf = _cultureInfo.CompareInfo.IndexOf;
break;
}
}
}

View file

@ -595,49 +595,49 @@ namespace System.Management.Automation
public enum StatMask
{
/// <summary>The mask to collect the owner mode.</summary>
OwnerModeMask = 0x1C0,
OwnerModeMask = 0x1C0,
/// <summary>The mask to get the owners read bit.</summary>
OwnerRead = 0x100,
OwnerRead = 0x100,
/// <summary>The mask to get the owners write bit.</summary>
OwnerWrite = 0x080,
OwnerWrite = 0x080,
/// <summary>The mask to get the owners execute bit.</summary>
OwnerExecute = 0x040,
OwnerExecute = 0x040,
/// <summary>The mask to get the group mode.</summary>
GroupModeMask = 0x038,
GroupModeMask = 0x038,
/// <summary>The mask to get the group mode.</summary>
GroupRead = 0x20,
GroupRead = 0x20,
/// <summary>The mask to get the group mode.</summary>
GroupWrite = 0x10,
GroupWrite = 0x10,
/// <summary>The mask to get the group mode.</summary>
GroupExecute = 0x8,
GroupExecute = 0x8,
/// <summary>The mask to get the "other" mode.</summary>
OtherModeMask = 0x007,
OtherModeMask = 0x007,
/// <summary>The mask to get the "other" read bit.</summary>
OtherRead = 0x004,
OtherRead = 0x004,
/// <summary>The mask to get the "other" write bit.</summary>
OtherWrite = 0x002,
OtherWrite = 0x002,
/// <summary>The mask to get the "other" execute bit.</summary>
OtherExecute = 0x001,
OtherExecute = 0x001,
/// <summary>The mask to retrieve the sticky bit.</summary>
SetStickyMask = 0x200,
SetStickyMask = 0x200,
/// <summary>The mask to retrieve the setgid bit.</summary>
SetGidMask = 0x400,
SetGidMask = 0x400,
/// <summary>The mask to retrieve the setuid bit.</summary>
SetUidMask = 0x800,
SetUidMask = 0x800,
}
/// <summary>The Common Stat class.</summary>
@ -772,7 +772,7 @@ namespace System.Management.Automation
return new string(modeCharacters);
}
/// <summary>
/// Get the user name. This is used in formatting, but we shouldn't
/// do the pinvoke this unless we're going to use it.
@ -792,7 +792,7 @@ namespace System.Management.Automation
return username;
}
/// <summary>
/// Get the group name. This is used in formatting, but we shouldn't
/// do the pinvoke this unless we're going to use it.
@ -857,81 +857,81 @@ namespace System.Management.Automation
/// <returns>A managed common stat class instance.</returns>
private static CommonStat CopyStatStruct(NativeMethods.CommonStatStruct css)
{
CommonStat cs = new CommonStat();
cs.Inode = css.Inode;
cs.Mode = css.Mode;
cs.UserId = css.UserId;
cs.GroupId = css.GroupId;
cs.HardlinkCount = css.HardlinkCount;
cs.Size = css.Size;
CommonStat cs = new CommonStat();
cs.Inode = css.Inode;
cs.Mode = css.Mode;
cs.UserId = css.UserId;
cs.GroupId = css.GroupId;
cs.HardlinkCount = css.HardlinkCount;
cs.Size = css.Size;
// These can sometime throw if we get too large a number back (seen on Raspbian).
// As a fallback, set the time to UnixEpoch.
try
{
cs.AccessTime = DateTime.UnixEpoch.AddSeconds(css.AccessTime).ToLocalTime();
}
catch
{
cs.AccessTime = DateTime.UnixEpoch.ToLocalTime();
}
// These can sometime throw if we get too large a number back (seen on Raspbian).
// As a fallback, set the time to UnixEpoch.
try
{
cs.AccessTime = DateTime.UnixEpoch.AddSeconds(css.AccessTime).ToLocalTime();
}
catch
{
cs.AccessTime = DateTime.UnixEpoch.ToLocalTime();
}
try
{
cs.ModifiedTime = DateTime.UnixEpoch.AddSeconds(css.ModifiedTime).ToLocalTime();
}
catch
{
cs.ModifiedTime = DateTime.UnixEpoch.ToLocalTime();
}
try
{
cs.ModifiedTime = DateTime.UnixEpoch.AddSeconds(css.ModifiedTime).ToLocalTime();
}
catch
{
cs.ModifiedTime = DateTime.UnixEpoch.ToLocalTime();
}
try
{
cs.StatusChangeTime = DateTime.UnixEpoch.AddSeconds(css.StatusChangeTime).ToLocalTime();
}
catch
{
cs.StatusChangeTime = DateTime.UnixEpoch.ToLocalTime();
}
try
{
cs.StatusChangeTime = DateTime.UnixEpoch.AddSeconds(css.StatusChangeTime).ToLocalTime();
}
catch
{
cs.StatusChangeTime = DateTime.UnixEpoch.ToLocalTime();
}
cs.BlockSize = css.BlockSize;
cs.DeviceId = css.DeviceId;
cs.NumberOfBlocks = css.NumberOfBlocks;
cs.BlockSize = css.BlockSize;
cs.DeviceId = css.DeviceId;
cs.NumberOfBlocks = css.NumberOfBlocks;
if (css.IsDirectory == 1)
{
cs.ItemType = ItemType.Directory;
}
else if (css.IsFile == 1)
{
cs.ItemType = ItemType.File;
}
else if (css.IsSymbolicLink == 1)
{
cs.ItemType = ItemType.SymbolicLink;
}
else if (css.IsBlockDevice == 1)
{
cs.ItemType = ItemType.BlockDevice;
}
else if (css.IsCharacterDevice == 1)
{
cs.ItemType = ItemType.CharacterDevice;
}
else if (css.IsNamedPipe == 1)
{
cs.ItemType = ItemType.NamedPipe;
}
else
{
cs.ItemType = ItemType.Socket;
}
if (css.IsDirectory == 1)
{
cs.ItemType = ItemType.Directory;
}
else if (css.IsFile == 1)
{
cs.ItemType = ItemType.File;
}
else if (css.IsSymbolicLink == 1)
{
cs.ItemType = ItemType.SymbolicLink;
}
else if (css.IsBlockDevice == 1)
{
cs.ItemType = ItemType.BlockDevice;
}
else if (css.IsCharacterDevice == 1)
{
cs.ItemType = ItemType.CharacterDevice;
}
else if (css.IsNamedPipe == 1)
{
cs.ItemType = ItemType.NamedPipe;
}
else
{
cs.ItemType = ItemType.Socket;
}
cs.IsSetUid = css.IsSetUid == 1;
cs.IsSetGid = css.IsSetGid == 1;
cs.IsSticky = css.IsSticky == 1;
cs.IsSetUid = css.IsSetUid == 1;
cs.IsSetGid = css.IsSetGid == 1;
cs.IsSticky = css.IsSticky == 1;
return cs;
return cs;
}
/// <summary>Get the lstat info from a path.</summary>
@ -1140,7 +1140,7 @@ namespace System.Management.Automation
/// <summary>This filesystem item is a file.</summary>
internal int IsFile;
/// <summary>This filesystem item is a symbolic link.</summary>
internal int IsSymbolicLink;

View file

@ -1549,7 +1549,7 @@ namespace System.Management.Automation
_context.CommandDiscovery.GetLookupDirectoryPaths(),
_context,
ConstructSearchPatternsFromName(_commandName, commandDiscovery: true),
useFuzzyMatch : false);
useFuzzyMatch: false);
}
else if (_canDoPathLookupResult == CanDoPathLookupResult.PathIsRooted)
{
@ -1573,7 +1573,7 @@ namespace System.Management.Automation
directoryCollection,
_context,
ConstructSearchPatternsFromName(fileName, commandDiscovery: true),
useFuzzyMatch : false);
useFuzzyMatch: false);
}
else
{
@ -1613,7 +1613,7 @@ namespace System.Management.Automation
directoryCollection,
_context,
ConstructSearchPatternsFromName(fileName, commandDiscovery: true),
useFuzzyMatch : false);
useFuzzyMatch: false);
}
else
{

View file

@ -3784,7 +3784,8 @@ namespace System.Management.Automation
name: propertyEntry.member.Name,
adapter: this,
baseObject: obj,
adapterData: propertyEntry) { IsHidden = propertyEntry.IsHidden } as T);
adapterData: propertyEntry)
{ IsHidden = propertyEntry.IsHidden } as T);
}
}
}

View file

@ -3584,7 +3584,7 @@ namespace System.Management.Automation.Runspaces
ConcurrentBag<string> errors = new ConcurrentBag<string>();
// Use at most 3 locks (we don't expect contention on that many cores anyways,
// and typically we'll be processing just 2 or 3 files anyway, hence capacity=3.
ConcurrentDictionary<string, string> filesProcessed = new ConcurrentDictionary<string, string>(
ConcurrentDictionary<string, string> filesProcessed = new ConcurrentDictionary<string, string>(
concurrencyLevel: 3,
capacity: 3,
StringComparer.OrdinalIgnoreCase);

View file

@ -1896,7 +1896,7 @@ namespace Microsoft.PowerShell.Commands
}
moduleProxyList = ImportModule_RemotelyViaPsrpSession(importModuleOptions, moduleNames, moduleFullyQualifiedNames, WindowsPowerShellCompatRemotingSession, usingWinCompat: true);
foreach(PSModuleInfo moduleProxy in moduleProxyList)
foreach (PSModuleInfo moduleProxy in moduleProxyList)
{
moduleProxy.IsWindowsPowerShellCompatModule = true;
System.Threading.Interlocked.Increment(ref s_WindowsPowerShellCompatUsageCounter);

View file

@ -332,27 +332,27 @@ namespace Microsoft.PowerShell.Commands
{
fileBaseName = moduleName;
#endif
string qualifiedPath = Path.Combine(path, fileBaseName);
module = LoadUsingMultiVersionModuleBase(qualifiedPath, manifestProcessingFlags, options, out found);
if (!found)
{
if (name.IndexOfAny(Utils.Separators.Directory) == -1)
{
qualifiedPath = Path.Combine(qualifiedPath, fileBaseName);
}
else if (Directory.Exists(qualifiedPath))
{
// if it points to a directory, add the basename back onto the path...
qualifiedPath = Path.Combine(qualifiedPath, Path.GetFileName(fileBaseName));
}
string qualifiedPath = Path.Combine(path, fileBaseName);
module = LoadUsingMultiVersionModuleBase(qualifiedPath, manifestProcessingFlags, options, out found);
if (!found)
{
if (name.IndexOfAny(Utils.Separators.Directory) == -1)
{
qualifiedPath = Path.Combine(qualifiedPath, fileBaseName);
}
else if (Directory.Exists(qualifiedPath))
{
// if it points to a directory, add the basename back onto the path...
qualifiedPath = Path.Combine(qualifiedPath, Path.GetFileName(fileBaseName));
}
module = LoadUsingExtensions(parentModule, name, qualifiedPath, extension, null, this.BasePrefix, ss, options, manifestProcessingFlags, out found);
}
module = LoadUsingExtensions(parentModule, name, qualifiedPath, extension, null, this.BasePrefix, ss, options, manifestProcessingFlags, out found);
}
if (found)
{
break;
}
if (found)
{
break;
}
#if UNIX
}
}
@ -2359,10 +2359,10 @@ namespace Microsoft.PowerShell.Commands
{
if (importingModule)
{
IList<PSModuleInfo> moduleProxies = ImportModulesUsingWinCompat(new string [] {moduleManifestPath}, null, new ImportModuleOptions());
IList<PSModuleInfo> moduleProxies = ImportModulesUsingWinCompat(new string[] { moduleManifestPath }, null, new ImportModuleOptions());
// we are loading by a single ManifestPath so expect max of 1
if(moduleProxies.Count > 0)
if (moduleProxies.Count > 0)
{
return moduleProxies[0];
}
@ -4810,7 +4810,7 @@ namespace Microsoft.PowerShell.Commands
internal PSSession CreateWindowsPowerShellCompatResources()
{
PSSession compatSession = null;
lock(s_WindowsPowerShellCompatSyncObject)
lock (s_WindowsPowerShellCompatSyncObject)
{
compatSession = GetWindowsPowerShellCompatRemotingSession();
if (compatSession == null)
@ -4834,7 +4834,7 @@ namespace Microsoft.PowerShell.Commands
internal void CleanupWindowsPowerShellCompatResources()
{
lock(s_WindowsPowerShellCompatSyncObject)
lock (s_WindowsPowerShellCompatSyncObject)
{
var compatSession = GetWindowsPowerShellCompatRemotingSession();
if (compatSession != null)
@ -4848,7 +4848,7 @@ namespace Microsoft.PowerShell.Commands
}
}
internal virtual IList<PSModuleInfo> ImportModulesUsingWinCompat(IEnumerable<string> moduleNames, IEnumerable<ModuleSpecification> moduleFullyQualifiedNames, ImportModuleOptions importModuleOptions) {throw new System.NotImplementedException();}
internal virtual IList<PSModuleInfo> ImportModulesUsingWinCompat(IEnumerable<string> moduleNames, IEnumerable<ModuleSpecification> moduleFullyQualifiedNames, ImportModuleOptions importModuleOptions) { throw new System.NotImplementedException(); }
private void RemoveTypesAndFormatting(
IList<string> formatFilesToRemove,

View file

@ -365,7 +365,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"SerializedInvocationInfo",
GetMethodInfo(typeof(Microsoft.PowerShell.DeserializingTypeConverter), @"GetInvocationInfo"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);

View file

@ -705,7 +705,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"NameString",
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"NameString"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);
@ -716,7 +717,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"LengthString",
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"LengthString"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);
@ -727,7 +729,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"LastWriteTimeString",
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"LastWriteTimeString"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);
@ -830,7 +833,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"NameString",
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"NameString"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);
@ -841,7 +845,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"LengthString",
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"LengthString"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);
@ -852,7 +857,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"LastWriteTimeString",
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.FileSystemProvider), @"LastWriteTimeString"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);
@ -5095,7 +5101,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"Flags",
GetMethodInfo(typeof(Microsoft.PowerShell.DeserializingTypeConverter), @"GetParameterSetMetadataFlags"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);
@ -5256,7 +5263,8 @@ namespace System.Management.Automation.Runspaces
new PSCodeProperty(
@"InstanceId",
GetMethodInfo(typeof(Microsoft.PowerShell.DeserializingTypeConverter), @"GetFormatViewDefinitionInstanceId"),
setterCodeReference: null) { IsHidden = true },
setterCodeReference: null)
{ IsHidden = true },
typeMembers,
isOverride: false);

View file

@ -645,7 +645,7 @@ namespace System.Management.Automation
/// </summary>
/// <param name="breakpoints">Breakpoints.</param>
/// <param name="runspaceId">The runspace id of the runspace you want to interact with, null being the current runspace.</param>
public virtual void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId) =>
public virtual void SetBreakpoints(IEnumerable<Breakpoint> breakpoints, int? runspaceId) =>
throw new PSNotImplementedException();
/// <summary>
@ -3947,7 +3947,7 @@ namespace System.Management.Automation
{
WaitForReadyDebug();
DebugRunspace(runspace, breakAll:true);
DebugRunspace(runspace, breakAll: true);
// Block this event thread until debugging has ended.
WaitForDebugComplete();

View file

@ -971,7 +971,7 @@ namespace System.Management.Automation.Runspaces
// If we have no running pipeline, or if the currently running pipeline is
// the same as the current thread, then execute the action.
var pipelineRunning = _currentlyRunningPipeline as PipelineBase;
return pipelineRunning == null ||
return pipelineRunning == null ||
Thread.CurrentThread == pipelineRunning.NestedPipelineExecutionThread;
}
}

View file

@ -600,7 +600,8 @@ namespace System.Management.Automation
int subStringLength = 0;
for (int charCount = 0; charCount < item.Length; charCount++) {
for (int charCount = 0; charCount < item.Length; charCount++)
{
// Evaluate the predicate using the character at cursor.
object predicateResult = predicate.DoInvokeReturnAsIs(
useLocalScope: true,

View file

@ -962,7 +962,7 @@ namespace System.Management.Automation.Language
var temps = new List<ParameterExpression>();
var getExpr = av.GetValue(this, exprs, temps);
if(et == ExpressionType.Coalesce)
if (et == ExpressionType.Coalesce)
{
exprs.Add(av.SetValue(this, Coalesce(getExpr, right)));
}
@ -982,7 +982,7 @@ namespace System.Management.Automation.Language
{
return left;
}
else if(leftType == typeof(AutomationNull))
else if (leftType == typeof(AutomationNull))
{
return right;
}
@ -3307,7 +3307,7 @@ namespace System.Management.Automation.Language
// e.g. ("Hi"), vs (Test-Path ./here.txt)
return ShouldSetExecutionStatusToSuccess(parenExpression.Pipeline);
case SubExpressionAst subExpressionAst:
case SubExpressionAst subExpressionAst:
// Subexpressions generally set $? since they encapsulate a statement block
// But $() requires an explicit setting
return subExpressionAst.SubExpression.Statements.Count == 0;

View file

@ -885,9 +885,9 @@ namespace System.Management.Automation.Language
internal void SkipNewlines(bool skipSemis)
{
// We normally don't create any tokens in a Skip method, but the
// V2 tokenizer api returns newline, semi-colon, and line
// continuation tokens so we create them as they are encountered.
// We normally don't create any tokens in a Skip method, but the
// V2 tokenizer api returns newline, semi-colon, and line
// continuation tokens so we create them as they are encountered.
again:
char c = GetChar();
switch (c)

View file

@ -2105,7 +2105,7 @@ namespace System.Management.Automation
{
// This is supported only for PowerShell versions >= 7.0
CheckRemoteBreakpointManagementSupport(RemoteDebuggingCommands.SetBreakpoint);
Breakpoint breakpoint = new CommandBreakpoint(path, null, command, action);
var functionParameters = new Dictionary<string, object>
{

View file

@ -322,7 +322,7 @@ namespace System.Management.Automation.Runspaces
case WSManConnectionInfo _:
return "WSMan";
case SSHConnectionInfo _:
case SSHConnectionInfo _:
return "SSH";
case NamedPipeConnectionInfo _:

View file

@ -598,14 +598,14 @@ namespace Microsoft.PowerShell.Commands
if (WorkingDirectory != null && !Directory.Exists(WorkingDirectory))
{
string message = StringUtil.Format(RemotingErrorIdStrings.StartJobWorkingDirectoryNotFound, WorkingDirectory);
var errorRecord = new ErrorRecord(
new DirectoryNotFoundException(message),
"DirectoryNotFoundException",
ErrorCategory.InvalidOperation,
targetObject: null);
string message = StringUtil.Format(RemotingErrorIdStrings.StartJobWorkingDirectoryNotFound, WorkingDirectory);
var errorRecord = new ErrorRecord(
new DirectoryNotFoundException(message),
"DirectoryNotFoundException",
ErrorCategory.InvalidOperation,
targetObject: null);
ThrowTerminatingError(errorRecord);
ThrowTerminatingError(errorRecord);
}
if (WorkingDirectory == null)

View file

@ -93,20 +93,20 @@ namespace System.Management.Automation.Remoting
#region DO NOT REMOVE OR CHANGE THE VALUES OF THESE CONSTANTS - it will break remote debugging compatibility with PowerShell
// Commands related to debugger stop events
internal const string GetDebuggerStopArgs = "__Get-PSDebuggerStopArgs";
internal const string SetDebuggerAction = "__Set-PSDebuggerAction";
internal const string GetDebuggerStopArgs = "__Get-PSDebuggerStopArgs";
internal const string SetDebuggerAction = "__Set-PSDebuggerAction";
// Miscellaneous debug commands
internal const string SetDebuggerStepMode = "__Set-PSDebuggerStepMode";
internal const string SetDebugMode = "__Set-PSDebugMode";
internal const string SetDebuggerStepMode = "__Set-PSDebuggerStepMode";
internal const string SetDebugMode = "__Set-PSDebugMode";
internal const string SetUnhandledBreakpointMode = "__Set-PSUnhandledBreakpointMode";
// Breakpoint commands
internal const string GetBreakpoint = "__Get-PSBreakpoint";
internal const string SetBreakpoint = "__Set-PSBreakpoint";
internal const string EnableBreakpoint = "__Enable-PSBreakpoint";
internal const string DisableBreakpoint = "__Disable-PSBreakpoint";
internal const string RemoveBreakpoint = "__Remove-PSBreakpoint";
internal const string GetBreakpoint = "__Get-PSBreakpoint";
internal const string SetBreakpoint = "__Set-PSBreakpoint";
internal const string EnableBreakpoint = "__Enable-PSBreakpoint";
internal const string DisableBreakpoint = "__Disable-PSBreakpoint";
internal const string RemoveBreakpoint = "__Remove-PSBreakpoint";
#endregion

View file

@ -791,7 +791,7 @@ namespace System.Management.Automation
catch (Exception ex)
{
terminateImmediate = true;
preProcessOutput.Add(
PSObject.AsPSObject(ex));
}
@ -1426,7 +1426,7 @@ namespace System.Management.Automation
TryGetParameter<int?>(command, "RunspaceId", out int? runspaceId);
if (TryGetParameter<int>(command, "Id", out int breakpointId))
{
preProcessOutput.Add(serverRemoteDebugger.GetBreakpoint(breakpointId, runspaceId));
preProcessOutput.Add(serverRemoteDebugger.GetBreakpoint(breakpointId, runspaceId));
}
else
{
@ -1477,7 +1477,7 @@ namespace System.Management.Automation
}
serverRemoteDebugger.SetBreakpoints(bps, runspaceId);
foreach (var bp in bps)
{
preProcessOutput.Add(bp);
@ -1497,7 +1497,7 @@ namespace System.Management.Automation
Breakpoint breakpoint = serverRemoteDebugger.GetBreakpoint(breakpointId, runspaceId);
preProcessOutput.Add(
breakpoint == null
breakpoint == null
? false
: serverRemoteDebugger.RemoveBreakpoint(breakpoint, runspaceId));
@ -1518,7 +1518,7 @@ namespace System.Management.Automation
{
preProcessOutput.Add(serverRemoteDebugger.EnableBreakpoint(bp, runspaceId));
}
result = PreProcessCommandResult.BreakpointManagement;
}
else if (commandText.Equals(RemoteDebuggingCommands.DisableBreakpoint, StringComparison.OrdinalIgnoreCase))
@ -1536,7 +1536,7 @@ namespace System.Management.Automation
{
preProcessOutput.Add(serverRemoteDebugger.DisableBreakpoint(bp, runspaceId));
}
result = PreProcessCommandResult.BreakpointManagement;
}
@ -1578,7 +1578,7 @@ namespace System.Management.Automation
value = GetParameter<T>(command, parameterName);
return true;
}
catch (Exception ex) when(
catch (Exception ex) when (
ex is PSArgumentException ||
ex is InvalidCastException ||
ex is PSInvalidCastException)

View file

@ -28,7 +28,7 @@ namespace Microsoft.PowerShell.Telemetry
/// will be reported, otherwise it will be "anonymous".
/// </summary>
ModuleLoad,
/// <summary>
/// Send telemetry when we load a module using Windows compatibility feature, only module names in the s_knownModules list
/// will be reported, otherwise it will be "anonymous".
@ -121,21 +121,21 @@ namespace Microsoft.PowerShell.Telemetry
s_knownModules = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"AADRM",
"activedirectory",
"activedirectory",
"adcsadministration",
"adcsdeployment",
"adcsdeployment",
"addsadministration",
"addsdeployment",
"addsdeployment",
"adfs",
"adrms",
"adrmsadmin",
"adrmsadmin",
"agpm",
"appbackgroundtask",
"appbackgroundtask",
"applocker",
"appv",
"appvclient",
"appvsequencer",
"appvserver",
"appvclient",
"appvsequencer",
"appvserver",
"appx",
"assignedaccess",
"Az",

View file

@ -124,7 +124,7 @@ namespace PSTests.Parallel
PSObject pso = new PSObject();
pso.AddOrSetProperty("IsReadOnly", false);
fileSystemProvider.SetProperty(testPath, pso);
fileSystemProvider.GetProperty(testPath, new Collection<string>(){ "IsReadOnly" });
fileSystemProvider.GetProperty(testPath, new Collection<string>() { "IsReadOnly" });
FileInfo fileSystemObject1 = new FileInfo(testPath);
PSObject psobject1 = PSObject.AsPSObject(fileSystemObject1);
PSPropertyInfo property = psobject1.Properties["IsReadOnly"];
@ -138,7 +138,7 @@ namespace PSTests.Parallel
ProviderInfo providerInfoToSet = GetProvider();
fileSystemProvider.SetProviderInformation(providerInfoToSet);
fileSystemProvider.Context = new CmdletProviderContext(GetExecutionContext());
fileSystemProvider.GetProperty(testPath, new Collection<string>(){ "Name" });
fileSystemProvider.GetProperty(testPath, new Collection<string>() { "Name" });
FileInfo fileSystemObject1 = new FileInfo(testPath);
PSObject psobject1 = PSObject.AsPSObject(fileSystemObject1);
PSPropertyInfo property = psobject1.Properties["FullName"];
@ -153,7 +153,7 @@ namespace PSTests.Parallel
ProviderInfo providerInfoToSet = GetProvider();
fileSystemProvider.SetProviderInformation(providerInfoToSet);
fileSystemProvider.Context = new CmdletProviderContext(GetExecutionContext());
fileSystemProvider.ClearProperty(testPath, new Collection<string>(){ "Attributes" });
fileSystemProvider.ClearProperty(testPath, new Collection<string>() { "Attributes" });
}
[Fact]
@ -178,7 +178,7 @@ namespace PSTests.Parallel
fileSystemProvider.Context = new CmdletProviderContext(GetExecutionContext());
IContentWriter contentWriter = fileSystemProvider.GetContentWriter(testPath);
contentWriter.Write(new List<string>(){ "contentWriterTestContent" });
contentWriter.Write(new List<string>() { "contentWriterTestContent" });
contentWriter.Close();
Assert.Equal(File.ReadAllText(testPath), testContent + @"contentWriterTestContent" + System.Environment.NewLine);
}

View file

@ -10,7 +10,7 @@ using Xunit;
namespace PSTests.Parallel
{
public class NamedPipeTests
{
{
[Fact]
public void TestCustomPipeNameCreation()
{
@ -35,7 +35,7 @@ namespace PSTests.Parallel
if (!Platform.IsWindows)
{
Assert.Throws<InvalidOperationException>(() =>
Assert.Throws<InvalidOperationException>(() =>
RemoteSessionNamedPipeServer.CreateCustomNamedPipeServer(longPipeName));
}
else