Fix SA1119 part 1 (#14204)

This commit is contained in:
xtqqczze 2021-01-09 07:41:51 +00:00 committed by GitHub
parent e6492f9169
commit bb55515717
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 14 deletions

View file

@ -83,7 +83,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
GetComputerName(cmdlet));
string nameSpace;
List<CimSessionProxy> proxys = new();
bool isGetCimInstanceCommand = (cmdlet is GetCimInstanceCommand);
bool isGetCimInstanceCommand = cmdlet is GetCimInstanceCommand;
CimInstance targetCimInstance = null;
switch (cmdlet.ParameterSetName)
{

View file

@ -604,7 +604,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
if (pattern.IsMatch(kvp.Key))
{
HashSet<CimSessionWrapper> wrappers = kvp.Value;
foundSession = (wrappers.Count > 0);
foundSession = wrappers.Count > 0;
foreach (CimSessionWrapper wrapper in wrappers)
{
if (!sessionIds.Contains(wrapper.SessionId))
@ -644,7 +644,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
if (this.curCimSessionsByComputerName.ContainsKey(computername))
{
HashSet<CimSessionWrapper> wrappers = this.curCimSessionsByComputerName[computername];
foundSession = (wrappers.Count > 0);
foundSession = wrappers.Count > 0;
foreach (CimSessionWrapper wrapper in wrappers)
{
if (!sessionIds.Contains(wrapper.SessionId))

View file

@ -344,7 +344,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
public CimSessionProxy(string computerName)
{
CreateSetSession(computerName, null, null, null, false);
this.isDefaultSession = (computerName == ConstValue.NullComputerName);
this.isDefaultSession = computerName == ConstValue.NullComputerName;
}
/// <summary>
@ -360,7 +360,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
public CimSessionProxy(string computerName, CimSessionOptions sessionOptions)
{
CreateSetSession(computerName, null, sessionOptions, null, false);
this.isDefaultSession = (computerName == ConstValue.NullComputerName);
this.isDefaultSession = computerName == ConstValue.NullComputerName;
}
/// <summary>
@ -403,7 +403,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
string cimsessionComputerName = cimInstance.GetCimSessionComputerName();
CreateSetSession(cimsessionComputerName, null, null, null, false);
this.isDefaultSession = (cimsessionComputerName == ConstValue.NullComputerName);
this.isDefaultSession = cimsessionComputerName == ConstValue.NullComputerName;
DebugHelper.WriteLogEx("Create a temp session with computerName = {0}.", 0, cimsessionComputerName);
}
@ -421,7 +421,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
public CimSessionProxy(string computerName, CimSessionOptions sessionOptions, CimOperationOptions operOptions)
{
CreateSetSession(computerName, null, sessionOptions, operOptions, false);
this.isDefaultSession = (computerName == ConstValue.NullComputerName);
this.isDefaultSession = computerName == ConstValue.NullComputerName;
}
/// <summary>
@ -436,7 +436,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
public CimSessionProxy(string computerName, CimOperationOptions operOptions)
{
CreateSetSession(computerName, null, null, operOptions, false);
this.isDefaultSession = (computerName == ConstValue.NullComputerName);
this.isDefaultSession = computerName == ConstValue.NullComputerName;
}
/// <summary>

View file

@ -208,7 +208,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// </summary>
private CimGetCimClass GetOperationAgent()
{
return (this.AsyncOperation as CimGetCimClass);
return this.AsyncOperation as CimGetCimClass;
}
/// <summary>

View file

@ -474,7 +474,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// </summary>
private CimGetInstance GetOperationAgent()
{
return (this.AsyncOperation as CimGetInstance);
return this.AsyncOperation as CimGetInstance;
}
/// <summary>

View file

@ -371,7 +371,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// </summary>
private CimNewCimInstance GetOperationAgent()
{
return (this.AsyncOperation as CimNewCimInstance);
return this.AsyncOperation as CimNewCimInstance;
}
/// <summary>

View file

@ -225,7 +225,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
outputCredential = null;
if (options != null)
{
DComSessionOptions dcomOptions = (options as DComSessionOptions);
DComSessionOptions dcomOptions = options as DComSessionOptions;
if (dcomOptions != null)
{
bool conflict = false;

View file

@ -273,7 +273,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// </summary>
private CimRemoveCimInstance GetOperationAgent()
{
return (this.AsyncOperation as CimRemoveCimInstance);
return this.AsyncOperation as CimRemoveCimInstance;
}
/// <summary>

View file

@ -319,7 +319,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// </summary>
private CimSetCimInstance GetOperationAgent()
{
return (this.AsyncOperation as CimSetCimInstance);
return this.AsyncOperation as CimSetCimInstance;
}
/// <summary>