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 @@ -132,7 +132,7 @@ internal static void Dispatch(
/// <summary>
/// Is runspace pushed.
/// </summary>
private bool IsRunspacePushed(PSHost host)
private static bool IsRunspacePushed(PSHost host)
{
if (!(host is IHostSupportsInteractiveSession host2)) { return false; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ private void HandleCloseCompleted(object sender, EventArgs args)
}
}

private bool IsFinished(PSInvocationState state)
private static bool IsFinished(PSInvocationState state)
{
return (state == PSInvocationState.Completed ||
state == PSInvocationState.Failed ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,7 @@ internal void ConnectJob(Guid runspaceInstanceId)
SubmitAndWaitForConnect(connectJobOperations);
}

private void SubmitAndWaitForConnect(List<IThrottleOperation> connectJobOperations)
private static void SubmitAndWaitForConnect(List<IThrottleOperation> connectJobOperations)
{
using (ThrottleManager connectThrottleManager = new ThrottleManager())
{
Expand Down Expand Up @@ -4122,7 +4122,7 @@ private Pipeline DrainAndBlockRemoteOutput()
return null;
}

private void RestoreRemoteOutput(Pipeline runningCmd)
private static void RestoreRemoteOutput(Pipeline runningCmd)
{
if (runningCmd != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ private List<Job2> GetFilteredJobs(
/// <param name="sourceAdapter"></param>
/// <param name="jobSourceAdapterTypes"></param>
/// <returns></returns>
private bool CheckTypeNames(JobSourceAdapter sourceAdapter, string[] jobSourceAdapterTypes)
private static bool CheckTypeNames(JobSourceAdapter sourceAdapter, string[] jobSourceAdapterTypes)
{
// If no type names were specified then allow all adapter types.
if (jobSourceAdapterTypes == null ||
Expand All @@ -641,7 +641,7 @@ private bool CheckTypeNames(JobSourceAdapter sourceAdapter, string[] jobSourceAd
return false;
}

private string GetAdapterName(JobSourceAdapter sourceAdapter)
private static string GetAdapterName(JobSourceAdapter sourceAdapter)
{
return (!string.IsNullOrEmpty(sourceAdapter.Name) ?
sourceAdapter.Name :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ internal PSCommand CreatePsCommand(string line, bool isScript, bool? useNewScope
/// <summary>
/// Creates the PSCommand when the runspace is not overridden.
/// </summary>
private PSCommand CreatePsCommandNotOverridden(string line, bool isScript, bool? useNewScope)
private static PSCommand CreatePsCommandNotOverridden(string line, bool isScript, bool? useNewScope)
{
PSCommand command = new PSCommand();

Expand Down Expand Up @@ -407,7 +407,7 @@ private void StartProgressBar(
}
}

private void StopProgressBar(
private static void StopProgressBar(
long sourceId)
{
s_RCProgress.StopProgress(sourceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ private void DoFatal(object sender, RemoteSessionStateMachineEventArgs eventArgs

#endregion Event Handlers

private void CleanAll()
private static void CleanAll()
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ private string GetTransportName()
/// </summary>
/// <param name="shell">Shell configuration name.</param>
/// <returns>Display shell name.</returns>
private string GetDisplayShellName(string shell)
private static string GetDisplayShellName(string shell)
{
string shellPrefix = System.Management.Automation.Remoting.Client.WSManNativeApi.ResourceURIPrefix;
int index = shell.IndexOf(shellPrefix, StringComparison.OrdinalIgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ protected override void EndProcessing()
/// 1. New shell successfully registered. However cannot delete temporary plugin file {0}.
/// Reason for failure: {1}.
/// </exception>
private void DeleteFile(string tmpFileName)
private static void DeleteFile(string tmpFileName)
{
Dbg.Assert(!string.IsNullOrEmpty(tmpFileName), "tmpFile cannot be null or empty.");

Expand Down Expand Up @@ -693,7 +693,7 @@ private void DeleteFile(string tmpFileName)
/// 2. Cannot write shell configuration data into temporary file {0}. Try again.
/// Reason for failure: {1}.
/// </exception>
private string ConstructTemporaryFile(string pluginContent)
private static string ConstructTemporaryFile(string pluginContent)
{
// Path.GetTempFileName creates a temporary file whereas GetRandomFileName does not.
string tmpFileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()) + "psshell.xml";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private bool CheckForDebuggableJob()
return debuggableJobFound;
}

private bool GetJobDebuggable(Job job)
private static bool GetJobDebuggable(Job job)
{
if (job is IJobDebugger)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ private bool ValidateIdleTimeout(PSSession session)
return true;
}

private string GetLocalhostWithNetworkAccessEnabled(Dictionary<Guid, PSSession> psSessions)
private static string GetLocalhostWithNetworkAccessEnabled(Dictionary<Guid, PSSession> psSessions)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private Runspace CreateNamedPipeRunspace(NamedPipeConnectionInfo connectionInfo)
return remoteRunspace;
}

private void PrepareRunspace(Runspace runspace)
private static void PrepareRunspace(Runspace runspace)
{
string promptFn = StringUtil.Format(RemotingErrorIdStrings.EnterPSHostProcessPrompt,
@"function global:prompt { """,
Expand Down Expand Up @@ -574,7 +574,7 @@ protected override void EndProcessing()

#region Private Methods

private int[] GetProcIdsFromProcs(Process[] processes)
private static int[] GetProcIdsFromProcs(Process[] processes)
{
List<int> returnIds = new List<int>();
foreach (Process process in processes)
Expand All @@ -585,7 +585,7 @@ private int[] GetProcIdsFromProcs(Process[] processes)
return returnIds.ToArray();
}

private int[] GetProcIdsFromNames(string[] names)
private static int[] GetProcIdsFromNames(string[] names)
{
if ((names == null) || (names.Length == 0))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ private void StartProgressBar(
this.Host);
}

private void StopProgressBar(
private static void StopProgressBar(
long sourceId)
{
s_RCProgress.StopProgress(sourceId);
Expand Down Expand Up @@ -1954,7 +1954,7 @@ private void DetermineThrowStatementBehavior()
/// Process the stream object before writing it in the specified collection.
/// </summary>
/// <param name="streamObject">Stream object to process.</param>
private void PreProcessStreamObject(PSStreamObject streamObject)
private static void PreProcessStreamObject(PSStreamObject streamObject)
{
ErrorRecord errorRecord = streamObject.Value as ErrorRecord;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ internal Pipeline CreatePipeline(RemoteRunspace remoteRunspace)
/// <summary>
/// Check the powershell version of the remote server.
/// </summary>
private string GetRemoteServerPsVersion(RemoteRunspace remoteRunspace)
private static string GetRemoteServerPsVersion(RemoteRunspace remoteRunspace)
{
if (remoteRunspace.ConnectionInfo is NewProcessConnectionInfo)
{
Expand Down Expand Up @@ -2427,7 +2427,7 @@ private List<object> GetUsingVariableValues(List<VariableExpressionAst> paramUsi
/// </summary>
/// <param name="localScriptBlock"></param>
/// <returns>A list of UsingExpressionAsts ordered by the StartOffset.</returns>
private List<VariableExpressionAst> GetUsingVariables(ScriptBlock localScriptBlock)
private static List<VariableExpressionAst> GetUsingVariables(ScriptBlock localScriptBlock)
{
if (localScriptBlock == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ private RemoteRunspace GetRunspaceForVMSession()
/// <summary>
/// Create temporary remote runspace.
/// </summary>
private RemoteRunspace CreateTemporaryRemoteRunspaceForPowerShellDirect(PSHost host, RunspaceConnectionInfo connectionInfo)
private static RemoteRunspace CreateTemporaryRemoteRunspaceForPowerShellDirect(PSHost host, RunspaceConnectionInfo connectionInfo)
{
// Create and open the runspace.
TypeTable typeTable = TypeTable.LoadDefaultTypeFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ private void ConnectSessionToJob(PSSession session, PSRemotingJob job = null)
/// <param name="session">Session to connect.</param>
/// <param name="ex">Optional exception object.</param>
/// <returns>Connected session or null.</returns>
private PSSession ConnectSession(PSSession session, out Exception ex)
private static PSSession ConnectSession(PSSession session, out Exception ex)
{
ex = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ internal List<Job> FindJobsMatchingByFilter(bool writeobject)
/// <param name="matches"></param>
/// <param name="jobsToSearch"></param>
/// <returns></returns>
private bool FindJobsMatchingByFilterHelper(List<Job> matches, List<Job> jobsToSearch)
private static bool FindJobsMatchingByFilterHelper(List<Job> matches, List<Job> jobsToSearch)
{
// check that filter only has job properties
// if so, filter on one at a time using helpers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal Indexer(int[] lengths)
/// Check lengths non negative.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
private bool CheckLengthsNonNegative(int[] lengths)
private static bool CheckLengthsNonNegative(int[] lengths)
{
for (int i = 0; i < lengths.Length; ++i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ internal RemoteSessionNamedPipeServer(
/// <param name="coreName">Named pipe core name.</param>
/// <param name="securityDesc"></param>
/// <returns>NamedPipeServerStream.</returns>
private NamedPipeServerStream CreateNamedPipe(
private static NamedPipeServerStream CreateNamedPipe(
string serverName,
string namespaceName,
string coreName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ internal override BaseClientSessionTransportManager CreateClientSessionTransport

#region Private Methods

private string ResolveShellUri(string shell)
private static string ResolveShellUri(string shell)
{
string resolvedShellUri = shell;
if (string.IsNullOrEmpty(resolvedShellUri))
Expand Down Expand Up @@ -3493,7 +3493,7 @@ private void GetContainerPropertiesInternal()
/// <summary>
/// Run some tasks on MTA thread if needed.
/// </summary>
private void RunOnMTAThread(ThreadStart threadProc)
private static void RunOnMTAThread(ThreadStart threadProc)
{
if (Thread.CurrentThread.GetApartmentState() == ApartmentState.MTA)
{
Expand All @@ -3512,7 +3512,7 @@ private void RunOnMTAThread(ThreadStart threadProc)
/// <summary>
/// Get error message from the thrown exception.
/// </summary>
private string GetErrorMessageFromException(Exception e)
private static string GetErrorMessageFromException(Exception e)
{
string errorMessage = e.Message;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ internal void ExecuteVoidMethod(PSHost clientHost)
/// <summary>
/// Get remote runspace to close.
/// </summary>
private RemoteRunspace GetRemoteRunspaceToClose(PSHost clientHost)
private static RemoteRunspace GetRemoteRunspaceToClose(PSHost clientHost)
{
// Figure out if we need to close the remote runspace. Return null if we don't.

Expand Down Expand Up @@ -440,7 +440,7 @@ internal Collection<RemoteHostCall> PerformSecurityChecksOnHostMessage(string co
/// </summary>
/// <param name="caption">Caption to modify.</param>
/// <returns>New modified caption.</returns>
private string ModifyCaption(string caption)
private static string ModifyCaption(string caption)
{
string pscaption = CredUI.PromptForCredential_DefaultCaption;

Expand All @@ -465,7 +465,7 @@ private string ModifyCaption(string caption)
/// <param name="computerName">computername to include in the
/// message</param>
/// <returns>Message which contains a warning as well.</returns>
private string ModifyMessage(string message, string computerName)
private static string ModifyMessage(string message, string computerName)
{
string modifiedMessage = PSRemotingErrorInvariants.FormatResourceString(
RemotingErrorIdStrings.RemoteHostPromptForCredentialModifiedMessage,
Expand All @@ -485,7 +485,7 @@ private string ModifyMessage(string message, string computerName)
/// <param name="resourceString">Resource string to use.</param>
/// <returns>A constructed remote host call message
/// which will display the warning.</returns>
private RemoteHostCall ConstructWarningMessageForSecureString(string computerName,
private static RemoteHostCall ConstructWarningMessageForSecureString(string computerName,
string resourceString)
{
string warning = PSRemotingErrorInvariants.FormatResourceString(
Expand All @@ -506,7 +506,7 @@ private RemoteHostCall ConstructWarningMessageForSecureString(string computerNam
/// in warning</param>
/// <returns>A constructed remote host call message
/// which will display the warning.</returns>
private RemoteHostCall ConstructWarningMessageForGetBufferContents(string computerName)
private static RemoteHostCall ConstructWarningMessageForGetBufferContents(string computerName)
{
string warning = PSRemotingErrorInvariants.FormatResourceString(
RemotingErrorIdStrings.RemoteHostGetBufferContents,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private void SerializeHeader(Stream streamToWriteTo)
return;
}

private void SerializeUInt(uint data, Stream streamToWriteTo)
private static void SerializeUInt(uint data, Stream streamToWriteTo)
{
Dbg.Assert(streamToWriteTo != null, "stream to write to cannot be null");

Expand Down Expand Up @@ -241,7 +241,7 @@ private static uint DeserializeUInt(Stream serializedDataStream)
return result;
}

private void SerializeGuid(Guid guid, Stream streamToWriteTo)
private static void SerializeGuid(Guid guid, Stream streamToWriteTo)
{
Dbg.Assert(streamToWriteTo != null, "stream to write to cannot be null");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ internal void EnqueueAndStartProcessingThread(RemoteDataObject<PSObject> remoteO
/// </summary>
/// <param name="remoteObject">Remote data object.</param>
/// <returns>True if remote data object requires a user response.</returns>
private bool CheckForInteractiveHostCall(RemoteDataObject<PSObject> remoteObject)
private static bool CheckForInteractiveHostCall(RemoteDataObject<PSObject> remoteObject)
{
bool interactiveHostCall = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void Update(string optionName, string optionValue)
/// <exception cref="ArgumentException">
/// 1. "optionName" is already defined
/// </exception>
private void AssertValueNotAssigned(string optionName, object originalValue)
private static void AssertValueNotAssigned(string optionName, object originalValue)
{
if (originalValue != null)
{
Expand Down Expand Up @@ -1896,7 +1896,7 @@ private void MergeConfigHashIntoConfigHash(IDictionary childConfigHash)
}
}

private string GetRoleCapabilityPath(string roleCapability)
private static string GetRoleCapabilityPath(string roleCapability)
{
string moduleName = "*";
if (roleCapability.Contains('\\'))
Expand Down Expand Up @@ -2620,7 +2620,7 @@ private static void ProcessVisibleCommand(InitialSessionState iss, string comman
/// <summary>
/// Creates an alias entry.
/// </summary>
private SessionStateAliasEntry CreateSessionStateAliasEntry(Hashtable alias, bool isAliasVisibilityDefined)
private static SessionStateAliasEntry CreateSessionStateAliasEntry(Hashtable alias, bool isAliasVisibilityDefined)
{
string name = TryGetValue(alias, ConfigFileConstants.AliasNameToken);

Expand Down Expand Up @@ -2660,7 +2660,7 @@ private SessionStateAliasEntry CreateSessionStateAliasEntry(Hashtable alias, boo
/// Creates a function entry.
/// </summary>
/// <returns></returns>
private SessionStateFunctionEntry CreateSessionStateFunctionEntry(Hashtable function, bool isFunctionVisibilityDefined)
private static SessionStateFunctionEntry CreateSessionStateFunctionEntry(Hashtable function, bool isFunctionVisibilityDefined)
{
string name = TryGetValue(function, ConfigFileConstants.FunctionNameToken);

Expand Down Expand Up @@ -2700,7 +2700,7 @@ private SessionStateFunctionEntry CreateSessionStateFunctionEntry(Hashtable func
/// <summary>
/// Creates a variable entry.
/// </summary>
private SessionStateVariableEntry CreateSessionStateVariableEntry(Hashtable variable, PSLanguageMode languageMode)
private static SessionStateVariableEntry CreateSessionStateVariableEntry(Hashtable variable, PSLanguageMode languageMode)
{
string name = TryGetValue(variable, ConfigFileConstants.VariableNameToken);

Expand Down
Loading