diff --git a/PowerToys.sln b/PowerToys.sln index 2f26e8eac5..9f84e45eac 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -162,7 +162,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox", "src\modules\launcher {59BD9891-3837-438A-958D-ADC7F91F6F7E} = {59BD9891-3837-438A-958D-ADC7F91F6F7E} {74F1B9ED-F59C-4FE7-B473-7B453E30837E} = {74F1B9ED-F59C-4FE7-B473-7B453E30837E} {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} {F8B870EB-D5F5-45BA-9CF7-A5C459818820} = {F8B870EB-D5F5-45BA-9CF7-A5C459818820} EndProjectSection EndProject @@ -184,8 +183,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Plugin.Program", "src\m EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Plugin.Shell", "src\modules\launcher\Plugins\Wox.Plugin.Shell\Wox.Plugin.Shell.csproj", "{C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Plugin.Folder", "src\modules\launcher\Plugins\Wox.Plugin.Folder\Wox.Plugin.Folder.csproj", "{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Indexer", "src\modules\launcher\Plugins\Microsoft.Plugin.Indexer\Microsoft.Plugin.Indexer.csproj", "{F8B870EB-D5F5-45BA-9CF7-A5C459818820}" ProjectSection(ProjectDependencies) = postProject {8451ECDD-2EA4-4966-BB0A-7BBC40138E80} = {8451ECDD-2EA4-4966-BB0A-7BBC40138E80} @@ -564,10 +561,6 @@ Global {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|x64.ActiveCfg = Release|x64 {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|x64.Build.0 = Release|x64 {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|x86.ActiveCfg = Release|x64 - {74F1B9ED-F59C-4FE7-B473-7B453E30837E}.Debug|x64.ActiveCfg = Debug|x64 - {74F1B9ED-F59C-4FE7-B473-7B453E30837E}.Debug|x64.Build.0 = Debug|x64 - {74F1B9ED-F59C-4FE7-B473-7B453E30837E}.Release|x64.ActiveCfg = Release|x64 - {74F1B9ED-F59C-4FE7-B473-7B453E30837E}.Release|x64.Build.0 = Release|x64 {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Debug|ARM.ActiveCfg = Debug|x64 {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Debug|ARM64.ActiveCfg = Debug|x64 {59BD9891-3837-438A-958D-ADC7F91F6F7E}.Debug|x64.ActiveCfg = Debug|x64 @@ -608,16 +601,6 @@ Global {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Release|x64.ActiveCfg = Release|x64 {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Release|x64.Build.0 = Release|x64 {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}.Release|x86.ActiveCfg = Release|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|ARM.ActiveCfg = Debug|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|ARM64.ActiveCfg = Debug|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x64.ActiveCfg = Debug|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x64.Build.0 = Debug|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x86.ActiveCfg = Debug|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|ARM.ActiveCfg = Release|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|ARM64.ActiveCfg = Release|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|x64.ActiveCfg = Release|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|x64.Build.0 = Release|x64 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|x86.ActiveCfg = Release|x64 {F8B870EB-D5F5-45BA-9CF7-A5C459818820}.Debug|ARM.ActiveCfg = Debug|x64 {F8B870EB-D5F5-45BA-9CF7-A5C459818820}.Debug|ARM64.ActiveCfg = Debug|x64 {F8B870EB-D5F5-45BA-9CF7-A5C459818820}.Debug|x64.ActiveCfg = Debug|x64 @@ -800,7 +783,6 @@ Global {74F1B9ED-F59C-4FE7-B473-7B453E30837E} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {4AFC9975-2456-4C70-94A4-84073C1CED93} - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {F8B870EB-D5F5-45BA-9CF7-A5C459818820} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {E364F67B-BB12-4E91-B639-355866EBCD8B} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68} {F97E5003-F263-4D4A-A964-0F1F3C82DEF2} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68} diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Folder/ContextMenuLoader.cs b/src/modules/launcher/Plugins/Wox.Plugin.Folder/ContextMenuLoader.cs deleted file mode 100644 index f6e83b1787..0000000000 --- a/src/modules/launcher/Plugins/Wox.Plugin.Folder/ContextMenuLoader.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Threading.Tasks; -using System.Windows; -using Wox.Infrastructure.Logger; -using Wox.Infrastructure.Image; -using Wox.Plugin.SharedCommands; - -namespace Wox.Plugin.Folder -{ - internal class ContextMenuLoader : IContextMenu - { - private readonly PluginInitContext _context; - - public ContextMenuLoader(PluginInitContext context) - { - _context = context; - } - - public List LoadContextMenus(Result selectedResult) - { - var contextMenus = new List(); - if (selectedResult.ContextData is SearchResult record) - { - if (record.Type == ResultType.File) - { - contextMenus.Add(CreateOpenContainingFolderResult(record)); - } - - var icoPath = (record.Type == ResultType.File) ? Main.FileImagePath : Main.FolderImagePath; - var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder"; - contextMenus.Add(new ContextMenuResult - { - Title = "Copy path", - Glyph = "\xE8C8", - FontFamily = "Segoe MDL2 Assets", - SubTitle = $"Copy the current {fileOrFolder} path to clipboard", - AcceleratorKey = "C", - AcceleratorModifiers = "Control", - Action = (context) => - { - try - { - Clipboard.SetText(record.FullPath); - return true; - } - catch (Exception e) - { - var message = "Fail to set text in clipboard"; - LogException(message, e); - _context.API.ShowMsg(message); - return false; - } - } - }); - } - - return contextMenus; - } - - private ContextMenuResult CreateOpenContainingFolderResult(SearchResult record) - { - return new ContextMenuResult - { - Title = "Open containing folder", - Glyph = "\xE838", - FontFamily = "Segoe MDL2 Assets", - AcceleratorKey = "E", - AcceleratorModifiers = "Control,Shift", - Action = _ => - { - try - { - Process.Start("explorer.exe", $" /select,\"{record.FullPath}\""); - } - catch(Exception e) - { - var message = $"Fail to open file at {record.FullPath}"; - LogException(message, e); - _context.API.ShowMsg(message); - return false; - } - - return true; - } - }; - } - - - private Result CreateOpenWithEditorResult(SearchResult record) - { - string editorPath = "notepad.exe"; // TODO add the ability to create a custom editor - - var name = "Open With Editor: " + Path.GetFileNameWithoutExtension(editorPath); - return new Result - { - Title = name, - Action = _ => - { - try - { - Process.Start(editorPath, record.FullPath); - return true; - } - catch (Exception e) - { - var message = $"Fail to editor for file at {record.FullPath}"; - LogException(message, e); - _context.API.ShowMsg(message); - return false; - } - }, - IcoPath = editorPath - }; - } - - public void LogException(string message, Exception e) - { - Log.Exception($"|Wox.Plugin.Folder.ContextMenu|{message}", e); - } - - private bool CanRunAsDifferentUser(string path) - { - switch(Path.GetExtension(path)) - { - case ".exe": - case ".bat": - return true; - - default: - return false; - - } - } - } - - public class SearchResult - { - public string FullPath { get; set; } - public ResultType Type { get; set; } - } - - public enum ResultType - { - Volume, - Folder, - File - } -} \ No newline at end of file diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Folder/FolderLink.cs b/src/modules/launcher/Plugins/Wox.Plugin.Folder/FolderLink.cs deleted file mode 100644 index 8148c45bf4..0000000000 --- a/src/modules/launcher/Plugins/Wox.Plugin.Folder/FolderLink.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Linq; -using Newtonsoft.Json; - -namespace Wox.Plugin.Folder -{ - [JsonObject(MemberSerialization.OptIn)] - public class FolderLink - { - [JsonProperty] - public string Path { get; set; } - - public string Nickname => - Path.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None) - .Last() - + " (" + System.IO.Path.GetDirectoryName(Path) + ")"; - } -} diff --git a/src/modules/launcher/Plugins/Wox.Plugin.Folder/FolderPluginSettings.xaml b/src/modules/launcher/Plugins/Wox.Plugin.Folder/FolderPluginSettings.xaml deleted file mode 100644 index 93b9178e01..0000000000 --- a/src/modules/launcher/Plugins/Wox.Plugin.Folder/FolderPluginSettings.xaml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -