@@ -227,10 +227,7 @@ private static Win32 Win32Program(string path)
227
227
ProgramLogger . LogException ( $ "|Win32|Win32Program|{ path } " +
228
228
$ "|Permission denied when trying to load the program from { path } ", e ) ;
229
229
230
- return new Win32 ( )
231
- {
232
- Valid = false , Enabled = false
233
- } ;
230
+ return Default ;
234
231
}
235
232
}
236
233
@@ -308,9 +305,9 @@ private static Win32 UrlProgram(string path, string[] protocols)
308
305
{
309
306
return program ;
310
307
}
311
- foreach ( var protocol in protocols )
308
+ foreach ( var protocol in protocols )
312
309
{
313
- if ( url . StartsWith ( protocol ) )
310
+ if ( url . StartsWith ( protocol ) )
314
311
{
315
312
program . LnkResolvedPath = url ;
316
313
program . Valid = true ;
@@ -347,10 +344,7 @@ private static Win32 ExeProgram(string path)
347
344
ProgramLogger . LogException ( $ "|Win32|ExeProgram|{ path } " +
348
345
$ "|Permission denied when trying to load the program from { path } ", e ) ;
349
346
350
- return new Win32 ( )
351
- {
352
- Valid = false , Enabled = false
353
- } ;
347
+ return Default ;
354
348
}
355
349
}
356
350
@@ -361,7 +355,8 @@ private static IEnumerable<string> ProgramPaths(string directory, string[] suffi
361
355
362
356
return Directory . EnumerateFiles ( directory , "*" , new EnumerationOptions
363
357
{
364
- IgnoreInaccessible = true , RecurseSubdirectories = true
358
+ IgnoreInaccessible = true ,
359
+ RecurseSubdirectories = true
365
360
} ) . Where ( x => suffixes . Contains ( Extension ( x ) ) ) ;
366
361
}
367
362
@@ -542,6 +537,7 @@ public static Win32[] All(Settings settings)
542
537
var programs = Enumerable . Empty < Win32 > ( ) ;
543
538
var suffixes = settings . GetSuffixes ( ) ;
544
539
var protocols = settings . GetProtocols ( ) ;
540
+
545
541
var unregistered = UnregisteredPrograms ( settings . ProgramSources , suffixes , protocols ) ;
546
542
547
543
programs = programs . Concat ( unregistered ) ;
@@ -634,7 +630,7 @@ public static async Task MonitorDirectoryChangeAsync()
634
630
await Task . Run ( Main . IndexWin32Programs ) ;
635
631
}
636
632
}
637
-
633
+
638
634
public static void WatchDirectory ( string directory )
639
635
{
640
636
if ( ! Directory . Exists ( directory ) )
@@ -647,7 +643,7 @@ public static void WatchDirectory(string directory)
647
643
watcher . Deleted += static ( _ , _ ) => indexQueue . Writer . TryWrite ( default ) ;
648
644
watcher . EnableRaisingEvents = true ;
649
645
watcher . IncludeSubdirectories = true ;
650
-
646
+
651
647
Watchers . Add ( watcher ) ;
652
648
}
653
649
0 commit comments