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 @@ -470,7 +470,7 @@ private string GenerateTypeSource(string typeNamespace, string typeName, string
}

// Get the -FromMember template for a given language
private string GetMethodTemplate(Language language)
private static string GetMethodTemplate(Language language)
{
switch (language)
{
Expand All @@ -486,7 +486,7 @@ private string GetMethodTemplate(Language language)
}

// Get the -FromMember namespace template for a given language
private string GetNamespaceTemplate(Language language)
private static string GetNamespaceTemplate(Language language)
{
switch (language)
{
Expand All @@ -502,7 +502,7 @@ private string GetNamespaceTemplate(Language language)
}

// Get the -FromMember namespace template for a given language
private string GetUsingTemplate(Language language)
private static string GetUsingTemplate(Language language)
{
switch (language)
{
Expand Down Expand Up @@ -840,7 +840,7 @@ private string ResolveAssemblyName(string assembly, bool isForReferenceAssembly)
// However, this does give us a massive usability improvement, as users can just say
// Add-Type -AssemblyName Forms (instead of System.Windows.Forms)
// This is just long, not unmaintainable.
private Assembly LoadAssemblyHelper(string assemblyName)
private static Assembly LoadAssemblyHelper(string assemblyName)
{
Assembly loadedAssembly = null;

Expand Down Expand Up @@ -898,7 +898,7 @@ private void WriteTypes(Assembly assembly)

#region SourceCodeProcessing

private OutputKind OutputAssemblyTypeToOutputKind(OutputAssemblyType outputType)
private static OutputKind OutputAssemblyTypeToOutputKind(OutputAssemblyType outputType)
{
switch (outputType)
{
Expand Down Expand Up @@ -1136,7 +1136,7 @@ public override void VisitNamedType(INamedTypeSymbol symbol)
}
}

private void CacheNewTypes(ConcurrentBag<string> newTypes)
private static void CacheNewTypes(ConcurrentBag<string> newTypes)
{
foreach (var typeName in newTypes)
{
Expand Down Expand Up @@ -1266,7 +1266,7 @@ private void HandleCompilerErrors(ImmutableArray<Diagnostic> compilerDiagnostics
}
}

private string BuildErrorMessage(Diagnostic diagnisticRecord)
private static string BuildErrorMessage(Diagnostic diagnisticRecord)
{
var location = diagnisticRecord.Location;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public AccessRightTypeNames Type
private AccessRightTypeNames _type;
private bool _isTypeSet = false;

private string ConvertToNTAccount(SecurityIdentifier securityIdentifier)
private static string ConvertToNTAccount(SecurityIdentifier securityIdentifier)
{
try
{
Expand All @@ -57,7 +57,7 @@ private string ConvertToNTAccount(SecurityIdentifier securityIdentifier)
}
}

private List<string> GetApplicableAccessRights(int accessMask, AccessRightTypeNames? typeName)
private static List<string> GetApplicableAccessRights(int accessMask, AccessRightTypeNames? typeName)
{
List<Type> typesToExamine = new List<Type>();
List<string> foundAccessRightNames = new List<string>();
Expand Down Expand Up @@ -95,7 +95,7 @@ private List<string> GetApplicableAccessRights(int accessMask, AccessRightTypeNa
return foundAccessRightNames;
}

private Type GetRealAccessRightType(AccessRightTypeNames typeName)
private static Type GetRealAccessRightType(AccessRightTypeNames typeName)
{
switch (typeName)
{
Expand All @@ -116,7 +116,7 @@ private Type GetRealAccessRightType(AccessRightTypeNames typeName)
}
}

private string[] ConvertAccessControlListToStrings(CommonAcl acl, AccessRightTypeNames? typeName)
private static string[] ConvertAccessControlListToStrings(CommonAcl acl, AccessRightTypeNames? typeName)
{
if (acl == null || acl.Count == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ private void WriteListEntry()
/// <summary>
/// To write the Property name.
/// </summary>
private void WritePropertyName(StringBuilder Listtag, MshParameter p)
private static void WritePropertyName(StringBuilder Listtag, MshParameter p)
{
// for writing the property name
string label = p.GetEntry(ConvertHTMLParameterDefinitionKeys.LabelEntryKey) as string;
Expand Down Expand Up @@ -653,7 +653,7 @@ private void WritePropertyValue(StringBuilder Listtag, MshParameter p)
/// <summary>
/// To write the Table header for the object property names.
/// </summary>
private void WriteTableHeader(StringBuilder THtag, List<MshParameter> resolvedNameMshParameters)
private static void WriteTableHeader(StringBuilder THtag, List<MshParameter> resolvedNameMshParameters)
{
// write the property names
foreach (MshParameter p in resolvedNameMshParameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ private bool HandleKnownContainerTypes(object source, string property, int depth
/// <param name="ct"></param>
/// <param name="dictionary"></param>
/// <param name="enumerable"></param>
private void GetKnownContainerTypeInfo(
private static void GetKnownContainerTypeInfo(
object source, out ContainerType ct, out IDictionary dictionary, out IEnumerable enumerable)
{
Dbg.Assert(source != null, "caller should validate the parameter");
Expand Down Expand Up @@ -676,7 +676,7 @@ private void WriteStartOfPSObject(
/// <param name="source"></param>
/// <returns>
/// </returns>
private bool PSObjectHasNotes(PSObject source)
private static bool PSObjectHasNotes(PSObject source)
{
if (source.InstanceMembers != null && source.InstanceMembers.Count > 0)
{
Expand Down Expand Up @@ -955,7 +955,7 @@ private void HandlePSObjectAsString(PSObject source, string property, int depth)
/// <returns>
/// string value to use for serializing this PSObject.
/// </returns>
private string GetStringFromPSObject(PSObject source)
private static string GetStringFromPSObject(PSObject source)
{
Dbg.Assert(source != null, "caller should have validated the information");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ private void EnableHostDebugger(Runspace runspace, bool enabled)
}
}

private void SetLocalMode(System.Management.Automation.Debugger debugger, bool localMode)
private static void SetLocalMode(System.Management.Automation.Debugger debugger, bool localMode)
{
ServerRemoteDebugger remoteDebugger = debugger as ServerRemoteDebugger;
if (remoteDebugger != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ internal HeaderInfo GenerateHeaderInfo(PSObject input, OutGridViewCommand parent
/// </summary>
/// <returns>None.</returns>
/// <remarks>This method updates "activeAssociationList" instance property.</remarks>
private void FilterActiveAssociationList(List<MshResolvedExpressionParameterAssociation> activeAssociationList)
private static void FilterActiveAssociationList(List<MshResolvedExpressionParameterAssociation> activeAssociationList)
{
// we got a valid set of properties from the default property set
// make sure we do not have too many properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected override void ProcessRecord()
/// Returns the items in the input list that match an item in the filter array according to
/// the given selection criterion.
/// </summary>
private List<Breakpoint> Filter<T>(List<Breakpoint> input, T[] filter, FilterSelector<T> selector)
private static List<Breakpoint> Filter<T>(List<Breakpoint> input, T[] filter, FilterSelector<T> selector)
{
List<Breakpoint> output = new List<Breakpoint>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private PolymorphicRandomNumberGenerator Generator
[Parameter(ParameterSetName = RandomNumberParameterSet)]
public object Minimum { get; set; }

private bool IsInt(object o)
private static bool IsInt(object o)
{
if (o == null || o is int)
{
Expand All @@ -227,7 +227,7 @@ private bool IsInt(object o)
return false;
}

private bool IsInt64(object o)
private static bool IsInt64(object o)
{
if (o == null || o is Int64)
{
Expand All @@ -237,7 +237,7 @@ private bool IsInt64(object o)
return false;
}

private object ProcessOperand(object o)
private static object ProcessOperand(object o)
{
if (o == null)
{
Expand All @@ -257,7 +257,7 @@ private object ProcessOperand(object o)
return baseObject;
}

private double ConvertToDouble(object o, double defaultIfNull)
private static double ConvertToDouble(object o, double defaultIfNull)
{
if (o == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ private ParameterMetadata RehydrateParameterMetadata(PSObject deserializedParame
parameterType);
}

private bool IsProxyForCmdlet(Dictionary<string, ParameterMetadata> parameters)
private static bool IsProxyForCmdlet(Dictionary<string, ParameterMetadata> parameters)
{
// we are not sending CmdletBinding/DefaultParameterSet over the wire anymore
// we need to infer IsProxyForCmdlet from presence of all common parameters
Expand Down Expand Up @@ -1355,7 +1355,7 @@ private CommandMetadata RehydrateCommandMetadata(PSObject deserializedCommandInf
return new CommandMetadata(
name: name,
commandType: commandType,
isProxyForCmdlet: this.IsProxyForCmdlet(parameters),
isProxyForCmdlet: IsProxyForCmdlet(parameters),
defaultParameterSetName: ParameterAttribute.AllParameterSets,
supportsShouldProcess: false,
confirmImpact: ConfirmImpact.None,
Expand All @@ -1365,7 +1365,7 @@ private CommandMetadata RehydrateCommandMetadata(PSObject deserializedCommandInf
parameters: parameters);
}

private int GetCommandTypePriority(CommandTypes commandType)
private static int GetCommandTypePriority(CommandTypes commandType)
{
switch (commandType)
{
Expand Down Expand Up @@ -1434,8 +1434,8 @@ private void AddRemoteCommandMetadata(
CommandMetadata previousCommandWithSameName;
if (name2commandMetadata.TryGetValue(commandMetadata.Name, out previousCommandWithSameName))
{
int previousCommandPriority = this.GetCommandTypePriority(previousCommandWithSameName.WrappedCommandType);
int currentCommandPriority = this.GetCommandTypePriority(commandMetadata.WrappedCommandType);
int previousCommandPriority = GetCommandTypePriority(previousCommandWithSameName.WrappedCommandType);
int currentCommandPriority = GetCommandTypePriority(commandMetadata.WrappedCommandType);
if (previousCommandPriority < currentCommandPriority)
{
return;
Expand Down Expand Up @@ -1975,7 +1975,7 @@ private string GetConnectionString()
return null;
}

private string EscapeFunctionNameForRemoteHelp(string name)
private static string EscapeFunctionNameForRemoteHelp(string name)
{
if (name == null)
{
Expand All @@ -2000,7 +2000,7 @@ private string EscapeFunctionNameForRemoteHelp(string name)
##############################################################################
";

private void GenerateSectionSeparator(TextWriter writer)
private static void GenerateSectionSeparator(TextWriter writer)
{
writer.Write(SectionSeparator);
}
Expand Down Expand Up @@ -2135,7 +2135,7 @@ function Write-PSImplicitRemotingMessage
}
";

private void GenerateHelperFunctionsWriteMessage(TextWriter writer)
private static void GenerateHelperFunctionsWriteMessage(TextWriter writer)
{
if (writer == null)
{
Expand Down Expand Up @@ -2190,7 +2190,7 @@ function Set-PSImplicitRemotingSession
if ($PSSessionOverride) {{ Set-PSImplicitRemotingSession $PSSessionOverride }}
";

private void GenerateHelperFunctionsSetImplicitRunspace(TextWriter writer)
private static void GenerateHelperFunctionsSetImplicitRunspace(TextWriter writer)
{
if (writer == null)
{
Expand Down Expand Up @@ -2767,7 +2767,7 @@ function Get-PSImplicitRemotingClientSideParameters
}
";

private void GenerateHelperFunctionsClientSideParameters(TextWriter writer)
private static void GenerateHelperFunctionsClientSideParameters(TextWriter writer)
{
if (writer == null)
{
Expand All @@ -2781,12 +2781,12 @@ private void GenerateHelperFunctionsClientSideParameters(TextWriter writer)

private void GenerateHelperFunctions(TextWriter writer)
{
this.GenerateSectionSeparator(writer);
this.GenerateHelperFunctionsWriteMessage(writer);
GenerateSectionSeparator(writer);
GenerateHelperFunctionsWriteMessage(writer);
this.GenerateHelperFunctionsGetSessionOption(writer);
this.GenerateHelperFunctionsSetImplicitRunspace(writer);
GenerateHelperFunctionsSetImplicitRunspace(writer);
this.GenerateHelperFunctionsGetImplicitRunspace(writer);
this.GenerateHelperFunctionsClientSideParameters(writer);
GenerateHelperFunctionsClientSideParameters(writer);
}

#endregion
Expand Down Expand Up @@ -2846,15 +2846,15 @@ private void GenerateHelperFunctions(TextWriter writer)
}}
";

private void GenerateCommandProxy(TextWriter writer, CommandMetadata commandMetadata)
private static void GenerateCommandProxy(TextWriter writer, CommandMetadata commandMetadata)
{
if (writer == null)
{
throw PSTraceSource.NewArgumentNullException(nameof(writer));
}

string functionNameForString = CodeGeneration.EscapeSingleQuotedStringContent(commandMetadata.Name);
string functionNameForHelp = this.EscapeFunctionNameForRemoteHelp(commandMetadata.Name);
string functionNameForHelp = EscapeFunctionNameForRemoteHelp(commandMetadata.Name);
writer.Write(
CommandProxyTemplate,
/* 0 */ functionNameForString,
Expand All @@ -2868,7 +2868,7 @@ private void GenerateCommandProxy(TextWriter writer, CommandMetadata commandMeta
/* 8 */ commandMetadata.WrappedAnyCmdlet);
}

private void GenerateCommandProxy(TextWriter writer, IEnumerable<CommandMetadata> listOfCommandMetadata)
private static void GenerateCommandProxy(TextWriter writer, IEnumerable<CommandMetadata> listOfCommandMetadata)
{
if (writer == null)
{
Expand All @@ -2880,7 +2880,7 @@ private void GenerateCommandProxy(TextWriter writer, IEnumerable<CommandMetadata
throw PSTraceSource.NewArgumentNullException(nameof(listOfCommandMetadata));
}

this.GenerateSectionSeparator(writer);
GenerateSectionSeparator(writer);
foreach (CommandMetadata commandMetadata in listOfCommandMetadata)
{
GenerateCommandProxy(writer, commandMetadata);
Expand All @@ -2895,7 +2895,7 @@ private void GenerateCommandProxy(TextWriter writer, IEnumerable<CommandMetadata
& $script:ExportModuleMember -Function {0}
";

private void GenerateExportDeclaration(TextWriter writer, IEnumerable<CommandMetadata> listOfCommandMetadata)
private static void GenerateExportDeclaration(TextWriter writer, IEnumerable<CommandMetadata> listOfCommandMetadata)
{
if (writer == null)
{
Expand All @@ -2907,14 +2907,14 @@ private void GenerateExportDeclaration(TextWriter writer, IEnumerable<CommandMet
throw PSTraceSource.NewArgumentNullException(nameof(listOfCommandMetadata));
}

this.GenerateSectionSeparator(writer);
GenerateSectionSeparator(writer);

List<string> listOfCommandNames = GetListOfCommandNames(listOfCommandMetadata);
string exportString = GenerateArrayString(listOfCommandNames);
writer.Write(ExportFunctionsTemplate, exportString);
}

private List<string> GetListOfCommandNames(IEnumerable<CommandMetadata> listOfCommandMetadata)
private static List<string> GetListOfCommandNames(IEnumerable<CommandMetadata> listOfCommandMetadata)
{
if (listOfCommandMetadata == null)
{
Expand All @@ -2930,7 +2930,7 @@ private List<string> GetListOfCommandNames(IEnumerable<CommandMetadata> listOfCo
return listOfCommandNames;
}

private string GenerateArrayString(IEnumerable<string> listOfStrings)
private static string GenerateArrayString(IEnumerable<string> listOfStrings)
{
if (listOfStrings == null)
{
Expand Down Expand Up @@ -2968,9 +2968,9 @@ private string GenerateArrayString(IEnumerable<string> listOfStrings)
& $script:ExportModuleMember -Alias {0}
";

private void GenerateAliases(TextWriter writer, Dictionary<string, string> alias2resolvedCommandName)
private static void GenerateAliases(TextWriter writer, Dictionary<string, string> alias2resolvedCommandName)
{
this.GenerateSectionSeparator(writer);
GenerateSectionSeparator(writer);

foreach (KeyValuePair<string, string> pair in alias2resolvedCommandName)
{
Expand All @@ -2991,7 +2991,7 @@ private void GenerateAliases(TextWriter writer, Dictionary<string, string> alias

#region Generating format.ps1xml file

private void GenerateFormatFile(TextWriter writer, List<ExtendedTypeDefinition> listOfFormatData)
private static void GenerateFormatFile(TextWriter writer, List<ExtendedTypeDefinition> listOfFormatData)
{
if (writer == null)
{
Expand Down
Loading