From eeaa6f920d6d223f97e49db9745354c31dda5ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Wed, 3 Feb 2021 17:50:21 +0800 Subject: [PATCH 1/7] add null check before updateresultmanifest --- Flow.Launcher.Core/Plugin/PluginManager.cs | 2 ++ Flow.Launcher/ViewModel/MainViewModel.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 26167e945..700a7d509 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -183,6 +183,8 @@ namespace Flow.Launcher.Core.Plugin throw new ArgumentOutOfRangeException(); } token.ThrowIfCancellationRequested(); + if (results == null) + return results; UpdatePluginMetadata(results, metadata, query); metadata.QueryCount += 1; diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 05dbb3a8b..afbe6e197 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -363,7 +363,7 @@ namespace Flow.Launcher.ViewModel } if (!match.IsSearchPrecisionScoreMet()) return false; - + r.Score = match.Score; return true; @@ -512,7 +512,7 @@ namespace Flow.Launcher.ViewModel await Task.Yield(); var results = await PluginManager.QueryForPlugin(plugin, query, currentCancellationToken); - if (!currentCancellationToken.IsCancellationRequested) + if (!currentCancellationToken.IsCancellationRequested && results != null) _resultsUpdateQueue.Post(new ResultsForUpdate(results, plugin.Metadata, query, currentCancellationToken)); } From d0b94c5b81d0f62f9eef67fc9af97fab7948f6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Wed, 3 Feb 2021 17:50:36 +0800 Subject: [PATCH 2/7] specify name for property to avoid property collision --- Flow.Launcher.Core/Plugin/JsonPRCModel.cs | 2 + Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 65 ++++++++++------------ 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/JsonPRCModel.cs b/Flow.Launcher.Core/Plugin/JsonPRCModel.cs index 9bc7c2472..247fe1889 100644 --- a/Flow.Launcher.Core/Plugin/JsonPRCModel.cs +++ b/Flow.Launcher.Core/Plugin/JsonPRCModel.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using Flow.Launcher.Plugin; namespace Flow.Launcher.Core.Plugin @@ -42,6 +43,7 @@ namespace Flow.Launcher.Core.Plugin public class JsonRPCQueryResponseModel : JsonRPCResponseModel { + [JsonPropertyName("result")] public new List Result { get; set; } } diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs index 3d4522498..c7ad70391 100644 --- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs +++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs @@ -147,47 +147,42 @@ namespace Flow.Launcher.Core.Plugin { try { - using (var process = Process.Start(startInfo)) + using var process = Process.Start(startInfo); + if (process == null) { - if (process != null) + Log.Error("|JsonRPCPlugin.Execute|Can't start new process"); + return string.Empty; + } + + using var standardOutput = process.StandardOutput; + var result = standardOutput.ReadToEnd(); + if (string.IsNullOrEmpty(result)) + { + using (var standardError = process.StandardError) { - using (var standardOutput = process.StandardOutput) + var error = standardError.ReadToEnd(); + if (!string.IsNullOrEmpty(error)) { - var result = standardOutput.ReadToEnd(); - if (string.IsNullOrEmpty(result)) - { - using (var standardError = process.StandardError) - { - var error = standardError.ReadToEnd(); - if (!string.IsNullOrEmpty(error)) - { - Log.Error($"|JsonRPCPlugin.Execute|{error}"); - return string.Empty; - } - else - { - Log.Error("|JsonRPCPlugin.Execute|Empty standard output and standard error."); - return string.Empty; - } - } - } - else if (result.StartsWith("DEBUG:")) - { - MessageBox.Show(new Form { TopMost = true }, result.Substring(6)); - return string.Empty; - } - else - { - return result; - } + Log.Error($"|JsonRPCPlugin.Execute|{error}"); + return string.Empty; + } + else + { + Log.Error("|JsonRPCPlugin.Execute|Empty standard output and standard error."); + return string.Empty; } } - else - { - Log.Error("|JsonRPCPlugin.Execute|Can't start new process"); - return string.Empty; - } } + else if (result.StartsWith("DEBUG:")) + { + MessageBox.Show(new Form { TopMost = true }, result.Substring(6)); + return string.Empty; + } + else + { + return result; + } + } catch (Exception e) { From bcf046f842b404d4583048aabc97c0c18612d6a2 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 3 Feb 2021 20:51:19 +1100 Subject: [PATCH 3/7] fix move method call only restricted to within the same drive --- .../Search/ResultManager.cs | 2 -- .../PluginsManager.cs | 9 +++++++-- Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 600b573cf..6872f04b4 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -1,10 +1,8 @@ using Flow.Launcher.Infrastructure; using Flow.Launcher.Plugin.SharedCommands; using System; -using System.Diagnostics; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; using System.Windows; namespace Flow.Launcher.Plugin.Explorer.Search diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs index 0f5e6d9e8..881872fc1 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs @@ -3,6 +3,7 @@ using Flow.Launcher.Infrastructure.Http; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin.PluginsManager.Models; +using Flow.Launcher.Plugin.SharedCommands; using System; using System.Collections.Generic; using System.IO; @@ -327,7 +328,9 @@ namespace Flow.Launcher.Plugin.PluginsManager var zipFilePath = Path.Combine(tempFolderPath, Path.GetFileName(downloadedFilePath)); - File.Move(downloadedFilePath, zipFilePath); + File.Copy(downloadedFilePath, zipFilePath); + + File.Delete(downloadedFilePath); Utilities.UnZip(zipFilePath, tempFolderPluginPath, true); @@ -345,7 +348,9 @@ namespace Flow.Launcher.Plugin.PluginsManager string newPluginPath = Path.Combine(DataLocation.PluginsDirectory, $"{plugin.Name}-{plugin.Version}"); - Directory.Move(pluginFolderPath, newPluginPath); + FilesFolders.CopyAll(pluginFolderPath, newPluginPath); + + Directory.Delete(pluginFolderPath, true); } internal List RequestUninstall(string search) diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json index 75d6038d4..b37a6b1af 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json @@ -6,7 +6,7 @@ "Name": "Plugins Manager", "Description": "Management of installing, uninstalling or updating Flow Launcher plugins", "Author": "Jeremy Wu", - "Version": "1.6.1", + "Version": "1.6.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll", From 833aa39884d9d6a31fc7c682115c61057dba76b8 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 3 Feb 2021 23:12:02 +1100 Subject: [PATCH 4/7] Update readme Todo: add search methods to usage --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ac8611298..578f6f724 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,9 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be - Support search using environment variable paths - Run batch and PowerShell commands as Administrator or a different user. - Support languages from Chinese to Italian and more. -- Support of wide range of plugins. +- Support wide range of plugins. +- Prioritise the order of each plugin's results +- Save file or folder locations for quick access - Fully portable. [ **SOFTPEDIA EDITOR'S PICK**](https://www.softpedia.com/get/System/Launchers-Shutdown-Tools/Flow-Launcher.shtml) From 3915895a98e17de537b3eecb12aaa42e89e0ce57 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 4 Feb 2021 19:56:08 +1100 Subject: [PATCH 5/7] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 578f6f724..66533c760 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be - Search everything from applications, files, bookmarks, YouTube, Twitter and more. All from the comfort of your keyboard without ever touching the mouse. - Search for file contents. -- Support search using environment variable paths +- Support search using environment variable paths. - Run batch and PowerShell commands as Administrator or a different user. - Support languages from Chinese to Italian and more. - Support wide range of plugins. -- Prioritise the order of each plugin's results -- Save file or folder locations for quick access +- Prioritise the order of each plugin's results. +- Save file or folder locations for quick access. - Fully portable. [ **SOFTPEDIA EDITOR'S PICK**](https://www.softpedia.com/get/System/Launchers-Shutdown-Tools/Flow-Launcher.shtml) @@ -47,6 +47,7 @@ Windows may complain about security due to code not being signed, this will be c **Usage** - Open flow's search window: Alt+Space is the default hotkey. +- Search programs, bookmarks and control panel items with acronyms eg. `gk` or `gp` for GitKraken Preview; fuzzy search eg.`code` or `vis` for Visual Studio Code - Open context menu: Ctrl+O/Shift+Enter. - Cancel/Return to previous screen: Esc. - Install/Uninstall/Update plugins: in the search window, type `pm install`/`pm uninstall`/`pm update` + the plugin name. From d428d6f56c3c9c57ada6e95250bb1027adc5a2a0 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 4 Feb 2021 20:01:50 +1100 Subject: [PATCH 6/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 66533c760..94861ec2a 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ Windows may complain about security due to code not being signed, this will be c **Usage** - Open flow's search window: Alt+Space is the default hotkey. -- Search programs, bookmarks and control panel items with acronyms eg. `gk` or `gp` for GitKraken Preview; fuzzy search eg.`code` or `vis` for Visual Studio Code -- Open context menu: Ctrl+O/Shift+Enter. +- Search programs, bookmarks and control panel items with acronyms eg. `gk` or `gp` for GitKraken Preview; fuzzy search eg. `code` or `vis` for Visual Studio Code +- Open context menu: on the selected result, press Ctrl+O/Shift+Enter. - Cancel/Return to previous screen: Esc. - Install/Uninstall/Update plugins: in the search window, type `pm install`/`pm uninstall`/`pm update` + the plugin name. - Saved user settings are located: From 892b7cf63eaa76fa046ea14c6316945efc10f6fb Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 4 Feb 2021 20:02:55 +1100 Subject: [PATCH 7/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 94861ec2a..9af47a5ee 100644 --- a/README.md +++ b/README.md @@ -47,14 +47,14 @@ Windows may complain about security due to code not being signed, this will be c **Usage** - Open flow's search window: Alt+Space is the default hotkey. -- Search programs, bookmarks and control panel items with acronyms eg. `gk` or `gp` for GitKraken Preview; fuzzy search eg. `code` or `vis` for Visual Studio Code +- Search programs, bookmarks and control panel items with acronyms eg. `gk` or `gp` for GitKraken Preview; fuzzy search eg. `code` or `vis` for Visual Studio Code. - Open context menu: on the selected result, press Ctrl+O/Shift+Enter. - Cancel/Return to previous screen: Esc. - Install/Uninstall/Update plugins: in the search window, type `pm install`/`pm uninstall`/`pm update` + the plugin name. - Saved user settings are located: - If using roaming: `%APPDATA%\FlowLauncher` - If using portable, by default: `%localappdata%\FlowLauncher\app-\UserData` -- Logs are saved along with your user settings folder +- Logs are saved along with your user settings folder. ## Status