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 @@ -393,7 +393,7 @@ private bool TryFindInGAC(AssemblyName assemblyName, out string assemblyFilePath
}

// Find the assembly under 'gacRoot' and select the latest version.
private bool FindInGac(string gacRoot, AssemblyName assemblyName, out string assemblyPath)
private static bool FindInGac(string gacRoot, AssemblyName assemblyName, out string assemblyPath)
{
bool assemblyFound = false;
assemblyPath = null;
Expand Down Expand Up @@ -430,7 +430,7 @@ private bool FindInGac(string gacRoot, AssemblyName assemblyName, out string ass
/// <summary>
/// Try to get the specified assembly from cache.
/// </summary>
private bool TryGetAssemblyFromCache(AssemblyName assemblyName, out Assembly asmLoaded)
private static bool TryGetAssemblyFromCache(AssemblyName assemblyName, out Assembly asmLoaded)
{
if (s_assemblyCache.TryGetValue(assemblyName.Name, out asmLoaded))
{
Expand All @@ -454,7 +454,7 @@ private bool TryGetAssemblyFromCache(AssemblyName assemblyName, out Assembly asm
/// <param name="requestedAssembly">AssemblyName of the requested assembly.</param>
/// <param name="loadedAssembly">AssemblyName of the loaded assembly.</param>
/// <returns></returns>
private bool IsAssemblyMatching(AssemblyName requestedAssembly, AssemblyName loadedAssembly)
private static bool IsAssemblyMatching(AssemblyName requestedAssembly, AssemblyName loadedAssembly)
{
//
// We use the same rules as CoreCLR loader to compare the requested assembly and loaded assembly:
Expand Down Expand Up @@ -501,7 +501,7 @@ private bool IsAssemblyMatching(AssemblyName requestedAssembly, AssemblyName loa
/// <param name="tpaStrongName">
/// The assembly strong name of a CoreCLR Trusted_Platform_Assembly
/// </param>
private Assembly GetTrustedPlatformAssembly(string tpaStrongName)
private static Assembly GetTrustedPlatformAssembly(string tpaStrongName)
{
// We always depend on the default context to load the TPAs that are recorded in
// the type catalog.
Expand All @@ -517,7 +517,7 @@ private Assembly GetTrustedPlatformAssembly(string tpaStrongName)
/// <summary>
/// Throw FileLoadException.
/// </summary>
private void ThrowFileLoadException(string errorTemplate, params object[] args)
private static void ThrowFileLoadException(string errorTemplate, params object[] args)
{
string message = string.Format(CultureInfo.CurrentCulture, errorTemplate, args);
throw new FileLoadException(message);
Expand All @@ -526,7 +526,7 @@ private void ThrowFileLoadException(string errorTemplate, params object[] args)
/// <summary>
/// Throw FileNotFoundException.
/// </summary>
private void ThrowFileNotFoundException(string errorTemplate, params object[] args)
private static void ThrowFileNotFoundException(string errorTemplate, params object[] args)
{
string message = string.Format(CultureInfo.CurrentCulture, errorTemplate, args);
throw new FileNotFoundException(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ internal void LogEntry(XmlLoaderLoggerEntry entry)
WriteToTracer(entry);
}

private void WriteToTracer(XmlLoaderLoggerEntry entry)
private static void WriteToTracer(XmlLoaderLoggerEntry entry)
{
if (entry.entryType == XmlLoaderLoggerEntry.EntryType.Error)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ internal Assembly ResolveAssemblyName(string assemblyName)
return retVal;
}

private Assembly ResolveAssemblyNameInLoadedAssemblies(string assemblyName, bool fullName)
private static Assembly ResolveAssemblyNameInLoadedAssemblies(string assemblyName, bool fullName)
{
Assembly result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private int MatchTypeIndex(string typeName, PSObject currentObject, PSPropertyEx
return BestMatchIndexUndefined;
}

private bool MatchCondition(PSObject currentObject, PSPropertyExpression ex)
private static bool MatchCondition(PSObject currentObject, PSPropertyExpression ex)
{
if (ex == null)
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ private ControlBase LoadTableControlFromObjectModel(TableControl table, int view
/// </summary>
/// <param name="tableBody"></param>
/// <param name="headers"></param>
private void LoadHeadersSectionFromObjectModel(TableControlBody tableBody, List<TableControlColumnHeader> headers)
private static void LoadHeadersSectionFromObjectModel(TableControlBody tableBody, List<TableControlColumnHeader> headers)
{
foreach (TableControlColumnHeader header in headers)
{
Expand Down Expand Up @@ -746,7 +746,7 @@ private ExpressionToken LoadExpressionFromObjectModel(DisplayEntry displayEntry,
/// Load EntrySelectedBy (TypeName) into AppliesTo.
/// </summary>
/// <returns></returns>
private AppliesTo LoadAppliesToSectionFromObjectModel(List<string> selectedBy, List<DisplayEntry> condition)
private static AppliesTo LoadAppliesToSectionFromObjectModel(List<string> selectedBy, List<DisplayEntry> condition)
{
AppliesTo appliesTo = new AppliesTo();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private PSPropertyExpressionResult GetValue(PSObject target, bool eatExceptions)
}
}

private PSObject IfHashtableWrapAsPSCustomObject(PSObject target, out bool wrapped)
private static PSObject IfHashtableWrapAsPSCustomObject(PSObject target, out bool wrapped)
{
wrapped = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private string GetCmdletName(CommonCmdletMetadata cmdletMetadata)
return verb + "-" + noun;
}

private string GetCmdletAttributes(CommonCmdletMetadata cmdletMetadata)
private static string GetCmdletAttributes(CommonCmdletMetadata cmdletMetadata)
{
// Generate the script for the Alias and Obsolete Attribute if any is declared in CDXML
StringBuilder attributes = new StringBuilder(150);
Expand Down Expand Up @@ -1444,7 +1444,7 @@ private void GenerateMethodParametersProcessing(
}
}

private void GenerateIfBoundParameter(
private static void GenerateIfBoundParameter(
IEnumerable<string> commonParameterSets,
IEnumerable<string> methodParameterSets,
ParameterMetadata cmdletParameterMetadata,
Expand Down Expand Up @@ -1874,7 +1874,7 @@ private string GetHelpDirectiveForExternalHelp()

private void WriteCmdlet(TextWriter output, StaticCmdletMetadata staticCmdlet)
{
string attributeString = this.GetCmdletAttributes(staticCmdlet.CmdletMetadata);
string attributeString = GetCmdletAttributes(staticCmdlet.CmdletMetadata);

Dictionary<string, ParameterMetadata> commonParameters = this.GetCommonParameters();
List<string> commonParameterSets = GetCommonParameterSets(commonParameters);
Expand Down Expand Up @@ -1959,7 +1959,7 @@ private static void AddPassThruParameter(IDictionary<string, ParameterMetadata>

private void WriteCmdlet(TextWriter output, InstanceCmdletMetadata instanceCmdlet)
{
string attributeString = this.GetCmdletAttributes(instanceCmdlet.CmdletMetadata);
string attributeString = GetCmdletAttributes(instanceCmdlet.CmdletMetadata);

Dictionary<string, ParameterMetadata> commonParameters = this.GetCommonParameters();
List<string> commonParameterSets = GetCommonParameterSets(commonParameters);
Expand Down Expand Up @@ -2066,7 +2066,7 @@ private void WriteGetCmdlet(TextWriter output)
CommonCmdletMetadata cmdletMetadata = this.GetGetCmdletMetadata();
Dbg.Assert(cmdletMetadata != null, "xsd should ensure that cmdlet metadata element is always present");
CommandMetadata commandMetadata = this.GetCommandMetadata(cmdletMetadata);
string attributeString = this.GetCmdletAttributes(cmdletMetadata);
string attributeString = GetCmdletAttributes(cmdletMetadata);

GetCmdletParameters getCmdletParameters = this.GetGetCmdletParameters(null);
if (!string.IsNullOrEmpty(getCmdletParameters.DefaultCmdletParameterSet))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public override object GetPropertyValue(PSAdaptedProperty adaptedProperty)
throw new ArgumentNullException(nameof(adaptedProperty));
}

private void AddTypeNameHierarchy(IList<string> typeNamesWithNamespace, IList<string> typeNamesWithoutNamespace, string namespaceName, string className)
private static void AddTypeNameHierarchy(IList<string> typeNamesWithNamespace, IList<string> typeNamesWithoutNamespace, string namespaceName, string className)
{
if (!string.IsNullOrEmpty(namespaceName))
{
Expand All @@ -258,7 +258,7 @@ private void AddTypeNameHierarchy(IList<string> typeNamesWithNamespace, IList<st
className));
}

private List<CimClass> GetInheritanceChain(CimInstance cimInstance)
private static List<CimClass> GetInheritanceChain(CimInstance cimInstance)
{
List<CimClass> inheritanceChain = new List<CimClass>();
CimClass cimClass = cimInstance.CimClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ internal override HelpCategory HelpCategory

#region Help Provider Interface

private void GetModulePaths(CommandInfo commandInfo, out string moduleName, out string moduleDir, out string nestedModulePath)
private static void GetModulePaths(CommandInfo commandInfo, out string moduleName, out string moduleDir, out string nestedModulePath)
{
Dbg.Assert(commandInfo != null, "Caller should verify that commandInfo != null");

Expand Down Expand Up @@ -132,7 +132,7 @@ private void GetModulePaths(CommandInfo commandInfo, out string moduleName, out
}
}

private string GetHelpName(CommandInfo commandInfo)
private static string GetHelpName(CommandInfo commandInfo)
{
Dbg.Assert(commandInfo != null, "Caller should verify that commandInfo != null");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ internal override IEnumerable<HelpInfo> SearchHelp(HelpRequest helpRequest, bool
}
}

private void GetModuleNameAndVersion(string psmodulePathRoot, string filePath, out string moduleName, out Version moduleVersion)
private static void GetModuleNameAndVersion(string psmodulePathRoot, string filePath, out string moduleName, out Version moduleVersion)
{
moduleVersion = null;
moduleName = null;
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/MUIFileSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void SearchForFiles()
}
}

private string[] GetFiles(string path, string pattern)
private static string[] GetFiles(string path, string pattern)
{
#if UNIX
// On Linux, file names are case sensitive, so we need to add
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/MamlNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ private PSObject[] GetMamlFormattingPSObjects(XmlNode xmlNode)
/// </summary>
/// <param name="nodes"></param>
/// <returns></returns>
private int GetParaMamlNodeCount(XmlNodeList nodes)
private static int GetParaMamlNodeCount(XmlNodeList nodes)
{
int i = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/SaveHelpCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public override object Transform(EngineIntrinsics engineIntrinsics, object input
return inputData;
}

private bool TryConvertFromDeserializedModuleInfo(object inputData, out PSModuleInfo moduleInfo)
private static bool TryConvertFromDeserializedModuleInfo(object inputData, out PSModuleInfo moduleInfo)
{
moduleInfo = null;
PSObject pso = inputData as PSObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ internal UpdatableHelpInfo CreateHelpInfo(string xml, string moduleName, Guid mo
/// <param name="schema">Xml schema.</param>
/// <param name="handler">Validation event handler.</param>
/// <param name="helpInfo">HelpInfo or HelpContent?</param>
private XmlDocument CreateValidXmlDocument(string xml, string ns, string schema, ValidationEventHandler handler,
private static XmlDocument CreateValidXmlDocument(string xml, string ns, string schema, ValidationEventHandler handler,
bool helpInfo)
{
XmlReaderSettings settings = new XmlReaderSettings();
Expand Down Expand Up @@ -998,7 +998,7 @@ internal void GenerateHelpInfo(string moduleName, Guid moduleGuid, string conten
/// Removes the read only attribute.
/// </summary>
/// <param name="path"></param>
private void RemoveReadOnly(string path)
private static void RemoveReadOnly(string path)
{
if (File.Exists(path))
{
Expand Down Expand Up @@ -1093,7 +1093,7 @@ internal void InstallHelpContent(UpdatableHelpCommandType commandType, Execution
}

#if UNIX
private bool ExpandArchive(string source, string destination)
private static bool ExpandArchive(string source, string destination)
{
bool sucessfulDecompression = false;

Expand Down Expand Up @@ -1125,7 +1125,7 @@ private bool ExpandArchive(string source, string destination)
/// <param name="srcPath">Source path.</param>
/// <param name="destPath">Destination path.</param>
/// <param name="needToCopy">Is set to false if we find a single file placeholder.txt in cab. This means we no longer need to install help files.</param>
private void UnzipHelpContent(ExecutionContext context, string srcPath, string destPath, out bool needToCopy)
private static void UnzipHelpContent(ExecutionContext context, string srcPath, string destPath, out bool needToCopy)
{
needToCopy = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ internal override bool ProcessModuleWithCulture(UpdatableHelpModuleInfo module,
/// </summary>
/// <param name="path"></param>
/// <param name="e"></param>
private void ThrowPathMustBeValidContainersException(string path, Exception e)
private static void ThrowPathMustBeValidContainersException(string path, Exception e)
{
throw new UpdatableHelpSystemException("PathMustBeValidContainers",
StringUtil.Format(HelpDisplayStrings.PathMustBeValidContainers, path), ErrorCategory.InvalidArgument,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ private void WinMapNetworkDrive(PSDriveInfo drive)
/// </summary>
/// <param name="drive"></param>
/// <returns></returns>
private bool IsNetworkMappedDrive(PSDriveInfo drive)
private static bool IsNetworkMappedDrive(PSDriveInfo drive)
{
bool shouldMapNetworkDrive = (drive != null && !string.IsNullOrEmpty(drive.Root) && PathIsNetworkPath(drive.Root)) &&
(drive.Persist || (drive.Credential != null && !drive.Credential.Equals(PSCredential.Empty)));
Expand Down Expand Up @@ -789,7 +789,7 @@ private PSDriveInfo WinRemoveDrive(PSDriveInfo drive)
/// PS Drive Info.
/// </param>
/// <returns>True if the drive can be persisted or else false.</returns>
private bool IsSupportedDriveForPersistence(PSDriveInfo drive)
private static bool IsSupportedDriveForPersistence(PSDriveInfo drive)
{
bool isSupportedDriveForPersistence = false;
if (drive != null && !string.IsNullOrEmpty(drive.Name) && drive.Name.Length == 1)
Expand Down Expand Up @@ -4203,7 +4203,7 @@ private void RemoveFunctionsPSCopyFileFromRemoteSession(System.Management.Automa
SafeInvokeCommand.Invoke(ps, this, null, false);
}

private bool ValidRemoteSessionForScripting(Runspace runspace)
private static bool ValidRemoteSessionForScripting(Runspace runspace)
{
if (runspace is not RemoteRunspace)
{
Expand Down Expand Up @@ -4768,7 +4768,7 @@ private bool CopyFileStreamToRemoteSession(FileInfo file, string destinationPath

// Returns a hash table with metadata about this file info.
//
private Hashtable GetFileMetadata(FileInfo file)
private static Hashtable GetFileMetadata(FileInfo file)
{
Hashtable metadata = new Hashtable();

Expand Down Expand Up @@ -6137,7 +6137,7 @@ private void CopyAndDelete(DirectoryInfo directory, string destination, bool for
}

#if !UNIX
private bool IsSameWindowsVolume(string source, string destination)
private static bool IsSameWindowsVolume(string source, string destination)
{
FileInfo src = new FileInfo(source);
FileInfo dest = new FileInfo(destination);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,7 @@ internal string GenerateRelativePath(
return driveRootRelativeWorkingPath;
}

private bool HasRelativePathTokens(string path)
private static bool HasRelativePathTokens(string path)
{
string comparePath = path.Replace('/', '\\');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2956,7 +2956,7 @@ private string NormalizePath(string path)
return result;
}

private bool HasRelativePathTokens(string path)
private static bool HasRelativePathTokens(string path)
{
return (
path.StartsWith('\\') ||
Expand Down Expand Up @@ -3195,7 +3195,7 @@ private object ResetRegistryKeyValue(IRegistryWrapper key, string valueName)
/// <returns>
/// true if the path is empty, a \ or a /, else false
/// </returns>
private bool IsHiveContainer(string path)
private static bool IsHiveContainer(string path)
{
bool result = false;
if (path == null)
Expand Down Expand Up @@ -4114,7 +4114,7 @@ private bool ParseKind(string type, out RegistryValueKind kind)
/// <returns>
/// A string containing the default value name.
/// </returns>
private string LocalizedDefaultToken => "(default)";
private static string LocalizedDefaultToken => "(default)";

/// <summary>
/// Converts an empty or null userEnteredPropertyName to the localized
Expand Down
Loading