From c5c15d2ab398173664d9b1c62c01640e46ead543 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 24 May 2020 19:18:58 +1000 Subject: [PATCH] Move IsLocationPathString method to FilesFolder class --- .../SharedCommands/FilesFolders.cs | 33 +++++++++++++++++++ .../Search/SearchManager.cs | 30 ----------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs index 17c2dc511..440ac6756 100644 --- a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs +++ b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs @@ -127,5 +127,38 @@ namespace Flow.Launcher.Plugin.SharedCommands #endif } } + + /// + /// This checks whether a given string is a directory path or network location string. + /// It does not check if location actually exists. + /// + public static bool IsLocationPathString(string querySearchString) + { + if (string.IsNullOrEmpty(querySearchString)) + return false; + + // // shared folder location, and not \\\location\ + if (querySearchString.Length >= 3 + && querySearchString.StartsWith(@"\\") + && char.IsLetter(querySearchString[2])) + return true; + + // c:\ + if (querySearchString.Length == 3 + && char.IsLetter(querySearchString[0]) + && querySearchString[1] == ':' + && querySearchString[2] == '\\') + return true; + + // c:\\ + if (querySearchString.Length >= 4 + && char.IsLetter(querySearchString[0]) + && querySearchString[1] == ':' + && querySearchString[2] == '\\' + && char.IsLetter(querySearchString[3])) + return true; + + return false; + } } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index e2e195f4d..1f2327e5c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -49,36 +49,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search } /// - /// This checks whether a given string is a directory path or network location string. - /// It does not check if location actually exists. - /// - public bool IsLocationPathString(string querySearchString) - { - if (string.IsNullOrEmpty(querySearchString)) - return false; - - // // shared folder location, and not \\\location\ - if (querySearchString.Length >= 3 - && querySearchString.StartsWith(@"\\") - && char.IsLetter(querySearchString[2])) - return true; - - // c:\ - if (querySearchString.Length == 3 - && char.IsLetter(querySearchString[0]) - && querySearchString[1] == ':' - && querySearchString[2] == '\\') - return true; - - // c:\\ - if (querySearchString.Length >= 4 - && char.IsLetter(querySearchString[0]) - && querySearchString[1] == ':' - && querySearchString[2] == '\\' - && char.IsLetter(querySearchString[3])) - return true; - - return false; } public List TopLevelFolderSearchBehaviour(