mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
change strings to Constants
This commit is contained in:
parent
0c53d76fec
commit
758b565f01
4 changed files with 13 additions and 14 deletions
|
|
@ -14,9 +14,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
|
|
||||||
internal const string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
|
internal const string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
|
||||||
|
|
||||||
internal static readonly char[] SpecialSearchChars = new char[]
|
internal const char AllFilesFolderSearchWildcard = '>';
|
||||||
{
|
|
||||||
'?', '*', '>'
|
internal const char DirectorySeperator = '\\';
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo
|
||||||
{
|
{
|
||||||
var criteria = ConstructSearchCriteria(search);
|
var criteria = ConstructSearchCriteria(search);
|
||||||
|
|
||||||
if (search.LastIndexOf('>') > search.LastIndexOf('\\'))
|
if (search.LastIndexOf(Constants.AllFilesFolderSearchWildcard) > search.LastIndexOf(Constants.DirectorySeperator))
|
||||||
return DirectorySearch(SearchOption.AllDirectories, query, search, criteria);
|
return DirectorySearch(SearchOption.AllDirectories, query, search, criteria);
|
||||||
|
|
||||||
return DirectorySearch(SearchOption.TopDirectoryOnly, query, search, criteria);
|
return DirectorySearch(SearchOption.TopDirectoryOnly, query, search, criteria);
|
||||||
|
|
@ -31,13 +31,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo
|
||||||
{
|
{
|
||||||
string incompleteName = "";
|
string incompleteName = "";
|
||||||
|
|
||||||
if (!search.EndsWith("\\"))
|
if (!search.EndsWith(Constants.DirectorySeperator))
|
||||||
{
|
{
|
||||||
var indexOfSeparator = search.LastIndexOf('\\');
|
var indexOfSeparator = search.LastIndexOf(Constants.DirectorySeperator);
|
||||||
|
|
||||||
incompleteName = search.Substring(indexOfSeparator + 1).ToLower();
|
incompleteName = search.Substring(indexOfSeparator + 1).ToLower();
|
||||||
|
|
||||||
if (incompleteName.StartsWith('>'))
|
if (incompleteName.StartsWith(Constants.AllFilesFolderSearchWildcard))
|
||||||
incompleteName = "*" + incompleteName.Substring(1);
|
incompleteName = "*" + incompleteName.Substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string changeTo = path.EndsWith("\\") ? path : path + "\\";
|
string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
|
||||||
Main.Context.API.ChangeQuery(string.IsNullOrEmpty(query.ActionKeyword) ?
|
Main.Context.API.ChangeQuery(string.IsNullOrEmpty(query.ActionKeyword) ?
|
||||||
changeTo :
|
changeTo :
|
||||||
query.ActionKeyword + " " + changeTo);
|
query.ActionKeyword + " " + changeTo);
|
||||||
|
|
@ -56,7 +56,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
folderName = folderName.TrimEnd('\\').Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
|
folderName = folderName.TrimEnd(Constants.DirectorySeperator).Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstResult = "";
|
var firstResult = "";
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
||||||
|
|
||||||
private string QueryWhereRestrictionsFromLocationPath(string path, string searchDepth)
|
private string QueryWhereRestrictionsFromLocationPath(string path, string searchDepth)
|
||||||
{
|
{
|
||||||
if (path.EndsWith("\\"))
|
if (path.EndsWith(Constants.DirectorySeperator))
|
||||||
return searchDepth + $"{path}'";
|
return searchDepth + $"{path}'";
|
||||||
|
|
||||||
var indexOfSeparator = path.LastIndexOf('\\');
|
var indexOfSeparator = path.LastIndexOf(Constants.DirectorySeperator);
|
||||||
|
|
||||||
var itemName = path.Substring(indexOfSeparator + 1);
|
var itemName = path.Substring(indexOfSeparator + 1);
|
||||||
|
|
||||||
if (itemName.StartsWith('>'))
|
if (itemName.StartsWith(Constants.AllFilesFolderSearchWildcard))
|
||||||
itemName = itemName.Substring(1);
|
itemName = itemName.Substring(1);
|
||||||
|
|
||||||
var previousLevelDirectory = path.Substring(0, indexOfSeparator);
|
var previousLevelDirectory = path.Substring(0, indexOfSeparator);
|
||||||
|
|
@ -95,7 +95,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
||||||
{
|
{
|
||||||
string query = "SELECT TOP " + _settings.MaxResult + $" {CreateBaseQuery().QuerySelectColumns} FROM {SystemIndex} WHERE ";
|
string query = "SELECT TOP " + _settings.MaxResult + $" {CreateBaseQuery().QuerySelectColumns} FROM {SystemIndex} WHERE ";
|
||||||
|
|
||||||
if (path.IndexOfAny(Constants.SpecialSearchChars) >= 0)
|
if (path.LastIndexOf(Constants.AllFilesFolderSearchWildcard) > path.LastIndexOf(Constants.DirectorySeperator))
|
||||||
return query + QueryWhereRestrictionsForTopLevelDirectoryAllFilesAndFoldersSearch(path);
|
return query + QueryWhereRestrictionsForTopLevelDirectoryAllFilesAndFoldersSearch(path);
|
||||||
|
|
||||||
return query + QueryWhereRestrictionsForTopLevelDirectorySearch(path);
|
return query + QueryWhereRestrictionsForTopLevelDirectorySearch(path);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue