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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,44 +180,44 @@ internal class CimSessionState : IDisposable
/// where <int> is the next available session number.
/// For example, CimSession1, CimSession2, etc...
/// </summary>
internal static string CimSessionClassName = "CimSession";
internal static readonly string CimSessionClassName = "CimSession";

/// <summary>
/// CimSession object name.
/// </summary>
internal static string CimSessionObject = "{CimSession Object}";
internal static readonly string CimSessionObject = "{CimSession Object}";

/// <summary>
/// <para>
/// CimSession object path, which is identifying a cimsession object
/// </para>
/// </summary>
internal static string SessionObjectPath = @"CimSession id = {0}, name = {2}, ComputerName = {3}, instance id = {1}";
internal static readonly string SessionObjectPath = @"CimSession id = {0}, name = {2}, ComputerName = {3}, instance id = {1}";

/// <summary>
/// Id property name of cimsession wrapper object.
/// </summary>
internal static string idPropName = "Id";
internal static readonly string idPropName = "Id";

/// <summary>
/// Instanceid property name of cimsession wrapper object.
/// </summary>
internal static string instanceidPropName = "InstanceId";
internal static readonly string instanceidPropName = "InstanceId";

/// <summary>
/// Name property name of cimsession wrapper object.
/// </summary>
internal static string namePropName = "Name";
internal static readonly string namePropName = "Name";

/// <summary>
/// Computer name property name of cimsession object.
/// </summary>
internal static string computernamePropName = "ComputerName";
internal static readonly string computernamePropName = "ComputerName";

/// <summary>
/// Protocol name property name of cimsession object.
/// </summary>
internal static string protocolPropName = "Protocol";
internal static readonly string protocolPropName = "Protocol";

/// <summary>
/// <para>
Expand Down Expand Up @@ -813,15 +813,15 @@ public CimSessionBase()
/// can running parallelly under more than one runspace(s).
/// </para>
/// </summary>
internal static ConcurrentDictionary<Guid, CimSessionState> cimSessions
internal static readonly ConcurrentDictionary<Guid, CimSessionState> cimSessions
= new ConcurrentDictionary<Guid, CimSessionState>();

/// <summary>
/// <para>
/// Default runspace Id.
/// </para>
/// </summary>
internal static Guid defaultRunspaceId = Guid.Empty;
internal static readonly Guid defaultRunspaceId = Guid.Empty;

/// <summary>
/// <para>
Expand Down Expand Up @@ -1209,7 +1209,7 @@ internal class CimRemoveSession : CimSessionBase
/// <summary>
/// Remove session action string.
/// </summary>
internal static string RemoveCimSessionActionName = "Remove CimSession";
internal static readonly string RemoveCimSessionActionName = "Remove CimSession";

/// <summary>
/// Constructor.
Expand Down
52 changes: 26 additions & 26 deletions src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,47 @@ internal static class ConstValue
/// Default computername
/// </para>
/// </summary>
internal static string[] DefaultSessionName = { @"*" };
internal static readonly string[] DefaultSessionName = { @"*" };

/// <summary>
/// <para>
/// Empty computername, which will create DCOM session
/// </para>
/// </summary>
internal static string NullComputerName = null;
internal static readonly string NullComputerName = null;

/// <summary>
/// <para>
/// Empty computername array, which will create DCOM session
/// </para>
/// </summary>
internal static string[] NullComputerNames = { NullComputerName };
internal static readonly string[] NullComputerNames = { NullComputerName };

/// <summary>
/// <para>
/// localhost computername, which will create WSMAN session
/// </para>
/// </summary>
internal static string LocalhostComputerName = @"localhost";
internal static readonly string LocalhostComputerName = @"localhost";

/// <summary>
/// <para>
/// Default namespace
/// </para>
/// </summary>
internal static string DefaultNameSpace = @"root\cimv2";
internal static readonly string DefaultNameSpace = @"root\cimv2";

/// <summary>
/// <para>
/// Default namespace
/// </para>
/// </summary>
internal static string DefaultQueryDialect = @"WQL";
internal static readonly string DefaultQueryDialect = @"WQL";

/// <summary>
/// Name of the note property that controls if "PSComputerName" column is shown.
/// </summary>
internal static string ShowComputerNameNoteProperty = "PSShowComputerName";
internal static readonly string ShowComputerNameNoteProperty = "PSShowComputerName";

/// <summary>
/// <para>
Expand Down Expand Up @@ -169,17 +169,17 @@ internal static bool GenerateVerboseMessage
/// <summary>
/// Flag used to control generating message into powershell.
/// </summary>
internal static string logFile = @"c:\temp\Cim.log";
internal static readonly string logFile = @"c:\temp\Cim.log";

/// <summary>
/// Indent space string.
/// </summary>
internal static string space = @" ";
internal static readonly string space = @" ";

/// <summary>
/// Indent space strings array.
/// </summary>
internal static string[] spaces = {
internal static readonly string[] spaces = {
string.Empty,
space,
space + space,
Expand All @@ -191,26 +191,26 @@ internal static bool GenerateVerboseMessage
/// <summary>
/// Lock the log file.
/// </summary>
internal static object logLock = new object();
internal static readonly object logLock = new object();

#endregion

#region internal strings
internal static string runspaceStateChanged = "Runspace {0} state changed to {1}";
internal static string classDumpInfo = @"Class type is {0}";
internal static string propertyDumpInfo = @"Property name {0} of type {1}, its value is {2}";
internal static string defaultPropertyType = @"It is a default property, default value is {0}";
internal static string propertyValueSet = @"This property value is set by user {0}";
internal static string addParameterSetName = @"Add parameter set {0} name to cache";
internal static string removeParameterSetName = @"Remove parameter set {0} name from cache";
internal static string currentParameterSetNameCount = @"Cache have {0} parameter set names";
internal static string currentParameterSetNameInCache = @"Cache have parameter set {0} valid {1}";
internal static string currentnonMandatoryParameterSetInCache = @"Cache have optional parameter set {0} valid {1}";
internal static string optionalParameterSetNameCount = @"Cache have {0} optional parameter set names";
internal static string finalParameterSetName = @"------Final parameter set name of the cmdlet is {0}";
internal static string addToOptionalParameterSet = @"Add to optional ParameterSetNames {0}";
internal static string startToResolveParameterSet = @"------Resolve ParameterSet Name";
internal static string reservedString = @"------";
internal static readonly string runspaceStateChanged = "Runspace {0} state changed to {1}";
internal static readonly string classDumpInfo = @"Class type is {0}";
internal static readonly string propertyDumpInfo = @"Property name {0} of type {1}, its value is {2}";
internal static readonly string defaultPropertyType = @"It is a default property, default value is {0}";
internal static readonly string propertyValueSet = @"This property value is set by user {0}";
internal static readonly string addParameterSetName = @"Add parameter set {0} name to cache";
internal static readonly string removeParameterSetName = @"Remove parameter set {0} name from cache";
internal static readonly string currentParameterSetNameCount = @"Cache have {0} parameter set names";
internal static readonly string currentParameterSetNameInCache = @"Cache have parameter set {0} valid {1}";
internal static readonly string currentnonMandatoryParameterSetInCache = @"Cache have optional parameter set {0} valid {1}";
internal static readonly string optionalParameterSetNameCount = @"Cache have {0} optional parameter set names";
internal static readonly string finalParameterSetName = @"------Final parameter set name of the cmdlet is {0}";
internal static readonly string addToOptionalParameterSet = @"Add to optional ParameterSetNames {0}";
internal static readonly string startToResolveParameterSet = @"------Resolve ParameterSet Name";
internal static readonly string reservedString = @"------";
#endregion

#region runtime methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class CoreCommandBase : PSCmdlet, IDynamicParameters
/// using "NavigationCommands" as the category.
/// </summary>
[Dbg.TraceSourceAttribute("NavigationCommands", "The namespace navigation tracer")]
internal static Dbg.PSTraceSource tracer = Dbg.PSTraceSource.GetTracer("NavigationCommands", "The namespace navigation tracer");
internal static readonly Dbg.PSTraceSource tracer = Dbg.PSTraceSource.GetTracer("NavigationCommands", "The namespace navigation tracer");

#endregion Tracer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2700,14 +2700,14 @@ internal struct JOBOBJECT_BASIC_PROCESS_ID_LIST
internal static class ProcessNativeMethods
{
// Fields
internal static UInt32 GENERIC_READ = 0x80000000;
internal static UInt32 GENERIC_WRITE = 0x40000000;
internal static UInt32 FILE_ATTRIBUTE_NORMAL = 0x80000000;
internal static UInt32 CREATE_ALWAYS = 2;
internal static UInt32 FILE_SHARE_WRITE = 0x00000002;
internal static UInt32 FILE_SHARE_READ = 0x00000001;
internal static UInt32 OF_READWRITE = 0x00000002;
internal static UInt32 OPEN_EXISTING = 3;
internal static readonly UInt32 GENERIC_READ = 0x80000000;
internal static readonly UInt32 GENERIC_WRITE = 0x40000000;
internal static readonly UInt32 FILE_ATTRIBUTE_NORMAL = 0x80000000;
internal static readonly UInt32 CREATE_ALWAYS = 2;
internal static readonly UInt32 FILE_SHARE_WRITE = 0x00000002;
internal static readonly UInt32 FILE_SHARE_READ = 0x00000001;
internal static readonly UInt32 OF_READWRITE = 0x00000002;
internal static readonly UInt32 OPEN_EXISTING = 3;

// Methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ internal class CommandLineParameterParser
private const int MaxPipePathLengthLinux = 108;
private const int MaxPipePathLengthMacOS = 104;

internal static string[] validParameters = {
internal static readonly string[] validParameters = {
"sta",
"mta",
"command",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ public override void WriteErrorLine(string value)

// We use System.Environment.NewLine because we are platform-agnostic

internal static string Crlf = System.Environment.NewLine;
internal static readonly string Crlf = System.Environment.NewLine;

private const string Tab = "\x0009";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3386,7 +3386,7 @@ internal static class Crypt32Helpers
/// </summary>
private static object s_staticLock = new object();

internal static List<string> storeNames = new List<string>();
internal static readonly List<string> storeNames = new List<string>();

/// <summary>
/// Get a list of store names at the specified location.
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.WSMan.Management/WsManHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ internal class Sessions
/// <summary>
/// Dictionary object to store the connection.
/// </summary>
internal static Dictionary<string, object> SessionObjCache = new Dictionary<string, object>();
internal static readonly Dictionary<string, object> SessionObjCache = new Dictionary<string, object>();

~Sessions()
{
ReleaseSessions();
}
}

internal static Sessions AutoSession = new Sessions();
internal static readonly Sessions AutoSession = new Sessions();
//
//
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static bool IsWindowsDesktop
#endif

// format files
internal static List<string> FormatFileNames = new List<string>
internal static readonly List<string> FormatFileNames = new List<string>
{
"Certificate.format.ps1xml",
"Diagnostics.format.ps1xml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class OutCommandInner : ImplementationCommandBase
{
#region tracer
[TraceSource("format_out_OutCommandInner", "OutCommandInner")]
internal static PSTraceSource tracer = PSTraceSource.GetTracer("format_out_OutCommandInner", "OutCommandInner");
internal static readonly PSTraceSource tracer = PSTraceSource.GetTracer("format_out_OutCommandInner", "OutCommandInner");
#endregion tracer

internal override void BeginProcessing()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal sealed class OutputManagerInner : ImplementationCommandBase
{
#region tracer
[TraceSource("format_out_OutputManagerInner", "OutputManagerInner")]
internal static PSTraceSource tracer = PSTraceSource.GetTracer("format_out_OutputManagerInner", "OutputManagerInner");
internal static readonly PSTraceSource tracer = PSTraceSource.GetTracer("format_out_OutputManagerInner", "OutputManagerInner");
#endregion tracer

#region LineOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ internal sealed class ParameterProcessor
{
#region tracer
[TraceSource("ParameterProcessor", "ParameterProcessor")]
internal static PSTraceSource tracer = PSTraceSource.GetTracer("ParameterProcessor", "ParameterProcessor");
internal static readonly PSTraceSource tracer = PSTraceSource.GetTracer("ParameterProcessor", "ParameterProcessor");
#endregion tracer

internal static void ThrowParameterBindingException(TerminatingErrorContext invocationContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal sealed class MshResolvedExpressionParameterAssociation
{
#region tracer
[TraceSource("MshResolvedExpressionParameterAssociation", "MshResolvedExpressionParameterAssociation")]
internal static PSTraceSource tracer = PSTraceSource.GetTracer("MshResolvedExpressionParameterAssociation",
internal static readonly PSTraceSource tracer = PSTraceSource.GetTracer("MshResolvedExpressionParameterAssociation",
"MshResolvedExpressionParameterAssociation");
#endregion tracer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ internal sealed class ConsoleLineOutput : LineOutput
{
#region tracer
[TraceSource("ConsoleLineOutput", "ConsoleLineOutput")]
internal static PSTraceSource tracer = PSTraceSource.GetTracer("ConsoleLineOutput", "ConsoleLineOutput");
internal static readonly PSTraceSource tracer = PSTraceSource.GetTracer("ConsoleLineOutput", "ConsoleLineOutput");
#endregion tracer

#region LineOutput implementation
Expand Down
4 changes: 2 additions & 2 deletions src/System.Management.Automation/engine/CommandDiscovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public enum PSModuleAutoLoadingPreference
internal class CommandDiscovery
{
[TraceSource("CommandDiscovery", "Traces the discovery of cmdlets, scripts, functions, applications, etc.")]
internal static PSTraceSource discoveryTracer =
internal static readonly PSTraceSource discoveryTracer =
PSTraceSource.GetTracer(
"CommandDiscovery",
"Traces the discovery of cmdlets, scripts, functions, applications, etc.",
Expand Down Expand Up @@ -1710,7 +1710,7 @@ internal Collection<int> IndexOfRelativePath()
[EventSource(Name = "Microsoft-PowerShell-CommandDiscovery")]
internal class CommandDiscoveryEventSource : EventSource
{
internal static CommandDiscoveryEventSource Log = new CommandDiscoveryEventSource();
internal static readonly CommandDiscoveryEventSource Log = new CommandDiscoveryEventSource();

public void CommandLookupStart(string CommandName) { WriteEvent(1, CommandName); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ internal bool UseFullLanguageModeInDebugger
}
}

internal static List<string> ModulesWithJobSourceAdapters = new List<string>
internal static readonly List<string> ModulesWithJobSourceAdapters = new List<string>
{
Utils.ScheduledJobModuleName,
};
Expand Down
Loading
X Tutup