diff --git a/Flow.Launcher.sln b/Flow.Launcher.sln index c873bc147..4d8997177 100644 --- a/Flow.Launcher.sln +++ b/Flow.Launcher.sln @@ -24,15 +24,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher", "Flow.Launc {9B130CC5-14FB-41FF-B310-0A95B6894C37} = {9B130CC5-14FB-41FF-B310-0A95B6894C37} {FDED22C8-B637-42E8-824A-63B5B6E05A3A} = {FDED22C8-B637-42E8-824A-63B5B6E05A3A} {A3DCCBCA-ACC1-421D-B16E-210896234C26} = {A3DCCBCA-ACC1-421D-B16E-210896234C26} - {049490F0-ECD2-4148-9B39-2135EC346EBE} = {049490F0-ECD2-4148-9B39-2135EC346EBE} {403B57F2-1856-4FC7-8A24-36AB346B763E} = {403B57F2-1856-4FC7-8A24-36AB346B763E} {588088F4-3262-4F9F-9663-A05DE12534C3} = {588088F4-3262-4F9F-9663-A05DE12534C3} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Infrastructure", "Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj", "{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.PluginManagement", "Plugins\Flow.Launcher.Plugin.PluginManagement\Flow.Launcher.Plugin.PluginManagement.csproj", "{049490F0-ECD2-4148-9B39-2135EC346EBE}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Core", "Flow.Launcher.Core\Flow.Launcher.Core.csproj", "{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Program", "Plugins\Flow.Launcher.Plugin.Program\Flow.Launcher.Plugin.Program.csproj", "{FDB3555B-58EF-4AE6-B5F1-904719637AB4}" @@ -132,18 +129,6 @@ Global {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|x64.Build.0 = Release|Any CPU {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|x86.ActiveCfg = Release|Any CPU {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}.Release|x86.Build.0 = Release|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|x64.ActiveCfg = Debug|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|x64.Build.0 = Debug|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|x86.ActiveCfg = Debug|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Debug|x86.Build.0 = Debug|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|Any CPU.Build.0 = Release|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|x64.ActiveCfg = Release|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|x64.Build.0 = Release|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|x86.ActiveCfg = Release|Any CPU - {049490F0-ECD2-4148-9B39-2135EC346EBE}.Release|x86.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 @@ -318,7 +303,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {049490F0-ECD2-4148-9B39-2135EC346EBE} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} {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} diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 0cc671ef6..07bb96339 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -22,7 +22,6 @@ Loaded="OnLoaded" Initialized="OnInitialized" Closing="OnClosing" - Drop="OnDrop" LocationChanged="OnLocationChanged" Deactivated="OnDeactivated" PreviewKeyDown="OnKeyDown" diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 993eb76c5..3812b4e1f 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -199,24 +199,6 @@ namespace Flow.Launcher } } - private void OnDrop(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - { - // Note that you can have more than one file. - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - if (files[0].ToLower().EndsWith(".flowlauncher")) - { - PluginManager.InstallPlugin(files[0]); - } - else - { - MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidFlowLauncherPluginFileFormat")); - } - } - e.Handled = false; - } - private void OnPreviewDragOver(object sender, DragEventArgs e) { e.Handled = true; diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Flow.Launcher.Plugin.PluginManagement.csproj b/Plugins/Flow.Launcher.Plugin.PluginManagement/Flow.Launcher.Plugin.PluginManagement.csproj deleted file mode 100644 index 08e89d861..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Flow.Launcher.Plugin.PluginManagement.csproj +++ /dev/null @@ -1,102 +0,0 @@ - - - - Library - netcoreapp3.1 - {049490F0-ECD2-4148-9B39-2135EC346EBE} - Properties - Flow.Launcher.Plugin.PluginManagement - Flow.Launcher.Plugin.PluginManagement - true - true - false - false - - - - true - full - false - ..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.PluginManagement\ - DEBUG;TRACE - prompt - 4 - false - - - - pdbonly - true - ..\..\Output\Release\Plugins\Flow.Launcher.Plugin.PluginManagement\ - TRACE - prompt - 4 - false - - - - - - - - - - PreserveNewest - - - - - - PreserveNewest - - - - - - MSBuild:Compile - Designer - PreserveNewest - - - - - - MSBuild:Compile - Designer - PreserveNewest - - - - - - MSBuild:Compile - Designer - PreserveNewest - - - - - - MSBuild:Compile - Designer - PreserveNewest - - - - - - MSBuild:Compile - Designer - PreserveNewest - - - - - - MSBuild:Compile - Designer - PreserveNewest - - - - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Flow.Launcher.PluginResult.cs b/Plugins/Flow.Launcher.Plugin.PluginManagement/Flow.Launcher.PluginResult.cs deleted file mode 100644 index 7f5d75d4e..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Flow.Launcher.PluginResult.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Flow.Launcher.Plugin.PluginManagement -{ - public class FlowLauncherPluginResult - { - public string plugin_file; - public string description; - public int liked_count; - public string name; - public string version; - } -} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Images/plugin.png b/Plugins/Flow.Launcher.Plugin.PluginManagement/Images/plugin.png deleted file mode 100644 index 6ff9b8b15..000000000 Binary files a/Plugins/Flow.Launcher.Plugin.PluginManagement/Images/plugin.png and /dev/null differ diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/de.xaml b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/de.xaml deleted file mode 100644 index 38b2f1b4b..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/de.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - Flow Launcher Plugin Verwaltung - Installiere/Entferne/Aktualisiere Flow Launcher Plugins - - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/en.xaml deleted file mode 100644 index b49f33c76..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/en.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - Plugin Management - Install, remove or update Flow Launcher plugins - - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/pl.xaml b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/pl.xaml deleted file mode 100644 index 362db73e5..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/pl.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - Zarządzanie wtyczkami Flow Launcher - Pozwala na instalacje, usuwanie i aktualizacje wtyczek - - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/sk.xaml b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/sk.xaml deleted file mode 100644 index b51eceb6a..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/sk.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - Správca pluginov - Inštalácia, odinštalácia alebo aktualizácia pluginov Flow Launchera - - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/tr.xaml b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/tr.xaml deleted file mode 100644 index fee82a78b..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/tr.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - Flow Launcher Eklenti Yöneticisi - Flow Launcher eklentilerini kurun, kaldırın ya da güncelleyin - - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/zh-cn.xaml b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/zh-cn.xaml deleted file mode 100644 index 009fd976c..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/zh-cn.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - Flow Launcher插件管理 - 安装/卸载/更新Flow Launcher插件 - - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/zh-tw.xaml b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/zh-tw.xaml deleted file mode 100644 index c93d740f1..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/zh-tw.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - Flow Launcher 外掛管理 - 安裝/解除安裝/更新 Flow Launcher 外掛 - - diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs deleted file mode 100644 index e1b631517..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs +++ /dev/null @@ -1,258 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using Newtonsoft.Json; -using Flow.Launcher.Infrastructure; -using Flow.Launcher.Infrastructure.Http; -using Flow.Launcher.Infrastructure.Logger; - -namespace Flow.Launcher.Plugin.PluginManagement -{ - public class Main : IPlugin, IPluginI18n - { - private static string APIBASE = "http://api.wox.one"; - private static string pluginSearchUrl = APIBASE + "/plugin/search/"; - private const string ListCommand = "list"; - private const string InstallCommand = "install"; - private const string UninstallCommand = "uninstall"; - private PluginInitContext context; - - public List Query(Query query) - { - List results = new List(); - - if (string.IsNullOrEmpty(query.Search)) - { - results.Add(ResultForListCommandAutoComplete(query)); - results.Add(ResultForInstallCommandAutoComplete(query)); - results.Add(ResultForUninstallCommandAutoComplete(query)); - return results; - } - - string command = query.FirstSearch.ToLower(); - if (string.IsNullOrEmpty(command)) return results; - - if (command == ListCommand) - { - return ResultForListInstalledPlugins(); - } - if (command == UninstallCommand) - { - return ResultForUnInstallPlugin(query); - } - if (command == InstallCommand) - { - return ResultForInstallPlugin(query); - } - - if (InstallCommand.Contains(command)) - { - results.Add(ResultForInstallCommandAutoComplete(query)); - } - if (UninstallCommand.Contains(command)) - { - results.Add(ResultForUninstallCommandAutoComplete(query)); - } - if (ListCommand.Contains(command)) - { - results.Add(ResultForListCommandAutoComplete(query)); - } - - return results; - } - - private Result ResultForListCommandAutoComplete(Query query) - { - string title = ListCommand; - string subtitle = "list installed plugins"; - return ResultForCommand(query, ListCommand, title, subtitle); - } - - private Result ResultForInstallCommandAutoComplete(Query query) - { - string title = $"{InstallCommand} "; - string subtitle = "list installed plugins"; - return ResultForCommand(query, InstallCommand, title, subtitle); - } - - private Result ResultForUninstallCommandAutoComplete(Query query) - { - string title = $"{UninstallCommand} "; - string subtitle = "list installed plugins"; - return ResultForCommand(query, UninstallCommand, title, subtitle); - } - - private Result ResultForCommand(Query query, string command, string title, string subtitle) - { - const string seperater = Plugin.Query.TermSeperater; - var result = new Result - { - Title = title, - IcoPath = "Images\\plugin.png", - SubTitle = subtitle, - Action = e => - { - context.API.ChangeQuery($"{query.ActionKeyword}{seperater}{command}{seperater}"); - return false; - } - }; - return result; - } - - private List ResultForInstallPlugin(Query query) - { - List results = new List(); - string pluginName = query.SecondSearch; - if (string.IsNullOrEmpty(pluginName)) return results; - string json; - try - { - json = Http.Get(pluginSearchUrl + pluginName).Result; - } - catch (WebException e) - { - //todo happlebao add option in log to decide give user prompt or not - context.API.ShowMsg("PluginManagement.ResultForInstallPlugin: Can't connect to Wox plugin website, check your conenction"); - Log.Exception("|PluginManagement.ResultForInstallPlugin|Can't connect to Wox plugin website, check your conenction", e); - return new List(); - } - List searchedPlugins; - try - { - searchedPlugins = JsonConvert.DeserializeObject>(json); - } - catch (JsonSerializationException e) - { - context.API.ShowMsg("PluginManagement.ResultForInstallPlugin: Coundn't parse api search results, Please update your Flow Launcher!"); - Log.Exception("|PluginManagement.ResultForInstallPlugin|Coundn't parse api search results, Please update your Flow Launcher!", e); - return results; - } - - foreach (FlowLauncherPluginResult r in searchedPlugins) - { - FlowLauncherPluginResult r1 = r; - results.Add(new Result - { - Title = r.name, - SubTitle = r.description, - IcoPath = "Images\\plugin.png", - TitleHighlightData = StringMatcher.FuzzySearch(query.SecondSearch, r.name).MatchData, - SubTitleHighlightData = StringMatcher.FuzzySearch(query.SecondSearch, r.description).MatchData, - Action = c => - { - MessageBoxResult result = MessageBox.Show("Are you sure you wish to install the \'" + r.name + "\' plugin", - "Install plugin", MessageBoxButton.YesNo); - - if (result == MessageBoxResult.Yes) - { - string folder = Path.Combine(Path.GetTempPath(), "FlowLauncherPluginDownload"); - if (!Directory.Exists(folder)) Directory.CreateDirectory(folder); - string filePath = Path.Combine(folder, Guid.NewGuid().ToString() + ".flowlauncher"); - - string pluginUrl = APIBASE + "/media/" + r1.plugin_file; - - try - { - Http.Download(pluginUrl, filePath); - } - catch (WebException e) - { - context.API.ShowMsg($"PluginManagement.ResultForInstallPlugin: download failed for <{r.name}>"); - Log.Exception($"|PluginManagement.ResultForInstallPlugin|download failed for <{r.name}>", e); - return false; - } - context.API.InstallPlugin(filePath); - } - return false; - } - }); - } - return results; - } - - private List ResultForUnInstallPlugin(Query query) - { - List results = new List(); - List allInstalledPlugins = context.API.GetAllPlugins().Select(o => o.Metadata).ToList(); - if (!string.IsNullOrEmpty(query.SecondSearch)) - { - allInstalledPlugins = - allInstalledPlugins.Where(o => o.Name.ToLower().Contains(query.SecondSearch.ToLower())).ToList(); - } - - foreach (PluginMetadata plugin in allInstalledPlugins) - { - results.Add(new Result - { - Title = plugin.Name, - SubTitle = plugin.Description, - IcoPath = plugin.IcoPath, - TitleHighlightData = StringMatcher.FuzzySearch(query.SecondSearch, plugin.Name).MatchData, - SubTitleHighlightData = StringMatcher.FuzzySearch(query.SecondSearch, plugin.Description).MatchData, - Action = e => - { - UnInstallPlugin(plugin); - return false; - } - }); - } - return results; - } - - private void UnInstallPlugin(PluginMetadata plugin) - { - string content = $"Do you want to uninstall following plugin?{Environment.NewLine}{Environment.NewLine}" + - $"Name: {plugin.Name}{Environment.NewLine}" + - $"Version: {plugin.Version}{Environment.NewLine}" + - $"Author: {plugin.Author}"; - if (MessageBox.Show(content, "Flow Launcher", MessageBoxButton.YesNo) == MessageBoxResult.Yes) - { - File.Create(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")).Close(); - var result = MessageBox.Show($"You have uninstalled plugin {plugin.Name} successfully.{Environment.NewLine}" + - "Restart Flow Launcher to take effect?", - "Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question); - if (result == MessageBoxResult.Yes) - { - context.API.RestartApp(); - } - } - } - - private List ResultForListInstalledPlugins() - { - List results = new List(); - foreach (PluginMetadata plugin in context.API.GetAllPlugins().Select(o => o.Metadata)) - { - string actionKeywordString = string.Join(" or ", plugin.ActionKeywords.ToArray()); - results.Add(new Result - { - Title = $"{plugin.Name} - Action Keywords: {actionKeywordString}", - SubTitle = plugin.Description, - IcoPath = plugin.IcoPath - }); - } - return results; - } - - public void Init(PluginInitContext context) - { - this.context = context; - } - - public string GetTranslatedPluginTitle() - { - return context.API.GetTranslation("flowlauncher_plugin_plugin_management_plugin_name"); - } - - public string GetTranslatedPluginDescription() - { - return context.API.GetTranslation("flowlauncher_plugin_plugin_management_plugin_description"); - } - } -} diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginManagement/plugin.json deleted file mode 100644 index 7b8262f79..000000000 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/plugin.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "ID": "D2D2C23B084D422DB66FE0C79D6C2A6A", - "ActionKeyword": "wpm", - "Name": "Plugin Management", - "Description": "Install/Remove/Update Flow Launcher plugins", - "Author": "qianlifeng", - "Version": "1.1.1", - "Language": "csharp", - "Website": "https://github.com/Flow-Launcher/Flow.Launcher", - "ExecuteFileName": "Flow.Launcher.Plugin.PluginManagement.dll", - "IcoPath": "Images\\plugin.png" -}