@@ -504,10 +504,10 @@ private static WinGetData ReadDataForRange1(string[] output)
504504 }
505505
506506 List < WinGetInfoEntry > directories = new ( ) ;
507- string [ ] logsEntry = output [ 7 ] . Split ( ':' ) ;
508- if ( logsEntry . Length == 2 )
507+ WinGetInfoEntry ? logs = ReadSingleEntry ( output , 7 ) ;
508+ if ( logs != null )
509509 {
510- directories . Add ( new WinGetInfoEntry ( logsEntry [ 0 ] . Trim ( ) , logsEntry [ 1 ] . Trim ( ) ) ) ;
510+ directories . Add ( logs ) ;
511511 }
512512
513513 // Remove unnasesary range from output
@@ -536,16 +536,16 @@ private static WinGetData ReadDataForRange2(string[] output)
536536 }
537537
538538 List < WinGetInfoEntry > directories = new ( ) ;
539- string [ ] logsEntry = output [ 7 ] . Split ( ':' ) ;
540- if ( logsEntry . Length == 2 )
539+ WinGetInfoEntry ? logs = ReadSingleEntry ( output , 7 ) ;
540+ if ( logs != null )
541541 {
542- directories . Add ( new WinGetInfoEntry ( logsEntry [ 0 ] . Trim ( ) , logsEntry [ 1 ] . Trim ( ) ) ) ;
542+ directories . Add ( logs ) ;
543543 }
544544
545- string [ ] userSettingsEntry = output [ 9 ] . Split ( ':' ) ;
546- if ( userSettingsEntry . Length == 2 )
545+ WinGetInfoEntry ? userSettings = ReadSingleEntry ( output , 9 ) ;
546+ if ( userSettings != null )
547547 {
548- directories . Add ( new WinGetInfoEntry ( userSettingsEntry [ 0 ] . Trim ( ) , userSettingsEntry [ 1 ] . Trim ( ) ) ) ;
548+ directories . Add ( userSettings ) ;
549549 }
550550
551551 // Remove unnasesary range from output
@@ -574,16 +574,16 @@ private static WinGetData ReadDataForRange3(string[] output)
574574 }
575575
576576 List < WinGetInfoEntry > directories = new ( ) ;
577- string [ ] logsEntry = output [ 7 ] . Split ( ':' ) ;
578- if ( logsEntry . Length == 2 )
577+ WinGetInfoEntry ? logs = ReadSingleEntry ( output , 7 ) ;
578+ if ( logs != null )
579579 {
580- directories . Add ( new WinGetInfoEntry ( logsEntry [ 0 ] . Trim ( ) , logsEntry [ 1 ] . Trim ( ) ) ) ;
580+ directories . Add ( logs ) ;
581581 }
582582
583- string [ ] userSettingsEntry = output [ 9 ] . Split ( ':' ) ;
584- if ( userSettingsEntry . Length == 2 )
583+ WinGetInfoEntry ? userSettings = ReadSingleEntry ( output , 9 ) ;
584+ if ( userSettings != null )
585585 {
586- directories . Add ( new WinGetInfoEntry ( userSettingsEntry [ 0 ] . Trim ( ) , userSettingsEntry [ 1 ] . Trim ( ) ) ) ;
586+ directories . Add ( userSettings ) ;
587587 }
588588
589589 // Remove unnasesary range from output
@@ -634,6 +634,16 @@ private static WinGetData ReadDataForRange4(string[] output)
634634 return new WinGetData ( version , directories , links , adminSetting ) ;
635635 }
636636
637+ private static WinGetInfoEntry ? ReadSingleEntry ( string [ ] output , int index )
638+ {
639+ string [ ] entry = output [ index ] . Split ( ':' ) ;
640+ if ( entry . Length == 2 )
641+ {
642+ return new WinGetInfoEntry ( entry [ 0 ] . Trim ( ) , entry [ 1 ] . Trim ( ) ) ;
643+ }
644+ return null ;
645+ }
646+
637647 private static List < WinGetInfoEntry > ReadDirectories ( string [ ] output )
638648 {
639649 List < WinGetInfoEntry > directories = new ( ) ;
0 commit comments