Style: Replace String.IsNullOrEmpty with string.IsNullOrEmpty (#8557)
This commit is contained in:
parent
f31750c0d1
commit
56569b9315
|
@ -46,7 +46,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this.activity = theActivity;
|
||||
this.activityID = theActivityID;
|
||||
this.currentOperation = theCurrentOperation;
|
||||
if (String.IsNullOrEmpty(theStatusDescription))
|
||||
if (string.IsNullOrEmpty(theStatusDescription))
|
||||
{
|
||||
this.statusDescription = Strings.DefaultStatusDescription;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <returns></returns>
|
||||
internal static bool IsDefaultComputerName(string computerName)
|
||||
{
|
||||
return String.IsNullOrEmpty(computerName);
|
||||
return string.IsNullOrEmpty(computerName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -194,7 +194,7 @@ $result
|
|||
FolderItemVerbs verbs = item.Verbs();
|
||||
foreach (FolderItemVerb verb in verbs)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(verb.Name) &&
|
||||
if (!string.IsNullOrEmpty(verb.Name) &&
|
||||
(verb.Name.Equals(ControlPanelResources.VerbActionOpen, StringComparison.OrdinalIgnoreCase) ||
|
||||
CompareVerbActionOpen(verb.Name)))
|
||||
{
|
||||
|
@ -224,7 +224,7 @@ $result
|
|||
foreach (ShellFolderItem item in allItems)
|
||||
{
|
||||
string canonicalName = (string)item.ExtendedProperty("System.ApplicationName");
|
||||
canonicalName = !String.IsNullOrEmpty(canonicalName)
|
||||
canonicalName = !string.IsNullOrEmpty(canonicalName)
|
||||
? canonicalName.Substring(0, canonicalName.IndexOf("\0", StringComparison.OrdinalIgnoreCase))
|
||||
: null;
|
||||
|
||||
|
|
|
@ -1268,11 +1268,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
EventSourceCreationData newEventSource = new EventSourceCreationData(_sourceName, LogName);
|
||||
newEventSource.MachineName = compname;
|
||||
if (!String.IsNullOrEmpty(MessageResourceFile))
|
||||
if (!string.IsNullOrEmpty(MessageResourceFile))
|
||||
newEventSource.MessageResourceFile = MessageResourceFile;
|
||||
if (!String.IsNullOrEmpty(ParameterResourceFile))
|
||||
if (!string.IsNullOrEmpty(ParameterResourceFile))
|
||||
newEventSource.ParameterResourceFile = ParameterResourceFile;
|
||||
if (!String.IsNullOrEmpty(CategoryResourceFile))
|
||||
if (!string.IsNullOrEmpty(CategoryResourceFile))
|
||||
newEventSource.CategoryResourceFile = CategoryResourceFile;
|
||||
EventLog.CreateEventSource(newEventSource);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
returnValue.Append(String.Join(", ", _property));
|
||||
returnValue.Append(" from ");
|
||||
returnValue.Append(Class);
|
||||
if (!String.IsNullOrEmpty(Filter))
|
||||
if (!string.IsNullOrEmpty(Filter))
|
||||
{
|
||||
returnValue.Append(" where ");
|
||||
returnValue.Append(Filter);
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// try to translate the SID to a more friendly username
|
||||
// just stick with the SID if anything goes wrong
|
||||
string installed = (string)obj["InstalledBy"];
|
||||
if (!String.IsNullOrEmpty(installed))
|
||||
if (!string.IsNullOrEmpty(installed))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (_path != null)
|
||||
{
|
||||
mPath = new ManagementPath(_path);
|
||||
if (String.IsNullOrEmpty(mPath.NamespacePath))
|
||||
if (string.IsNullOrEmpty(mPath.NamespacePath))
|
||||
{
|
||||
mPath.NamespacePath = this.Namespace;
|
||||
}
|
||||
|
|
|
@ -1377,11 +1377,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
tracer.WriteLine("ProviderName: {0}", providerName);
|
||||
|
||||
bool providerNameEmpty = String.IsNullOrEmpty(providerName);
|
||||
bool providerNameEmpty = string.IsNullOrEmpty(providerName);
|
||||
bool providerNameContainsWildcardCharacters =
|
||||
WildcardPattern.ContainsWildcardCharacters(providerName);
|
||||
|
||||
bool driveNameEmpty = String.IsNullOrEmpty(driveName);
|
||||
bool driveNameEmpty = string.IsNullOrEmpty(driveName);
|
||||
bool driveNameContainsWildcardCharacters =
|
||||
WildcardPattern.ContainsWildcardCharacters(driveName);
|
||||
|
||||
|
@ -1400,7 +1400,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// exist.
|
||||
if (!driveNameEmpty && !driveNameContainsWildcardCharacters)
|
||||
{
|
||||
if (String.IsNullOrEmpty(scope))
|
||||
if (string.IsNullOrEmpty(scope))
|
||||
{
|
||||
SessionState.Drive.Get(driveName);
|
||||
}
|
||||
|
@ -2079,7 +2079,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (Path != null && Path.Length > 0)
|
||||
{
|
||||
// Path is only globbed if Name is specified.
|
||||
if (String.IsNullOrEmpty(Name))
|
||||
if (string.IsNullOrEmpty(Name))
|
||||
return InvokeProvider.Item.NewItemDynamicParameters(WildcardPattern.Escape(Path[0]), ItemType, Value, context);
|
||||
else
|
||||
return InvokeProvider.Item.NewItemDynamicParameters(Path[0], ItemType, Value, context);
|
||||
|
|
|
@ -1930,7 +1930,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
NetworkCredential nwcredential = _credential.GetNetworkCredential();
|
||||
startInfo.UserName = nwcredential.UserName;
|
||||
if (String.IsNullOrEmpty(nwcredential.Domain))
|
||||
if (string.IsNullOrEmpty(nwcredential.Domain))
|
||||
{
|
||||
startInfo.Domain = ".";
|
||||
}
|
||||
|
@ -2175,7 +2175,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private void StdOutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(outLine.Data))
|
||||
if (!string.IsNullOrEmpty(outLine.Data))
|
||||
{
|
||||
_outputWriter.WriteLine(outLine.Data);
|
||||
_outputWriter.Flush();
|
||||
|
@ -2184,7 +2184,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private void StdErrorHandler(object sendingProcess, DataReceivedEventArgs outLine)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(outLine.Data))
|
||||
if (!string.IsNullOrEmpty(outLine.Data))
|
||||
{
|
||||
_errorWriter.WriteLine(outLine.Data);
|
||||
_errorWriter.Flush();
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (this.Credential != null)
|
||||
{
|
||||
System.Net.NetworkCredential cred = this.Credential.GetNetworkCredential();
|
||||
if (String.IsNullOrEmpty(cred.Domain))
|
||||
if (string.IsNullOrEmpty(cred.Domain))
|
||||
{
|
||||
conOptions.Username = cred.UserName;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (_path != null)
|
||||
{
|
||||
mPath = new ManagementPath(_path);
|
||||
if (String.IsNullOrEmpty(mPath.NamespacePath))
|
||||
if (string.IsNullOrEmpty(mPath.NamespacePath))
|
||||
{
|
||||
mPath.NamespacePath = this.Namespace;
|
||||
}
|
||||
|
|
|
@ -1660,7 +1660,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
objServiceShouldBeDisposed = true;
|
||||
}
|
||||
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(Name), "null ServiceName");
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(Name), "null ServiceName");
|
||||
|
||||
// "new ServiceController" will succeed even if
|
||||
// there is no such service. This checks whether
|
||||
|
@ -1733,7 +1733,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return;
|
||||
}
|
||||
// Modify startup type or display name or credential
|
||||
if (!String.IsNullOrEmpty(DisplayName)
|
||||
if (!string.IsNullOrEmpty(DisplayName)
|
||||
|| ServiceStartupType.InvalidValue != StartupType || Credential != null)
|
||||
{
|
||||
DWORD dwStartType = NativeMethods.SERVICE_NO_CHANGE;
|
||||
|
@ -2055,9 +2055,9 @@ namespace Microsoft.PowerShell.Commands
|
|||
[ArchitectureSensitive]
|
||||
protected override void BeginProcessing()
|
||||
{
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(Name),
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(Name),
|
||||
"null ServiceName");
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(BinaryPathName),
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(BinaryPathName),
|
||||
"null BinaryPathName");
|
||||
|
||||
// confirm the operation first
|
||||
|
@ -2336,7 +2336,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
objServiceShouldBeDisposed = true;
|
||||
}
|
||||
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(Name), "null ServiceName");
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(Name), "null ServiceName");
|
||||
|
||||
// "new ServiceController" will succeed even if there is no such service.
|
||||
// This checks whether the service actually exists.
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
case propertyValuePathSet:
|
||||
case propertyValueLiteralPathSet:
|
||||
if (!String.IsNullOrEmpty(Name))
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
mshObject = new PSObject();
|
||||
mshObject.Properties.Add(new PSNoteProperty(Name, Value));
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
returnValue.Append(String.Join(", ", getObject.Property));
|
||||
returnValue.Append(" from ");
|
||||
returnValue.Append(getObject.Class);
|
||||
if (!String.IsNullOrEmpty(getObject.Filter))
|
||||
if (!string.IsNullOrEmpty(getObject.Filter))
|
||||
{
|
||||
returnValue.Append(" where ");
|
||||
returnValue.Append(getObject.Filter);
|
||||
|
@ -303,7 +303,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
else
|
||||
{
|
||||
mPath = new ManagementPath(setObject.Path);
|
||||
if (String.IsNullOrEmpty(mPath.NamespacePath))
|
||||
if (string.IsNullOrEmpty(mPath.NamespacePath))
|
||||
{
|
||||
mPath.NamespacePath = setObject.Namespace;
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (invokeObject.Path != null)
|
||||
{
|
||||
mPath = new ManagementPath(invokeObject.Path);
|
||||
if (String.IsNullOrEmpty(mPath.NamespacePath))
|
||||
if (string.IsNullOrEmpty(mPath.NamespacePath))
|
||||
{
|
||||
mPath.NamespacePath = invokeObject.Namespace;
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (removeObject.Path != null)
|
||||
{
|
||||
mPath = new ManagementPath(removeObject.Path);
|
||||
if (String.IsNullOrEmpty(mPath.NamespacePath))
|
||||
if (string.IsNullOrEmpty(mPath.NamespacePath))
|
||||
{
|
||||
mPath.NamespacePath = removeObject.Namespace;
|
||||
}
|
||||
|
@ -1312,7 +1312,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
else
|
||||
{
|
||||
mPath = new ManagementPath(wmiInstance.Path);
|
||||
if (String.IsNullOrEmpty(mPath.NamespacePath))
|
||||
if (string.IsNullOrEmpty(mPath.NamespacePath))
|
||||
{
|
||||
mPath.NamespacePath = wmiInstance.Namespace;
|
||||
}
|
||||
|
|
|
@ -467,7 +467,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
CultureInfo.InvariantCulture,
|
||||
GetMethodTemplate(language), typeName, sourceCodeText);
|
||||
|
||||
if (!String.IsNullOrEmpty(typeNamespace))
|
||||
if (!string.IsNullOrEmpty(typeNamespace))
|
||||
{
|
||||
return usingSource + String.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
|
@ -572,7 +572,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
// Generate an error if they've specified an output
|
||||
// assembly type without an output assembly
|
||||
if (String.IsNullOrEmpty(_outputAssembly) && this.MyInvocation.BoundParameters.ContainsKey(nameof(OutputType)))
|
||||
if (string.IsNullOrEmpty(_outputAssembly) && this.MyInvocation.BoundParameters.ContainsKey(nameof(OutputType)))
|
||||
{
|
||||
ErrorRecord errorRecord = new ErrorRecord(
|
||||
new Exception(
|
||||
|
@ -621,7 +621,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// These assemblies are used, when ReferencedAssemblies parameter is not specified.
|
||||
private static Lazy<IEnumerable<PortableExecutableReference>> s_defaultAssemblies = new Lazy<IEnumerable<PortableExecutableReference>>(InitDefaultRefAssemblies);
|
||||
|
||||
private bool InMemory { get { return String.IsNullOrEmpty(_outputAssembly); } }
|
||||
private bool InMemory { get { return string.IsNullOrEmpty(_outputAssembly); } }
|
||||
|
||||
// These dictionaries prevent reloading already loaded and unchanged code.
|
||||
// We don't worry about unbounded growing of the cache because in .Net Core 2.0 we can not unload assemblies.
|
||||
|
@ -1005,7 +1005,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
break;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(_outputAssembly) && !PassThru.IsPresent)
|
||||
if (!string.IsNullOrEmpty(_outputAssembly) && !PassThru.IsPresent)
|
||||
{
|
||||
CompileToAssembly(syntaxTrees, compilationOptions, emitOptions);
|
||||
}
|
||||
|
@ -1316,7 +1316,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
int hash;
|
||||
|
||||
if (String.IsNullOrEmpty(st.FilePath))
|
||||
if (string.IsNullOrEmpty(st.FilePath))
|
||||
{
|
||||
// If the file name does not exist, the source text is set by the user using parameters.
|
||||
// In this case, we assume that the source text is of a small size and we can re-allocate by ToString().
|
||||
|
|
|
@ -1309,7 +1309,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (values.Count == 0)
|
||||
break;
|
||||
|
||||
if (values.Count == 1 && String.IsNullOrEmpty(values[0]))
|
||||
if (values.Count == 1 && string.IsNullOrEmpty(values[0]))
|
||||
{
|
||||
// skip the blank lines
|
||||
continue;
|
||||
|
@ -1340,7 +1340,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
HashSet<string> headers = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (string currentHeader in names)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(currentHeader))
|
||||
if (!string.IsNullOrEmpty(currentHeader))
|
||||
{
|
||||
if (!headers.Contains(currentHeader))
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
Hashtable result = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
if (String.IsNullOrEmpty(_stringData))
|
||||
if (string.IsNullOrEmpty(_stringData))
|
||||
{
|
||||
WriteObject(result);
|
||||
return;
|
||||
|
@ -55,7 +55,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
string s = line.Trim();
|
||||
|
||||
if (String.IsNullOrEmpty(s) || s[0] == '#')
|
||||
if (string.IsNullOrEmpty(s) || s[0] == '#')
|
||||
continue;
|
||||
|
||||
int index = s.IndexOf('=');
|
||||
|
|
|
@ -195,7 +195,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// First get the alias table (from the proper scope if necessary)
|
||||
IDictionary<string, AliasInfo> aliasTable = null;
|
||||
|
||||
if (!String.IsNullOrEmpty(Scope))
|
||||
if (!string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
// This can throw PSArgumentException and PSArgumentOutOfRangeException
|
||||
// but just let them go as this is terminal for the pipeline and the
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
//get the command origin
|
||||
CommandOrigin origin = MyInvocation.CommandOrigin;
|
||||
string displayString = "name";
|
||||
if (!String.IsNullOrEmpty(Scope))
|
||||
if (!string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
// This can throw PSArgumentException and PSArgumentOutOfRangeException
|
||||
// but just let them go as this is terminal for the pipeline and the
|
||||
|
|
|
@ -2523,7 +2523,7 @@ function Get-PSImplicitRemotingSession
|
|||
NewVMRunspaceTemplate,
|
||||
/* 0 */ this.GenerateConnectionStringForNewRunspace(),
|
||||
/* 1 */ this.GenerateCredentialParameter(),
|
||||
/* 2 */ String.IsNullOrEmpty(vmConfigurationName) ? String.Empty : String.Concat("-ConfigurationName ", vmConfigurationName));
|
||||
/* 2 */ string.IsNullOrEmpty(vmConfigurationName) ? String.Empty : String.Concat("-ConfigurationName ", vmConfigurationName));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2536,7 +2536,7 @@ function Get-PSImplicitRemotingSession
|
|||
NewContainerRunspaceTemplate,
|
||||
/* 0 */ this.GenerateConnectionStringForNewRunspace(),
|
||||
/* 1 */ containerConnectionInfo.ContainerProc.RunAsAdmin ? "-RunAsAdministrator" : string.Empty,
|
||||
/* 2 */ String.IsNullOrEmpty(containerConfigurationName) ? String.Empty : String.Concat("-ConfigurationName ", containerConfigurationName));
|
||||
/* 2 */ string.IsNullOrEmpty(containerConfigurationName) ? String.Empty : String.Concat("-ConfigurationName ", containerConfigurationName));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -243,9 +243,9 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private string GetFilePath()
|
||||
{
|
||||
if (String.IsNullOrEmpty(_fileName))
|
||||
if (string.IsNullOrEmpty(_fileName))
|
||||
{
|
||||
if (InvocationExtent == null || String.IsNullOrEmpty(InvocationExtent.File))
|
||||
if (InvocationExtent == null || string.IsNullOrEmpty(InvocationExtent.File))
|
||||
{
|
||||
throw PSTraceSource.NewInvalidOperationException(ImportLocalizedDataStrings.NotCalledFromAScriptFile);
|
||||
}
|
||||
|
@ -253,9 +253,9 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
string dir = _baseDirectory;
|
||||
|
||||
if (String.IsNullOrEmpty(dir))
|
||||
if (string.IsNullOrEmpty(dir))
|
||||
{
|
||||
if (InvocationExtent != null && !String.IsNullOrEmpty(InvocationExtent.File))
|
||||
if (InvocationExtent != null && !string.IsNullOrEmpty(InvocationExtent.File))
|
||||
{
|
||||
dir = Path.GetDirectoryName(InvocationExtent.File);
|
||||
}
|
||||
|
@ -268,13 +268,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
dir = PathUtils.ResolveFilePath(dir, this);
|
||||
|
||||
string fileName = _fileName;
|
||||
if (String.IsNullOrEmpty(fileName))
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
fileName = InvocationExtent.File;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Path.GetDirectoryName(fileName)))
|
||||
if (!string.IsNullOrEmpty(Path.GetDirectoryName(fileName)))
|
||||
{
|
||||
throw PSTraceSource.NewInvalidOperationException(ImportLocalizedDataStrings.FileNameParameterCannotHavePath);
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
CultureInfo currentCulture = culture;
|
||||
string filePath;
|
||||
string fullFileName = fileName + ".psd1";
|
||||
while (currentCulture != null && !String.IsNullOrEmpty(currentCulture.Name))
|
||||
while (currentCulture != null && !string.IsNullOrEmpty(currentCulture.Name))
|
||||
{
|
||||
filePath = Path.Combine(dir, currentCulture.Name, fullFileName);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (!Force)
|
||||
{
|
||||
AliasInfo existingAlias = null;
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
existingAlias = SessionState.Internal.GetAlias(alias.Name);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
try
|
||||
{
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
result = SessionState.Internal.SetAliasItem(alias, Force, MyInvocation.CommandOrigin);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Context,
|
||||
options);
|
||||
|
||||
if (!String.IsNullOrEmpty(values[2]))
|
||||
if (!string.IsNullOrEmpty(values[2]))
|
||||
{
|
||||
newAlias.Description = values[2];
|
||||
}
|
||||
|
|
|
@ -655,7 +655,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <returns>Number of chars in inStr.</returns>
|
||||
internal static int CountChar(string inStr, bool ignoreWhiteSpace)
|
||||
{
|
||||
if (String.IsNullOrEmpty(inStr))
|
||||
if (string.IsNullOrEmpty(inStr))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <returns>Number of words in inStr.</returns>
|
||||
internal static int CountWord(string inStr)
|
||||
{
|
||||
if (String.IsNullOrEmpty(inStr))
|
||||
if (string.IsNullOrEmpty(inStr))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <returns>Number of lines in inStr.</returns>
|
||||
internal static int CountLine(string inStr)
|
||||
{
|
||||
if (String.IsNullOrEmpty(inStr))
|
||||
if (string.IsNullOrEmpty(inStr))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (!Force)
|
||||
{
|
||||
AliasInfo existingAlias = null;
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
existingAlias = SessionState.Internal.GetAlias(Name);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
try
|
||||
{
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
result = SessionState.Internal.SetAliasItem(newAlias, Force, MyInvocation.CommandOrigin);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
string element = (string)LanguagePrimitives.ConvertTo(e.Current, typeof(string), CultureInfo.InvariantCulture);
|
||||
|
||||
if (!String.IsNullOrEmpty(element))
|
||||
if (!string.IsNullOrEmpty(element))
|
||||
{
|
||||
// Prepend a space if the stringbuilder isn't empty...
|
||||
// We could consider using $OFS here but that's probably more
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
foreach (string aliasName in Name)
|
||||
{
|
||||
AliasInfo existingAlias = null;
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
existingAlias = SessionState.Internal.GetAlias(aliasName);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
try
|
||||
{
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
result = SessionState.Internal.SetAliasItem(aliasToSet, Force, MyInvocation.CommandOrigin);
|
||||
}
|
||||
|
|
|
@ -574,7 +574,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private void EnsureMemberNameHasBeenSpecified()
|
||||
{
|
||||
if (String.IsNullOrEmpty(_memberName))
|
||||
if (string.IsNullOrEmpty(_memberName))
|
||||
{
|
||||
ThrowTerminatingError(NewError("MemberNameShouldBeSpecified", UpdateDataStrings.ShouldBeSpecified, null, "MemberName", _memberType));
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
if (_value1 is string)
|
||||
{
|
||||
if (String.IsNullOrEmpty((string)_value1))
|
||||
if (string.IsNullOrEmpty((string)_value1))
|
||||
{
|
||||
ThrowTerminatingError(NewError("ValueShouldBeSpecified", UpdateDataStrings.ShouldNotBeNull, null, "Value", _memberType));
|
||||
}
|
||||
|
@ -1204,7 +1204,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
typeNameToRemove = _typeName;
|
||||
}
|
||||
|
||||
Dbg.Assert(!String.IsNullOrEmpty(typeNameToRemove), "TypeNameToRemove should be not null and not empty at this point");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(typeNameToRemove), "TypeNameToRemove should be not null and not empty at this point");
|
||||
TypeData type = new TypeData(typeNameToRemove);
|
||||
string removeTypeFormattedTarget = string.Format(CultureInfo.InvariantCulture, removeTypeTarget, typeNameToRemove);
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
List<PSVariable> result = new List<PSVariable>();
|
||||
|
||||
if (String.IsNullOrEmpty(name))
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
name = "*";
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// view.
|
||||
|
||||
IDictionary<string, PSVariable> variableTable = null;
|
||||
if (String.IsNullOrEmpty(lookupScope))
|
||||
if (string.IsNullOrEmpty(lookupScope))
|
||||
{
|
||||
variableTable = SessionState.Internal.GetVariableTable();
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (!Force)
|
||||
{
|
||||
PSVariable varFound = null;
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
varFound =
|
||||
SessionState.PSVariable.GetAtScope(Name, "local");
|
||||
|
@ -532,7 +532,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
try
|
||||
{
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
SessionState.Internal.NewVariable(newVariable, Force);
|
||||
}
|
||||
|
@ -818,7 +818,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
bool wasFiltered = false;
|
||||
|
||||
if (!String.IsNullOrEmpty(Scope))
|
||||
if (!string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
// We really only need to find matches if the scope was specified.
|
||||
// If the scope wasn't specified then we need to create the
|
||||
|
@ -851,7 +851,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
ScopedItemOptions newOptions = ScopedItemOptions.None;
|
||||
|
||||
if (!String.IsNullOrEmpty(Scope) &&
|
||||
if (!string.IsNullOrEmpty(Scope) &&
|
||||
String.Equals("private", Scope, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
newOptions = ScopedItemOptions.Private;
|
||||
|
@ -895,7 +895,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
object result = null;
|
||||
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
result =
|
||||
SessionState.Internal.SetVariable(varToSet, Force, origin);
|
||||
|
@ -1151,7 +1151,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
if (String.IsNullOrEmpty(Scope))
|
||||
if (string.IsNullOrEmpty(Scope))
|
||||
{
|
||||
SessionState.Internal.RemoveVariable(matchingVariable, _force);
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// fill the Content buffer
|
||||
string characterSet = WebResponseHelper.GetCharacterSet(BaseResponse);
|
||||
|
||||
if (String.IsNullOrEmpty(characterSet) && ContentHelper.IsJson(contentType))
|
||||
if (string.IsNullOrEmpty(characterSet) && ContentHelper.IsJson(contentType))
|
||||
{
|
||||
characterSet = Encoding.UTF8.HeaderName;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private static bool CheckIsJson(string contentType)
|
||||
{
|
||||
if (String.IsNullOrEmpty(contentType))
|
||||
if (string.IsNullOrEmpty(contentType))
|
||||
return false;
|
||||
|
||||
// the correct type for JSON content, as specified in RFC 4627
|
||||
|
@ -152,7 +152,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private static bool CheckIsText(string contentType)
|
||||
{
|
||||
if (String.IsNullOrEmpty(contentType))
|
||||
if (string.IsNullOrEmpty(contentType))
|
||||
return false;
|
||||
|
||||
// any text, xml or json types are text
|
||||
|
@ -189,7 +189,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private static bool CheckIsXml(string contentType)
|
||||
{
|
||||
if (String.IsNullOrEmpty(contentType))
|
||||
if (string.IsNullOrEmpty(contentType))
|
||||
return false;
|
||||
|
||||
// RFC 3023: Media types with the suffix "+xml" are XML
|
||||
|
@ -203,7 +203,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private static string GetContentTypeSignature(string contentType)
|
||||
{
|
||||
if (String.IsNullOrEmpty(contentType))
|
||||
if (string.IsNullOrEmpty(contentType))
|
||||
return null;
|
||||
|
||||
string sig = contentType.Split(s_contentTypeParamSeparator, 2)[0].ToUpperInvariant();
|
||||
|
|
|
@ -443,7 +443,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
StreamHelper.SaveStreamToFile(responseStream, QualifiedOutFile, this);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(ResponseHeadersVariable))
|
||||
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
|
||||
{
|
||||
PSVariableIntrinsics vi = SessionState.PSVariable;
|
||||
vi.Set(ResponseHeadersVariable, WebResponseHelper.GetHeadersDictionary(response));
|
||||
|
|
|
@ -1545,7 +1545,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(detailMsg))
|
||||
if (!string.IsNullOrEmpty(detailMsg))
|
||||
{
|
||||
er.ErrorDetails = new ErrorDetails(detailMsg);
|
||||
}
|
||||
|
|
|
@ -1114,7 +1114,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
set
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
_path = inputStream;
|
||||
}
|
||||
|
|
|
@ -438,7 +438,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
_propertyMshParameterList = ProcessParameter(_property);
|
||||
|
||||
if (!String.IsNullOrEmpty(_title))
|
||||
if (!string.IsNullOrEmpty(_title))
|
||||
{
|
||||
WebUtility.HtmlEncode(_title);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
bool matchFound = false;
|
||||
|
||||
if (String.IsNullOrEmpty(patternToMatch))
|
||||
if (string.IsNullOrEmpty(patternToMatch))
|
||||
{
|
||||
notMatched.Add(patternToMatch);
|
||||
continue;
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
foreach (string notMatchedName in notMatched)
|
||||
{
|
||||
if (String.IsNullOrEmpty(notMatchedName))
|
||||
if (string.IsNullOrEmpty(notMatchedName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
|
||||
string errid = ErrorId;
|
||||
if (String.IsNullOrEmpty(errid))
|
||||
if (string.IsNullOrEmpty(errid))
|
||||
{
|
||||
errid = e.GetType().FullName;
|
||||
}
|
||||
|
@ -331,14 +331,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
TargetObject
|
||||
);
|
||||
|
||||
if (this.Exception != null && !String.IsNullOrEmpty(msg))
|
||||
if (this.Exception != null && !string.IsNullOrEmpty(msg))
|
||||
{
|
||||
errorRecord.ErrorDetails = new ErrorDetails(msg);
|
||||
}
|
||||
}
|
||||
|
||||
string recact = RecommendedAction;
|
||||
if (!String.IsNullOrEmpty(recact))
|
||||
if (!string.IsNullOrEmpty(recact))
|
||||
{
|
||||
if (errorRecord.ErrorDetails == null)
|
||||
{
|
||||
|
@ -348,13 +348,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
errorRecord.ErrorDetails.RecommendedAction = recact;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(CategoryActivity))
|
||||
if (!string.IsNullOrEmpty(CategoryActivity))
|
||||
errorRecord.CategoryInfo.Activity = CategoryActivity;
|
||||
if (!String.IsNullOrEmpty(CategoryReason))
|
||||
if (!string.IsNullOrEmpty(CategoryReason))
|
||||
errorRecord.CategoryInfo.Reason = CategoryReason;
|
||||
if (!String.IsNullOrEmpty(CategoryTargetName))
|
||||
if (!string.IsNullOrEmpty(CategoryTargetName))
|
||||
errorRecord.CategoryInfo.TargetName = CategoryTargetName;
|
||||
if (!String.IsNullOrEmpty(CategoryTargetType))
|
||||
if (!string.IsNullOrEmpty(CategoryTargetType))
|
||||
errorRecord.CategoryInfo.TargetType = CategoryTargetType;
|
||||
|
||||
/* 2005/01/25 removing throw-error
|
||||
|
@ -373,7 +373,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
errorRecord.SetInvocationInfo(myInvocation);
|
||||
errorRecord.PreserveInvocationInfoOnce = true;
|
||||
if (!String.IsNullOrEmpty(CategoryActivity))
|
||||
if (!string.IsNullOrEmpty(CategoryActivity))
|
||||
errorRecord.CategoryInfo.Activity = CategoryActivity;
|
||||
else
|
||||
errorRecord.CategoryInfo.Activity = "Write-Error";
|
||||
|
|
|
@ -611,7 +611,7 @@ namespace Microsoft.PowerShell
|
|||
private static bool MatchSwitch(string switchKey, string match, string smallestUnambiguousMatch)
|
||||
{
|
||||
Dbg.Assert(switchKey != null, "need a value");
|
||||
Dbg.Assert(!String.IsNullOrEmpty(match), "need a value");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(match), "need a value");
|
||||
Dbg.Assert(match.Trim().ToLowerInvariant() == match, "match should be normalized to lowercase w/ no outside whitespace");
|
||||
Dbg.Assert(smallestUnambiguousMatch.Trim().ToLowerInvariant() == smallestUnambiguousMatch, "match should be normalized to lowercase w/ no outside whitespace");
|
||||
Dbg.Assert(match.Contains(smallestUnambiguousMatch), "sUM should be a substring of match");
|
||||
|
@ -638,7 +638,7 @@ namespace Microsoft.PowerShell
|
|||
private void DisplayBanner()
|
||||
{
|
||||
// If banner text is not supplied do nothing.
|
||||
if (!String.IsNullOrEmpty(_bannerText))
|
||||
if (!string.IsNullOrEmpty(_bannerText))
|
||||
{
|
||||
_hostUI.WriteLine(_bannerText);
|
||||
_hostUI.WriteLine();
|
||||
|
|
|
@ -2536,7 +2536,7 @@ namespace Microsoft.PowerShell
|
|||
Dbg.Assert(!consoleHandle.IsInvalid, "ConsoleHandle is not valid");
|
||||
Dbg.Assert(!consoleHandle.IsClosed, "ConsoleHandle is closed");
|
||||
|
||||
if (String.IsNullOrEmpty(output))
|
||||
if (string.IsNullOrEmpty(output))
|
||||
return;
|
||||
|
||||
// Native WriteConsole doesn't support output buffer longer than 64K.
|
||||
|
|
|
@ -1362,7 +1362,7 @@ namespace Microsoft.PowerShell
|
|||
#if !UNIX
|
||||
// See if we need to change the process-wide execution
|
||||
// policy
|
||||
if (!String.IsNullOrEmpty(cpp.ExecutionPolicy))
|
||||
if (!string.IsNullOrEmpty(cpp.ExecutionPolicy))
|
||||
{
|
||||
ExecutionPolicy executionPolicy = SecuritySupport.ParseExecutionPolicy(cpp.ExecutionPolicy);
|
||||
SecuritySupport.SetExecutionPolicy(ExecutionPolicyScope.Process, executionPolicy, null);
|
||||
|
@ -1463,7 +1463,7 @@ namespace Microsoft.PowerShell
|
|||
|
||||
private Exception InitializeRunspaceHelper(string command, Executor exec, Executor.ExecutionOptions options)
|
||||
{
|
||||
Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value");
|
||||
Dbg.Assert(exec != null, "non-null Executor instance needed");
|
||||
|
||||
s_runspaceInitTracer.WriteLine("running command {0}", command);
|
||||
|
@ -1829,7 +1829,7 @@ namespace Microsoft.PowerShell
|
|||
ReportException(e1, exec);
|
||||
}
|
||||
}
|
||||
else if (!String.IsNullOrEmpty(initialCommand))
|
||||
else if (!string.IsNullOrEmpty(initialCommand))
|
||||
{
|
||||
// Run the command passed on the command line
|
||||
|
||||
|
@ -1884,7 +1884,7 @@ namespace Microsoft.PowerShell
|
|||
|
||||
private void RunProfile(string profileFileName, Executor exec)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(profileFileName))
|
||||
if (!string.IsNullOrEmpty(profileFileName))
|
||||
{
|
||||
s_runspaceInitTracer.WriteLine("checking profile" + profileFileName);
|
||||
|
||||
|
@ -2700,7 +2700,7 @@ namespace Microsoft.PowerShell
|
|||
Exception unused = null;
|
||||
string promptString = _promptExec.ExecuteCommandAndGetResultAsString("prompt", out unused);
|
||||
|
||||
if (String.IsNullOrEmpty(promptString))
|
||||
if (string.IsNullOrEmpty(promptString))
|
||||
{
|
||||
promptString = ConsoleHostStrings.DefaultPrompt;
|
||||
}
|
||||
|
|
|
@ -884,7 +884,7 @@ namespace Microsoft.PowerShell
|
|||
{
|
||||
List<Word> result = new List<Word>();
|
||||
|
||||
if (String.IsNullOrEmpty(text))
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Microsoft.PowerShell
|
|||
{
|
||||
if (fd != null)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(fd.HelpMessage))
|
||||
if (!string.IsNullOrEmpty(fd.HelpMessage))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace Microsoft.PowerShell
|
|||
|
||||
Boolean cancelInput = false;
|
||||
|
||||
if (!String.IsNullOrEmpty(caption))
|
||||
if (!string.IsNullOrEmpty(caption))
|
||||
{
|
||||
// Should be a skin lookup
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace Microsoft.PowerShell
|
|||
WriteLineToConsole();
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(message))
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
{
|
||||
WriteLineToConsole(WrapToCurrentWindowWidth(message));
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace Microsoft.PowerShell
|
|||
internal void ExecuteCommandAsync(string command, out Exception exceptionThrown, ExecutionOptions options)
|
||||
{
|
||||
Dbg.Assert(!useNestedPipelines, "can't async invoke a nested pipeline");
|
||||
Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value");
|
||||
|
||||
bool addToHistory = (options & ExecutionOptions.AddToHistory) > 0;
|
||||
Pipeline tempPipeline = _parent.RunspaceRef.CreatePipeline(command, addToHistory, false);
|
||||
|
@ -294,7 +294,7 @@ namespace Microsoft.PowerShell
|
|||
|
||||
internal Pipeline CreatePipeline(string command, bool addToHistory)
|
||||
{
|
||||
Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value");
|
||||
return _parent.RunspaceRef.CreatePipeline(command, addToHistory, useNestedPipelines);
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ namespace Microsoft.PowerShell
|
|||
/// </returns>
|
||||
internal Collection<PSObject> ExecuteCommand(string command, out Exception exceptionThrown, ExecutionOptions options)
|
||||
{
|
||||
Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value");
|
||||
|
||||
// Experimental:
|
||||
// Check for implicit remoting commands that can be batched, and execute as batched if able.
|
||||
|
@ -556,7 +556,7 @@ namespace Microsoft.PowerShell
|
|||
{
|
||||
exceptionThrown = null;
|
||||
|
||||
Dbg.Assert(!String.IsNullOrEmpty(command), "command should have a value");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(command), "command should have a value");
|
||||
|
||||
bool? result = null;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Microsoft.PowerShell
|
|||
Thread.CurrentThread.CurrentCulture = NativeCultureResolver.Culture;
|
||||
|
||||
#if DEBUG
|
||||
if (args.Length > 0 && !String.IsNullOrEmpty(args[0]) && args[0].Equals("-isswait", StringComparison.OrdinalIgnoreCase))
|
||||
if (args.Length > 0 && !string.IsNullOrEmpty(args[0]) && args[0].Equals("-isswait", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Console.WriteLine("Attach the debugger to continue...");
|
||||
while (!System.Diagnostics.Debugger.IsAttached) {
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace Microsoft.PowerShell
|
|||
|
||||
// Fifth and Sixth lines: The current operation
|
||||
|
||||
if (!String.IsNullOrEmpty(CurrentOperation))
|
||||
if (!string.IsNullOrEmpty(CurrentOperation))
|
||||
{
|
||||
strCollection.Add(" ");
|
||||
RenderFullDescription(this.CurrentOperation, indent, maxWidth, rawUI, strCollection, isFullPlus);
|
||||
|
@ -285,7 +285,7 @@ namespace Microsoft.PowerShell
|
|||
|
||||
// Third line: The current operation
|
||||
|
||||
if (!String.IsNullOrEmpty(CurrentOperation))
|
||||
if (!string.IsNullOrEmpty(CurrentOperation))
|
||||
{
|
||||
strCollection.Add(
|
||||
StringUtil.TruncateToBufferCellWidth(
|
||||
|
@ -457,7 +457,7 @@ namespace Microsoft.PowerShell
|
|||
++lines;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(CurrentOperation))
|
||||
if (!string.IsNullOrEmpty(CurrentOperation))
|
||||
{
|
||||
if (isFullPlus)
|
||||
{
|
||||
|
@ -494,7 +494,7 @@ namespace Microsoft.PowerShell
|
|||
// Start with 1 for the Activity, and 1 for the Status.
|
||||
|
||||
int lines = 2;
|
||||
if (!String.IsNullOrEmpty(CurrentOperation))
|
||||
if (!string.IsNullOrEmpty(CurrentOperation))
|
||||
{
|
||||
++lines;
|
||||
}
|
||||
|
|
|
@ -1064,7 +1064,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
while (true)
|
||||
{
|
||||
string s = Marshal.PtrToStringUni(pointer);
|
||||
if (String.IsNullOrEmpty(s))
|
||||
if (string.IsNullOrEmpty(s))
|
||||
break;
|
||||
keywordsList.Add(s);
|
||||
//nr of bytes = # chars * 2 + 2 bytes for character '\0'.
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace System.Management.Automation.SecurityAccountsManager.Native
|
|||
|
||||
public UNICODE_STRING(string s)
|
||||
{
|
||||
buffer = String.IsNullOrEmpty(s) ? String.Empty : s;
|
||||
buffer = string.IsNullOrEmpty(s) ? String.Empty : s;
|
||||
Length = (UInt16)(2 * buffer.Length);
|
||||
MaximumLength = Length;
|
||||
}
|
||||
|
|
|
@ -1321,7 +1321,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
// Verify the parameters
|
||||
|
||||
if (String.IsNullOrEmpty(path))
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("path");
|
||||
}
|
||||
|
@ -2726,7 +2726,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string noun = null;
|
||||
try
|
||||
{
|
||||
if (!String.IsNullOrEmpty(helpItemName))
|
||||
if (!string.IsNullOrEmpty(helpItemName))
|
||||
{
|
||||
CmdletInfo.SplitCmdletName(helpItemName, out verb, out noun);
|
||||
}
|
||||
|
@ -2735,7 +2735,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return String.Empty;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(verb) || String.IsNullOrEmpty(noun))
|
||||
if (string.IsNullOrEmpty(verb) || string.IsNullOrEmpty(noun))
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
|
@ -2962,7 +2962,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return String.IsNullOrEmpty(_friendlyName) ?
|
||||
return string.IsNullOrEmpty(_friendlyName) ?
|
||||
_oid :
|
||||
_friendlyName + " (" + _oid + ")";
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
protected override void BeginProcessing()
|
||||
{
|
||||
// Validate Path
|
||||
if (!String.IsNullOrEmpty(Path))
|
||||
if (!string.IsNullOrEmpty(Path))
|
||||
{
|
||||
ProviderInfo provider = null;
|
||||
Collection<string> resolvedPaths = GetResolvedProviderPathFromPSPath(Path, out provider);
|
||||
|
@ -107,7 +107,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_resolvedPath = resolvedPaths[0];
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(LiteralPath))
|
||||
if (!string.IsNullOrEmpty(LiteralPath))
|
||||
{
|
||||
// Validate that the path exists
|
||||
SessionState.InvokeProvider.Item.Get(new string[] { LiteralPath }, false, true);
|
||||
|
@ -115,7 +115,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
|
||||
// Validate OutFile
|
||||
if (!String.IsNullOrEmpty(OutFile))
|
||||
if (!string.IsNullOrEmpty(OutFile))
|
||||
{
|
||||
_resolvedOutFile = GetUnresolvedProviderPathFromPSPath(OutFile);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ThrowTerminatingError(terminatingError);
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(_resolvedOutFile))
|
||||
if (string.IsNullOrEmpty(_resolvedOutFile))
|
||||
{
|
||||
WriteObject(encodedContent);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
protected override void BeginProcessing()
|
||||
{
|
||||
// Validate Path
|
||||
if (!String.IsNullOrEmpty(Path))
|
||||
if (!string.IsNullOrEmpty(Path))
|
||||
{
|
||||
ProviderInfo provider = null;
|
||||
Collection<string> resolvedPaths = GetResolvedProviderPathFromPSPath(Path, out provider);
|
||||
|
@ -258,7 +258,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_resolvedPath = resolvedPaths[0];
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(LiteralPath))
|
||||
if (!string.IsNullOrEmpty(LiteralPath))
|
||||
{
|
||||
// Validate that the path exists
|
||||
SessionState.InvokeProvider.Item.Get(new string[] { LiteralPath }, false, true);
|
||||
|
@ -416,7 +416,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
protected override void BeginProcessing()
|
||||
{
|
||||
// Validate Path
|
||||
if (!String.IsNullOrEmpty(Path))
|
||||
if (!string.IsNullOrEmpty(Path))
|
||||
{
|
||||
ProviderInfo provider = null;
|
||||
Collection<string> resolvedPaths = GetResolvedProviderPathFromPSPath(Path, out provider);
|
||||
|
@ -436,7 +436,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_resolvedPath = resolvedPaths[0];
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(LiteralPath))
|
||||
if (!string.IsNullOrEmpty(LiteralPath))
|
||||
{
|
||||
// Validate that the path exists
|
||||
SessionState.InvokeProvider.Item.Get(new string[] { LiteralPath }, false, true);
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace Microsoft.WSMan.Management
|
|||
return null;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(drive.Root) == false)
|
||||
if (string.IsNullOrEmpty(drive.Root) == false)
|
||||
{
|
||||
AssertError(helper.GetResourceMsgFromResourcetext("NewDriveRootDoesNotExist"), false);
|
||||
return null;
|
||||
|
@ -355,7 +355,7 @@ namespace Microsoft.WSMan.Management
|
|||
string childname = String.Empty;
|
||||
string strPathCheck = String.Empty;
|
||||
|
||||
if (path.Length == 0 && String.IsNullOrEmpty(childname))
|
||||
if (path.Length == 0 && string.IsNullOrEmpty(childname))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ namespace Microsoft.WSMan.Management
|
|||
|
||||
string childname = string.Empty;
|
||||
|
||||
if (path.Length == 0 && String.IsNullOrEmpty(childname))
|
||||
if (path.Length == 0 && string.IsNullOrEmpty(childname))
|
||||
{
|
||||
WriteItemObject(GetItemPSObjectWithTypeName(WSManStringLiterals.rootpath, WSManStringLiterals.ContainerChildValue, null, null, null, WsManElementObjectTypes.WSManConfigElement), WSManStringLiterals.rootpath, true);
|
||||
return;
|
||||
|
@ -889,7 +889,7 @@ namespace Microsoft.WSMan.Management
|
|||
|
||||
string ChildName = string.Empty;
|
||||
|
||||
if (path.Length == 0 && String.IsNullOrEmpty(ChildName))
|
||||
if (path.Length == 0 && string.IsNullOrEmpty(ChildName))
|
||||
{
|
||||
AssertError(helper.GetResourceMsgFromResourcetext("SetItemNotSupported"), false);
|
||||
return;
|
||||
|
@ -994,7 +994,7 @@ namespace Microsoft.WSMan.Management
|
|||
XmlDocument xmlPlugins = FindResourceValue(sessionobj, uri, null);
|
||||
string currentpluginname = string.Empty;
|
||||
GetPluginNames(xmlPlugins, out objPluginNames, out currentpluginname, path);
|
||||
if (String.IsNullOrEmpty(currentpluginname))
|
||||
if (string.IsNullOrEmpty(currentpluginname))
|
||||
{
|
||||
if (!this.clearItemIsCalled)
|
||||
{
|
||||
|
@ -1048,7 +1048,7 @@ namespace Microsoft.WSMan.Management
|
|||
|
||||
if (WSManStringLiterals.ConfigRunAsPasswordName.Equals(ChildName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if(String.IsNullOrEmpty(
|
||||
if(string.IsNullOrEmpty(
|
||||
pluginConfiguration.GetOneConfiguration(
|
||||
String.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
|
@ -1261,7 +1261,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(pluginConfiguration.ServerSession.Error))
|
||||
if (!string.IsNullOrEmpty(pluginConfiguration.ServerSession.Error))
|
||||
{
|
||||
AssertError(pluginConfiguration.ServerSession.Error, true);
|
||||
}
|
||||
|
@ -1316,7 +1316,7 @@ namespace Microsoft.WSMan.Management
|
|||
{
|
||||
if (dynParams.Concatenate)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(value.ToString()))
|
||||
if (!string.IsNullOrEmpty(value.ToString()))
|
||||
{
|
||||
// ',' is used as the delimiter in WSMan for TrustedHosts.
|
||||
value = SplitAndUpdateStringUsingDelimiter(sessionobj, uri, ChildName, value.ToString(), ",");
|
||||
|
@ -1434,7 +1434,7 @@ namespace Microsoft.WSMan.Management
|
|||
string childname = String.Empty;
|
||||
string strPathCheck = String.Empty;
|
||||
|
||||
if (path.Length == 0 && String.IsNullOrEmpty(childname))
|
||||
if (path.Length == 0 && string.IsNullOrEmpty(childname))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1779,7 +1779,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
{
|
||||
AssertError(((IWSManSession)sessionobj).Error, true);
|
||||
}
|
||||
|
@ -2079,7 +2079,7 @@ namespace Microsoft.WSMan.Management
|
|||
WSManProviderNewItemPluginParameters niParams = DynamicParameters as WSManProviderNewItemPluginParameters;
|
||||
if (niParams != null)
|
||||
{
|
||||
if (String.IsNullOrEmpty(niParams.File))
|
||||
if (string.IsNullOrEmpty(niParams.File))
|
||||
{
|
||||
mshObj.Properties.Add(new PSNoteProperty("Name", niParams.Plugin));
|
||||
mshObj.Properties.Add(new PSNoteProperty("Filename", niParams.FileName));
|
||||
|
@ -2285,7 +2285,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
{
|
||||
AssertError(((IWSManSession)sessionobj).Error, true);
|
||||
}
|
||||
|
@ -2336,7 +2336,7 @@ namespace Microsoft.WSMan.Management
|
|||
mshObject = new PSObject(element);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(ExtendedTypeName))
|
||||
if (!string.IsNullOrEmpty(ExtendedTypeName))
|
||||
{
|
||||
StringBuilder types = new StringBuilder(string.Empty);
|
||||
if (mshObject != null)
|
||||
|
@ -2716,7 +2716,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
{
|
||||
AssertError(((IWSManSession)sessionobj).Error, true);
|
||||
}
|
||||
|
@ -2741,7 +2741,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
{
|
||||
AssertError(((IWSManSession)sessionobj).Error, true);
|
||||
}
|
||||
|
@ -2790,7 +2790,7 @@ namespace Microsoft.WSMan.Management
|
|||
|
||||
Marshal.ReleaseComObject(value);
|
||||
|
||||
if (!String.IsNullOrEmpty(strXmlValue))
|
||||
if (!string.IsNullOrEmpty(strXmlValue))
|
||||
{
|
||||
xmlEnumResources = new XmlDocument();
|
||||
strXmlValue = "<WsManResults>" + strXmlValue + "</WsManResults>";
|
||||
|
@ -2801,7 +2801,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
{
|
||||
AssertError(((IWSManSession)sessionobj).Error, true);
|
||||
}
|
||||
|
@ -2837,7 +2837,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
{
|
||||
AssertError(((IWSManSession)sessionobj).Error, true);
|
||||
}
|
||||
|
@ -2863,7 +2863,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
if (!string.IsNullOrEmpty(((IWSManSession)sessionobj).Error))
|
||||
{
|
||||
AssertError(((IWSManSession)sessionobj).Error, true);
|
||||
}
|
||||
|
@ -2924,7 +2924,7 @@ namespace Microsoft.WSMan.Management
|
|||
valuexml = valuexml + ((IWSManEnumerator)value).ReadItem();
|
||||
}
|
||||
|
||||
if ((valuexml != string.Empty) && !(String.IsNullOrEmpty(valuexml)))
|
||||
if ((valuexml != string.Empty) && !(string.IsNullOrEmpty(valuexml)))
|
||||
{
|
||||
valuexml = "<WsManResults>" + valuexml + "</WsManResults>";
|
||||
}
|
||||
|
@ -3030,7 +3030,7 @@ namespace Microsoft.WSMan.Management
|
|||
result = true;
|
||||
}
|
||||
}
|
||||
else if (!String.IsNullOrEmpty(value))
|
||||
else if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
foreach (string key in pkeys)
|
||||
{
|
||||
|
@ -3117,7 +3117,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(ExtendedTypeName))
|
||||
if (!string.IsNullOrEmpty(ExtendedTypeName))
|
||||
{
|
||||
StringBuilder types = new StringBuilder(string.Empty);
|
||||
if (mshObject != null)
|
||||
|
@ -3183,7 +3183,7 @@ namespace Microsoft.WSMan.Management
|
|||
existingvalue = mshObject.Properties[childname].Value.ToString();
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(existingvalue))
|
||||
if (!string.IsNullOrEmpty(existingvalue))
|
||||
{
|
||||
string[] existingsplitvalues = existingvalue.Split(new string[] { Delimiter }, StringSplitOptions.None);
|
||||
string[] newvalues = value.Split(new string[] { Delimiter }, StringSplitOptions.None);
|
||||
|
@ -3450,7 +3450,7 @@ namespace Microsoft.WSMan.Management
|
|||
|
||||
//Get the wsman host name to find the session object
|
||||
string host = GetHostName(path);
|
||||
if (String.IsNullOrEmpty(host))
|
||||
if (string.IsNullOrEmpty(host))
|
||||
{
|
||||
throw new InvalidOperationException("InvalidPath");
|
||||
}
|
||||
|
@ -3627,7 +3627,7 @@ namespace Microsoft.WSMan.Management
|
|||
result = WSManStringLiterals.containerListener;
|
||||
else
|
||||
{
|
||||
if (!String.IsNullOrEmpty(hostname))
|
||||
if (!string.IsNullOrEmpty(hostname))
|
||||
{
|
||||
Dictionary<string, object> SessionObjCache = WSManHelper.GetSessionObjCache();
|
||||
if (ChildName.Equals(hostname, StringComparison.OrdinalIgnoreCase))
|
||||
|
@ -3903,7 +3903,7 @@ namespace Microsoft.WSMan.Management
|
|||
//Get the wsman host name to find the session object
|
||||
string host = GetHostName(path);
|
||||
|
||||
if (String.IsNullOrEmpty(host))
|
||||
if (string.IsNullOrEmpty(host))
|
||||
{
|
||||
return false;
|
||||
|
||||
|
@ -3922,7 +3922,7 @@ namespace Microsoft.WSMan.Management
|
|||
//Get URI to pass to WsMan Automation API
|
||||
string uri = NormalizePath(path, host);
|
||||
|
||||
if (String.IsNullOrEmpty(uri))
|
||||
if (string.IsNullOrEmpty(uri))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -3951,7 +3951,7 @@ namespace Microsoft.WSMan.Management
|
|||
XmlDocument outxml = FindResourceValue(sessionobj, uri, null);
|
||||
string currentpluginname = String.Empty;
|
||||
GetPluginNames(outxml, out objPluginNames, out currentpluginname, path);
|
||||
if (String.IsNullOrEmpty(currentpluginname))
|
||||
if (string.IsNullOrEmpty(currentpluginname))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -4210,7 +4210,7 @@ namespace Microsoft.WSMan.Management
|
|||
|
||||
//Get the wsman host name to find the session object
|
||||
string host = GetHostName(path);
|
||||
if (String.IsNullOrEmpty(host))
|
||||
if (string.IsNullOrEmpty(host))
|
||||
{
|
||||
throw new InvalidOperationException("InvalidPath");
|
||||
}
|
||||
|
@ -4880,7 +4880,7 @@ namespace Microsoft.WSMan.Management
|
|||
XmlAttributeCollection attributecol = nodelistPlugin.Item(0).Attributes;
|
||||
|
||||
XmlNode runAsUserNode = attributecol.GetNamedItem(WSManStringLiterals.ConfigRunAsUserName);
|
||||
bool runAsUserPresent = runAsUserNode != null && !String.IsNullOrEmpty(runAsUserNode.Value);
|
||||
bool runAsUserPresent = runAsUserNode != null && !string.IsNullOrEmpty(runAsUserNode.Value);
|
||||
|
||||
for (int i = 0; i <= attributecol.Count - 1; i++)
|
||||
{
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_SessionObj.Error))
|
||||
if (!string.IsNullOrEmpty(m_SessionObj.Error))
|
||||
{
|
||||
helper.AssertError(m_SessionObj.Error, true, null);
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_SessionObj.Error))
|
||||
if (!string.IsNullOrEmpty(m_SessionObj.Error))
|
||||
{
|
||||
helper.AssertError(m_SessionObj.Error, true, null);
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_SessionObj.Error))
|
||||
if (!string.IsNullOrEmpty(m_SessionObj.Error))
|
||||
{
|
||||
helper.AssertError(m_SessionObj.Error, true, delegatecomputer);
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_SessionObj.Error))
|
||||
if (!string.IsNullOrEmpty(m_SessionObj.Error))
|
||||
{
|
||||
helper.AssertError(m_SessionObj.Error, true, delegatecomputer);
|
||||
}
|
||||
|
@ -894,7 +894,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_SessionObj.Error))
|
||||
if (!string.IsNullOrEmpty(m_SessionObj.Error))
|
||||
{
|
||||
helper.AssertError(m_SessionObj.Error, true, null);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace Microsoft.WSMan.Management
|
|||
/// <returns>False, if operation failed.</returns>
|
||||
public bool RefreshCurrentConfiguration(string responseOfGet)
|
||||
{
|
||||
if (String.IsNullOrEmpty(responseOfGet))
|
||||
if (string.IsNullOrEmpty(responseOfGet))
|
||||
{
|
||||
throw new ArgumentNullException("responseOfGet");
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ namespace Microsoft.WSMan.Management
|
|||
this.nameSpaceManger = new XmlNamespaceManager(this.rootDocument.NameTable);
|
||||
this.nameSpaceManger.AddNamespace(CurrentConfigurations.DefaultNameSpacePrefix, this.documentElement.NamespaceURI);
|
||||
|
||||
return String.IsNullOrEmpty(this.serverSession.Error);
|
||||
return string.IsNullOrEmpty(this.serverSession.Error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -101,7 +101,7 @@ namespace Microsoft.WSMan.Management
|
|||
/// <returns>False, if operation is not succesful.</returns>
|
||||
public void PutConfigurationOnServer(string resourceUri)
|
||||
{
|
||||
if (String.IsNullOrEmpty(resourceUri))
|
||||
if (string.IsNullOrEmpty(resourceUri))
|
||||
{
|
||||
throw new ArgumentNullException("resourceUri");
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ namespace Microsoft.WSMan.Management
|
|||
throw new ArgumentNullException("pathToNodeFromRoot");
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(configurationName))
|
||||
if (string.IsNullOrEmpty(configurationName))
|
||||
{
|
||||
throw new ArgumentNullException("configurationName");
|
||||
}
|
||||
|
|
|
@ -289,12 +289,12 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
if (!string.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
{
|
||||
helper.AssertError(m_wsmanObject.Error, true, resourceuri);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(m_session.Error))
|
||||
if (!string.IsNullOrEmpty(m_session.Error))
|
||||
{
|
||||
helper.AssertError(m_session.Error, true, resourceuri);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace Microsoft.WSMan.Management
|
|||
{
|
||||
try
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_SessionObj.Error))
|
||||
if (!string.IsNullOrEmpty(m_SessionObj.Error))
|
||||
{
|
||||
XmlDocument ErrorDoc = new XmlDocument();
|
||||
ErrorDoc.LoadXml(m_SessionObj.Error);
|
||||
|
|
|
@ -253,7 +253,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_SessionObj.Error))
|
||||
if (!string.IsNullOrEmpty(m_SessionObj.Error))
|
||||
{
|
||||
helper.AssertError(m_SessionObj.Error, true, null);
|
||||
}
|
||||
|
|
|
@ -580,12 +580,12 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
if (!string.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
{
|
||||
helper.AssertError(m_wsmanObject.Error, true, resourceuri);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(m_session.Error))
|
||||
if (!string.IsNullOrEmpty(m_session.Error))
|
||||
{
|
||||
helper.AssertError(m_session.Error, true, resourceuri);
|
||||
}
|
||||
|
@ -956,12 +956,12 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
if (!string.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
{
|
||||
helper.AssertError(m_wsmanObject.Error, true, resourceuri);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(m_session.Error))
|
||||
if (!string.IsNullOrEmpty(m_session.Error))
|
||||
{
|
||||
helper.AssertError(m_session.Error, true, resourceuri);
|
||||
}
|
||||
|
@ -1237,12 +1237,12 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_session.Error))
|
||||
if (!string.IsNullOrEmpty(m_session.Error))
|
||||
{
|
||||
helper.AssertError(m_session.Error, true, resourceuri);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
if (!string.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
{
|
||||
helper.AssertError(m_wsmanObject.Error, true, resourceuri);
|
||||
}
|
||||
|
@ -1545,12 +1545,12 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
if (!string.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
{
|
||||
helper.AssertError(m_wsmanObject.Error, true, resourceuri);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(m_session.Error))
|
||||
if (!string.IsNullOrEmpty(m_session.Error))
|
||||
{
|
||||
helper.AssertError(m_session.Error, true, resourceuri);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace Microsoft.WSMan.Management
|
|||
throw new ArgumentNullException("resourceManager");
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(resourceName))
|
||||
if (string.IsNullOrEmpty(resourceName))
|
||||
{
|
||||
throw new ArgumentNullException("resourceName");
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ namespace Microsoft.WSMan.Management
|
|||
if (credential.UserName != null)
|
||||
{
|
||||
nwCredential = credential.GetNetworkCredential();
|
||||
if (String.IsNullOrEmpty(nwCredential.Domain))
|
||||
if (string.IsNullOrEmpty(nwCredential.Domain))
|
||||
{
|
||||
if ( authentication.Equals(AuthenticationMechanism.Digest) || authentication.Equals(AuthenticationMechanism.Basic) )
|
||||
{
|
||||
|
@ -987,7 +987,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
if (!string.IsNullOrEmpty(m_wsmanObject.Error))
|
||||
{
|
||||
AssertError(m_wsmanObject.Error, true, computername);
|
||||
}
|
||||
|
|
|
@ -314,13 +314,13 @@ namespace System.Management.Automation
|
|||
bool assemblyFound = false;
|
||||
char dirSeparator = IO.Path.DirectorySeparatorChar;
|
||||
|
||||
if (String.IsNullOrEmpty(_winDir))
|
||||
if (string.IsNullOrEmpty(_winDir))
|
||||
{
|
||||
//cache value of '_winDir' folder in member variable.
|
||||
_winDir = Environment.GetEnvironmentVariable("winDir");
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(_gacPathMSIL))
|
||||
if (string.IsNullOrEmpty(_gacPathMSIL))
|
||||
{
|
||||
//cache value of '_gacPathMSIL' folder in member variable.
|
||||
_gacPathMSIL = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_MSIL";
|
||||
|
@ -334,7 +334,7 @@ namespace System.Management.Automation
|
|||
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
if (String.IsNullOrEmpty(_gacPath64))
|
||||
if (string.IsNullOrEmpty(_gacPath64))
|
||||
{
|
||||
//cache value of '_gacPath64' folder in member variable.
|
||||
_gacPath64 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_64";
|
||||
|
@ -344,7 +344,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
else
|
||||
{
|
||||
if (String.IsNullOrEmpty(_gacPath32))
|
||||
if (string.IsNullOrEmpty(_gacPath32))
|
||||
{
|
||||
//cache value of '_gacPath32' folder in member variable.
|
||||
_gacPath32 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_32";
|
||||
|
@ -373,12 +373,12 @@ namespace System.Management.Automation
|
|||
//Enumerate all directories, sort by name and select the last. This selects the latest version.
|
||||
var chosenVersionDirectory = Directory.GetDirectories(tempAssemblyDirPath).OrderBy(d => d).LastOrDefault();
|
||||
|
||||
if (!String.IsNullOrEmpty(chosenVersionDirectory))
|
||||
if (!string.IsNullOrEmpty(chosenVersionDirectory))
|
||||
{
|
||||
//Select first or default as the directory will contain only one assembly. If nothing then default is null;
|
||||
var foundAssemblyPath = Directory.GetFiles(chosenVersionDirectory, $"{assemblyName.Name}*").FirstOrDefault();
|
||||
|
||||
if (!String.IsNullOrEmpty(foundAssemblyPath))
|
||||
if (!string.IsNullOrEmpty(foundAssemblyPath))
|
||||
{
|
||||
AssemblyName asmNameFound = AssemblyLoadContext.GetAssemblyName(foundAssemblyPath);
|
||||
if (IsAssemblyMatching(assemblyName, asmNameFound))
|
||||
|
|
|
@ -255,7 +255,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
case Platform.XDG_Type.CONFIG:
|
||||
//the user has set XDG_CONFIG_HOME corresponding to profile path
|
||||
if (String.IsNullOrEmpty(xdgconfighome))
|
||||
if (string.IsNullOrEmpty(xdgconfighome))
|
||||
{
|
||||
//xdg values have not been set
|
||||
return xdgConfigHomeDefault;
|
||||
|
@ -268,7 +268,7 @@ namespace System.Management.Automation
|
|||
|
||||
case Platform.XDG_Type.DATA:
|
||||
//the user has set XDG_DATA_HOME corresponding to module path
|
||||
if (String.IsNullOrEmpty(xdgdatahome))
|
||||
if (string.IsNullOrEmpty(xdgdatahome))
|
||||
{
|
||||
// create the xdg folder if needed
|
||||
if (!Directory.Exists(xdgDataHomeDefault))
|
||||
|
@ -293,7 +293,7 @@ namespace System.Management.Automation
|
|||
|
||||
case Platform.XDG_Type.USER_MODULES:
|
||||
//the user has set XDG_DATA_HOME corresponding to module path
|
||||
if (String.IsNullOrEmpty(xdgdatahome))
|
||||
if (string.IsNullOrEmpty(xdgdatahome))
|
||||
{
|
||||
//xdg values have not been set
|
||||
if (!Directory.Exists(xdgModuleDefault)) //module folder not always guaranteed to exist
|
||||
|
@ -321,7 +321,7 @@ namespace System.Management.Automation
|
|||
|
||||
case Platform.XDG_Type.CACHE:
|
||||
//the user has set XDG_CACHE_HOME
|
||||
if (String.IsNullOrEmpty(xdgcachehome))
|
||||
if (string.IsNullOrEmpty(xdgcachehome))
|
||||
{
|
||||
//xdg values have not been set
|
||||
if (!Directory.Exists(xdgCacheDefault)) //module folder not always guaranteed to exist
|
||||
|
|
|
@ -561,7 +561,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!String.IsNullOrEmpty(word.Delim))
|
||||
if (!string.IsNullOrEmpty(word.Delim))
|
||||
{
|
||||
wordToAdd += word.Delim;
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
|
||||
internal string GetMandatoryInnerText(XmlNode n)
|
||||
{
|
||||
if (String.IsNullOrEmpty(n.InnerText))
|
||||
if (string.IsNullOrEmpty(n.InnerText))
|
||||
{
|
||||
this.ReportEmptyNode(n);
|
||||
return null;
|
||||
|
@ -346,7 +346,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
|
||||
internal string GetMandatoryAttributeValue(XmlAttribute a)
|
||||
{
|
||||
if (String.IsNullOrEmpty(a.Value))
|
||||
if (string.IsNullOrEmpty(a.Value))
|
||||
{
|
||||
this.ReportEmptyAttribute(a);
|
||||
return null;
|
||||
|
|
|
@ -634,7 +634,7 @@ namespace System.Management.Automation
|
|||
/// <param name="viewDefinitions"></param>
|
||||
public ExtendedTypeDefinition(string typeName, IEnumerable<FormatViewDefinition> viewDefinitions) : this()
|
||||
{
|
||||
if (String.IsNullOrEmpty(typeName))
|
||||
if (string.IsNullOrEmpty(typeName))
|
||||
throw PSTraceSource.NewArgumentNullException("typeName");
|
||||
if (viewDefinitions == null)
|
||||
throw PSTraceSource.NewArgumentNullException("viewDefinitions");
|
||||
|
@ -652,7 +652,7 @@ namespace System.Management.Automation
|
|||
/// <param name="typeName"></param>
|
||||
public ExtendedTypeDefinition(string typeName) : this()
|
||||
{
|
||||
if (String.IsNullOrEmpty(typeName))
|
||||
if (string.IsNullOrEmpty(typeName))
|
||||
throw PSTraceSource.NewArgumentNullException("typeName");
|
||||
|
||||
TypeNames.Add(typeName);
|
||||
|
@ -690,7 +690,7 @@ namespace System.Management.Automation
|
|||
/// <summary/>
|
||||
public FormatViewDefinition(string name, PSControl control)
|
||||
{
|
||||
if (String.IsNullOrEmpty(name))
|
||||
if (string.IsNullOrEmpty(name))
|
||||
throw PSTraceSource.NewArgumentNullException("name");
|
||||
if (control == null)
|
||||
throw PSTraceSource.NewArgumentNullException("control");
|
||||
|
@ -797,7 +797,7 @@ namespace System.Management.Automation
|
|||
/// <summary>Public constructor for DisplayEntry</summary>
|
||||
public DisplayEntry(string value, DisplayEntryValueType type)
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
if (string.IsNullOrEmpty(value))
|
||||
if (value == null || type == DisplayEntryValueType.Property)
|
||||
throw PSTraceSource.NewArgumentNullException("value");
|
||||
|
||||
|
@ -816,7 +816,7 @@ namespace System.Management.Automation
|
|||
Value = expression.expressionValue;
|
||||
ValueType = expression.isScriptBlock ? DisplayEntryValueType.ScriptBlock : DisplayEntryValueType.Property;
|
||||
|
||||
if (String.IsNullOrEmpty(Value))
|
||||
if (string.IsNullOrEmpty(Value))
|
||||
if (Value == null || ValueType == DisplayEntryValueType.Property)
|
||||
throw PSTraceSource.NewArgumentNullException("value");
|
||||
}
|
||||
|
|
|
@ -596,7 +596,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
// Label --- Label cardinality 0..1
|
||||
// Width --- Width cardinality 0..1
|
||||
// Alignment --- Alignment cardinality 0..1
|
||||
if (!String.IsNullOrEmpty(header.Label))
|
||||
if (!string.IsNullOrEmpty(header.Label))
|
||||
{
|
||||
TextToken tt = new TextToken();
|
||||
tt.text = header.Label;
|
||||
|
@ -754,7 +754,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
{
|
||||
foreach (string type in selectedBy)
|
||||
{
|
||||
if (String.IsNullOrEmpty(type))
|
||||
if (string.IsNullOrEmpty(type))
|
||||
return null;
|
||||
TypeReference tr = new TypeReference { name = type };
|
||||
appliesTo.referenceList.Add(tr);
|
||||
|
@ -898,7 +898,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
|||
lvid.formatTokenList.Add(fpt);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(listItem.Label))
|
||||
if (!string.IsNullOrEmpty(listItem.Label))
|
||||
{
|
||||
TextToken tt = new TextToken();
|
||||
tt.text = listItem.Label;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
internal ApplicationInfo(string name, string path, ExecutionContext context) : base(name, CommandTypes.Application)
|
||||
{
|
||||
if (String.IsNullOrEmpty(path))
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("path");
|
||||
}
|
||||
|
|
|
@ -690,7 +690,7 @@ namespace System.Management.Automation
|
|||
set
|
||||
{
|
||||
_parameterSetName = value;
|
||||
if (String.IsNullOrEmpty(_parameterSetName))
|
||||
if (string.IsNullOrEmpty(_parameterSetName))
|
||||
{
|
||||
_parameterSetName = ParameterAttribute.AllParameterSets;
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ namespace System.Management.Automation
|
|||
Match match = regex.Match(objectString);
|
||||
if (!match.Success)
|
||||
{
|
||||
var errorMessageFormat = String.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidatePatternFailure : ErrorMessage;
|
||||
var errorMessageFormat = string.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidatePatternFailure : ErrorMessage;
|
||||
throw new ValidationMetadataException("ValidatePatternFailure",
|
||||
null, errorMessageFormat,
|
||||
objectString, RegexPattern);
|
||||
|
@ -1368,7 +1368,7 @@ namespace System.Management.Automation
|
|||
/// <exception cref="ArgumentException">For invalid arguments.</exception>
|
||||
public ValidatePatternAttribute(string regexPattern)
|
||||
{
|
||||
if (String.IsNullOrEmpty(regexPattern))
|
||||
if (string.IsNullOrEmpty(regexPattern))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("regexPattern");
|
||||
}
|
||||
|
@ -1425,7 +1425,7 @@ namespace System.Management.Automation
|
|||
|
||||
if (!LanguagePrimitives.IsTrue(result))
|
||||
{
|
||||
var errorMessageFormat = String.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidateScriptFailure : ErrorMessage;
|
||||
var errorMessageFormat = string.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidateScriptFailure : ErrorMessage;
|
||||
throw new ValidationMetadataException("ValidateScriptFailure",
|
||||
null, errorMessageFormat,
|
||||
element, ScriptBlock);
|
||||
|
@ -1712,7 +1712,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
var errorMessageFormat = String.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidateSetFailure : ErrorMessage;
|
||||
var errorMessageFormat = string.IsNullOrEmpty(ErrorMessage) ? Metadata.ValidateSetFailure : ErrorMessage;
|
||||
throw new ValidationMetadataException("ValidateSetFailure", null,
|
||||
errorMessageFormat,
|
||||
element.ToString(), SetAsString());
|
||||
|
@ -2082,7 +2082,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
else if (arguments is string str)
|
||||
{
|
||||
if (String.IsNullOrEmpty(str))
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
throw new ValidationMetadataException(
|
||||
"ArgumentIsEmpty",
|
||||
|
@ -2112,7 +2112,7 @@ namespace System.Management.Automation
|
|||
|
||||
if (element is string elementAsString)
|
||||
{
|
||||
if (String.IsNullOrEmpty(elementAsString))
|
||||
if (string.IsNullOrEmpty(elementAsString))
|
||||
{
|
||||
throw new ValidationMetadataException(
|
||||
"ArgumentCollectionContainsEmpty",
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace System.Management.Automation
|
|||
ExecutionContext context)
|
||||
: base(name, CommandTypes.Cmdlet, context)
|
||||
{
|
||||
if (String.IsNullOrEmpty(name))
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("name");
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace System.Management.Automation
|
|||
public CmdletInfo(string name, Type implementingType)
|
||||
: base(name, CommandTypes.Cmdlet, null)
|
||||
{
|
||||
if (String.IsNullOrEmpty(name))
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("name");
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
System.Diagnostics.Debug.Assert(cmdletName != null, "cmdletName != null");
|
||||
string result = cmdletName;
|
||||
if (!String.IsNullOrEmpty(moduleName))
|
||||
if (!string.IsNullOrEmpty(moduleName))
|
||||
{
|
||||
result = moduleName + '\\' + result;
|
||||
}
|
||||
|
|
|
@ -2818,7 +2818,7 @@ namespace System.Management.Automation
|
|||
if (currentParameterSetActive == 1)
|
||||
{
|
||||
string parameterSetName = bindableParameters.GetParameterSetName(currentParameterSet);
|
||||
if (!String.IsNullOrEmpty(parameterSetName))
|
||||
if (!string.IsNullOrEmpty(parameterSetName))
|
||||
{
|
||||
ParameterBinderBase.bindingTracer.WriteLine("Remaining valid parameter set: {0}", parameterSetName);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace System.Management.Automation.ComInterop
|
|||
// yields a runtime exception in the ToString() function.
|
||||
DefaultValue = DBNull.Value;
|
||||
|
||||
if (!String.IsNullOrEmpty(name))
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
// This is a parameter, not a return value
|
||||
IsOut = (elemDesc.desc.paramdesc.wParamFlags & PARAMFLAG.PARAMFLAG_FOUT) != 0;
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace System.Management.Automation.ComInterop
|
|||
typeName = ctd.TypeName;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(typeName))
|
||||
if (string.IsNullOrEmpty(typeName))
|
||||
{
|
||||
typeName = "IDispatch";
|
||||
}
|
||||
|
|
|
@ -886,7 +886,7 @@ namespace System.Management.Automation
|
|||
// Determine if we need to quote the paths we parse
|
||||
|
||||
lastWord = lastWord ?? string.Empty;
|
||||
bool isLastWordEmpty = String.IsNullOrEmpty(lastWord);
|
||||
bool isLastWordEmpty = string.IsNullOrEmpty(lastWord);
|
||||
bool lastCharIsStar = !isLastWordEmpty && lastWord.EndsWith("*", StringComparison.Ordinal);
|
||||
bool containsGlobChars = WildcardPattern.ContainsWildcardCharacters(lastWord);
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ namespace System.Management.Automation
|
|||
|
||||
private static List<PathItemAndConvertedPath> PSv2FindMatches(PowerShellExecutionHelper helper, string path, bool shouldFullyQualifyPaths)
|
||||
{
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(path), "path should have a value");
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(path), "path should have a value");
|
||||
var result = new List<PathItemAndConvertedPath>();
|
||||
|
||||
Exception exceptionThrown;
|
||||
|
|
|
@ -954,7 +954,7 @@ namespace System.Management.Automation
|
|||
private static string GetFirstLineSubString(string stringToComplete, out bool hasNewLine)
|
||||
{
|
||||
hasNewLine = false;
|
||||
if (!String.IsNullOrEmpty(stringToComplete))
|
||||
if (!string.IsNullOrEmpty(stringToComplete))
|
||||
{
|
||||
var index = stringToComplete.IndexOfAny(Utils.Separators.CrLf);
|
||||
if (index >= 0)
|
||||
|
@ -1146,7 +1146,7 @@ namespace System.Management.Automation
|
|||
dynamicKeywordAst != keywordAst &&
|
||||
!String.Equals(dynamicKeywordAst.Keyword.Keyword, @"Node", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(dynamicKeywordAst.ElementName))
|
||||
if (!string.IsNullOrEmpty(dynamicKeywordAst.ElementName))
|
||||
{
|
||||
StringBuilder sb = new StringBuilder("[", 50);
|
||||
sb.Append(dynamicKeywordAst.Keyword.Keyword);
|
||||
|
|
|
@ -273,7 +273,7 @@ namespace System.Management.Automation
|
|||
// --> command 'Get-PowerShellFoo' in the global session state (prefixed commandInfo)
|
||||
// command 'Get-Foo' in the module session state (un-prefixed commandInfo)
|
||||
// in that case, we should not add the module name qualification because it doesn't work
|
||||
if (String.IsNullOrEmpty(commandInfo.Prefix) || !ModuleCmdletBase.IsPrefixedCommand(commandInfo))
|
||||
if (string.IsNullOrEmpty(commandInfo.Prefix) || !ModuleCmdletBase.IsPrefixedCommand(commandInfo))
|
||||
{
|
||||
name = commandInfo.ModuleName + "\\" + commandInfo.Name;
|
||||
}
|
||||
|
@ -323,9 +323,9 @@ namespace System.Management.Automation
|
|||
if (!includeModulePrefix)
|
||||
{
|
||||
var commandInfo = commandList[0] as CommandInfo;
|
||||
if (commandInfo != null && !String.IsNullOrEmpty(commandInfo.Prefix))
|
||||
if (commandInfo != null && !string.IsNullOrEmpty(commandInfo.Prefix))
|
||||
{
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(commandInfo.ModuleName), "the module name should exist if commandInfo.Prefix is not an empty string");
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(commandInfo.ModuleName), "the module name should exist if commandInfo.Prefix is not an empty string");
|
||||
if (!ModuleCmdletBase.IsPrefixedCommand(commandInfo))
|
||||
{
|
||||
completionName = commandInfo.ModuleName + "\\" + completionName;
|
||||
|
@ -364,9 +364,9 @@ namespace System.Management.Automation
|
|||
if (!includeModulePrefix)
|
||||
{
|
||||
var commandInfo = keyValuePair.Value as CommandInfo;
|
||||
if (commandInfo != null && !String.IsNullOrEmpty(commandInfo.Prefix))
|
||||
if (commandInfo != null && !string.IsNullOrEmpty(commandInfo.Prefix))
|
||||
{
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(commandInfo.ModuleName), "the module name should exist if commandInfo.Prefix is not an empty string");
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(commandInfo.ModuleName), "the module name should exist if commandInfo.Prefix is not an empty string");
|
||||
if (!ModuleCmdletBase.IsPrefixedCommand(commandInfo))
|
||||
{
|
||||
completionName = commandInfo.ModuleName + "\\" + completionName;
|
||||
|
@ -3648,7 +3648,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
if (paramName.Equals("ItemType", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(context.WordToComplete))
|
||||
if (!string.IsNullOrEmpty(context.WordToComplete))
|
||||
{
|
||||
WildcardPattern patternEvaluator = WildcardPattern.Get(context.WordToComplete + "*", WildcardOptions.IgnoreCase);
|
||||
|
||||
|
@ -4596,7 +4596,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(userPath))
|
||||
if (string.IsNullOrEmpty(userPath))
|
||||
{
|
||||
Diagnostics.Assert(false, "Found a variable source but it was an unknown AST type.");
|
||||
}
|
||||
|
@ -6099,7 +6099,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
case TokenKind.Switch:
|
||||
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(wordToComplete) && wordToComplete[0].IsDash(), "the word to complete should start with '-'");
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(wordToComplete) && wordToComplete[0].IsDash(), "the word to complete should start with '-'");
|
||||
wordToComplete = wordToComplete.Substring(1);
|
||||
bool withColon = wordToComplete.EndsWith(":", StringComparison.Ordinal);
|
||||
wordToComplete = withColon ? wordToComplete.Remove(wordToComplete.Length - 1) : wordToComplete;
|
||||
|
|
|
@ -168,12 +168,12 @@ namespace System.Management.Automation
|
|||
/// <param name="toolTip">The text for the tooltip with details to be displayed about the object.</param>
|
||||
public CompletionResult(string completionText, string listItemText, CompletionResultType resultType, string toolTip)
|
||||
{
|
||||
if (String.IsNullOrEmpty(completionText))
|
||||
if (string.IsNullOrEmpty(completionText))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("completionText");
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(listItemText))
|
||||
if (string.IsNullOrEmpty(listItemText))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("listItemText");
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ namespace System.Management.Automation
|
|||
throw PSTraceSource.NewArgumentOutOfRangeException("resultType", resultType);
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(toolTip))
|
||||
if (string.IsNullOrEmpty(toolTip))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentNullException("toolTip");
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
internal CmdletInfo AddCmdletInfoToCache(string name, CmdletInfo newCmdletInfo, bool isGlobal)
|
||||
{
|
||||
if (String.IsNullOrEmpty(name))
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("name");
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ namespace System.Management.Automation
|
|||
// If there were no PSSnapins required but there is a shellID required, then we need
|
||||
// to error
|
||||
|
||||
if (!String.IsNullOrEmpty(scriptInfo.RequiresApplicationID))
|
||||
if (!string.IsNullOrEmpty(scriptInfo.RequiresApplicationID))
|
||||
{
|
||||
ScriptRequiresException sre =
|
||||
new ScriptRequiresException(
|
||||
|
@ -771,7 +771,7 @@ namespace System.Management.Automation
|
|||
CommandOrigin commandOrigin,
|
||||
ExecutionContext context)
|
||||
{
|
||||
if (String.IsNullOrEmpty(commandName))
|
||||
if (string.IsNullOrEmpty(commandName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -1207,7 +1207,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(moduleName) || String.IsNullOrEmpty(moduleCommandName) || moduleName.EndsWith(".", StringComparison.Ordinal))
|
||||
if (string.IsNullOrEmpty(moduleName) || string.IsNullOrEmpty(moduleCommandName) || moduleName.EndsWith(".", StringComparison.Ordinal))
|
||||
return null;
|
||||
|
||||
bool etwEnabled = CommandDiscoveryEventSource.Log.IsEnabled();
|
||||
|
@ -1482,7 +1482,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
internal IEnumerator<CmdletInfo> GetCmdletInfo(string cmdletName, bool searchAllScopes)
|
||||
{
|
||||
Dbg.Assert(!String.IsNullOrEmpty(cmdletName), "Caller should verify the cmdletName");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(cmdletName), "Caller should verify the cmdletName");
|
||||
|
||||
PSSnapinQualifiedName commandName = PSSnapinQualifiedName.GetInstance(cmdletName);
|
||||
|
||||
|
@ -1507,7 +1507,7 @@ namespace System.Management.Automation
|
|||
|
||||
foreach (var cmdletInfo in cmdlets)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(commandName.PSSnapInName))
|
||||
if (!string.IsNullOrEmpty(commandName.PSSnapInName))
|
||||
{
|
||||
if (String.Equals(cmdletInfo.ModuleName, commandName.PSSnapInName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -1573,7 +1573,7 @@ namespace System.Management.Automation
|
|||
|
||||
// check the environment variable
|
||||
string psEnvironmentVariable = Environment.GetEnvironmentVariable(environmentVariable);
|
||||
if (!String.IsNullOrEmpty(psEnvironmentVariable))
|
||||
if (!string.IsNullOrEmpty(psEnvironmentVariable))
|
||||
{
|
||||
return LanguagePrimitives.ConvertTo<PSModuleAutoLoadingPreference>(psEnvironmentVariable);
|
||||
}
|
||||
|
@ -1693,7 +1693,7 @@ namespace System.Management.Automation
|
|||
for (int index = 0; index < this.Count; ++index)
|
||||
{
|
||||
string path = this[index];
|
||||
if (!String.IsNullOrEmpty(path) &&
|
||||
if (!string.IsNullOrEmpty(path) &&
|
||||
path.StartsWith(".", StringComparison.Ordinal))
|
||||
{
|
||||
result.Add(index);
|
||||
|
@ -1718,7 +1718,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
public new int IndexOf(string item)
|
||||
{
|
||||
if (String.IsNullOrEmpty(item))
|
||||
if (string.IsNullOrEmpty(item))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("item");
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
internal void Rename(string newName)
|
||||
{
|
||||
if (String.IsNullOrEmpty(newName))
|
||||
if (string.IsNullOrEmpty(newName))
|
||||
{
|
||||
throw new ArgumentNullException("newName");
|
||||
}
|
||||
|
|
|
@ -312,7 +312,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
internal static CommandMetadata Get(string commandName, Type cmdletType, ExecutionContext context)
|
||||
{
|
||||
if (String.IsNullOrEmpty(commandName))
|
||||
if (string.IsNullOrEmpty(commandName))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("commandName");
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
internal CommandMetadata(string commandName, Type cmdletType, ExecutionContext context)
|
||||
{
|
||||
if (String.IsNullOrEmpty(commandName))
|
||||
if (string.IsNullOrEmpty(commandName))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("commandName");
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace System.Management.Automation
|
|||
|
||||
// Note, if the directory resolves to multiple paths, only the first is used.
|
||||
|
||||
if (!String.IsNullOrEmpty(resolvedPath))
|
||||
if (!string.IsNullOrEmpty(resolvedPath))
|
||||
{
|
||||
CommandDiscovery.discoveryTracer.TraceError(
|
||||
"The relative path resolved to: {0}",
|
||||
|
|
|
@ -408,7 +408,7 @@ namespace System.Management.Automation
|
|||
private void HandleObsoleteCommand(ObsoleteAttribute obsoleteAttr)
|
||||
{
|
||||
string commandName =
|
||||
String.IsNullOrEmpty(CommandInfo.Name)
|
||||
string.IsNullOrEmpty(CommandInfo.Name)
|
||||
? "script block"
|
||||
: String.Format(System.Globalization.CultureInfo.InvariantCulture,
|
||||
CommandBaseStrings.ObsoleteCommand, CommandInfo.Name);
|
||||
|
|
|
@ -378,7 +378,7 @@ namespace System.Management.Automation
|
|||
CommandInfo currentMatch = null;
|
||||
string path = DoPowerShellRelativePathLookup();
|
||||
|
||||
if (!String.IsNullOrEmpty(path))
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
currentMatch = GetInfoFromPath(path);
|
||||
}
|
||||
|
@ -1178,7 +1178,7 @@ namespace System.Management.Automation
|
|||
internal Collection<string> ConstructSearchPatternsFromName(string name, bool commandDiscovery = false)
|
||||
{
|
||||
Dbg.Assert(
|
||||
!String.IsNullOrEmpty(name),
|
||||
!string.IsNullOrEmpty(name),
|
||||
"Caller should verify name");
|
||||
|
||||
Collection<string> result = new Collection<string>();
|
||||
|
@ -1188,7 +1188,7 @@ namespace System.Management.Automation
|
|||
|
||||
bool commandNameAddedFirst = false;
|
||||
|
||||
if (!String.IsNullOrEmpty(Path.GetExtension(name)))
|
||||
if (!string.IsNullOrEmpty(Path.GetExtension(name)))
|
||||
{
|
||||
result.Add(name);
|
||||
commandNameAddedFirst = true;
|
||||
|
@ -1240,7 +1240,7 @@ namespace System.Management.Automation
|
|||
private static bool IsQualifiedPSPath(string commandName)
|
||||
{
|
||||
Dbg.Assert(
|
||||
!String.IsNullOrEmpty(commandName),
|
||||
!string.IsNullOrEmpty(commandName),
|
||||
"The caller should have verified the commandName");
|
||||
|
||||
bool result =
|
||||
|
@ -1410,7 +1410,7 @@ namespace System.Management.Automation
|
|||
|
||||
string fileName = Path.GetFileName(_commandName);
|
||||
|
||||
if (!String.IsNullOrEmpty(fileName))
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
fileName = fileName.TrimEnd(Utils.Separators.PathSearchTrimEnd);
|
||||
_pathSearcher =
|
||||
|
@ -1449,7 +1449,7 @@ namespace System.Management.Automation
|
|||
|
||||
string fileName = Path.GetFileName(_commandName);
|
||||
|
||||
if (!String.IsNullOrEmpty(fileName))
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
fileName = fileName.TrimEnd(Utils.Separators.PathSearchTrimEnd);
|
||||
_pathSearcher =
|
||||
|
|
|
@ -4861,7 +4861,7 @@ namespace System.Management.Automation
|
|||
XmlNode node = (XmlNode)obj;
|
||||
string nodeNamespace = node.NamespaceURI;
|
||||
IEnumerable<string> baseTypeNames = GetDotNetTypeNameHierarchy(obj);
|
||||
if (String.IsNullOrEmpty(nodeNamespace))
|
||||
if (string.IsNullOrEmpty(nodeNamespace))
|
||||
{
|
||||
foreach (string baseType in baseTypeNames)
|
||||
{
|
||||
|
|
|
@ -323,7 +323,7 @@ namespace System.Management.Automation
|
|||
out string user,
|
||||
out string domain)
|
||||
{
|
||||
if (String.IsNullOrEmpty(input))
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
user = domain = null;
|
||||
return false;
|
||||
|
|
|
@ -506,7 +506,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
internal void SetName(string newName)
|
||||
{
|
||||
if (String.IsNullOrEmpty(newName))
|
||||
if (string.IsNullOrEmpty(newName))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("newName");
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace System.Management.Automation
|
|||
get
|
||||
{
|
||||
string result = this.Name;
|
||||
if (!String.IsNullOrEmpty(this.PSSnapInName))
|
||||
if (!string.IsNullOrEmpty(this.PSSnapInName))
|
||||
{
|
||||
result =
|
||||
String.Format(
|
||||
|
@ -374,7 +374,7 @@ namespace System.Management.Automation
|
|||
throw PSTraceSource.NewArgumentNullException("implementingType");
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(name))
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("name");
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ namespace System.Management.Automation
|
|||
// If the pssnapin name and provider name are specified, then both must match
|
||||
do // false loop
|
||||
{
|
||||
if (!String.IsNullOrEmpty(qualifiedProviderName.PSSnapInName))
|
||||
if (!string.IsNullOrEmpty(qualifiedProviderName.PSSnapInName))
|
||||
{
|
||||
// After converting core snapins to load as modules, the providers will have Module property populated
|
||||
if (!String.Equals(qualifiedProviderName.PSSnapInName, this.PSSnapInName, StringComparison.OrdinalIgnoreCase) &&
|
||||
|
@ -496,7 +496,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
bool result = false;
|
||||
|
||||
if (String.IsNullOrEmpty(psSnapinQualifiedName.PSSnapInName) ||
|
||||
if (string.IsNullOrEmpty(psSnapinQualifiedName.PSSnapInName) ||
|
||||
String.Equals(psSnapinQualifiedName.PSSnapInName, PSSnapInName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
result = true;
|
||||
|
|
|
@ -223,12 +223,12 @@ namespace System.Management.Automation
|
|||
{
|
||||
get
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_errorRecord._activityOverride))
|
||||
if (!string.IsNullOrEmpty(_errorRecord._activityOverride))
|
||||
return _errorRecord._activityOverride;
|
||||
|
||||
if (_errorRecord.InvocationInfo != null
|
||||
&& (_errorRecord.InvocationInfo.MyCommand is CmdletInfo || _errorRecord.InvocationInfo.MyCommand is IScriptCommandInfo)
|
||||
&& !String.IsNullOrEmpty(_errorRecord.InvocationInfo.MyCommand.Name)
|
||||
&& !string.IsNullOrEmpty(_errorRecord.InvocationInfo.MyCommand.Name)
|
||||
)
|
||||
{
|
||||
return _errorRecord.InvocationInfo.MyCommand.Name;
|
||||
|
@ -257,7 +257,7 @@ namespace System.Management.Automation
|
|||
get
|
||||
{
|
||||
_reasonIsExceptionType = false;
|
||||
if (!String.IsNullOrEmpty(_errorRecord._reasonOverride))
|
||||
if (!string.IsNullOrEmpty(_errorRecord._reasonOverride))
|
||||
return _errorRecord._reasonOverride;
|
||||
if (_errorRecord.Exception != null)
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
get
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_errorRecord._targetNameOverride))
|
||||
if (!string.IsNullOrEmpty(_errorRecord._targetNameOverride))
|
||||
return _errorRecord._targetNameOverride;
|
||||
if (_errorRecord.TargetObject != null)
|
||||
{
|
||||
|
@ -330,7 +330,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
get
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_errorRecord._targetTypeOverride))
|
||||
if (!string.IsNullOrEmpty(_errorRecord._targetTypeOverride))
|
||||
return _errorRecord._targetTypeOverride;
|
||||
if (_errorRecord.TargetObject != null)
|
||||
{
|
||||
|
@ -404,7 +404,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
// get template text
|
||||
string errorCategoryString = Category.ToString();
|
||||
if (String.IsNullOrEmpty(errorCategoryString))
|
||||
if (string.IsNullOrEmpty(errorCategoryString))
|
||||
{
|
||||
// this probably indicates an invalid ErrorCategory value
|
||||
errorCategoryString = ErrorCategory.NotSpecified.ToString();
|
||||
|
@ -412,13 +412,13 @@ namespace System.Management.Automation
|
|||
|
||||
string templateText = ErrorCategoryStrings.ResourceManager.GetString(errorCategoryString, uiCultureInfo);
|
||||
|
||||
if (String.IsNullOrEmpty(templateText))
|
||||
if (string.IsNullOrEmpty(templateText))
|
||||
{
|
||||
// this probably indicates an invalid ErrorCategory value
|
||||
templateText = ErrorCategoryStrings.NotSpecified;
|
||||
}
|
||||
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(templateText),
|
||||
Diagnostics.Assert(!string.IsNullOrEmpty(templateText),
|
||||
"ErrorCategoryStrings.resx resource failure");
|
||||
|
||||
string activityInUse = Ellipsize(uiCultureInfo, Activity);
|
||||
|
@ -802,10 +802,10 @@ namespace System.Management.Automation
|
|||
if (cmdlet == null)
|
||||
throw PSTraceSource.NewArgumentNullException("cmdlet");
|
||||
|
||||
if (String.IsNullOrEmpty(baseName))
|
||||
if (string.IsNullOrEmpty(baseName))
|
||||
throw PSTraceSource.NewArgumentNullException("baseName");
|
||||
|
||||
if (String.IsNullOrEmpty(resourceId))
|
||||
if (string.IsNullOrEmpty(resourceId))
|
||||
throw PSTraceSource.NewArgumentNullException("resourceId");
|
||||
|
||||
string template = string.Empty;
|
||||
|
@ -837,10 +837,10 @@ namespace System.Management.Automation
|
|||
if (resourceSupplier == null)
|
||||
throw PSTraceSource.NewArgumentNullException("resourceSupplier");
|
||||
|
||||
if (String.IsNullOrEmpty(baseName))
|
||||
if (string.IsNullOrEmpty(baseName))
|
||||
throw PSTraceSource.NewArgumentNullException("baseName");
|
||||
|
||||
if (String.IsNullOrEmpty(resourceId))
|
||||
if (string.IsNullOrEmpty(resourceId))
|
||||
throw PSTraceSource.NewArgumentNullException("resourceId");
|
||||
|
||||
string template = string.Empty;
|
||||
|
@ -872,10 +872,10 @@ namespace System.Management.Automation
|
|||
if (assembly == null)
|
||||
throw PSTraceSource.NewArgumentNullException("assembly");
|
||||
|
||||
if (String.IsNullOrEmpty(baseName))
|
||||
if (string.IsNullOrEmpty(baseName))
|
||||
throw PSTraceSource.NewArgumentNullException("baseName");
|
||||
|
||||
if (String.IsNullOrEmpty(resourceId))
|
||||
if (string.IsNullOrEmpty(resourceId))
|
||||
throw PSTraceSource.NewArgumentNullException("resourceId");
|
||||
|
||||
string template = string.Empty;
|
||||
|
@ -1491,8 +1491,8 @@ namespace System.Management.Automation
|
|||
|
||||
string typeName = GetInvocationTypeName();
|
||||
string delimiter =
|
||||
(String.IsNullOrEmpty(typeName)
|
||||
|| String.IsNullOrEmpty(_errorId))
|
||||
(string.IsNullOrEmpty(typeName)
|
||||
|| string.IsNullOrEmpty(_errorId))
|
||||
? string.Empty : ",";
|
||||
return NotNull(_errorId) + delimiter + NotNull(typeName);
|
||||
}
|
||||
|
@ -1693,14 +1693,14 @@ namespace System.Management.Automation
|
|||
public override string ToString()
|
||||
{
|
||||
if (ErrorDetails != null
|
||||
&& !String.IsNullOrEmpty(ErrorDetails.Message))
|
||||
&& !string.IsNullOrEmpty(ErrorDetails.Message))
|
||||
{
|
||||
return ErrorDetails.Message;
|
||||
}
|
||||
|
||||
if (Exception != null)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Exception.Message))
|
||||
if (!string.IsNullOrEmpty(Exception.Message))
|
||||
{
|
||||
return Exception.Message;
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
// Use the ShellID from PSAuthorizationManager before everything else because that's what's used
|
||||
// to check execution policy...
|
||||
if (AuthorizationManager is PSAuthorizationManager && !String.IsNullOrEmpty(AuthorizationManager.ShellId))
|
||||
if (AuthorizationManager is PSAuthorizationManager && !string.IsNullOrEmpty(AuthorizationManager.ShellId))
|
||||
{
|
||||
_shellId = AuthorizationManager.ShellId;
|
||||
}
|
||||
|
@ -1347,7 +1347,7 @@ namespace System.Management.Automation
|
|||
// First we try to load the assembly based on the filename
|
||||
Assembly loadedAssembly = null;
|
||||
error = null;
|
||||
if (!String.IsNullOrEmpty(filename))
|
||||
if (!string.IsNullOrEmpty(filename))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1376,7 +1376,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
// Then we try to load the assembly based on the given name
|
||||
if (!String.IsNullOrEmpty(name))
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
string fixedName = null;
|
||||
// Remove the '.dll' if it's there...
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace System.Management.Automation
|
|||
internal ExternalScriptInfo(string name, string path, ExecutionContext context)
|
||||
: base(name, CommandTypes.ExternalScript, context)
|
||||
{
|
||||
if (String.IsNullOrEmpty(path))
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("path");
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
internal ExternalScriptInfo(string name, string path) : base(name, CommandTypes.ExternalScript)
|
||||
{
|
||||
if (String.IsNullOrEmpty(path))
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw PSTraceSource.NewArgumentException("path");
|
||||
}
|
||||
|
|
|
@ -510,7 +510,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// otherwise just return the object...
|
||||
if (Syntax)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(result.Syntax))
|
||||
if (!string.IsNullOrEmpty(result.Syntax))
|
||||
{
|
||||
PSObject syntax = PSObject.AsPSObject(result.Syntax);
|
||||
|
||||
|
@ -732,10 +732,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
// If the command name had no wildcards or was module-qualified,
|
||||
// import the module so that we can return the fully structured data.
|
||||
// This uses the same code path as module auto-loading.
|
||||
if ((!isPattern) || (!String.IsNullOrEmpty(moduleName)))
|
||||
if ((!isPattern) || (!string.IsNullOrEmpty(moduleName)))
|
||||
{
|
||||
string tempCommandName = commandName;
|
||||
if ((!isModuleQualified) && (!String.IsNullOrEmpty(moduleName)))
|
||||
if ((!isModuleQualified) && (!string.IsNullOrEmpty(moduleName)))
|
||||
{
|
||||
tempCommandName = moduleName + "\\" + commandName;
|
||||
}
|
||||
|
|
|
@ -2491,7 +2491,7 @@ namespace System.Management.Automation.Runspaces
|
|||
}
|
||||
|
||||
// Start transcribing
|
||||
if (!String.IsNullOrEmpty(TranscriptDirectory))
|
||||
if (!string.IsNullOrEmpty(TranscriptDirectory))
|
||||
{
|
||||
using (PowerShell psToInvoke = PowerShell.Create())
|
||||
{
|
||||
|
@ -2681,7 +2681,7 @@ namespace System.Management.Automation.Runspaces
|
|||
string name = variable["Name"].ToString();
|
||||
ScriptBlock sb = variable["Value"] as ScriptBlock;
|
||||
|
||||
if (!String.IsNullOrEmpty(name) && (sb != null))
|
||||
if (!string.IsNullOrEmpty(name) && (sb != null))
|
||||
{
|
||||
sb.SessionStateInternal = initializedRunspace.ExecutionContext.EngineSessionState;
|
||||
|
||||
|
@ -3505,7 +3505,7 @@ namespace System.Management.Automation.Runspaces
|
|||
if (filesProcessed.TryAdd(sste.FileName, null))
|
||||
{
|
||||
string moduleName = string.Empty;
|
||||
if (sste.PSSnapIn != null && !String.IsNullOrEmpty(sste.PSSnapIn.Name))
|
||||
if (sste.PSSnapIn != null && !string.IsNullOrEmpty(sste.PSSnapIn.Name))
|
||||
{
|
||||
moduleName = sste.PSSnapIn.Name;
|
||||
}
|
||||
|
|
|
@ -492,7 +492,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
resolvedPropertyName = member.Name;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(resolvedPropertyName))
|
||||
if (!string.IsNullOrEmpty(resolvedPropertyName))
|
||||
{
|
||||
// should process
|
||||
string propertyAction = String.Format(CultureInfo.InvariantCulture,
|
||||
|
@ -683,7 +683,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
objInString = null;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(objInString))
|
||||
if (string.IsNullOrEmpty(objInString))
|
||||
{
|
||||
var psobj = obj as PSObject;
|
||||
objInString = psobj != null ? psobj.BaseObject.GetType().FullName : obj.GetType().FullName;
|
||||
|
@ -821,7 +821,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
message = StringUtil.Format(resourceString, args);
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(message))
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
Dbg.Assert(false, "Could not load text for error record '" + errorId + "'");
|
||||
}
|
||||
|
@ -1797,7 +1797,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
resolvedPropertyName = members[0].Name;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(resolvedPropertyName))
|
||||
if (!string.IsNullOrEmpty(resolvedPropertyName))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -285,7 +285,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
get
|
||||
{
|
||||
if (!String.IsNullOrEmpty(ScriptPosition.File))
|
||||
if (!string.IsNullOrEmpty(ScriptPosition.File))
|
||||
{
|
||||
return Path.GetDirectoryName(ScriptPosition.File);
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ namespace System.Management.Automation
|
|||
private int AddParameterSetToMap(string parameterSetName)
|
||||
{
|
||||
int index = -1;
|
||||
if (!String.IsNullOrEmpty(parameterSetName))
|
||||
if (!string.IsNullOrEmpty(parameterSetName))
|
||||
{
|
||||
index = _parameterSetMap.IndexOf(parameterSetName);
|
||||
|
||||
|
@ -275,7 +275,7 @@ namespace System.Management.Automation
|
|||
|
||||
uint defaultParameterSetFlag = 0;
|
||||
|
||||
if (!String.IsNullOrEmpty(defaultParameterSetName))
|
||||
if (!string.IsNullOrEmpty(defaultParameterSetName))
|
||||
{
|
||||
_defaultParameterSetName = defaultParameterSetName;
|
||||
|
||||
|
@ -345,7 +345,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
string result = _defaultParameterSetName;
|
||||
|
||||
if (String.IsNullOrEmpty(result))
|
||||
if (string.IsNullOrEmpty(result))
|
||||
{
|
||||
result = ParameterAttribute.AllParameterSets;
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ namespace System.Management.Automation
|
|||
CompiledCommandParameter compiledParam = mergedParam.Parameter;
|
||||
if (compiledParam != null)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(compiledParam.Name))
|
||||
if (!string.IsNullOrEmpty(compiledParam.Name))
|
||||
return compiledParam.Name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -516,7 +516,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!String.IsNullOrEmpty(PSEdition))
|
||||
if (!string.IsNullOrEmpty(PSEdition))
|
||||
{
|
||||
modules = modules.Where(module => module.CompatiblePSEditions.Contains(PSEdition, StringComparer.OrdinalIgnoreCase));
|
||||
}
|
||||
|
|
|
@ -600,7 +600,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
|
||||
bool alreadyLoaded = false;
|
||||
if (!String.IsNullOrEmpty(rootedPath))
|
||||
if (!string.IsNullOrEmpty(rootedPath))
|
||||
{
|
||||
// TODO/FIXME: use IsModuleAlreadyLoaded to get consistent behavior
|
||||
// TODO/FIXME: (for example checking ModuleType != Manifest below seems incorrect - cdxml modules also declare their own version)
|
||||
|
|
|
@ -295,7 +295,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string extension = Path.GetExtension(name);
|
||||
string fileBaseName;
|
||||
module = null;
|
||||
if (String.IsNullOrEmpty(extension) || !ModuleIntrinsics.IsPowerShellModuleExtension(extension))
|
||||
if (string.IsNullOrEmpty(extension) || !ModuleIntrinsics.IsPowerShellModuleExtension(extension))
|
||||
{
|
||||
fileBaseName = name;
|
||||
extension = null;
|
||||
|
@ -638,7 +638,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string extension = Path.GetExtension(moduleSpecification.Name);
|
||||
// First check for fully-qualified paths - either absolute or relative
|
||||
string rootedPath = ResolveRootedFilePath(moduleSpecification.Name, this.Context);
|
||||
if (String.IsNullOrEmpty(rootedPath))
|
||||
if (string.IsNullOrEmpty(rootedPath))
|
||||
{
|
||||
rootedPath = FixupFileName(moduleBase, moduleSpecification.Name, extension);
|
||||
}
|
||||
|
@ -4284,7 +4284,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
CultureInfo culture = System.Globalization.CultureInfo.CurrentUICulture;
|
||||
CultureInfo currentCulture = culture;
|
||||
while (currentCulture != null && !String.IsNullOrEmpty(currentCulture.Name))
|
||||
while (currentCulture != null && !string.IsNullOrEmpty(currentCulture.Name))
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(dir);
|
||||
stringBuilder.Append("\\");
|
||||
|
@ -6525,7 +6525,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
PSModuleInfo module = null;
|
||||
|
||||
if (String.IsNullOrEmpty(moduleName) && String.IsNullOrEmpty(fileName) && assemblyToLoad == null)
|
||||
if (string.IsNullOrEmpty(moduleName) && string.IsNullOrEmpty(fileName) && assemblyToLoad == null)
|
||||
throw PSTraceSource.NewArgumentNullException("moduleName,fileName,assemblyToLoad");
|
||||
|
||||
// Load the dll and process any cmdlets it might contain...
|
||||
|
@ -7019,7 +7019,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
internal static bool IsPrefixedCommand(CommandInfo commandInfo)
|
||||
{
|
||||
Dbg.Assert(commandInfo != null, "Caller should verify that commandInfo is not null");
|
||||
Dbg.Assert(!String.IsNullOrEmpty(commandInfo.Prefix), "Caller should verify that the commandInfo has prefix");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(commandInfo.Prefix), "Caller should verify that the commandInfo has prefix");
|
||||
|
||||
string verb, noun;
|
||||
bool isPrefixed = CmdletInfo.SplitCmdletName(commandInfo.Name, out verb, out noun)
|
||||
|
|
|
@ -863,7 +863,7 @@ namespace System.Management.Automation
|
|||
foreach (Hashtable feature in features)
|
||||
{
|
||||
string featureName = feature["Name"] as string;
|
||||
if (String.IsNullOrEmpty(featureName)) { continue; }
|
||||
if (string.IsNullOrEmpty(featureName)) { continue; }
|
||||
|
||||
if (ExperimentalFeature.IsModuleFeatureName(featureName, moduleName))
|
||||
{
|
||||
|
@ -1025,7 +1025,7 @@ namespace System.Management.Automation
|
|||
/// <returns>The path of the Windows PowerShell system module directory.</returns>
|
||||
internal static string GetWindowsPowerShellPSHomeModulePath()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(InternalTestHooks.TestWindowsPowerShellPSHomeLocation))
|
||||
if (!string.IsNullOrEmpty(InternalTestHooks.TestWindowsPowerShellPSHomeLocation))
|
||||
{
|
||||
return InternalTestHooks.TestWindowsPowerShellPSHomeLocation;
|
||||
}
|
||||
|
|
|
@ -374,7 +374,7 @@ namespace System.Management.Automation.Internal
|
|||
#if UNIX
|
||||
return false;
|
||||
#else
|
||||
Dbg.Assert(!String.IsNullOrEmpty(path), $"Caller to verify that {nameof(path)} is not null or empty");
|
||||
Dbg.Assert(!string.IsNullOrEmpty(path), $"Caller to verify that {nameof(path)} is not null or empty");
|
||||
|
||||
string windowsPowerShellPSHomePath = ModuleIntrinsics.GetWindowsPowerShellPSHomeModulePath();
|
||||
return path.StartsWith(windowsPowerShellPSHomePath, StringComparison.OrdinalIgnoreCase);
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (_scriptBlock != null)
|
||||
{
|
||||
string gs = System.Guid.NewGuid().ToString();
|
||||
if (String.IsNullOrEmpty(_name))
|
||||
if (string.IsNullOrEmpty(_name))
|
||||
{
|
||||
_name = PSModuleInfo.DynamicModulePrefixString + gs;
|
||||
}
|
||||
|
|
|
@ -557,7 +557,7 @@ namespace System.Management.Automation
|
|||
if (current.CommandType == CommandTypes.Application)
|
||||
{
|
||||
string cmdExtension = System.IO.Path.GetExtension(current.Name);
|
||||
if (!String.IsNullOrEmpty(cmdExtension))
|
||||
if (!string.IsNullOrEmpty(cmdExtension))
|
||||
{
|
||||
// Only add the application in PATHEXT...
|
||||
foreach (string extension in CommandDiscovery.PathExtensions)
|
||||
|
|
|
@ -907,7 +907,7 @@ namespace System.Management.Automation
|
|||
|
||||
internal void SetupOutVariable()
|
||||
{
|
||||
if (String.IsNullOrEmpty(this.OutVariable))
|
||||
if (string.IsNullOrEmpty(this.OutVariable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -917,7 +917,7 @@ namespace System.Management.Automation
|
|||
// Handle the creation of OutVariable in the case of Out-Default specially,
|
||||
// as it needs to handle much of its OutVariable support itself.
|
||||
if (
|
||||
(!String.IsNullOrEmpty(this.OutVariable)) &&
|
||||
(!string.IsNullOrEmpty(this.OutVariable)) &&
|
||||
(!(this.OutVariable.StartsWith("+", StringComparison.Ordinal))) &&
|
||||
String.Equals("Out-Default", _thisCommand.CommandInfo.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -947,7 +947,7 @@ namespace System.Management.Automation
|
|||
// This can't use the common SetupVariable implementation, as this needs to persist for an entire
|
||||
// pipeline.
|
||||
|
||||
if (String.IsNullOrEmpty(this.PipelineVariable))
|
||||
if (string.IsNullOrEmpty(this.PipelineVariable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1524,7 +1524,7 @@ namespace System.Management.Automation
|
|||
return true;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(verboseWarning))
|
||||
if (string.IsNullOrEmpty(verboseWarning))
|
||||
verboseWarning = StringUtil.Format(CommandBaseStrings.ShouldProcessWarningFallback,
|
||||
verboseDescription);
|
||||
|
||||
|
@ -2048,7 +2048,7 @@ namespace System.Management.Automation
|
|||
|
||||
// This code forces the stack trace and source fields to be populated
|
||||
if (errorRecord.Exception != null
|
||||
&& String.IsNullOrEmpty(errorRecord.Exception.StackTrace))
|
||||
&& string.IsNullOrEmpty(errorRecord.Exception.StackTrace))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -2494,7 +2494,7 @@ namespace System.Management.Automation
|
|||
|
||||
internal void SetupVariable(VariableStreamKind streamKind, string variableName, ref IList varList)
|
||||
{
|
||||
if (String.IsNullOrEmpty(variableName))
|
||||
if (string.IsNullOrEmpty(variableName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -3550,12 +3550,12 @@ namespace System.Management.Automation
|
|||
pauseOption = currentOption++;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(inquireMessage))
|
||||
if (string.IsNullOrEmpty(inquireMessage))
|
||||
{
|
||||
inquireMessage = CommandBaseStrings.ShouldContinuePromptCaption;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(inquireCaption))
|
||||
if (string.IsNullOrEmpty(inquireCaption))
|
||||
{
|
||||
inquireCaption = CommandBaseStrings.InquireCaptionDefault;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue