Replace StringComparision.CurrentCulture with StringComparision.Ordinal (#8068)

This commit is contained in:
Ilya 2018-10-21 16:11:08 +05:00 committed by GitHub
parent ef504e5212
commit 0a4f33a872
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 72 additions and 72 deletions

View file

@ -511,9 +511,9 @@ namespace Microsoft.PowerShell.Commands
WriteVerbose(fileName);
string curExtension = System.IO.Path.GetExtension(fileName);
if (!curExtension.Equals(".blg", StringComparison.CurrentCultureIgnoreCase)
&& !curExtension.Equals(".csv", StringComparison.CurrentCultureIgnoreCase)
&& !curExtension.Equals(".tsv", StringComparison.CurrentCultureIgnoreCase))
if (!curExtension.Equals(".blg", StringComparison.OrdinalIgnoreCase)
&& !curExtension.Equals(".csv", StringComparison.OrdinalIgnoreCase)
&& !curExtension.Equals(".tsv", StringComparison.OrdinalIgnoreCase))
{
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterNotALogFile"), fileName);
Exception exc = new Exception(msg);
@ -521,7 +521,7 @@ namespace Microsoft.PowerShell.Commands
return;
}
if (!curExtension.Equals(firstExt, StringComparison.CurrentCultureIgnoreCase))
if (!curExtension.Equals(firstExt, StringComparison.OrdinalIgnoreCase))
{
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterNoMixedLogTypes"), fileName);
Exception exc = new Exception(msg);
@ -530,7 +530,7 @@ namespace Microsoft.PowerShell.Commands
}
}
if (firstExt.Equals(".blg", StringComparison.CurrentCultureIgnoreCase))
if (firstExt.Equals(".blg", StringComparison.OrdinalIgnoreCase))
{
if (_resolvedPaths.Count > 32)
{

View file

@ -837,7 +837,7 @@ $result
bool isLocal = false;
string compname;
if (computer.Equals("localhost", StringComparison.CurrentCultureIgnoreCase))
if (computer.Equals("localhost", StringComparison.OrdinalIgnoreCase))
{
compname = _shortLocalMachineName;
isLocal = true;
@ -1209,7 +1209,7 @@ $result
if (_cancel.Token.IsCancellationRequested) { break; }
if ((computer.Equals("localhost", StringComparison.CurrentCultureIgnoreCase)) || (computer.Equals(".", StringComparison.OrdinalIgnoreCase)))
if ((computer.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (computer.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
compname = Dns.GetHostName();
strLocal = "localhost";
@ -1826,7 +1826,7 @@ $result
internal static string GetScopeString(string computer, string namespaceParameter)
{
StringBuilder returnValue = new StringBuilder("\\\\");
if (computer.Equals("::1", StringComparison.CurrentCultureIgnoreCase) || computer.Equals("[::1]", StringComparison.CurrentCultureIgnoreCase))
if (computer.Equals("::1", StringComparison.OrdinalIgnoreCase) || computer.Equals("[::1]", StringComparison.OrdinalIgnoreCase))
{
returnValue.Append("localhost");
}
@ -1868,13 +1868,13 @@ $result
string driveApp;
foreach (string drive in drives)
{
if (!drive.EndsWith("\\", StringComparison.CurrentCultureIgnoreCase))
if (!drive.EndsWith("\\", StringComparison.OrdinalIgnoreCase))
{
driveApp = String.Concat(drive, "\\");
}
else
driveApp = drive;
if (driveApp.Equals(sysdrive, StringComparison.CurrentCultureIgnoreCase))
if (driveApp.Equals(sysdrive, StringComparison.OrdinalIgnoreCase))
return true;
}
return false;
@ -1911,7 +1911,7 @@ $result
i++;
}
if ((computer.Equals("localhost", StringComparison.CurrentCultureIgnoreCase)) || (computer.Equals(".", StringComparison.OrdinalIgnoreCase)))
if ((computer.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (computer.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
compname = Dns.GetHostName();
}

View file

@ -459,7 +459,7 @@ namespace Microsoft.PowerShell.Commands
bool entrymatch = false;
foreach (string type in _entryTypes)
{
if (type.Equals(entry.EntryType.ToString(), StringComparison.CurrentCultureIgnoreCase))
if (type.Equals(entry.EntryType.ToString(), StringComparison.OrdinalIgnoreCase))
{
entrymatch = true;
break;
@ -629,7 +629,7 @@ namespace Microsoft.PowerShell.Commands
string computer = string.Empty;
foreach (string compName in ComputerName)
{
if ((compName.Equals("localhost", StringComparison.CurrentCultureIgnoreCase)) || (compName.Equals(".", StringComparison.OrdinalIgnoreCase)))
if ((compName.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (compName.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computer = "localhost";
}
@ -777,7 +777,7 @@ namespace Microsoft.PowerShell.Commands
protected override void BeginProcessing()
{
string _computerName = string.Empty;
if ((ComputerName.Equals("localhost", StringComparison.CurrentCultureIgnoreCase)) || (ComputerName.Equals(".", StringComparison.OrdinalIgnoreCase)))
if ((ComputerName.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (ComputerName.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
_computerName = "localhost";
}
@ -933,7 +933,7 @@ namespace Microsoft.PowerShell.Commands
string computer = string.Empty;
foreach (string compname in ComputerName)
{
if ((compname.Equals("localhost", StringComparison.CurrentCultureIgnoreCase)) || (compname.Equals(".", StringComparison.OrdinalIgnoreCase)))
if ((compname.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (compname.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computer = "localhost";
}
@ -1202,7 +1202,7 @@ namespace Microsoft.PowerShell.Commands
string computer = string.Empty;
foreach (string compname in ComputerName)
{
if ((compname.Equals("localhost", StringComparison.CurrentCultureIgnoreCase)) || (compname.Equals(".", StringComparison.OrdinalIgnoreCase)))
if ((compname.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (compname.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computer = "localhost";
}
@ -1318,7 +1318,7 @@ namespace Microsoft.PowerShell.Commands
string computer = string.Empty;
foreach (string compName in ComputerName)
{
if ((compName.Equals("localhost", StringComparison.CurrentCultureIgnoreCase)) || (compName.Equals(".", StringComparison.OrdinalIgnoreCase)))
if ((compName.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (compName.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computer = "localhost";
}

View file

@ -1050,7 +1050,7 @@ namespace Microsoft.PowerShell.Commands
{
return string.Compare(s,
name,
StringComparison.CurrentCultureIgnoreCase) == 0;
StringComparison.OrdinalIgnoreCase) == 0;
};
var propertyName = availableProperties.Find(pred);

View file

@ -149,7 +149,7 @@ namespace Microsoft.PowerShell.Commands
int diff = String.Compare(
SafeGetProcessName(x),
SafeGetProcessName(y),
StringComparison.CurrentCultureIgnoreCase);
StringComparison.OrdinalIgnoreCase);
if (0 != diff)
return diff;
return SafeGetProcessId(x) - SafeGetProcessId(y);
@ -1212,7 +1212,7 @@ namespace Microsoft.PowerShell.Commands
}
// If the process is svchost stop all the dependent services before killing process
if (string.Equals(SafeGetProcessName(process), "SVCHOST", StringComparison.CurrentCultureIgnoreCase))
if (string.Equals(SafeGetProcessName(process), "SVCHOST", StringComparison.OrdinalIgnoreCase))
{
StopDependentService(process);
}
@ -1300,7 +1300,7 @@ namespace Microsoft.PowerShell.Commands
using (var processUser = new WindowsIdentity(ph))
{
return string.Equals(processUser.Name, _currentUserName, StringComparison.CurrentCultureIgnoreCase);
return string.Equals(processUser.Name, _currentUserName, StringComparison.OrdinalIgnoreCase);
}
}
}
@ -1913,7 +1913,7 @@ namespace Microsoft.PowerShell.Commands
{
_redirectstandardinput = ResolveFilePath(_redirectstandardinput);
_redirectstandardoutput = ResolveFilePath(_redirectstandardoutput);
if (_redirectstandardinput.Equals(_redirectstandardoutput, StringComparison.CurrentCultureIgnoreCase))
if (_redirectstandardinput.Equals(_redirectstandardoutput, StringComparison.OrdinalIgnoreCase))
{
message = StringUtil.Format(ProcessResources.DuplicateEntry, "RedirectStandardInput", "RedirectStandardOutput");
ErrorRecord er = new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, null);
@ -1927,7 +1927,7 @@ namespace Microsoft.PowerShell.Commands
{
_redirectstandardinput = ResolveFilePath(_redirectstandardinput);
_redirectstandarderror = ResolveFilePath(_redirectstandarderror);
if (_redirectstandardinput.Equals(_redirectstandarderror, StringComparison.CurrentCultureIgnoreCase))
if (_redirectstandardinput.Equals(_redirectstandarderror, StringComparison.OrdinalIgnoreCase))
{
message = StringUtil.Format(ProcessResources.DuplicateEntry, "RedirectStandardInput", "RedirectStandardError");
ErrorRecord er = new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, null);
@ -1941,7 +1941,7 @@ namespace Microsoft.PowerShell.Commands
{
_redirectstandarderror = ResolveFilePath(_redirectstandarderror);
_redirectstandardoutput = ResolveFilePath(_redirectstandardoutput);
if (_redirectstandardoutput.Equals(_redirectstandarderror, StringComparison.CurrentCultureIgnoreCase))
if (_redirectstandardoutput.Equals(_redirectstandarderror, StringComparison.OrdinalIgnoreCase))
{
message = StringUtil.Format(ProcessResources.DuplicateEntry, "RedirectStandardOutput", "RedirectStandardError");
ErrorRecord er = new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, null);

View file

@ -318,7 +318,7 @@ namespace Microsoft.PowerShell.Commands
// sort by servicename
private static int ServiceComparison(ServiceController x, ServiceController y)
{
return String.Compare(x.ServiceName, y.ServiceName, StringComparison.CurrentCultureIgnoreCase);
return String.Compare(x.ServiceName, y.ServiceName, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
@ -1791,7 +1791,7 @@ namespace Microsoft.PowerShell.Commands
DoStartService(service);
}
}
else if (Status.Equals("Stopped", StringComparison.CurrentCultureIgnoreCase))
else if (Status.Equals("Stopped", StringComparison.OrdinalIgnoreCase))
{
if (!service.Status.Equals(ServiceControllerStatus.Stopped))
{
@ -1808,7 +1808,7 @@ namespace Microsoft.PowerShell.Commands
DoStopService(service, Force, waitForServiceToStop: true);
}
}
else if (Status.Equals("Paused", StringComparison.CurrentCultureIgnoreCase))
else if (Status.Equals("Paused", StringComparison.OrdinalIgnoreCase))
{
if (!service.Status.Equals(ServiceControllerStatus.Paused))
{

View file

@ -1489,7 +1489,7 @@ namespace Microsoft.PowerShell
#if UNIX
if (keyInfo.Key == ConsoleKey.Enter)
#else
if (s.EndsWith(Crlf, StringComparison.CurrentCulture))
if (s.EndsWith(Crlf, StringComparison.Ordinal))
#endif
{
result = ReadLineResult.endedOnEnter;
@ -1509,7 +1509,7 @@ namespace Microsoft.PowerShell
continue;
}
#else
int i = s.IndexOf(Tab, StringComparison.CurrentCulture);
int i = s.IndexOf(Tab, StringComparison.Ordinal);
if (endOnTab && i != -1)
{
@ -1805,7 +1805,7 @@ namespace Microsoft.PowerShell
if (rlResult == ReadLineResult.endedOnTab || rlResult == ReadLineResult.endedOnShiftTab)
{
int tabIndex = input.IndexOf(Tab, StringComparison.CurrentCulture);
int tabIndex = input.IndexOf(Tab, StringComparison.Ordinal);
Dbg.Assert(tabIndex != -1, "tab should appear in the input");
string restOfLine = string.Empty;

View file

@ -369,7 +369,7 @@ namespace Microsoft.PowerShell
break;
}
else
if (rawInputString.StartsWith(PromptCommandPrefix, StringComparison.CurrentCulture))
if (rawInputString.StartsWith(PromptCommandPrefix, StringComparison.Ordinal))
{
processedInputString = PromptCommandMode(rawInputString, desc, out inputDone);
}

View file

@ -69,7 +69,7 @@ namespace Microsoft.WSMan.Management
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}

View file

@ -41,7 +41,7 @@ namespace Microsoft.WSMan.Management
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}

View file

@ -140,7 +140,7 @@ namespace Microsoft.WSMan.Management
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
@ -254,7 +254,7 @@ namespace Microsoft.WSMan.Management
{
crtComputerName = "localhost";
}
if (this.SessionState.Path.CurrentProviderLocation(WSManStringLiterals.rootpath).Path.StartsWith(this.SessionState.Drive.Current.Name + ":" + WSManStringLiterals.DefaultPathSeparator + crtComputerName, StringComparison.CurrentCultureIgnoreCase))
if (this.SessionState.Path.CurrentProviderLocation(WSManStringLiterals.rootpath).Path.StartsWith(this.SessionState.Drive.Current.Name + ":" + WSManStringLiterals.DefaultPathSeparator + crtComputerName, StringComparison.OrdinalIgnoreCase))
{
helper.AssertError(helper.GetResourceMsgFromResourcetext("ConnectFailure"), false, computername);
}
@ -289,7 +289,7 @@ namespace Microsoft.WSMan.Management
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
@ -333,11 +333,11 @@ namespace Microsoft.WSMan.Management
{
computername = "localhost";
}
if (this.SessionState.Path.CurrentProviderLocation(WSManStringLiterals.rootpath).Path.StartsWith(WSManStringLiterals.rootpath + ":" + WSManStringLiterals.DefaultPathSeparator + computername, StringComparison.CurrentCultureIgnoreCase))
if (this.SessionState.Path.CurrentProviderLocation(WSManStringLiterals.rootpath).Path.StartsWith(WSManStringLiterals.rootpath + ":" + WSManStringLiterals.DefaultPathSeparator + computername, StringComparison.OrdinalIgnoreCase))
{
helper.AssertError(helper.GetResourceMsgFromResourcetext("DisconnectFailure"), false, computername);
}
if (computername.Equals("localhost", StringComparison.CurrentCultureIgnoreCase))
if (computername.Equals("localhost", StringComparison.OrdinalIgnoreCase))
{
helper.AssertError(helper.GetResourceMsgFromResourcetext("LocalHost"), false, computername);
}

View file

@ -81,7 +81,7 @@ namespace Microsoft.WSMan.Management
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
@ -393,11 +393,11 @@ namespace Microsoft.WSMan.Management
IWSManEnumerator obj;
if (returntype != null)
{
if (returntype.Equals("object", StringComparison.CurrentCultureIgnoreCase))
if (returntype.Equals("object", StringComparison.OrdinalIgnoreCase))
{
flags = wsmanObject.EnumerationFlagReturnObject();
}
else if (returntype.Equals("epr", StringComparison.CurrentCultureIgnoreCase))
else if (returntype.Equals("epr", StringComparison.OrdinalIgnoreCase))
{
flags = wsmanObject.EnumerationFlagReturnEPR();
}
@ -422,12 +422,12 @@ namespace Microsoft.WSMan.Management
if (dialect != null && filter != null)
{
if (dialect.ToString().Equals(helper.ALIAS_WQL, StringComparison.CurrentCultureIgnoreCase) || dialect.ToString().Equals(helper.URI_WQL_DIALECT, StringComparison.CurrentCultureIgnoreCase))
if (dialect.ToString().Equals(helper.ALIAS_WQL, StringComparison.OrdinalIgnoreCase) || dialect.ToString().Equals(helper.URI_WQL_DIALECT, StringComparison.OrdinalIgnoreCase))
{
fragment = helper.URI_WQL_DIALECT;
dialect = new Uri(fragment);
}
else if (dialect.ToString().Equals(helper.ALIAS_ASSOCIATION, StringComparison.CurrentCultureIgnoreCase) || dialect.ToString().Equals(helper.URI_ASSOCIATION_DIALECT, StringComparison.CurrentCultureIgnoreCase))
else if (dialect.ToString().Equals(helper.ALIAS_ASSOCIATION, StringComparison.OrdinalIgnoreCase) || dialect.ToString().Equals(helper.URI_ASSOCIATION_DIALECT, StringComparison.OrdinalIgnoreCase))
{
if (associations)
{
@ -440,7 +440,7 @@ namespace Microsoft.WSMan.Management
fragment = helper.URI_ASSOCIATION_DIALECT;
dialect = new Uri(fragment);
}
else if (dialect.ToString().Equals(helper.ALIAS_SELECTOR, StringComparison.CurrentCultureIgnoreCase) || dialect.ToString().Equals(helper.URI_SELECTOR_DIALECT, StringComparison.CurrentCultureIgnoreCase))
else if (dialect.ToString().Equals(helper.ALIAS_SELECTOR, StringComparison.OrdinalIgnoreCase) || dialect.ToString().Equals(helper.URI_SELECTOR_DIALECT, StringComparison.OrdinalIgnoreCase))
{
filter = GetFilter();
fragment = helper.URI_SELECTOR_DIALECT;
@ -631,7 +631,7 @@ namespace Microsoft.WSMan.Management
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
@ -828,11 +828,11 @@ namespace Microsoft.WSMan.Management
if (dialect != null)
{
if (dialect.ToString().Equals(helper.ALIAS_WQL, StringComparison.CurrentCultureIgnoreCase))
if (dialect.ToString().Equals(helper.ALIAS_WQL, StringComparison.OrdinalIgnoreCase))
dialect = new Uri(helper.URI_WQL_DIALECT);
if (dialect.ToString().Equals(helper.ALIAS_SELECTOR, StringComparison.CurrentCultureIgnoreCase))
if (dialect.ToString().Equals(helper.ALIAS_SELECTOR, StringComparison.OrdinalIgnoreCase))
dialect = new Uri(helper.URI_SELECTOR_DIALECT);
if (dialect.ToString().Equals(helper.ALIAS_ASSOCIATION, StringComparison.CurrentCultureIgnoreCase))
if (dialect.ToString().Equals(helper.ALIAS_ASSOCIATION, StringComparison.OrdinalIgnoreCase))
dialect = new Uri(helper.URI_ASSOCIATION_DIALECT);
}
@ -876,7 +876,7 @@ namespace Microsoft.WSMan.Management
{
foreach (XmlNode node in xmldoc.DocumentElement.ChildNodes)
{
if (node.Name.Equals(fragment, StringComparison.CurrentCultureIgnoreCase))
if (node.Name.Equals(fragment, StringComparison.OrdinalIgnoreCase))
WriteObject(node.Name + " = " + node.InnerText);
}
}
@ -978,7 +978,7 @@ namespace Microsoft.WSMan.Management
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
@ -1227,7 +1227,7 @@ namespace Microsoft.WSMan.Management
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}

View file

@ -1742,7 +1742,7 @@ namespace System.Management.Automation
{
string path = this[index];
if (!String.IsNullOrEmpty(path) &&
path.StartsWith(".", StringComparison.CurrentCulture))
path.StartsWith(".", StringComparison.Ordinal))
{
result.Add(index);
}

View file

@ -925,7 +925,7 @@ namespace System.Management.Automation
var typeName = GetMemberTypeProjection(typename.Name, membersTypes);
var members = new List<PSMemberNameAndType>();
members.AddRange(membersTypes);
members.Sort((c1,c2) =>string.Compare(c1.Name, c2.Name, StringComparison.CurrentCultureIgnoreCase));
members.Sort((c1,c2) => string.Compare(c1.Name, c2.Name, StringComparison.OrdinalIgnoreCase));
return new PSSyntheticTypeName(typeName, typename.Type, members);
}
@ -949,7 +949,7 @@ namespace System.Management.Automation
}
}
private static bool IsPSTypeName(PSMemberNameAndType member) => member.Name.Equals(nameof(PSTypeName), StringComparison.CurrentCultureIgnoreCase);
private static bool IsPSTypeName(PSMemberNameAndType member) => member.Name.Equals(nameof(PSTypeName), StringComparison.OrdinalIgnoreCase);
private static string GetMemberTypeProjection(string typename, IList<PSMemberNameAndType> members)
{

View file

@ -603,7 +603,7 @@ namespace System.Management.Automation
throw PSTraceSource.NewArgumentNullException("drive");
}
return String.Compare(Name, drive.Name, StringComparison.CurrentCultureIgnoreCase);
return String.Compare(Name, drive.Name, StringComparison.OrdinalIgnoreCase);
#pragma warning restore 56506
}

View file

@ -553,7 +553,7 @@ namespace Microsoft.PowerShell.Commands
}
else
{
return String.Compare(x.Name, y.Name, StringComparison.CurrentCultureIgnoreCase);
return String.Compare(x.Name, y.Name, StringComparison.OrdinalIgnoreCase);
}
}
}
@ -1322,10 +1322,10 @@ namespace Microsoft.PowerShell.Commands
foreach (CommandInfo commandInfo in _accumulatedResults)
{
if ((command.CommandType == commandInfo.CommandType &&
(String.Compare(command.Name, commandInfo.Name, StringComparison.CurrentCultureIgnoreCase) == 0 ||
(String.Compare(command.Name, commandInfo.Name, StringComparison.OrdinalIgnoreCase) == 0 ||
// If the command has been imported with a prefix, then just checking the names for duplication will not be enough.
// Hence, an additional check is done with the prefix information
String.Compare(ModuleCmdletBase.RemovePrefixFromCommandName(commandInfo.Name, commandInfo.Prefix), command.Name, StringComparison.CurrentCultureIgnoreCase) == 0)
String.Compare(ModuleCmdletBase.RemovePrefixFromCommandName(commandInfo.Name, commandInfo.Prefix), command.Name, StringComparison.OrdinalIgnoreCase) == 0)
) && commandInfo.Module != null && commandHasModule &&
( // We do reference equal comparison if both command are imported. If either one is not imported, we compare the module path
(commandInfo.IsImported && command.IsImported && commandInfo.Module.Equals(command.Module)) ||

View file

@ -522,7 +522,7 @@ namespace System.Management.Automation
// current working directory is relative to the root.
if (!LocationGlobber.IsProviderDirectPath(path) &&
path.StartsWith(StringLiterals.DefaultPathSeparatorString, StringComparison.CurrentCulture) &&
path.StartsWith(StringLiterals.DefaultPathSeparatorString, StringComparison.Ordinal) &&
!pathIsProviderQualifiedPath)
{
path = path.Substring(1);

View file

@ -1211,7 +1211,7 @@ namespace System.Management.Automation
foreach (var propertyName in properties)
{
if (name.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase))
if (name.Equals(propertyName, StringComparison.OrdinalIgnoreCase))
{
return true;
}
@ -1336,7 +1336,7 @@ namespace System.Management.Automation
{
case string propertyName:
{
if (string.Compare(name, propertyName, StringComparison.CurrentCultureIgnoreCase) == 0)
if (string.Compare(name, propertyName, StringComparison.OrdinalIgnoreCase) == 0)
{
return includeMatchedProperties;
}

View file

@ -967,7 +967,7 @@ namespace System.Management.Automation
/// <returns></returns>
internal static bool IsMamlHelp(string helpFile, XmlNode helpItemsNode)
{
if (helpFile.EndsWith(".maml", StringComparison.CurrentCultureIgnoreCase))
if (helpFile.EndsWith(".maml", StringComparison.OrdinalIgnoreCase))
return true;
if (helpItemsNode.Attributes == null)

View file

@ -180,7 +180,7 @@ namespace System.Management.Automation
{
Debug.Assert(!String.IsNullOrEmpty(helpFile), "helpFile cannot be null.");
if (helpFile.EndsWith(".maml", StringComparison.CurrentCultureIgnoreCase))
if (helpFile.EndsWith(".maml", StringComparison.OrdinalIgnoreCase))
return true;
if (helpItemsNode.Attributes == null)
@ -367,4 +367,4 @@ namespace System.Management.Automation
#endregion
}
}
}

View file

@ -185,7 +185,7 @@ namespace System.Management.Automation
{
Debug.Assert(!String.IsNullOrEmpty(helpFile), "helpFile cannot be null.");
if (helpFile.EndsWith(".maml", StringComparison.CurrentCultureIgnoreCase))
if (helpFile.EndsWith(".maml", StringComparison.OrdinalIgnoreCase))
return true;
if (helpItemsNode.Attributes == null)
@ -372,4 +372,4 @@ namespace System.Management.Automation
#endregion
}
}
}

View file

@ -586,7 +586,7 @@ namespace Microsoft.PowerShell.Commands
// The solution is a modified Boyer-Moore string search algorithm.
// This version retains the sub-linear search performance (via the
// lookup tables,) but offloads much of the dirty work to the
// very efficient BCL String.IndexOf(, StringComparison.CurrentCulture) method.
// very efficient BCL String.IndexOf(, StringComparison.Ordinal) method.
int numRead = 0;
int currentOffset = actualDelimiter.Length;
StringBuilder content = new StringBuilder();

View file

@ -1592,7 +1592,7 @@ namespace System.Management.Automation
break;
}
int index = path.IndexOf(":", StringComparison.CurrentCulture);
int index = path.IndexOf(":", StringComparison.Ordinal);
if (index == -1)
{
@ -1854,7 +1854,7 @@ namespace System.Management.Automation
string normalizedRoot = _sessionState.Drive.Current.Root.Replace(
StringLiterals.AlternatePathSeparator, StringLiterals.DefaultPathSeparator);
if (normalizedRoot.IndexOf(":", StringComparison.CurrentCulture) >= 0)
if (normalizedRoot.IndexOf(":", StringComparison.Ordinal) >= 0)
{
string normalizedPath = path.Replace(StringLiterals.AlternatePathSeparator, StringLiterals.DefaultPathSeparator);
if (normalizedPath.StartsWith(normalizedRoot, StringComparison.OrdinalIgnoreCase))
@ -2225,8 +2225,8 @@ namespace System.Management.Automation
// the loop.
break;
}
} // while
} // if (path.StartsWith(@"\", StringComparison.CurrentCulture))
}
}
// If more relative path remains add that to
// the known absolute path

View file

@ -390,7 +390,7 @@ namespace System.Management.Automation.Provider
}
else
{
if (child.StartsWith(StringLiterals.DefaultPathSeparatorString, StringComparison.CurrentCulture))
if (child.StartsWith(StringLiterals.DefaultPathSeparatorString, StringComparison.Ordinal))
{
if (parent.Length == 0)
{