Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -511,17 +511,17 @@ private void ValidateFilePaths()
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);
ThrowTerminatingError(new ErrorRecord(exc, "CounterNotALogFile", ErrorCategory.InvalidResult, null));
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);
Expand All @@ -530,7 +530,7 @@ private void ValidateFilePaths()
}
}

if (firstExt.Equals(".blg", StringComparison.CurrentCultureIgnoreCase))
if (firstExt.Equals(".blg", StringComparison.OrdinalIgnoreCase))
{
if (_resolvedPaths.Count > 32)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ protected override void ProcessRecord()
bool isLocal = false;
string compname;

if (computer.Equals("localhost", StringComparison.CurrentCultureIgnoreCase))
if (computer.Equals("localhost", StringComparison.OrdinalIgnoreCase))
{
compname = _shortLocalMachineName;
isLocal = true;
Expand Down Expand Up @@ -1209,7 +1209,7 @@ private void ProcessWSManProtocol(object[] flags)

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";
Expand Down Expand Up @@ -1826,7 +1826,7 @@ internal static string GetRandomPassword(int passwordLength)
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");
}
Expand Down Expand Up @@ -1868,13 +1868,13 @@ internal static bool ContainsSystemDrive(string[] drives, string sysdrive)
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;
Expand Down Expand Up @@ -1911,7 +1911,7 @@ internal static string GetMachineNames(string[] computerNames)
i++;
}

if ((computer.Equals("localhost", StringComparison.CurrentCultureIgnoreCase)) || (computer.Equals(".", StringComparison.OrdinalIgnoreCase)))
if ((computer.Equals("localhost", StringComparison.OrdinalIgnoreCase)) || (computer.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
compname = Dns.GetHostName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ private bool FiltersMatch(EventLogEntry entry)
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;
Expand Down Expand Up @@ -629,7 +629,7 @@ protected override void BeginProcessing()
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";
}
Expand Down Expand Up @@ -777,7 +777,7 @@ private void WriteNonTerminatingError(Exception exception, string errorId, strin
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";
}
Expand Down Expand Up @@ -933,7 +933,7 @@ protected override
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";
}
Expand Down Expand Up @@ -1202,7 +1202,7 @@ protected override void BeginProcessing()
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";
}
Expand Down Expand Up @@ -1318,7 +1318,7 @@ protected override void BeginProcessing()
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";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ private static List<string> CollectPropertyNames(string[] requestedProperties)
{
return string.Compare(s,
name,
StringComparison.CurrentCultureIgnoreCase) == 0;
StringComparison.OrdinalIgnoreCase) == 0;
};
var propertyName = availableProperties.Find(pred);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private static int ProcessComparison(Process x, Process y)
int diff = String.Compare(
SafeGetProcessName(x),
SafeGetProcessName(y),
StringComparison.CurrentCultureIgnoreCase);
StringComparison.OrdinalIgnoreCase);
if (0 != diff)
return diff;
return SafeGetProcessId(x) - SafeGetProcessId(y);
Expand Down Expand Up @@ -1212,7 +1212,7 @@ protected override void ProcessRecord()
}

// 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);
}
Expand Down Expand Up @@ -1300,7 +1300,7 @@ private bool IsProcessOwnedByCurrentUser(Process process)

using (var processUser = new WindowsIdentity(ph))
{
return string.Equals(processUser.Name, _currentUserName, StringComparison.CurrentCultureIgnoreCase);
return string.Equals(processUser.Name, _currentUserName, StringComparison.OrdinalIgnoreCase);
}
}
}
Expand Down Expand Up @@ -1913,7 +1913,7 @@ protected override void BeginProcessing()
{
_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);
Expand All @@ -1927,7 +1927,7 @@ protected override void BeginProcessing()
{
_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);
Expand All @@ -1941,7 +1941,7 @@ protected override void BeginProcessing()
{
_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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ internal List<ServiceController> MatchingServices()
// 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>
Expand Down Expand Up @@ -1791,7 +1791,7 @@ protected override void ProcessRecord()
DoStartService(service);
}
}
else if (Status.Equals("Stopped", StringComparison.CurrentCultureIgnoreCase))
else if (Status.Equals("Stopped", StringComparison.OrdinalIgnoreCase))
{
if (!service.Status.Equals(ServiceControllerStatus.Stopped))
{
Expand All @@ -1808,7 +1808,7 @@ protected override void ProcessRecord()
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))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ private string ReadLineFromConsole(bool endOnTab, string initialContent, bool ca
#if UNIX
if (keyInfo.Key == ConsoleKey.Enter)
#else
if (s.EndsWith(Crlf, StringComparison.CurrentCulture))
if (s.EndsWith(Crlf, StringComparison.Ordinal))
#endif
{
result = ReadLineResult.endedOnEnter;
Expand All @@ -1509,7 +1509,7 @@ private string ReadLineFromConsole(bool endOnTab, string initialContent, bool ca
continue;
}
#else
int i = s.IndexOf(Tab, StringComparison.CurrentCulture);
int i = s.IndexOf(Tab, StringComparison.Ordinal);

if (endOnTab && i != -1)
{
Expand Down Expand Up @@ -1805,7 +1805,7 @@ internal string ReadLineWithTabCompletion(Executor exec)

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ private string PromptReadInput(string fieldPrompt, FieldDescription desc, bool f
break;
}
else
if (rawInputString.StartsWith(PromptCommandPrefix, StringComparison.CurrentCulture))
if (rawInputString.StartsWith(PromptCommandPrefix, StringComparison.Ordinal))
{
processedInputString = PromptCommandMode(rawInputString, desc, out inputDone);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.WSMan.Management/InvokeWSManAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public String ComputerName
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.WSMan.Management/PingWSMan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String ComputerName
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
Expand Down
10 changes: 5 additions & 5 deletions src/Microsoft.WSMan.Management/WSManConnections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public String ComputerName
set
{
computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
Expand Down Expand Up @@ -254,7 +254,7 @@ protected override void BeginProcessing()
{
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);
}
Expand Down Expand Up @@ -289,7 +289,7 @@ public String ComputerName
{

computername = value;
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.CurrentCultureIgnoreCase)))
if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))
{
computername = "localhost";
}
Expand Down Expand Up @@ -333,11 +333,11 @@ protected override void BeginProcessing()
{
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);
}
Expand Down
Loading