CodeFactor cleanup (#12251)
* Code cleanup Signed-off-by: Reece Dunham <me@rdil.rocks> * whoops * Update src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs Co-Authored-By: Travis Plunk <travis.plunk@microsoft.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
parent
a29cffd49d
commit
8b3937ecfe
|
@ -13,7 +13,7 @@ RUN apt-get update \
|
|||
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
|
||||
#
|
||||
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
|
||||
&& apt-get -y install git procps lsb-release \
|
||||
&& apt-get -y install --no-install-recommends git procps lsb-release \
|
||||
#
|
||||
# Clean up
|
||||
&& apt-get autoremove -y \
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// The constructor.
|
||||
/// </summary>
|
||||
public CimAsyncOperation()
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="cmdletOperation">
|
||||
/// wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details.
|
||||
/// Wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details.
|
||||
/// </param>
|
||||
public void ProcessActions(CmdletOperationBase cmdletOperation)
|
||||
{
|
||||
|
@ -146,12 +146,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// process remaining actions until all operations are completed or
|
||||
/// Process remaining actions until all operations are completed or
|
||||
/// current cmdlet is terminated by user.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="cmdletOperation">
|
||||
/// wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details.
|
||||
/// Wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details.
|
||||
/// </param>
|
||||
public void ProcessRemainActions(CmdletOperationBase cmdletOperation)
|
||||
{
|
||||
|
@ -202,7 +202,6 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// Add temporary <seealso cref="CimSessionProxy"/> object to cache.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="computerName">Computer name of the cimsession.</param>
|
||||
/// <param name="sessionproxy">Cimsession wrapper object.</param>
|
||||
protected void AddCimSessionProxy(CimSessionProxy sessionproxy)
|
||||
{
|
||||
|
@ -382,7 +381,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="referenceType">Output the cimtype of the value, either Reference or ReferenceArray.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The object.</returns>
|
||||
protected object GetReferenceOrReferenceArrayObject(object value, ref CimType referenceType)
|
||||
{
|
||||
PSReference cimReference = value as PSReference;
|
||||
|
@ -496,7 +495,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Clean up managed resources
|
||||
/// Clean up managed resources.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
private void Cleanup()
|
||||
|
@ -585,7 +584,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
#region protected members
|
||||
/// <summary>
|
||||
/// Event to notify ps thread that either a ACK message sent back
|
||||
/// or a error happened. Currently only used by class
|
||||
/// or a error happened. Currently only used by
|
||||
/// <see cref="CimRegisterCimIndication"/>.
|
||||
/// </summary>
|
||||
protected ManualResetEventSlim ackedEvent;
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
internal class CimSyncAction : CimBaseAction, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// The constructor.
|
||||
/// </summary>
|
||||
public CimSyncAction()
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Set response result
|
||||
/// Set the response result.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal CimResponseType ResponseType
|
||||
|
@ -102,7 +102,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <summary>
|
||||
/// <para>
|
||||
/// Call this method when the action is completed or
|
||||
/// the operation is terminated
|
||||
/// the operation is terminated.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal virtual void OnComplete()
|
||||
|
@ -112,7 +112,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// block current thread.
|
||||
/// Block current thread.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
protected virtual void Block()
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// constructor
|
||||
/// The constructor.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public CimCmdletsAssemblyInitializer()
|
||||
|
@ -56,18 +56,18 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// CimCmdlet alias entry
|
||||
/// CimCmdlet alias entry.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal sealed class CimCmdletAliasEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Constructor
|
||||
/// The constructor.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="name">The entry name.</param>
|
||||
/// <param name="value">The entry value.</param>
|
||||
internal CimCmdletAliasEntry(string name, string value)
|
||||
{
|
||||
this._name = name;
|
||||
|
|
|
@ -221,10 +221,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// session counter bound to current runspace.
|
||||
/// Session counter bound to current runspace.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
private UInt32 sessionNameCounter;
|
||||
private uint sessionNameCounter;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -252,7 +252,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// Dictionary used to holds all CimSessions in current runspace by session id.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
private Dictionary<UInt32, CimSessionWrapper> curCimSessionsById;
|
||||
private Dictionary<uint, CimSessionWrapper> curCimSessionsById;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -265,7 +265,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// constructor
|
||||
/// The constructor.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal CimSessionState()
|
||||
|
@ -297,7 +297,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </para>
|
||||
/// </summary>
|
||||
/// <returns>Unique session id under current runspace.</returns>
|
||||
internal UInt32 GenerateSessionId()
|
||||
internal uint GenerateSessionId()
|
||||
{
|
||||
return this.sessionNameCounter++;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Indicates whether this object was disposed or not
|
||||
/// Indicates whether this object was disposed or not.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
private bool _disposed;
|
||||
|
@ -381,17 +381,19 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Add new CimSession object to cache
|
||||
/// Add new CimSession object to cache.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="session"></param>
|
||||
/// <param name="sessionId"></param>
|
||||
/// <param name="instanceId"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="computerName"></param>
|
||||
/// <param name="protocol"></param>
|
||||
/// <returns></returns>
|
||||
internal PSObject AddObjectToCache(
|
||||
CimSession session,
|
||||
UInt32 sessionId,
|
||||
uint sessionId,
|
||||
Guid instanceId,
|
||||
string name,
|
||||
string computerName,
|
||||
|
@ -434,11 +436,11 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
string message = string.Empty;
|
||||
if (psObject.BaseObject is CimSession)
|
||||
{
|
||||
UInt32 id = 0x0;
|
||||
uint id = 0x0;
|
||||
Guid instanceId = Guid.Empty;
|
||||
string name = string.Empty;
|
||||
string computerName = string.Empty;
|
||||
if (psObject.Properties[idPropName].Value is UInt32)
|
||||
if (psObject.Properties[idPropName].Value is uint)
|
||||
{
|
||||
id = Convert.ToUInt32(psObject.Properties[idPropName].Value, null);
|
||||
}
|
||||
|
@ -466,7 +468,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Remove given <see cref="PSObject"/> object from cache
|
||||
/// Remove given <see cref="PSObject"/> object from cache.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="psObject"></param>
|
||||
|
@ -482,7 +484,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Remove given <see cref="CimSession"/> object from cache
|
||||
/// Remove given <see cref="CimSession"/> object from cache.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="session"></param>
|
||||
|
@ -562,7 +564,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns>List of session wrapper objects.</returns>
|
||||
internal IEnumerable<PSObject> QuerySession(IEnumerable<UInt32> ids,
|
||||
internal IEnumerable<PSObject> QuerySession(
|
||||
IEnumerable<uint> ids,
|
||||
out IEnumerable<ErrorRecord> errorRecords)
|
||||
{
|
||||
HashSet<PSObject> sessions = new HashSet<PSObject>();
|
||||
|
@ -570,7 +573,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
List<ErrorRecord> errRecords = new List<ErrorRecord>();
|
||||
errorRecords = errRecords;
|
||||
// NOTES: use template function to implement this will save duplicate code
|
||||
foreach (UInt32 id in ids)
|
||||
foreach (uint id in ids)
|
||||
{
|
||||
if (this.curCimSessionsById.ContainsKey(id))
|
||||
{
|
||||
|
@ -594,7 +597,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
/// <param name="instanceIds"></param>
|
||||
/// <returns>List of session wrapper objects.</returns>
|
||||
internal IEnumerable<PSObject> QuerySession(IEnumerable<Guid> instanceIds,
|
||||
internal IEnumerable<PSObject> QuerySession(
|
||||
IEnumerable<Guid> instanceIds,
|
||||
out IEnumerable<ErrorRecord> errorRecords)
|
||||
{
|
||||
HashSet<PSObject> sessions = new HashSet<PSObject>();
|
||||
|
@ -781,7 +785,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
#region constructor
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// The constructor.
|
||||
/// </summary>
|
||||
public CimSessionBase()
|
||||
{
|
||||
|
@ -814,7 +818,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Default runspace id
|
||||
/// Default runspace Id.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal static Guid defaultRunspaceId = Guid.Empty;
|
||||
|
@ -855,7 +859,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// clean up the dictionaries if the runspace is closed or broken.
|
||||
/// Clean up the dictionaries if the runspace is closed or broken.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="sender">Runspace.</param>
|
||||
|
@ -905,7 +909,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Constructor
|
||||
/// The constructor.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="theProxy"></param>
|
||||
|
@ -920,7 +924,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>namespace</para>
|
||||
/// <para>Namespace</para>
|
||||
/// </summary>
|
||||
internal CimSessionWrapper CimSessionWrapper
|
||||
{
|
||||
|
@ -935,7 +939,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// constructor
|
||||
/// The constructor.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal CimNewSession() : base()
|
||||
|
@ -988,7 +992,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Add session to global cache
|
||||
/// Add session to global cache,
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="cimSession"></param>
|
||||
|
@ -999,7 +1003,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
DebugHelper.WriteLogEx();
|
||||
|
||||
CimTestCimSessionContext testCimSessionContext = context as CimTestCimSessionContext;
|
||||
UInt32 sessionId = this.sessionState.GenerateSessionId();
|
||||
uint sessionId = this.sessionState.GenerateSessionId();
|
||||
string originalSessionName = testCimSessionContext.CimSessionWrapper.Name;
|
||||
string sessionName = (originalSessionName != null) ? originalSessionName : string.Format(CultureInfo.CurrentUICulture, @"{0}{1}", CimSessionState.CimSessionClassName, sessionId);
|
||||
|
||||
|
@ -1017,11 +1021,11 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// process all actions in the action queue
|
||||
/// Process all actions in the action queue.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="cmdletOperation">
|
||||
/// wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details
|
||||
/// Wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details.
|
||||
/// </param>
|
||||
public void ProcessActions(CmdletOperationBase cmdletOperation)
|
||||
{
|
||||
|
@ -1030,12 +1034,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// process remaining actions until all operations are completed or
|
||||
/// current cmdlet is terminated by user
|
||||
/// Process remaining actions until all operations are completed or
|
||||
/// current cmdlet is terminated by user.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="cmdletOperation">
|
||||
/// wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details
|
||||
/// Wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details.
|
||||
/// </param>
|
||||
public void ProcessRemainActions(CmdletOperationBase cmdletOperation)
|
||||
{
|
||||
|
@ -1055,7 +1059,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Indicates whether this object was disposed or not
|
||||
/// Indicates whether this object was disposed or not.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
protected bool Disposed
|
||||
|
@ -1120,13 +1124,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Get CimSession based on given id/instanceid/computername/name
|
||||
/// Get CimSession based on given id/instanceid/computername/name.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal class CimGetSession : CimSessionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// The constructor.
|
||||
/// </summary>
|
||||
public CimGetSession() : base()
|
||||
{
|
||||
|
@ -1197,7 +1201,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Get CimSession based on given id/instanceid/computername/name
|
||||
/// Get CimSession based on given id/instanceid/computername/name.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal class CimRemoveSession : CimSessionBase
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Session proxy
|
||||
/// Session proxy.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
internal CimSessionProxy Proxy
|
||||
|
@ -60,7 +60,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
/// <summary>
|
||||
/// Class provides all information regarding the
|
||||
/// current invocation to .net api.
|
||||
/// current invocation to the .NET API.
|
||||
/// </summary>
|
||||
internal class InvocationContext
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# libpsl-native
|
||||
|
||||
The code under `libpsl-native` is being migrated to [PowerShell-native](https://github.com/PowerShell/PowerShell-native) repository.
|
||||
The code under `libpsl-native` is being migrated to the [PowerShell-native](https://github.com/PowerShell/PowerShell-native) repository.
|
||||
Please make PRs to the new repository.
|
||||
Code under here will be removed once the move is complete.
|
||||
|
|
Loading…
Reference in a new issue