File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -445,6 +445,49 @@ public void Open(string parameter) {
445445 }
446446 }
447447 }
448+ public void OpenAny ( string parameter )
449+ {
450+ string fileLocation = MainProgram . shortcutLocation ;
451+ Regex rx = new Regex ( "^" + parameter + Regex . Escape ( "." ) + ".*" , RegexOptions . IgnoreCase ) ;
452+ if ( Directory . Exists ( fileLocation ) || Uri . IsWellFormedUriString ( fileLocation , UriKind . Absolute ) )
453+ {
454+ DirectoryInfo d = new DirectoryInfo ( fileLocation ) ;
455+ bool opened = false ;
456+ foreach ( var dirFile in d . GetFiles ( ) )
457+ {
458+ if ( ! MainProgram . testingAction )
459+ {
460+ bool result = rx . IsMatch ( dirFile . Name ) ;
461+ if ( result )
462+ {
463+ Process . Start ( dirFile . FullName ) ;
464+ opened = true ;
465+ break ;
466+ }
467+ }
468+ }
469+ if ( ! opened )
470+ {
471+ Error ( "File(" + parameter + ") doesn't exist at" + " (" + fileLocation + ")" ) ;
472+ }
473+ else
474+ {
475+ if ( ! MainProgram . testingAction )
476+ {
477+ successMessage = "OPEN: opened " + parameter ;
478+ }
479+ else
480+ {
481+ successMessage = "OPEN: simulated opening " + parameter ;
482+ }
483+ }
484+
485+ }
486+ else
487+ {
488+ Error ( "Directory doesn't exist (" + fileLocation + ")" ) ;
489+ }
490+ }
448491 public void OpenAll ( string parameter ) {
449492 string fileLocation = ( ! parameter . Contains ( @":\" ) || ! parameter . Contains ( @":/" ) ) ? Path . Combine ( MainProgram . shortcutLocation , parameter ) : parameter ;
450493
You can’t perform that action at this time.
0 commit comments