diff --git a/Flow.Launcher.sln b/Flow.Launcher.sln index 5bdbc3270..b244c97de 100644 --- a/Flow.Launcher.sln +++ b/Flow.Launcher.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29806.167 @@ -21,7 +20,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher", "Flow.Launc {F9C4C081-4CC3-4146-95F1-E102B4E10A5F} = {F9C4C081-4CC3-4146-95F1-E102B4E10A5F} {59BD9891-3837-438A-958D-ADC7F91F6F7E} = {59BD9891-3837-438A-958D-ADC7F91F6F7E} {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} {F35190AA-4758-4D9E-A193-E3BDF6AD3567} = {F35190AA-4758-4D9E-A193-E3BDF6AD3567} {9B130CC5-14FB-41FF-B310-0A95B6894C37} = {9B130CC5-14FB-41FF-B310-0A95B6894C37} {FDED22C8-B637-42E8-824A-63B5B6E05A3A} = {FDED22C8-B637-42E8-824A-63B5B6E05A3A} @@ -42,8 +40,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.WebSea EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.ControlPanel", "Plugins\Flow.Launcher.Plugin.ControlPanel\Flow.Launcher.Plugin.ControlPanel.csproj", "{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Folder", "Plugins\Flow.Launcher.Plugin.Folder\Flow.Launcher.Plugin.Folder.csproj", "{787B8AA6-CA93-4C84-96FE-DF31110AD1C4}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.PluginIndicator", "Plugins\Flow.Launcher.Plugin.PluginIndicator\Flow.Launcher.Plugin.PluginIndicator.csproj", "{FDED22C8-B637-42E8-824A-63B5B6E05A3A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Sys", "Plugins\Flow.Launcher.Plugin.Sys\Flow.Launcher.Plugin.Sys.csproj", "{0B9DE348-9361-4940-ADB6-F5953BFFCCEC}" @@ -59,11 +55,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitattributes = .gitattributes .gitignore = .gitignore appveyor.yml = appveyor.yml + Scripts\flowlauncher.nuspec = Scripts\flowlauncher.nuspec LICENSE = LICENSE Scripts\post_build.ps1 = Scripts\post_build.ps1 README.md = README.md SolutionAssemblyInfo.cs = SolutionAssemblyInfo.cs - Scripts\flowlauncher.nuspec = Scripts\flowlauncher.nuspec EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorldCSharp", "Plugins\HelloWorldCSharp\HelloWorldCSharp.csproj", "{03FFA443-5F50-48D5-8869-F3DF316803AA}" @@ -196,18 +192,6 @@ Global {1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x64.Build.0 = Release|Any CPU {1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x86.ActiveCfg = Release|Any CPU {1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x86.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}.Debug|x86.ActiveCfg = Debug|Any CPU - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Debug|x86.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 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|x86.ActiveCfg = Release|Any CPU - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}.Release|x86.Build.0 = Release|Any CPU {FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU {FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -350,7 +334,6 @@ Global {FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} {403B57F2-1856-4FC7-8A24-36AB346B763E} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} {1EE20B48-82FB-48A2-8086-675D6DDAB4F0} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} {FDED22C8-B637-42E8-824A-63B5B6E05A3A} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} {0B9DE348-9361-4940-ADB6-F5953BFFCCEC} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} {A3DCCBCA-ACC1-421D-B16E-210896234C26} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} diff --git a/Plugins/Flow.Launcher.Plugin.Folder/ContextMenuLoader.cs b/Plugins/Flow.Launcher.Plugin.Folder/ContextMenuLoader.cs deleted file mode 100644 index 561047932..000000000 --- a/Plugins/Flow.Launcher.Plugin.Folder/ContextMenuLoader.cs +++ /dev/null @@ -1,219 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Threading.Tasks; -using System.Windows; -using Flow.Launcher.Infrastructure.Logger; -using Flow.Launcher.Infrastructure.Image; -using Flow.Launcher.Plugin.SharedCommands; - -namespace Flow.Launcher.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(CreateOpenWithEditorResult(record)); - 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 Result - { - Title = "Copy path", - SubTitle = $"Copy the current {fileOrFolder} path to clipboard", - 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; - } - }, - IcoPath = Main.CopyImagePath - }); - - contextMenus.Add(new Result - { - Title = $"Copy {fileOrFolder}", - SubTitle = $"Copy the {fileOrFolder} to clipboard", - Action = (context) => - { - try - { - Clipboard.SetFileDropList(new System.Collections.Specialized.StringCollection { record.FullPath }); - return true; - } - catch (Exception e) - { - var message = $"Fail to set {fileOrFolder} in clipboard"; - LogException(message, e); - _context.API.ShowMsg(message); - return false; - } - - }, - IcoPath = icoPath - }); - - if (record.Type == ResultType.File || record.Type == ResultType.Folder) - contextMenus.Add(new Result - { - Title = $"Delete {fileOrFolder}", - SubTitle = $"Delete the selected {fileOrFolder}", - Action = (context) => - { - try - { - if (record.Type == ResultType.File) - File.Delete(record.FullPath); - else - Directory.Delete(record.FullPath, true); - } - catch(Exception e) - { - var message = $"Fail to delete {fileOrFolder} at {record.FullPath}"; - LogException(message, e); - _context.API.ShowMsg(message); - return false; - } - - return true; - }, - IcoPath = Main.DeleteFileFolderImagePath - }); - - if (record.Type == ResultType.File && CanRunAsDifferentUser(record.FullPath)) - contextMenus.Add(new Result - { - Title = "Run as different user", - Action = (context) => - { - try - { - Task.Run(()=> ShellCommand.RunAsDifferentUser(record.FullPath.SetProcessStartInfo())); - } - catch (FileNotFoundException e) - { - var name = "Plugin: Folder"; - var message = $"File not found: {e.Message}"; - _context.API.ShowMsg(name, message); - } - - return true; - }, - IcoPath = "Images/user.png" - }); - } - - return contextMenus; - } - - private Result CreateOpenContainingFolderResult(SearchResult record) - { - return new Result - { - Title = "Open containing folder", - 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; - }, - IcoPath = Main.FolderImagePath - }; - } - - - 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($"|Flow.Launcher.Plugin.Folder.ContextMenu|{message}", e); - } - - private bool CanRunAsDifferentUser(string path) - { - switch(Path.GetExtension(path)) - { - case ".exe": - case ".bat": - case ".msi": - 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/Plugins/Flow.Launcher.Plugin.Folder/Flow.Launcher.Plugin.Folder.csproj b/Plugins/Flow.Launcher.Plugin.Folder/Flow.Launcher.Plugin.Folder.csproj deleted file mode 100644 index a05b5d49d..000000000 --- a/Plugins/Flow.Launcher.Plugin.Folder/Flow.Launcher.Plugin.Folder.csproj +++ /dev/null @@ -1,107 +0,0 @@ - - - - netcoreapp3.1 - {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} - Properties - Flow.Launcher.Plugin.Folder - Flow.Launcher.Plugin.Folder - true - false - false - - - - true - full - false - ..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.Folder\ - DEBUG;TRACE - prompt - 4 - false - - - - pdbonly - true - ..\..\Output\Release\Plugins\Flow.Launcher.Plugin.Folder\ - TRACE - prompt - 4 - false - - - - - PreserveNewest - - - - - - MSBuild:Compile - Designer - - - PreserveNewest - - - Always - - - PreserveNewest - - - Always - - - MSBuild:Compile - Designer - PreserveNewest - - - MSBuild:Compile - Designer - PreserveNewest - - - MSBuild:Compile - Designer - PreserveNewest - - - MSBuild:Compile - Designer - PreserveNewest - - - MSBuild:Compile - Designer - PreserveNewest - - - MSBuild:Compile - Designer - PreserveNewest - - - - - - - - - - - PreserveNewest - - - - - - - - - - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Folder/FolderLink.cs b/Plugins/Flow.Launcher.Plugin.Folder/FolderLink.cs deleted file mode 100644 index b7bcb1d34..000000000 --- a/Plugins/Flow.Launcher.Plugin.Folder/FolderLink.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Linq; -using Newtonsoft.Json; - -namespace Flow.Launcher.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/Plugins/Flow.Launcher.Plugin.Folder/FolderPluginSettings.xaml b/Plugins/Flow.Launcher.Plugin.Folder/FolderPluginSettings.xaml deleted file mode 100644 index fb43d6b7c..000000000 --- a/Plugins/Flow.Launcher.Plugin.Folder/FolderPluginSettings.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - -