Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Re-organizing method structure
Browse files Browse the repository at this point in the history
  • Loading branch information
StrangeRanger committed Mar 23, 2024
1 parent 00cae57 commit 5315779
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions ActiveDirectoryQuerier/PowerShell/PSExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,6 @@ public PSExecutor()
_powerShell.Commands.Clear();
}

private void AssembleFullCommand(Command psCommand, OutputFormat outputFormat)
{
ArgumentNullException.ThrowIfNull(psCommand);

_powerShell.Commands.AddCommand(psCommand.CommandText);

foreach (var parameter in psCommand.Parameters)
{
_powerShell.Commands.AddParameter(parameter.Name, parameter.Value);
}

if (outputFormat == OutputFormat.Csv)
{
_powerShell.Commands.AddCommand("ConvertTo-Csv").AddParameter("NoTypeInformation");
}
}

public PSOutput Execute(Command psCommand, OutputFormat outputFormat = OutputFormat.Text)
{
try
Expand Down Expand Up @@ -71,6 +54,23 @@ public async Task<PSOutput> ExecuteAsync(Command command, OutputFormat outputFor
return HandleExecutionException(exception);
}
}

private void AssembleFullCommand(Command psCommand, OutputFormat outputFormat)
{
ArgumentNullException.ThrowIfNull(psCommand);

_powerShell.Commands.AddCommand(psCommand.CommandText);

foreach (var parameter in psCommand.Parameters)
{
_powerShell.Commands.AddParameter(parameter.Name, parameter.Value);
}

if (outputFormat == OutputFormat.Csv)
{
_powerShell.Commands.AddCommand("ConvertTo-Csv").AddParameter("NoTypeInformation");
}
}

private PSOutput ProcessExecutionResults(IEnumerable<PSObject> results)
{
Expand Down

0 comments on commit 5315779

Please sign in to comment.