diff --git a/Drill/Core/SearchQueue.cs b/Drill/Core/SearchQueue.cs index 675ede16..49c847c4 100644 --- a/Drill/Core/SearchQueue.cs +++ b/Drill/Core/SearchQueue.cs @@ -22,6 +22,7 @@ internal class SearchQueue : IEnumerable readonly string searchString; readonly static string UserName = Environment.UserName; + HashSet visited = []; static SearchQueue() @@ -82,6 +83,18 @@ public void Add(DirectoryInfo item) public static SearchPriority GetDirectoryPriority(DirectoryInfo sub, string searchString) { + // all main drives are important besides C: + if (sub.Parent == null) + { + // all folders in C: are generally useless + if (sub.FullName == "C:\\") + return SearchPriority.Low; + return SearchPriority.High; + } + + + + if ( // all hidden folders sub.Name.StartsWith(".") @@ -96,8 +109,6 @@ public static SearchPriority GetDirectoryPriority(DirectoryInfo sub, string sear || sub.FullName.ToLower() == "cache" // often full of garbage || sub.FullName.StartsWith($"C:\\Users\\{UserName}\\AppData") - // all folders in C: are generally useless - || (sub.Parent != null && sub.Parent.FullName == "C:\\") // If the folder is deep inside an hidden folder || sub.FullName.Contains(Path.DirectorySeparatorChar + ".") ) @@ -117,8 +128,6 @@ public static SearchPriority GetDirectoryPriority(DirectoryInfo sub, string sear StringUtils.TokenMatching(searchString, sub.Name) // user folder || sub.FullName == $"C:\\Users\\{UserName}" - // all main drives - || (sub.Parent == null) // all folders in the user folder || sub.Parent != null && sub.Parent.FullName == $"C:\\Users\\{UserName}" // english dictionary @@ -129,8 +138,22 @@ public static SearchPriority GetDirectoryPriority(DirectoryInfo sub, string sear return SearchPriority.High; } + // If folder contains the username it's generally very important + if (sub.Name.ToLower().Contains(UserName.ToLower())) + { + return SearchPriority.High; + } + // If name is long and does not contain spaces or separating characters it's generally something from a tool + if (sub.Name.Length > 16 && !sub.Name.Contains("-") && !sub.Name.Contains(" ") && !sub.Name.Contains("_")) + { + return SearchPriority.High; + } + // Priority is normal if heuristics has no idea what to do +#if DEBUG + // TODO: log here +#endif return SearchPriority.Normal; } diff --git a/Drill/Drill.csproj b/Drill/Drill.csproj index 6a88f95f..5fe97cd6 100644 --- a/Drill/Drill.csproj +++ b/Drill/Drill.csproj @@ -67,7 +67,15 @@ - en-US;en + en-US;en + False + False + SHA256 + True + C:\Users\yatima\Desktop\DrillTest + True + True + 0 diff --git a/Drill/Drill.csproj.user b/Drill/Drill.csproj.user index 69d16fad..6df0f4e2 100644 --- a/Drill/Drill.csproj.user +++ b/Drill/Drill.csproj.user @@ -2,5 +2,9 @@ net8.0-windows10.0.19041.0 + SideloadOnly + False + x64 + False \ No newline at end of file