Skip to content

Commit eeed153

Browse files
committed
Minor improvements
1 parent 174eb12 commit eeed153

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Program.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
namespace Tetron.Mim.SynchronisationScheduler
1616
{
17-
internal class Program
17+
internal static class Program
1818
{
1919
#region accessors
2020
/// <summary>
21-
/// Indicates whether or not any management agents that have run imports have resulted in any pending imports to the Metaverse.
21+
/// Indicates whether any management agents that have run imports have resulted in any pending imports to the Metaverse.
2222
/// </summary>
2323
private static bool ManagementAgentImportsHadChanges { get; set; }
2424
private static bool InWhatIfMode { get; set; }
@@ -262,7 +262,7 @@ private static void ExecuteSchedule(Schedule schedule)
262262
{
263263
// thought: should the scheduler run continuously for a set period and try and run the supplied schedule
264264
// as often as possible, whilst respecting an optional minimal interval period, or leave it up to a Windows Scheduled Task
265-
// to call the scheduler every now and then? Going with the latter for now.
265+
// to call the scheduler sometimes? Going with the latter for now.
266266

267267
// process:
268268
// -- run non-block tasks in parallel.
@@ -496,7 +496,7 @@ private static bool ExecutePowerShellScript(string scriptPath)
496496
shell.AddCommand("Set-ExecutionPolicy").AddArgument("Unrestricted").AddParameter("Scope", "CurrentUser");
497497
shell.Commands.AddScript(scriptPath);
498498

499-
// we need to subscribe to these event handlers so we can get progress of the PowerShell script out into our logs
499+
// we need to subscribe to these event handlers, so we can get progress of the PowerShell script out into our logs
500500
shell.Streams.Debug.DataAdded += PowerShellDebugStreamHandler;
501501
shell.Streams.Verbose.DataAdded += PowerShellVerboseStreamHandler;
502502
shell.Streams.Information.DataAdded += PowerShellInformationStreamHandler;
@@ -507,7 +507,7 @@ private static bool ExecutePowerShellScript(string scriptPath)
507507
if (results == null || results.Count == 0)
508508
return true;
509509

510-
// we used to watch for a 'success' response, but this isn't required anymore
510+
// we used to watch for a 'success' response, but this isn't required anymore,
511511
// but we might still want to inspect the output in the future, so leaving this logging in.
512512
foreach (var result in results)
513513
Log.Debug($"{LoggingPrefix}PowerShell output: {result}");
@@ -778,14 +778,14 @@ private static void PowerShellWarningStreamHandler(object sender, DataAddedEvent
778778

779779
private static void PowerShellErrorStreamHandler(object sender, DataAddedEventArgs ea)
780780
{
781-
if (sender is PSDataCollection<ErrorRecord> streamObjectsReceived)
782-
{
783-
var currentStreamRecord = streamObjectsReceived[ea.Index];
784-
if (currentStreamRecord.ErrorDetails != null)
785-
Log.Error(currentStreamRecord.Exception, $"{LoggingPrefix}PowerShell: {currentStreamRecord.ErrorDetails.Message}");
786-
else
787-
Log.Error(currentStreamRecord.Exception, $"{LoggingPrefix}PowerShell: {currentStreamRecord.Exception.Message}");
788-
}
781+
if (!(sender is PSDataCollection<ErrorRecord> streamObjectsReceived))
782+
return;
783+
784+
var currentStreamRecord = streamObjectsReceived[ea.Index];
785+
Log.Error(currentStreamRecord.Exception,
786+
currentStreamRecord.ErrorDetails != null
787+
? $"{LoggingPrefix}PowerShell: {currentStreamRecord.ErrorDetails.Message}"
788+
: $"{LoggingPrefix}PowerShell: {currentStreamRecord.Exception.Message}");
789789
}
790790

791791
private static void VbsErrorDataReceivedHandler(object sender, DataReceivedEventArgs e)

0 commit comments

Comments
 (0)