From 79fd5dc7b1b03aa017bcac0b1299c981e4dd3b44 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Tue, 24 Mar 2020 16:07:17 -0700 Subject: [PATCH 1/5] Ported Indexer plugin to .net core 3 --- PowerToys.sln | 101 +++++++++++++- .../Wox.Plugin.Indexer.csproj | 91 ++----------- .../indexer/Images/WindowsIndexerImg.bmp | Bin 0 -> 3772 bytes src/modules/launcher/Plugins/indexer/Main.cs | 128 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 0 .../indexer/SearchHelper/DriveDetection.cs | 88 ++++++++++++ .../SearchHelper/IndexerExecutableInfo.cs | 66 +++++++++ .../indexer/SearchHelper/SearchResult.cs | 14 ++ .../indexer/SearchHelper/WindowsSearchAPI.cs | 99 ++++++++++++++ .../launcher/Plugins/indexer/Settings.cs | 23 ++++ .../launcher/Plugins/indexer/indexer.csproj | 87 ++++++++++++ .../packages.config | 0 .../plugin.json | 0 13 files changed, 614 insertions(+), 83 deletions(-) create mode 100644 src/modules/launcher/Plugins/indexer/Images/WindowsIndexerImg.bmp create mode 100644 src/modules/launcher/Plugins/indexer/Main.cs rename src/modules/launcher/Plugins/{Wox.Plugin.Indexer => indexer}/Properties/AssemblyInfo.cs (100%) create mode 100644 src/modules/launcher/Plugins/indexer/SearchHelper/DriveDetection.cs create mode 100644 src/modules/launcher/Plugins/indexer/SearchHelper/IndexerExecutableInfo.cs create mode 100644 src/modules/launcher/Plugins/indexer/SearchHelper/SearchResult.cs create mode 100644 src/modules/launcher/Plugins/indexer/SearchHelper/WindowsSearchAPI.cs create mode 100644 src/modules/launcher/Plugins/indexer/Settings.cs create mode 100644 src/modules/launcher/Plugins/indexer/indexer.csproj rename src/modules/launcher/Plugins/{Wox.Plugin.Indexer => indexer}/packages.config (100%) rename src/modules/launcher/Plugins/{Wox.Plugin.Indexer => indexer}/plugin.json (100%) diff --git a/PowerToys.sln b/PowerToys.sln index 04e19a418d..5a0ca04161 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -140,7 +140,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Infrastructure", "src\m EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Plugin", "src\modules\launcher\Wox.Plugin\Wox.Plugin.csproj", "{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Test", "src\modules\launcher\Wox.Test\Wox.Test.csproj", "{FF742965-9A80-41A5-B042-D6C7D3A21708}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Test", "src\modules\launcher\Wox.Test\Wox.Test.csproj", "{FF742965-9A80-41A5-B042-D6C7D3A21708}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{4AFC9975-2456-4C70-94A4-84073C1CED93}" EndProject @@ -154,150 +154,246 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Plugin.Folder", "src\mo EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wox.Launcher", "src\modules\launcher\Wox.Launcher\Wox.Launcher.vcxproj", "{E364F67B-BB12-4E91-B639-355866EBCD8B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Indexer", "src\modules\launcher\Plugins\Wox.Plugin.Indexer\Wox.Plugin.Indexer.csproj", "{63C3CEA8-51FE-472E-B97C-B58F8B17DD51}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "indexer", "src\modules\launcher\Plugins\Wox.Plugin.Indexer\indexer.csproj", "{63C3CEA8-51FE-472E-B97C-B58F8B17DD51}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Indexer", "src\modules\launcher\Plugins\Wox.Plugin.Indexer\Wox.Plugin.Indexer.csproj", "{8DD27FDE-7B2F-45D8-A148-3340205A7BEF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|Any CPU.ActiveCfg = Debug|x64 {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|x64.ActiveCfg = Debug|x64 {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|x64.Build.0 = Debug|x64 + {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Release|Any CPU.ActiveCfg = Release|x64 {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Release|x64.ActiveCfg = Release|x64 {9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Release|x64.Build.0 = Release|x64 + {74485049-C722-400F-ABE5-86AC52D929B3}.Debug|Any CPU.ActiveCfg = Debug|x64 {74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.ActiveCfg = Debug|x64 {74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.Build.0 = Debug|x64 + {74485049-C722-400F-ABE5-86AC52D929B3}.Release|Any CPU.ActiveCfg = Release|x64 {74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.ActiveCfg = Release|x64 {74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.Build.0 = Release|x64 + {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Debug|Any CPU.ActiveCfg = Debug|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Debug|x64.ActiveCfg = Debug|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Debug|x64.Build.0 = Debug|x64 + {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|Any CPU.ActiveCfg = Release|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|x64.ActiveCfg = Release|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|x64.Build.0 = Release|x64 + {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Debug|Any CPU.ActiveCfg = Debug|x64 {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Debug|x64.ActiveCfg = Debug|x64 {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Debug|x64.Build.0 = Debug|x64 + {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Release|Any CPU.ActiveCfg = Release|x64 {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Release|x64.ActiveCfg = Release|x64 {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Release|x64.Build.0 = Release|x64 + {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|Any CPU.ActiveCfg = Debug|x64 {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.ActiveCfg = Debug|x64 {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.Build.0 = Debug|x64 + {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|Any CPU.ActiveCfg = Release|x64 {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.ActiveCfg = Release|x64 {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.Build.0 = Release|x64 + {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Debug|Any CPU.ActiveCfg = Debug|x64 {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Debug|x64.ActiveCfg = Debug|x64 {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Debug|x64.Build.0 = Debug|x64 + {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Release|Any CPU.ActiveCfg = Release|x64 {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Release|x64.ActiveCfg = Release|x64 {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Release|x64.Build.0 = Release|x64 + {48804216-2A0E-4168-A6D8-9CD068D14227}.Debug|Any CPU.ActiveCfg = Debug|x64 {48804216-2A0E-4168-A6D8-9CD068D14227}.Debug|x64.ActiveCfg = Debug|x64 {48804216-2A0E-4168-A6D8-9CD068D14227}.Debug|x64.Build.0 = Debug|x64 + {48804216-2A0E-4168-A6D8-9CD068D14227}.Release|Any CPU.ActiveCfg = Release|x64 {48804216-2A0E-4168-A6D8-9CD068D14227}.Release|x64.ActiveCfg = Release|x64 {48804216-2A0E-4168-A6D8-9CD068D14227}.Release|x64.Build.0 = Release|x64 + {9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Debug|Any CPU.ActiveCfg = Debug|x64 {9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Debug|x64.ActiveCfg = Debug|x64 {9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Debug|x64.Build.0 = Debug|x64 + {9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Release|Any CPU.ActiveCfg = Release|x64 {9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Release|x64.ActiveCfg = Release|x64 {9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Release|x64.Build.0 = Release|x64 + {1A066C63-64B3-45F8-92FE-664E1CCE8077}.Debug|Any CPU.ActiveCfg = Debug|x64 {1A066C63-64B3-45F8-92FE-664E1CCE8077}.Debug|x64.ActiveCfg = Debug|x64 {1A066C63-64B3-45F8-92FE-664E1CCE8077}.Debug|x64.Build.0 = Debug|x64 + {1A066C63-64B3-45F8-92FE-664E1CCE8077}.Release|Any CPU.ActiveCfg = Release|x64 {1A066C63-64B3-45F8-92FE-664E1CCE8077}.Release|x64.ActiveCfg = Release|x64 {1A066C63-64B3-45F8-92FE-664E1CCE8077}.Release|x64.Build.0 = Release|x64 + {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Debug|Any CPU.ActiveCfg = Debug|x64 {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Debug|x64.ActiveCfg = Debug|x64 {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Debug|x64.Build.0 = Debug|x64 + {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|Any CPU.ActiveCfg = Release|x64 {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|x64.ActiveCfg = Release|x64 {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|x64.Build.0 = Release|x64 + {B25AC7A5-FB9F-4789-B392-D5C85E948670}.Debug|Any CPU.ActiveCfg = Debug|Win32 {B25AC7A5-FB9F-4789-B392-D5C85E948670}.Debug|x64.ActiveCfg = Debug|x64 {B25AC7A5-FB9F-4789-B392-D5C85E948670}.Debug|x64.Build.0 = Debug|x64 + {B25AC7A5-FB9F-4789-B392-D5C85E948670}.Release|Any CPU.ActiveCfg = Release|Win32 {B25AC7A5-FB9F-4789-B392-D5C85E948670}.Release|x64.ActiveCfg = Release|x64 {B25AC7A5-FB9F-4789-B392-D5C85E948670}.Release|x64.Build.0 = Release|x64 + {51920F1F-C28C-4ADF-8660-4238766796C2}.Debug|Any CPU.ActiveCfg = Debug|Win32 {51920F1F-C28C-4ADF-8660-4238766796C2}.Debug|x64.ActiveCfg = Debug|x64 {51920F1F-C28C-4ADF-8660-4238766796C2}.Debug|x64.Build.0 = Debug|x64 + {51920F1F-C28C-4ADF-8660-4238766796C2}.Release|Any CPU.ActiveCfg = Release|Win32 {51920F1F-C28C-4ADF-8660-4238766796C2}.Release|x64.ActiveCfg = Release|x64 {51920F1F-C28C-4ADF-8660-4238766796C2}.Release|x64.Build.0 = Release|x64 + {0E072714-D127-460B-AFAD-B4C40B412798}.Debug|Any CPU.ActiveCfg = Debug|x64 {0E072714-D127-460B-AFAD-B4C40B412798}.Debug|x64.ActiveCfg = Debug|x64 {0E072714-D127-460B-AFAD-B4C40B412798}.Debug|x64.Build.0 = Debug|x64 + {0E072714-D127-460B-AFAD-B4C40B412798}.Release|Any CPU.ActiveCfg = Release|x64 {0E072714-D127-460B-AFAD-B4C40B412798}.Release|x64.ActiveCfg = Release|x64 {0E072714-D127-460B-AFAD-B4C40B412798}.Release|x64.Build.0 = Release|x64 + {A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Debug|Any CPU.ActiveCfg = Debug|Win32 {A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Debug|x64.ActiveCfg = Debug|x64 {A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Debug|x64.Build.0 = Debug|x64 + {A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Release|Any CPU.ActiveCfg = Release|Win32 {A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Release|x64.ActiveCfg = Release|x64 {A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Release|x64.Build.0 = Release|x64 + {2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Debug|Any CPU.ActiveCfg = Debug|Win32 {2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Debug|x64.ActiveCfg = Debug|x64 {2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Debug|x64.Build.0 = Debug|x64 + {2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Release|Any CPU.ActiveCfg = Release|Win32 {2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Release|x64.ActiveCfg = Release|x64 {2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Release|x64.Build.0 = Release|x64 + {64A80062-4D8B-4229-8A38-DFA1D7497749}.Debug|Any CPU.ActiveCfg = Debug|x64 {64A80062-4D8B-4229-8A38-DFA1D7497749}.Debug|x64.ActiveCfg = Debug|x64 {64A80062-4D8B-4229-8A38-DFA1D7497749}.Debug|x64.Build.0 = Debug|x64 + {64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|Any CPU.ActiveCfg = Release|x64 {64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|x64.ActiveCfg = Release|x64 {64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|x64.Build.0 = Release|x64 + {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|Any CPU.ActiveCfg = Debug|x64 {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x64.ActiveCfg = Debug|x64 {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x64.Build.0 = Debug|x64 + {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|Any CPU.ActiveCfg = Release|x64 {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.ActiveCfg = Release|x64 {0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.Build.0 = Release|x64 + {0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|Any CPU.ActiveCfg = Debug|Win32 {0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|x64.ActiveCfg = Debug|x64 {0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|x64.Build.0 = Debug|x64 + {0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|Any CPU.ActiveCfg = Release|Win32 {0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|x64.ActiveCfg = Release|x64 {0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|x64.Build.0 = Release|x64 + {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|Any CPU.ActiveCfg = Debug|Win32 {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|x64.ActiveCfg = Debug|x64 {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|x64.Build.0 = Debug|x64 + {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|Any CPU.ActiveCfg = Release|Win32 {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|x64.ActiveCfg = Release|x64 {031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|x64.Build.0 = Release|x64 + {B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|Any CPU.ActiveCfg = Debug|x64 {B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|x64.ActiveCfg = Debug|x64 {B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|x64.Build.0 = Debug|x64 + {B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|Any CPU.ActiveCfg = Release|x64 {B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|x64.ActiveCfg = Release|x64 {B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|x64.Build.0 = Release|x64 + {51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|Any CPU.ActiveCfg = Debug|x64 {51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|x64.ActiveCfg = Debug|x64 {51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|x64.Build.0 = Debug|x64 + {51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|Any CPU.ActiveCfg = Release|x64 {51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|x64.ActiveCfg = Release|x64 {51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|x64.Build.0 = Release|x64 + {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Debug|Any CPU.ActiveCfg = Debug|Win32 {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Debug|x64.ActiveCfg = Debug|x64 {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Debug|x64.Build.0 = Debug|x64 + {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Release|Any CPU.ActiveCfg = Release|Win32 {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Release|x64.ActiveCfg = Release|x64 {D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Release|x64.Build.0 = Release|x64 + {17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|Any CPU.ActiveCfg = Debug|Win32 {17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|x64.ActiveCfg = Debug|x64 {17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|x64.Build.0 = Debug|x64 + {17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|Any CPU.ActiveCfg = Release|Win32 {17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|x64.ActiveCfg = Release|x64 {17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|x64.Build.0 = Release|x64 + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|Any CPU.Build.0 = Debug|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|x64.ActiveCfg = Debug|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|x64.Build.0 = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Any CPU.Build.0 = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|x64.ActiveCfg = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|x64.Build.0 = Release|Any CPU + {B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Debug|x64.ActiveCfg = Debug|Any CPU {B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Debug|x64.Build.0 = Debug|Any CPU + {B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Release|Any CPU.Build.0 = Release|Any CPU {B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Release|x64.ActiveCfg = Release|Any CPU {B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}.Release|x64.Build.0 = Release|Any CPU + {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Debug|x64.ActiveCfg = Debug|Any CPU {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Debug|x64.Build.0 = Debug|Any CPU + {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|Any CPU.Build.0 = Release|Any CPU {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|x64.ActiveCfg = Release|Any CPU {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|x64.Build.0 = Release|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|Any CPU.Build.0 = Debug|Any CPU {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|x64.ActiveCfg = Debug|Any CPU {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|x64.Build.0 = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|Any CPU.Build.0 = Release|Any CPU {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|x64.ActiveCfg = Release|Any CPU {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|x64.Build.0 = Release|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|x64.ActiveCfg = Debug|Any CPU {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|x64.Build.0 = Debug|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|Any CPU.ActiveCfg = Release|Any CPU {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|x64.ActiveCfg = Release|Any CPU {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|x64.Build.0 = Release|Any CPU + {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Debug|Any CPU.Build.0 = Debug|Any CPU {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Debug|x64.ActiveCfg = Debug|Any CPU {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Debug|x64.Build.0 = Debug|Any CPU + {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Release|Any CPU.Build.0 = Release|Any CPU {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Release|x64.ActiveCfg = Release|Any CPU {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Release|x64.Build.0 = Release|Any CPU + {FDB3555B-58EF-4AE6-B5F1-904719637AB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB3555B-58EF-4AE6-B5F1-904719637AB4}.Debug|Any CPU.Build.0 = Debug|Any CPU {FDB3555B-58EF-4AE6-B5F1-904719637AB4}.Debug|x64.ActiveCfg = Debug|Any CPU {FDB3555B-58EF-4AE6-B5F1-904719637AB4}.Debug|x64.Build.0 = Debug|Any CPU + {FDB3555B-58EF-4AE6-B5F1-904719637AB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB3555B-58EF-4AE6-B5F1-904719637AB4}.Release|Any CPU.Build.0 = Release|Any CPU {FDB3555B-58EF-4AE6-B5F1-904719637AB4}.Release|x64.ActiveCfg = Release|Any CPU {FDB3555B-58EF-4AE6-B5F1-904719637AB4}.Release|x64.Build.0 = Release|Any CPU + {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Debug|Any CPU.Build.0 = Debug|Any CPU {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Debug|x64.ActiveCfg = Debug|Any CPU {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Debug|x64.Build.0 = Debug|Any CPU + {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Release|Any CPU.Build.0 = Release|Any CPU {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Release|x64.ActiveCfg = Release|Any CPU {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Release|x64.Build.0 = Release|Any CPU + {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|Any CPU.Build.0 = Debug|Any CPU {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x64.ActiveCfg = Debug|Any CPU {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x64.Build.0 = Debug|Any CPU + {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|Any CPU.Build.0 = Release|Any CPU {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|x64.ActiveCfg = Release|Any CPU {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|x64.Build.0 = Release|Any CPU + {E364F67B-BB12-4E91-B639-355866EBCD8B}.Debug|Any CPU.ActiveCfg = Debug|x64 {E364F67B-BB12-4E91-B639-355866EBCD8B}.Debug|x64.ActiveCfg = Debug|x64 {E364F67B-BB12-4E91-B639-355866EBCD8B}.Debug|x64.Build.0 = Debug|x64 + {E364F67B-BB12-4E91-B639-355866EBCD8B}.Release|Any CPU.ActiveCfg = Release|x64 {E364F67B-BB12-4E91-B639-355866EBCD8B}.Release|x64.ActiveCfg = Release|x64 {E364F67B-BB12-4E91-B639-355866EBCD8B}.Release|x64.Build.0 = Release|x64 + {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Debug|Any CPU.ActiveCfg = Debug|x64 {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Debug|x64.ActiveCfg = Debug|x64 {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Debug|x64.Build.0 = Debug|x64 + {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Release|Any CPU.ActiveCfg = Release|x64 {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Release|x64.ActiveCfg = Release|x64 {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Release|x64.Build.0 = Release|x64 + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|x64.ActiveCfg = Debug|Any CPU + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|x64.Build.0 = Debug|Any CPU + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Release|Any CPU.Build.0 = Release|Any CPU + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Release|x64.ActiveCfg = Release|Any CPU + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -340,6 +436,7 @@ Global {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {E364F67B-BB12-4E91-B639-355866EBCD8B} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68} {63C3CEA8-51FE-472E-B97C-B58F8B17DD51} = {4AFC9975-2456-4C70-94A4-84073C1CED93} + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF} = {4AFC9975-2456-4C70-94A4-84073C1CED93} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0} diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj index 8613f27349..fae081ba33 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj @@ -1,87 +1,16 @@ - - - + + - Debug - AnyCPU - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51} - Library - Properties - Wox.Plugin.Indexer - Wox.Plugin.Indexer - v4.5.2 - 512 - true - - - - true - ..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Wox.Plugin.Indexer\ - DEBUG;TRACE - full - x64 - 7.3 - prompt - MinimumRecommendedRules.ruleset - 4 - false + netcoreapp3.1 - - ..\..\..\..\..\x64\Release\modules\launcher\Plugins\Wox.Plugin.Indexer\ - TRACE - true - pdbonly - x64 - 7.3 - prompt - MinimumRecommendedRules.ruleset - 4 - - - ..\..\..\..\..\packages\tlbimp-Microsoft.Search.Interop.1.0.0\lib\net45\Microsoft.Search.Interop.dll - True - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - - - - {4fd29318-a8ab-4d8f-aa47-60bc241b8da3} - Wox.Infrastructure - - - {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} - Wox.Plugin - - - - - - PreserveNewest - + + - - \ No newline at end of file + + + + + diff --git a/src/modules/launcher/Plugins/indexer/Images/WindowsIndexerImg.bmp b/src/modules/launcher/Plugins/indexer/Images/WindowsIndexerImg.bmp new file mode 100644 index 0000000000000000000000000000000000000000..78a015715ed228d84d4a2066a2f42d7e827efbd3 GIT binary patch literal 3772 zcmV;t4ny&YP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D4pB)&K~!i%?OADb zljoVG=`5WFTGCDenGi6vNg!!vrqd*yo^;NnKuDU9^Z-dFX##{K6L1#5IM{eMUh#@o zdBflxY)kSYd6T>e%bRT3mb?lqukuD5jP0-l2zT!LA=-3K&$OIro&4ZA=blf(pWg32 z&vT#qz7mV>#GSYkcj9-kWbxv=AAkHO+n#&w`J-F5Zd3kd%U0D(FTb4j^QWG2S$5yO zKe6BT&5PBm9scf@Pe1MY!N+@te1jq{$0TQ6&&*eUsZeXLXXUG|$ERdm^EwC!c)sejne%mZ+r6OGzq&CQ>&S(KU&t(F^DunUT;l zd=uS6=h0;tzEY`fv^1t=_pvXv@DURo{jPsd$i*0?UPbag?1>LmMmHPuzksei{QY3$2>hf+fuR> z)`P_}g1kF%$TWc}R-2MXvjB-V5shtQ&{Xw9E;l1BxfzL}wTKGP&IK!q%WNArZb;*j ze{*x?1qx4B*Ik}oJ~K(h4Fx3bN_;{%vBIZGTu;)cDHWxv2Z?bF@N-hZIZOxtv{u9x zb|X!D2J$=;GEQk*wfpw&?Y;Nje{`@fy)g0YhV}18#l~L<0u`CY`D#A|+)*v>%?poFqWK9e2EU;-IT zAfs~?HFfU8K@KBAX`LaKb2!2TLd+8gqjVxE zo#^@@$YSf^nyl@QJnVaTYTdfE+qmq)b>Ij0EdAF5`}YszY3fhe$^VM@1@W^A3$}3& z@FF~zggd+7&ICM}fHxEHB`@H^DX1LwQGOLWfyJ+L~Po)F*aXW zFcMNR`HG$VPl-oeO7IAYzSL=*l(lqPOX`h1rn=T%b8V}|RMR$8sWyyevs1qf(V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b!MBGY9bVyY4R)>UlKS(@Ah@>_W|3N%T+|v4jRsDA2e|PA+gh)zMTXah#`L$R5 mc0wd{3wPp9e6wQFqW=N1$a(d|v)2s(0000 _storage; + + // To access Windows Search functionalities + private readonly WindowsSearchAPI _api = new WindowsSearchAPI(); + + // To save the configurations of plugins + public void Save() + { + _storage.Save(); + } + + // This function uses the Windows indexer and returns the list of results obtained + public List Query(Query query) + { + var results = new List(); + if (!string.IsNullOrEmpty(query.Search)) + { + var searchQuery = query.Search; + if (_settings.MaxSearchCount <= 0) + { + _settings.MaxSearchCount = 50; + } + + try + { + var searchResultsList = _api.Search(searchQuery, maxCount: _settings.MaxSearchCount).ToList(); + foreach (var searchResult in searchResultsList) + { + var path = searchResult.Path; + + string workingDir = null; + if (_settings.UseLocationAsWorkingDir) + workingDir = Path.GetDirectoryName(path); + + Result r = new Result(); + r.Title = Path.GetFileName(path); + r.SubTitle = path; + r.IcoPath = path; + r.Action = c => + { + bool hide; + try + { + Process.Start(new ProcessStartInfo + { + FileName = path, + UseShellExecute = true, + WorkingDirectory = workingDir + }); + hide = true; + } + catch (Win32Exception) + { + var name = $"Plugin: {_context.CurrentPluginMetadata.Name}"; + var msg = "Can't Open this file"; + _context.API.ShowMsg(name, msg, string.Empty); + hide = false; + } + return hide; + }; + r.ContextData = searchResult; + results.Add(r); + } + } + catch (Exception ex) + { + results.Add(new Result + { + // TODO: Localize the string + Title = "Windows indexer plugin is not running", + IcoPath = "Images\\WindowsIndexerImg.bmp" + }); + } + } + + return results; + } + + public void Init(PluginInitContext context) + { + // initialize the context of the plugin + _context = context; + _storage = new PluginJsonStorage(); + _settings = _storage.Load(); + } + + // TODO: Localize the strings + // Set the Plugin Title + public string GetTranslatedPluginTitle() + { + return "Windows Indexer Plugin"; + } + + // TODO: Localize the string + // Set the plugin Description + public string GetTranslatedPluginDescription() + { + return "Returns files and folders"; + } + + + } +} diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Properties/AssemblyInfo.cs b/src/modules/launcher/Plugins/indexer/Properties/AssemblyInfo.cs similarity index 100% rename from src/modules/launcher/Plugins/Wox.Plugin.Indexer/Properties/AssemblyInfo.cs rename to src/modules/launcher/Plugins/indexer/Properties/AssemblyInfo.cs diff --git a/src/modules/launcher/Plugins/indexer/SearchHelper/DriveDetection.cs b/src/modules/launcher/Plugins/indexer/SearchHelper/DriveDetection.cs new file mode 100644 index 0000000000..25520d7487 --- /dev/null +++ b/src/modules/launcher/Plugins/indexer/SearchHelper/DriveDetection.cs @@ -0,0 +1,88 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Search.Interop; + +namespace Wox.Plugin.Indexer.SearchHelper +{ + class DriveDetection + { + // Variable which sets the warning status, can be turned off by user + // TODO : To be linked with the UI once it is finalized + public bool warningOn = true; + + // Function to return the names of all drives + public List GetDrives() + { + DriveInfo[] allDrives = DriveInfo.GetDrives(); + List allDriveNames = new List(); + + foreach (DriveInfo d in allDrives) + { + allDriveNames.Add(d.Name); + } + return allDriveNames; + } + + [STAThread] + // Function to get all the Search Scopes of the indexer + public List GetScopeRules() + { + List allScopeRules = new List(); + // This uses the Microsoft.Search.Interop assembly + CSearchManager manager = new CSearchManager(); + + // SystemIndex catalog is the default catalog in Windows + ISearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex"); + + // Get the ISearchQueryHelper which will help us to translate AQS --> SQL necessary to query the indexer + ISearchCrawlScopeManager crawlScopeManager = catalogManager.GetCrawlScopeManager(); + + // search for the scope rules + IEnumSearchScopeRules scopeRules = crawlScopeManager.EnumerateScopeRules(); + CSearchScopeRule scopeRule; + uint numScopes = 0; + + bool nextExists = true; + while (nextExists) + { + try + { + scopeRules.Next(1, out scopeRule, ref numScopes); + allScopeRules.Add(scopeRule.PatternOrURL); + /*Console.WriteLine(numScopes);*/ + } + catch (Exception ex) + { + nextExists = false; + } + } + + return allScopeRules; + } + + // Function to check if all Drives are indexed + public bool allDrivesIndexed() + { + bool allDrivesAreIndexed = true; + List drives = GetDrives(); + List scopeRules = GetScopeRules(); + + foreach (var drive in drives) + { + string driveScope = @"file:///" + drive; + if (!scopeRules.Contains(driveScope)) + { + allDrivesAreIndexed = false; + break; + } + } + + return allDrivesAreIndexed; + } + + } +} diff --git a/src/modules/launcher/Plugins/indexer/SearchHelper/IndexerExecutableInfo.cs b/src/modules/launcher/Plugins/indexer/SearchHelper/IndexerExecutableInfo.cs new file mode 100644 index 0000000000..9fd4cd97ed --- /dev/null +++ b/src/modules/launcher/Plugins/indexer/SearchHelper/IndexerExecutableInfo.cs @@ -0,0 +1,66 @@ +using System; +using System.Diagnostics; +using Microsoft.Win32; + +namespace Wox.Plugin.Indexer.SearchHelper +{ + class IndexerExecutableInfo + { + // Reference - Control Panel Plugin + private const string CONTROL = @"%SystemRoot%\System32\control.exe"; + private RegistryKey nameSpace = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace"); + RegistryKey clsid = Registry.ClassesRoot.OpenSubKey("CLSID"); + RegistryKey currentKey; + ProcessStartInfo executablePath; + + public ProcessStartInfo Create(uint iconSize) + { + foreach (string key in nameSpace.GetSubKeyNames()) + { + currentKey = clsid.OpenSubKey(key); + if (currentKey != null) + { + executablePath = getExecutablePath(currentKey); + + if (!(executablePath == null)) //Cannot have item without executable path + { + localizedString = getLocalizedString(currentKey); + } + } + } + + return executablePath; + } + + + // Ref - ControlPanelPlugin Wox + // Code to obtain the executable path for an item in the Control Panel + private ProcessStartInfo getExecutablePath(RegistryKey currentKey) + { + ProcessStartInfo executablePath = new ProcessStartInfo(); + string applicationName; + + if (currentKey.GetValue("System.ApplicationName") != null) + { + //CPL Files (usually native MS items) + applicationName = currentKey.GetValue("System.ApplicationName").ToString(); + executablePath.FileName = Environment.ExpandEnvironmentVariables(CONTROL); + executablePath.Arguments = "-name " + applicationName; + } + else if (currentKey.OpenSubKey("Shell\\Open\\Command") != null && currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null) != null) + { + //Other files (usually third party items) + string input = "\"" + Environment.ExpandEnvironmentVariables(currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null).ToString()) + "\""; + executablePath.FileName = "cmd.exe"; + executablePath.Arguments = "/C " + input; + executablePath.WindowStyle = ProcessWindowStyle.Hidden; + } + else + { + return null; + } + + return executablePath; + } + } +} diff --git a/src/modules/launcher/Plugins/indexer/SearchHelper/SearchResult.cs b/src/modules/launcher/Plugins/indexer/SearchHelper/SearchResult.cs new file mode 100644 index 0000000000..fc4c0ed770 --- /dev/null +++ b/src/modules/launcher/Plugins/indexer/SearchHelper/SearchResult.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Wox.Plugin.Indexer.SearchHelper +{ + public class SearchResult + { + // Contains the Path of the file or folder + public string Path { get; set; } + } +} diff --git a/src/modules/launcher/Plugins/indexer/SearchHelper/WindowsSearchAPI.cs b/src/modules/launcher/Plugins/indexer/SearchHelper/WindowsSearchAPI.cs new file mode 100644 index 0000000000..64875595a1 --- /dev/null +++ b/src/modules/launcher/Plugins/indexer/SearchHelper/WindowsSearchAPI.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Data.OleDb; +using Microsoft.Search.Interop; + +namespace Wox.Plugin.Indexer.SearchHelper +{ + public class WindowsSearchAPI + { + public OleDbConnection conn; + public OleDbCommand command; + public OleDbDataReader WDSResults; + + public IEnumerable ExecuteQuery(ISearchQueryHelper queryHelper, string keyword) + { + // Generate SQL from our parameters, converting the userQuery from AQS->WHERE clause + string sqlQuery = queryHelper.GenerateSQLFromUserQuery(keyword); + + // --- Perform the query --- + // create an OleDbConnection object which connects to the indexer provider with the windows application + using (conn = new OleDbConnection(queryHelper.ConnectionString)) + { + // open the connection + conn.Open(); + + // now create an OleDB command object with the query we built above and the connection we just opened. + using (command = new OleDbCommand(sqlQuery, conn)) + { + // execute the command, which returns the results as an OleDbDataReader. + using (WDSResults = command.ExecuteReader()) + { + while (WDSResults.Read()) + { + // col 0 is our path in display format + Console.WriteLine("{0}", WDSResults.GetString(0)); + var result = new SearchResult { Path = WDSResults.GetString(0) }; + + yield return result; + } + } + + } + } + } + + + public void ModifyQueryHelper(ref ISearchQueryHelper queryHelper, string pattern) + { + // convert file pattern if it is not '*'. Don't create restriction for '*' as it includes all files. + if (pattern != "*") + { + pattern = pattern.Replace("*", "%"); + pattern = pattern.Replace("?", "_"); + + if (pattern.Contains("%") || pattern.Contains("_")) + { + queryHelper.QueryWhereRestrictions += " AND System.FileName LIKE '" + pattern + "' "; + } + else + { + // if there are no wildcards we can use a contains which is much faster as it uses the index + queryHelper.QueryWhereRestrictions += " AND Contains(System.FileName, '" + pattern + "') "; + } + } + } + + public void InitQueryHelper(out ISearchQueryHelper queryHelper, int maxCount) + { + // This uses the Microsoft.Search.Interop assembly + CSearchManager manager = new CSearchManager(); + + // SystemIndex catalog is the default catalog in Windows + ISearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex"); + + // Get the ISearchQueryHelper which will help us to translate AQS --> SQL necessary to query the indexer + queryHelper = catalogManager.GetQueryHelper(); + + // Set the number of results we want. Don't set this property if all results are needed. + queryHelper.QueryMaxResults = maxCount; + + // Set list of columns we want to display, getting the path presently + queryHelper.QuerySelectColumns = "System.ItemPathDisplay"; + + // Set additional query restriction + queryHelper.QueryWhereRestrictions = "AND scope='file:'"; + + // Set sorting order + queryHelper.QuerySorting = "System.DateModified DESC"; + } + + public IEnumerable Search(string keyword, string pattern = "*", int maxCount = 100) + { + ISearchQueryHelper queryHelper; + InitQueryHelper(out queryHelper, maxCount); + ModifyQueryHelper(ref queryHelper, pattern); + return ExecuteQuery(queryHelper, keyword); + } + } +} diff --git a/src/modules/launcher/Plugins/indexer/Settings.cs b/src/modules/launcher/Plugins/indexer/Settings.cs new file mode 100644 index 0000000000..6fc9bbbf94 --- /dev/null +++ b/src/modules/launcher/Plugins/indexer/Settings.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Wox.Plugin.Indexer +{ + public class Settings + { + public List ContextMenus = new List(); + public int MaxSearchCount { get; set; } = 100; + public bool UseLocationAsWorkingDir { get; set; } = false; + } + + public class ContextMenu + { + public string Name { get; set; } + public string Command { get; set; } + public string Argument { get; set; } + public string ImagePath { get; set; } + } +} diff --git a/src/modules/launcher/Plugins/indexer/indexer.csproj b/src/modules/launcher/Plugins/indexer/indexer.csproj new file mode 100644 index 0000000000..8613f27349 --- /dev/null +++ b/src/modules/launcher/Plugins/indexer/indexer.csproj @@ -0,0 +1,87 @@ + + + + + Debug + AnyCPU + {63C3CEA8-51FE-472E-B97C-B58F8B17DD51} + Library + Properties + Wox.Plugin.Indexer + Wox.Plugin.Indexer + v4.5.2 + 512 + true + + + + true + ..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Wox.Plugin.Indexer\ + DEBUG;TRACE + full + x64 + 7.3 + prompt + MinimumRecommendedRules.ruleset + 4 + false + + + + ..\..\..\..\..\x64\Release\modules\launcher\Plugins\Wox.Plugin.Indexer\ + TRACE + true + pdbonly + x64 + 7.3 + prompt + MinimumRecommendedRules.ruleset + 4 + + + + ..\..\..\..\..\packages\tlbimp-Microsoft.Search.Interop.1.0.0\lib\net45\Microsoft.Search.Interop.dll + True + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + + + {4fd29318-a8ab-4d8f-aa47-60bc241b8da3} + Wox.Infrastructure + + + {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} + Wox.Plugin + + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/packages.config b/src/modules/launcher/Plugins/indexer/packages.config similarity index 100% rename from src/modules/launcher/Plugins/Wox.Plugin.Indexer/packages.config rename to src/modules/launcher/Plugins/indexer/packages.config diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/plugin.json b/src/modules/launcher/Plugins/indexer/plugin.json similarity index 100% rename from src/modules/launcher/Plugins/Wox.Plugin.Indexer/plugin.json rename to src/modules/launcher/Plugins/indexer/plugin.json From d9e1dce39329b70809fdc8a09fe8a461f70c7fc9 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Tue, 24 Mar 2020 16:13:02 -0700 Subject: [PATCH 2/5] Added the test project back --- PowerToys.sln | 9 --------- .../Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj | 4 ++++ src/modules/launcher/Wox.Test/Wox.Test.csproj | 2 ++ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/PowerToys.sln b/PowerToys.sln index 5a0ca04161..37f8bd46b8 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -154,8 +154,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Plugin.Folder", "src\mo EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wox.Launcher", "src\modules\launcher\Wox.Launcher\Wox.Launcher.vcxproj", "{E364F67B-BB12-4E91-B639-355866EBCD8B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "indexer", "src\modules\launcher\Plugins\Wox.Plugin.Indexer\indexer.csproj", "{63C3CEA8-51FE-472E-B97C-B58F8B17DD51}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Indexer", "src\modules\launcher\Plugins\Wox.Plugin.Indexer\Wox.Plugin.Indexer.csproj", "{8DD27FDE-7B2F-45D8-A148-3340205A7BEF}" EndProject Global @@ -380,12 +378,6 @@ Global {E364F67B-BB12-4E91-B639-355866EBCD8B}.Release|Any CPU.ActiveCfg = Release|x64 {E364F67B-BB12-4E91-B639-355866EBCD8B}.Release|x64.ActiveCfg = Release|x64 {E364F67B-BB12-4E91-B639-355866EBCD8B}.Release|x64.Build.0 = Release|x64 - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Debug|Any CPU.ActiveCfg = Debug|x64 - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Debug|x64.ActiveCfg = Debug|x64 - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Debug|x64.Build.0 = Debug|x64 - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Release|Any CPU.ActiveCfg = Release|x64 - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Release|x64.ActiveCfg = Release|x64 - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51}.Release|x64.Build.0 = Release|x64 {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|Any CPU.Build.0 = Debug|Any CPU {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -435,7 +427,6 @@ Global {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {E364F67B-BB12-4E91-B639-355866EBCD8B} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68} - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {8DD27FDE-7B2F-45D8-A148-3340205A7BEF} = {4AFC9975-2456-4C70-94A4-84073C1CED93} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj index fae081ba33..5d940b9ac2 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj @@ -4,6 +4,10 @@ netcoreapp3.1 + + + + diff --git a/src/modules/launcher/Wox.Test/Wox.Test.csproj b/src/modules/launcher/Wox.Test/Wox.Test.csproj index 8f5a3b6ba3..a9f494e722 100644 --- a/src/modules/launcher/Wox.Test/Wox.Test.csproj +++ b/src/modules/launcher/Wox.Test/Wox.Test.csproj @@ -38,6 +38,7 @@ + @@ -48,6 +49,7 @@ + From 5b5f48014b1408c0a3a3b69576db3e02cace3707 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Tue, 24 Mar 2020 16:15:58 -0700 Subject: [PATCH 3/5] Removed the .net framework indexer folder --- .../indexer/Images/WindowsIndexerImg.bmp | Bin 3772 -> 0 bytes src/modules/launcher/Plugins/indexer/Main.cs | 128 ------------------ .../indexer/Properties/AssemblyInfo.cs | 36 ----- .../indexer/SearchHelper/DriveDetection.cs | 88 ------------ .../SearchHelper/IndexerExecutableInfo.cs | 66 --------- .../indexer/SearchHelper/SearchResult.cs | 14 -- .../indexer/SearchHelper/WindowsSearchAPI.cs | 99 -------------- .../launcher/Plugins/indexer/Settings.cs | 23 ---- .../launcher/Plugins/indexer/indexer.csproj | 87 ------------ .../launcher/Plugins/indexer/packages.config | 4 - .../launcher/Plugins/indexer/plugin.json | 12 -- 11 files changed, 557 deletions(-) delete mode 100644 src/modules/launcher/Plugins/indexer/Images/WindowsIndexerImg.bmp delete mode 100644 src/modules/launcher/Plugins/indexer/Main.cs delete mode 100644 src/modules/launcher/Plugins/indexer/Properties/AssemblyInfo.cs delete mode 100644 src/modules/launcher/Plugins/indexer/SearchHelper/DriveDetection.cs delete mode 100644 src/modules/launcher/Plugins/indexer/SearchHelper/IndexerExecutableInfo.cs delete mode 100644 src/modules/launcher/Plugins/indexer/SearchHelper/SearchResult.cs delete mode 100644 src/modules/launcher/Plugins/indexer/SearchHelper/WindowsSearchAPI.cs delete mode 100644 src/modules/launcher/Plugins/indexer/Settings.cs delete mode 100644 src/modules/launcher/Plugins/indexer/indexer.csproj delete mode 100644 src/modules/launcher/Plugins/indexer/packages.config delete mode 100644 src/modules/launcher/Plugins/indexer/plugin.json diff --git a/src/modules/launcher/Plugins/indexer/Images/WindowsIndexerImg.bmp b/src/modules/launcher/Plugins/indexer/Images/WindowsIndexerImg.bmp deleted file mode 100644 index 78a015715ed228d84d4a2066a2f42d7e827efbd3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3772 zcmV;t4ny&YP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D4pB)&K~!i%?OADb zljoVG=`5WFTGCDenGi6vNg!!vrqd*yo^;NnKuDU9^Z-dFX##{K6L1#5IM{eMUh#@o zdBflxY)kSYd6T>e%bRT3mb?lqukuD5jP0-l2zT!LA=-3K&$OIro&4ZA=blf(pWg32 z&vT#qz7mV>#GSYkcj9-kWbxv=AAkHO+n#&w`J-F5Zd3kd%U0D(FTb4j^QWG2S$5yO zKe6BT&5PBm9scf@Pe1MY!N+@te1jq{$0TQ6&&*eUsZeXLXXUG|$ERdm^EwC!c)sejne%mZ+r6OGzq&CQ>&S(KU&t(F^DunUT;l zd=uS6=h0;tzEY`fv^1t=_pvXv@DURo{jPsd$i*0?UPbag?1>LmMmHPuzksei{QY3$2>hf+fuR> z)`P_}g1kF%$TWc}R-2MXvjB-V5shtQ&{Xw9E;l1BxfzL}wTKGP&IK!q%WNArZb;*j ze{*x?1qx4B*Ik}oJ~K(h4Fx3bN_;{%vBIZGTu;)cDHWxv2Z?bF@N-hZIZOxtv{u9x zb|X!D2J$=;GEQk*wfpw&?Y;Nje{`@fy)g0YhV}18#l~L<0u`CY`D#A|+)*v>%?poFqWK9e2EU;-IT zAfs~?HFfU8K@KBAX`LaKb2!2TLd+8gqjVxE zo#^@@$YSf^nyl@QJnVaTYTdfE+qmq)b>Ij0EdAF5`}YszY3fhe$^VM@1@W^A3$}3& z@FF~zggd+7&ICM}fHxEHB`@H^DX1LwQGOLWfyJ+L~Po)F*aXW zFcM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lNa&W_78AERBz`J?ns|BTN(V3JPh7NVC$h#}TwNwPup^XA5C7&*Y#<&Y z{-nb!MBGY9bVyY4R)>UlKS(@Ah@>_W|3N%T+|v4jRsDA2e|PA+gh)zMTXah#`L$R5 mc0wd{3wPp9e6wQFqW=N1$a(d|v)2s(0000 _storage; - - // To access Windows Search functionalities - private readonly WindowsSearchAPI _api = new WindowsSearchAPI(); - - // To save the configurations of plugins - public void Save() - { - _storage.Save(); - } - - // This function uses the Windows indexer and returns the list of results obtained - public List Query(Query query) - { - var results = new List(); - if (!string.IsNullOrEmpty(query.Search)) - { - var searchQuery = query.Search; - if (_settings.MaxSearchCount <= 0) - { - _settings.MaxSearchCount = 50; - } - - try - { - var searchResultsList = _api.Search(searchQuery, maxCount: _settings.MaxSearchCount).ToList(); - foreach (var searchResult in searchResultsList) - { - var path = searchResult.Path; - - string workingDir = null; - if (_settings.UseLocationAsWorkingDir) - workingDir = Path.GetDirectoryName(path); - - Result r = new Result(); - r.Title = Path.GetFileName(path); - r.SubTitle = path; - r.IcoPath = path; - r.Action = c => - { - bool hide; - try - { - Process.Start(new ProcessStartInfo - { - FileName = path, - UseShellExecute = true, - WorkingDirectory = workingDir - }); - hide = true; - } - catch (Win32Exception) - { - var name = $"Plugin: {_context.CurrentPluginMetadata.Name}"; - var msg = "Can't Open this file"; - _context.API.ShowMsg(name, msg, string.Empty); - hide = false; - } - return hide; - }; - r.ContextData = searchResult; - results.Add(r); - } - } - catch (Exception ex) - { - results.Add(new Result - { - // TODO: Localize the string - Title = "Windows indexer plugin is not running", - IcoPath = "Images\\WindowsIndexerImg.bmp" - }); - } - } - - return results; - } - - public void Init(PluginInitContext context) - { - // initialize the context of the plugin - _context = context; - _storage = new PluginJsonStorage(); - _settings = _storage.Load(); - } - - // TODO: Localize the strings - // Set the Plugin Title - public string GetTranslatedPluginTitle() - { - return "Windows Indexer Plugin"; - } - - // TODO: Localize the string - // Set the plugin Description - public string GetTranslatedPluginDescription() - { - return "Returns files and folders"; - } - - - } -} diff --git a/src/modules/launcher/Plugins/indexer/Properties/AssemblyInfo.cs b/src/modules/launcher/Plugins/indexer/Properties/AssemblyInfo.cs deleted file mode 100644 index a6f591220c..0000000000 --- a/src/modules/launcher/Plugins/indexer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Wox.Plugin.Indexer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.Indexer")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("63c3cea8-51fe-472e-b97c-b58f8b17dd51")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/modules/launcher/Plugins/indexer/SearchHelper/DriveDetection.cs b/src/modules/launcher/Plugins/indexer/SearchHelper/DriveDetection.cs deleted file mode 100644 index 25520d7487..0000000000 --- a/src/modules/launcher/Plugins/indexer/SearchHelper/DriveDetection.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Search.Interop; - -namespace Wox.Plugin.Indexer.SearchHelper -{ - class DriveDetection - { - // Variable which sets the warning status, can be turned off by user - // TODO : To be linked with the UI once it is finalized - public bool warningOn = true; - - // Function to return the names of all drives - public List GetDrives() - { - DriveInfo[] allDrives = DriveInfo.GetDrives(); - List allDriveNames = new List(); - - foreach (DriveInfo d in allDrives) - { - allDriveNames.Add(d.Name); - } - return allDriveNames; - } - - [STAThread] - // Function to get all the Search Scopes of the indexer - public List GetScopeRules() - { - List allScopeRules = new List(); - // This uses the Microsoft.Search.Interop assembly - CSearchManager manager = new CSearchManager(); - - // SystemIndex catalog is the default catalog in Windows - ISearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex"); - - // Get the ISearchQueryHelper which will help us to translate AQS --> SQL necessary to query the indexer - ISearchCrawlScopeManager crawlScopeManager = catalogManager.GetCrawlScopeManager(); - - // search for the scope rules - IEnumSearchScopeRules scopeRules = crawlScopeManager.EnumerateScopeRules(); - CSearchScopeRule scopeRule; - uint numScopes = 0; - - bool nextExists = true; - while (nextExists) - { - try - { - scopeRules.Next(1, out scopeRule, ref numScopes); - allScopeRules.Add(scopeRule.PatternOrURL); - /*Console.WriteLine(numScopes);*/ - } - catch (Exception ex) - { - nextExists = false; - } - } - - return allScopeRules; - } - - // Function to check if all Drives are indexed - public bool allDrivesIndexed() - { - bool allDrivesAreIndexed = true; - List drives = GetDrives(); - List scopeRules = GetScopeRules(); - - foreach (var drive in drives) - { - string driveScope = @"file:///" + drive; - if (!scopeRules.Contains(driveScope)) - { - allDrivesAreIndexed = false; - break; - } - } - - return allDrivesAreIndexed; - } - - } -} diff --git a/src/modules/launcher/Plugins/indexer/SearchHelper/IndexerExecutableInfo.cs b/src/modules/launcher/Plugins/indexer/SearchHelper/IndexerExecutableInfo.cs deleted file mode 100644 index 9fd4cd97ed..0000000000 --- a/src/modules/launcher/Plugins/indexer/SearchHelper/IndexerExecutableInfo.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Diagnostics; -using Microsoft.Win32; - -namespace Wox.Plugin.Indexer.SearchHelper -{ - class IndexerExecutableInfo - { - // Reference - Control Panel Plugin - private const string CONTROL = @"%SystemRoot%\System32\control.exe"; - private RegistryKey nameSpace = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace"); - RegistryKey clsid = Registry.ClassesRoot.OpenSubKey("CLSID"); - RegistryKey currentKey; - ProcessStartInfo executablePath; - - public ProcessStartInfo Create(uint iconSize) - { - foreach (string key in nameSpace.GetSubKeyNames()) - { - currentKey = clsid.OpenSubKey(key); - if (currentKey != null) - { - executablePath = getExecutablePath(currentKey); - - if (!(executablePath == null)) //Cannot have item without executable path - { - localizedString = getLocalizedString(currentKey); - } - } - } - - return executablePath; - } - - - // Ref - ControlPanelPlugin Wox - // Code to obtain the executable path for an item in the Control Panel - private ProcessStartInfo getExecutablePath(RegistryKey currentKey) - { - ProcessStartInfo executablePath = new ProcessStartInfo(); - string applicationName; - - if (currentKey.GetValue("System.ApplicationName") != null) - { - //CPL Files (usually native MS items) - applicationName = currentKey.GetValue("System.ApplicationName").ToString(); - executablePath.FileName = Environment.ExpandEnvironmentVariables(CONTROL); - executablePath.Arguments = "-name " + applicationName; - } - else if (currentKey.OpenSubKey("Shell\\Open\\Command") != null && currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null) != null) - { - //Other files (usually third party items) - string input = "\"" + Environment.ExpandEnvironmentVariables(currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null).ToString()) + "\""; - executablePath.FileName = "cmd.exe"; - executablePath.Arguments = "/C " + input; - executablePath.WindowStyle = ProcessWindowStyle.Hidden; - } - else - { - return null; - } - - return executablePath; - } - } -} diff --git a/src/modules/launcher/Plugins/indexer/SearchHelper/SearchResult.cs b/src/modules/launcher/Plugins/indexer/SearchHelper/SearchResult.cs deleted file mode 100644 index fc4c0ed770..0000000000 --- a/src/modules/launcher/Plugins/indexer/SearchHelper/SearchResult.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Wox.Plugin.Indexer.SearchHelper -{ - public class SearchResult - { - // Contains the Path of the file or folder - public string Path { get; set; } - } -} diff --git a/src/modules/launcher/Plugins/indexer/SearchHelper/WindowsSearchAPI.cs b/src/modules/launcher/Plugins/indexer/SearchHelper/WindowsSearchAPI.cs deleted file mode 100644 index 64875595a1..0000000000 --- a/src/modules/launcher/Plugins/indexer/SearchHelper/WindowsSearchAPI.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data.OleDb; -using Microsoft.Search.Interop; - -namespace Wox.Plugin.Indexer.SearchHelper -{ - public class WindowsSearchAPI - { - public OleDbConnection conn; - public OleDbCommand command; - public OleDbDataReader WDSResults; - - public IEnumerable ExecuteQuery(ISearchQueryHelper queryHelper, string keyword) - { - // Generate SQL from our parameters, converting the userQuery from AQS->WHERE clause - string sqlQuery = queryHelper.GenerateSQLFromUserQuery(keyword); - - // --- Perform the query --- - // create an OleDbConnection object which connects to the indexer provider with the windows application - using (conn = new OleDbConnection(queryHelper.ConnectionString)) - { - // open the connection - conn.Open(); - - // now create an OleDB command object with the query we built above and the connection we just opened. - using (command = new OleDbCommand(sqlQuery, conn)) - { - // execute the command, which returns the results as an OleDbDataReader. - using (WDSResults = command.ExecuteReader()) - { - while (WDSResults.Read()) - { - // col 0 is our path in display format - Console.WriteLine("{0}", WDSResults.GetString(0)); - var result = new SearchResult { Path = WDSResults.GetString(0) }; - - yield return result; - } - } - - } - } - } - - - public void ModifyQueryHelper(ref ISearchQueryHelper queryHelper, string pattern) - { - // convert file pattern if it is not '*'. Don't create restriction for '*' as it includes all files. - if (pattern != "*") - { - pattern = pattern.Replace("*", "%"); - pattern = pattern.Replace("?", "_"); - - if (pattern.Contains("%") || pattern.Contains("_")) - { - queryHelper.QueryWhereRestrictions += " AND System.FileName LIKE '" + pattern + "' "; - } - else - { - // if there are no wildcards we can use a contains which is much faster as it uses the index - queryHelper.QueryWhereRestrictions += " AND Contains(System.FileName, '" + pattern + "') "; - } - } - } - - public void InitQueryHelper(out ISearchQueryHelper queryHelper, int maxCount) - { - // This uses the Microsoft.Search.Interop assembly - CSearchManager manager = new CSearchManager(); - - // SystemIndex catalog is the default catalog in Windows - ISearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex"); - - // Get the ISearchQueryHelper which will help us to translate AQS --> SQL necessary to query the indexer - queryHelper = catalogManager.GetQueryHelper(); - - // Set the number of results we want. Don't set this property if all results are needed. - queryHelper.QueryMaxResults = maxCount; - - // Set list of columns we want to display, getting the path presently - queryHelper.QuerySelectColumns = "System.ItemPathDisplay"; - - // Set additional query restriction - queryHelper.QueryWhereRestrictions = "AND scope='file:'"; - - // Set sorting order - queryHelper.QuerySorting = "System.DateModified DESC"; - } - - public IEnumerable Search(string keyword, string pattern = "*", int maxCount = 100) - { - ISearchQueryHelper queryHelper; - InitQueryHelper(out queryHelper, maxCount); - ModifyQueryHelper(ref queryHelper, pattern); - return ExecuteQuery(queryHelper, keyword); - } - } -} diff --git a/src/modules/launcher/Plugins/indexer/Settings.cs b/src/modules/launcher/Plugins/indexer/Settings.cs deleted file mode 100644 index 6fc9bbbf94..0000000000 --- a/src/modules/launcher/Plugins/indexer/Settings.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Wox.Plugin.Indexer -{ - public class Settings - { - public List ContextMenus = new List(); - public int MaxSearchCount { get; set; } = 100; - public bool UseLocationAsWorkingDir { get; set; } = false; - } - - public class ContextMenu - { - public string Name { get; set; } - public string Command { get; set; } - public string Argument { get; set; } - public string ImagePath { get; set; } - } -} diff --git a/src/modules/launcher/Plugins/indexer/indexer.csproj b/src/modules/launcher/Plugins/indexer/indexer.csproj deleted file mode 100644 index 8613f27349..0000000000 --- a/src/modules/launcher/Plugins/indexer/indexer.csproj +++ /dev/null @@ -1,87 +0,0 @@ - - - - - Debug - AnyCPU - {63C3CEA8-51FE-472E-B97C-B58F8B17DD51} - Library - Properties - Wox.Plugin.Indexer - Wox.Plugin.Indexer - v4.5.2 - 512 - true - - - - true - ..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Wox.Plugin.Indexer\ - DEBUG;TRACE - full - x64 - 7.3 - prompt - MinimumRecommendedRules.ruleset - 4 - false - - - - ..\..\..\..\..\x64\Release\modules\launcher\Plugins\Wox.Plugin.Indexer\ - TRACE - true - pdbonly - x64 - 7.3 - prompt - MinimumRecommendedRules.ruleset - 4 - - - - ..\..\..\..\..\packages\tlbimp-Microsoft.Search.Interop.1.0.0\lib\net45\Microsoft.Search.Interop.dll - True - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - - - - {4fd29318-a8ab-4d8f-aa47-60bc241b8da3} - Wox.Infrastructure - - - {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} - Wox.Plugin - - - - - - PreserveNewest - - - - - \ No newline at end of file diff --git a/src/modules/launcher/Plugins/indexer/packages.config b/src/modules/launcher/Plugins/indexer/packages.config deleted file mode 100644 index 6b77ac3b21..0000000000 --- a/src/modules/launcher/Plugins/indexer/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/modules/launcher/Plugins/indexer/plugin.json b/src/modules/launcher/Plugins/indexer/plugin.json deleted file mode 100644 index 741c57ddcc..0000000000 --- a/src/modules/launcher/Plugins/indexer/plugin.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "ID": "2140FC9819AD43A3A616E2735815C27C", - "ActionKeyword": "*", - "Name": "Windows Indexer", - "Description": "Search for files and folders", - "Author": "??", - "Version": "1.0.0", - "Language": "csharp", - "Website": "http://www.wox.one/plugin", - "ExecuteFileName": "Wox.Plugin.Indexer.dll", - "IcoPath": "Images\\WindowsIndexerImg.bmp" -} From 0c8e3515fe1042150917f0626a3502e2a635f56a Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Tue, 24 Mar 2020 16:18:26 -0700 Subject: [PATCH 4/5] readding the plugin.json file --- .../launcher/Plugins/Wox.Plugin.Indexer/plugin.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/modules/launcher/Plugins/Wox.Plugin.Indexer/plugin.json diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/plugin.json b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/plugin.json new file mode 100644 index 0000000000..741c57ddcc --- /dev/null +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/plugin.json @@ -0,0 +1,12 @@ +{ + "ID": "2140FC9819AD43A3A616E2735815C27C", + "ActionKeyword": "*", + "Name": "Windows Indexer", + "Description": "Search for files and folders", + "Author": "??", + "Version": "1.0.0", + "Language": "csharp", + "Website": "http://www.wox.one/plugin", + "ExecuteFileName": "Wox.Plugin.Indexer.dll", + "IcoPath": "Images\\WindowsIndexerImg.bmp" +} From 1822f36aba81222ae61144514b82c523159236c2 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Date: Tue, 24 Mar 2020 16:27:49 -0700 Subject: [PATCH 5/5] Changed the anyCPU config to x64 for windows indexer plugin --- PowerToys.sln | 4 ++-- .../Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/PowerToys.sln b/PowerToys.sln index 37f8bd46b8..5229e384cd 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -380,8 +380,8 @@ Global {E364F67B-BB12-4E91-B639-355866EBCD8B}.Release|x64.Build.0 = Release|x64 {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|x64.ActiveCfg = Debug|Any CPU - {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|x64.Build.0 = Debug|Any CPU + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|x64.ActiveCfg = Debug|x64 + {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Debug|x64.Build.0 = Debug|x64 {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Release|Any CPU.ActiveCfg = Release|Any CPU {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Release|Any CPU.Build.0 = Release|Any CPU {8DD27FDE-7B2F-45D8-A148-3340205A7BEF}.Release|x64.ActiveCfg = Release|Any CPU diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj index 5d940b9ac2..0880cb53ec 100644 --- a/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj +++ b/src/modules/launcher/Plugins/Wox.Plugin.Indexer/Wox.Plugin.Indexer.csproj @@ -2,12 +2,17 @@ netcoreapp3.1 + AnyCPU;x64 + + x64 + +