14
14
15
15
namespace Tetron . Mim . SynchronisationScheduler
16
16
{
17
- internal class Program
17
+ internal static class Program
18
18
{
19
19
#region accessors
20
20
/// <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.
22
22
/// </summary>
23
23
private static bool ManagementAgentImportsHadChanges { get ; set ; }
24
24
private static bool InWhatIfMode { get ; set ; }
@@ -262,7 +262,7 @@ private static void ExecuteSchedule(Schedule schedule)
262
262
{
263
263
// thought: should the scheduler run continuously for a set period and try and run the supplied schedule
264
264
// 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.
266
266
267
267
// process:
268
268
// -- run non-block tasks in parallel.
@@ -496,7 +496,7 @@ private static bool ExecutePowerShellScript(string scriptPath)
496
496
shell . AddCommand ( "Set-ExecutionPolicy" ) . AddArgument ( "Unrestricted" ) . AddParameter ( "Scope" , "CurrentUser" ) ;
497
497
shell . Commands . AddScript ( scriptPath ) ;
498
498
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
500
500
shell . Streams . Debug . DataAdded += PowerShellDebugStreamHandler ;
501
501
shell . Streams . Verbose . DataAdded += PowerShellVerboseStreamHandler ;
502
502
shell . Streams . Information . DataAdded += PowerShellInformationStreamHandler ;
@@ -507,7 +507,7 @@ private static bool ExecutePowerShellScript(string scriptPath)
507
507
if ( results == null || results . Count == 0 )
508
508
return true ;
509
509
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,
511
511
// but we might still want to inspect the output in the future, so leaving this logging in.
512
512
foreach ( var result in results )
513
513
Log . Debug ( $ "{ LoggingPrefix } PowerShell output: { result } ") ;
@@ -778,14 +778,14 @@ private static void PowerShellWarningStreamHandler(object sender, DataAddedEvent
778
778
779
779
private static void PowerShellErrorStreamHandler ( object sender , DataAddedEventArgs ea )
780
780
{
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 } " ) ;
789
789
}
790
790
791
791
private static void VbsErrorDataReceivedHandler ( object sender , DataReceivedEventArgs e )
0 commit comments