From 0da21b1ed75e05627622ea73269c8aad662a2392 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E5=BC=98=E9=9F=AC?=
Date: Mon, 8 Feb 2021 14:37:37 +0800
Subject: [PATCH 01/70] JSONRPC Async Model
---
Flow.Launcher.Core/Plugin/ExecutablePlugin.cs | 20 +--
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 120 +++++++++---------
Flow.Launcher.Core/Plugin/PythonPlugin.cs | 12 +-
3 files changed, 81 insertions(+), 71 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs b/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
index 6a96a94b7..cbf048f16 100644
--- a/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
+++ b/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
@@ -1,5 +1,7 @@
using System;
using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Core.Plugin
@@ -21,34 +23,36 @@ namespace Flow.Launcher.Core.Plugin
};
}
- protected override string ExecuteQuery(Query query)
+ protected override Task ExecuteQueryAsync(Query query, CancellationToken token)
{
JsonRPCServerRequestModel request = new JsonRPCServerRequestModel
{
Method = "query",
- Parameters = new object[] { query.Search },
+ Parameters = new object[] {query.Search},
};
_startInfo.Arguments = $"\"{request}\"";
- return Execute(_startInfo);
+ return ExecuteAsync(_startInfo, token);
}
protected override string ExecuteCallback(JsonRPCRequestModel rpcRequest)
{
_startInfo.Arguments = $"\"{rpcRequest}\"";
- return Execute(_startInfo);
+ return ExecuteAsync(_startInfo).GetAwaiter().GetResult();
}
- protected override string ExecuteContextMenu(Result selectedResult) {
- JsonRPCServerRequestModel request = new JsonRPCServerRequestModel {
+ protected override string ExecuteContextMenu(Result selectedResult)
+ {
+ JsonRPCServerRequestModel request = new JsonRPCServerRequestModel
+ {
Method = "contextmenu",
- Parameters = new object[] { selectedResult.ContextData },
+ Parameters = new object[] {selectedResult.ContextData},
};
_startInfo.Arguments = $"\"{request}\"";
- return Execute(_startInfo);
+ return ExecuteAsync(_startInfo).GetAwaiter().GetResult();
}
}
}
\ No newline at end of file
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
index c7ad70391..626013cf0 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
@@ -1,15 +1,14 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.IO;
using System.Reflection;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
-using Flow.Launcher.Infrastructure.Exception;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Plugin;
+using JetBrains.Annotations;
namespace Flow.Launcher.Core.Plugin
{
@@ -17,7 +16,7 @@ namespace Flow.Launcher.Core.Plugin
/// Represent the plugin that using JsonPRC
/// every JsonRPC plugin should has its own plugin instance
///
- internal abstract class JsonRPCPlugin : IPlugin, IContextMenu
+ internal abstract class JsonRPCPlugin : IAsyncPlugin, IContextMenu
{
protected PluginInitContext context;
public const string JsonRPC = "JsonRPC";
@@ -27,23 +26,10 @@ namespace Flow.Launcher.Core.Plugin
///
public abstract string SupportedLanguage { get; set; }
- protected abstract string ExecuteQuery(Query query);
+ protected abstract Task ExecuteQueryAsync(Query query, CancellationToken token);
protected abstract string ExecuteCallback(JsonRPCRequestModel rpcRequest);
protected abstract string ExecuteContextMenu(Result selectedResult);
- public List Query(Query query)
- {
- string output = ExecuteQuery(query);
- try
- {
- return DeserializedResult(output);
- }
- catch (Exception e)
- {
- Log.Exception($"|JsonRPCPlugin.Query|Exception when query <{query}>", e);
- return null;
- }
- }
public List LoadContextMenus(Result selectedResult)
{
@@ -65,44 +51,47 @@ namespace Flow.Launcher.Core.Plugin
{
List results = new List();
- JsonRPCQueryResponseModel queryResponseModel = JsonSerializer.Deserialize(output);
+ JsonRPCQueryResponseModel queryResponseModel =
+ JsonSerializer.Deserialize(output);
if (queryResponseModel.Result == null) return null;
foreach (JsonRPCResult result in queryResponseModel.Result)
{
- JsonRPCResult result1 = result;
result.Action = c =>
{
- if (result1.JsonRPCAction == null) return false;
+ if (result.JsonRPCAction == null) return false;
- if (!String.IsNullOrEmpty(result1.JsonRPCAction.Method))
+ if (!String.IsNullOrEmpty(result.JsonRPCAction.Method))
{
- if (result1.JsonRPCAction.Method.StartsWith("Flow.Launcher."))
+ if (result.JsonRPCAction.Method.StartsWith("Flow.Launcher."))
{
- ExecuteFlowLauncherAPI(result1.JsonRPCAction.Method.Substring(4), result1.JsonRPCAction.Parameters);
+ ExecuteFlowLauncherAPI(result.JsonRPCAction.Method.Substring(4),
+ result.JsonRPCAction.Parameters);
}
else
{
- string actionReponse = ExecuteCallback(result1.JsonRPCAction);
- JsonRPCRequestModel jsonRpcRequestModel = JsonSerializer.Deserialize(actionReponse);
+ string actionReponse = ExecuteCallback(result.JsonRPCAction);
+ JsonRPCRequestModel jsonRpcRequestModel =
+ JsonSerializer.Deserialize(actionReponse);
if (jsonRpcRequestModel != null
&& !String.IsNullOrEmpty(jsonRpcRequestModel.Method)
&& jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
{
- ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4), jsonRpcRequestModel.Parameters);
+ ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4),
+ jsonRpcRequestModel.Parameters);
}
}
}
- return !result1.JsonRPCAction.DontHideAfterAction;
+
+ return !result.JsonRPCAction.DontHideAfterAction;
};
results.Add(result);
}
+
return results;
}
- else
- {
- return null;
- }
+
+ return null;
}
private void ExecuteFlowLauncherAPI(string method, object[] parameters)
@@ -117,9 +106,7 @@ namespace Flow.Launcher.Core.Plugin
catch (Exception)
{
#if (DEBUG)
- {
- throw;
- }
+ throw;
#endif
}
}
@@ -130,8 +117,9 @@ namespace Flow.Launcher.Core.Plugin
///
///
///
+ /// Cancellation Token
///
- protected string Execute(string fileName, string arguments)
+ protected async Task ExecuteAsync(string fileName, string arguments, CancellationToken token = default)
{
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = fileName;
@@ -140,10 +128,10 @@ namespace Flow.Launcher.Core.Plugin
start.CreateNoWindow = true;
start.RedirectStandardOutput = true;
start.RedirectStandardError = true;
- return Execute(start);
+ return await ExecuteAsync(start, token);
}
- protected string Execute(ProcessStartInfo startInfo)
+ protected async Task ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token = default)
{
try
{
@@ -155,45 +143,59 @@ namespace Flow.Launcher.Core.Plugin
}
using var standardOutput = process.StandardOutput;
- var result = standardOutput.ReadToEnd();
+ var result = await standardOutput.ReadToEndAsync();
+ if (token.IsCancellationRequested)
+ return string.Empty;
+
if (string.IsNullOrEmpty(result))
{
- using (var standardError = process.StandardError)
+ using var standardError = process.StandardError;
+ var error = await standardError.ReadToEndAsync();
+ if (!string.IsNullOrEmpty(error))
{
- 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;
- }
+ Log.Error($"|JsonRPCPlugin.Execute|{error}");
+ return string.Empty;
}
- }
- else if (result.StartsWith("DEBUG:"))
- {
- MessageBox.Show(new Form { TopMost = true }, result.Substring(6));
+
+ Log.Error("|JsonRPCPlugin.Execute|Empty standard output and standard error.");
return string.Empty;
}
- else
+
+ if (result.StartsWith("DEBUG:"))
{
- return result;
+ MessageBox.Show(new Form {TopMost = true}, result.Substring(6));
+ return string.Empty;
}
+ return result;
}
catch (Exception e)
{
- Log.Exception($"|JsonRPCPlugin.Execute|Exception for filename <{startInfo.FileName}> with argument <{startInfo.Arguments}>", e);
+ Log.Exception(
+ $"|JsonRPCPlugin.Execute|Exception for filename <{startInfo.FileName}> with argument <{startInfo.Arguments}>",
+ e);
return string.Empty;
}
}
- public void Init(PluginInitContext ctx)
+ public async Task> QueryAsync(Query query, CancellationToken token)
{
- context = ctx;
+ string output = await ExecuteQueryAsync(query, token);
+ try
+ {
+ return DeserializedResult(output);
+ }
+ catch (Exception e)
+ {
+ Log.Exception($"|JsonRPCPlugin.Query|Exception when query <{query}>", e);
+ return null;
+ }
+ }
+
+ public Task InitAsync(PluginInitContext context)
+ {
+ this.context = context;
+ return Task.CompletedTask;
}
}
}
\ No newline at end of file
diff --git a/Flow.Launcher.Core/Plugin/PythonPlugin.cs b/Flow.Launcher.Core/Plugin/PythonPlugin.cs
index 3c5a3a699..314726735 100644
--- a/Flow.Launcher.Core/Plugin/PythonPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/PythonPlugin.cs
@@ -1,6 +1,8 @@
using System;
using System.Diagnostics;
using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Plugin;
@@ -28,7 +30,7 @@ namespace Flow.Launcher.Core.Plugin
}
- protected override string ExecuteQuery(Query query)
+ protected override Task ExecuteQueryAsync(Query query, CancellationToken token)
{
JsonRPCServerRequestModel request = new JsonRPCServerRequestModel
{
@@ -40,14 +42,15 @@ namespace Flow.Launcher.Core.Plugin
// todo happlebao why context can't be used in constructor
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
- return Execute(_startInfo);
+ return ExecuteAsync(_startInfo, token);
}
protected override string ExecuteCallback(JsonRPCRequestModel rpcRequest)
{
_startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{rpcRequest}\"";
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
- return Execute(_startInfo);
+ // TODO: Async Action
+ return ExecuteAsync(_startInfo).GetAwaiter().GetResult();
}
protected override string ExecuteContextMenu(Result selectedResult) {
@@ -58,7 +61,8 @@ namespace Flow.Launcher.Core.Plugin
_startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{request}\"";
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
- return Execute(_startInfo);
+ // TODO: Async Action
+ return ExecuteAsync(_startInfo).GetAwaiter().GetResult();
}
}
}
\ No newline at end of file
From b15319ea4da793d8401a97b0c782fd3164860097 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E5=BC=98=E9=9F=AC?=
Date: Mon, 8 Feb 2021 14:43:17 +0800
Subject: [PATCH 02/70] Keep the Sync version for ContextMenu and Callback
---
Flow.Launcher.Core/Plugin/ExecutablePlugin.cs | 4 +-
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 64 +++++++++++++++----
Flow.Launcher.Core/Plugin/PythonPlugin.cs | 4 +-
3 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs b/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
index cbf048f16..d0d47aa58 100644
--- a/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
+++ b/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
@@ -39,7 +39,7 @@ namespace Flow.Launcher.Core.Plugin
protected override string ExecuteCallback(JsonRPCRequestModel rpcRequest)
{
_startInfo.Arguments = $"\"{rpcRequest}\"";
- return ExecuteAsync(_startInfo).GetAwaiter().GetResult();
+ return Execute(_startInfo);
}
protected override string ExecuteContextMenu(Result selectedResult)
@@ -52,7 +52,7 @@ namespace Flow.Launcher.Core.Plugin
_startInfo.Arguments = $"\"{request}\"";
- return ExecuteAsync(_startInfo).GetAwaiter().GetResult();
+ return Execute(_startInfo);
}
}
}
\ No newline at end of file
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
index 626013cf0..7d221b74d 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
@@ -131,26 +131,20 @@ namespace Flow.Launcher.Core.Plugin
return await ExecuteAsync(start, token);
}
- protected async Task ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token = default)
+ protected string Execute(ProcessStartInfo startInfo)
{
try
{
using var process = Process.Start(startInfo);
- if (process == null)
- {
- Log.Error("|JsonRPCPlugin.Execute|Can't start new process");
- return string.Empty;
- }
-
+ if (process == null) return string.Empty;
+
using var standardOutput = process.StandardOutput;
- var result = await standardOutput.ReadToEndAsync();
- if (token.IsCancellationRequested)
- return string.Empty;
+ var result = standardOutput.ReadToEnd();
if (string.IsNullOrEmpty(result))
{
using var standardError = process.StandardError;
- var error = await standardError.ReadToEndAsync();
+ var error = standardError.ReadToEnd();
if (!string.IsNullOrEmpty(error))
{
Log.Error($"|JsonRPCPlugin.Execute|{error}");
@@ -168,6 +162,7 @@ namespace Flow.Launcher.Core.Plugin
}
return result;
+
}
catch (Exception e)
{
@@ -178,6 +173,53 @@ namespace Flow.Launcher.Core.Plugin
}
}
+ protected async Task ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token = default)
+ {
+ try
+ {
+ using var process = Process.Start(startInfo);
+ if (process == null)
+ {
+ Log.Error("|JsonRPCPlugin.ExecuteAsync|Can't start new process");
+ return string.Empty;
+ }
+
+ using var standardOutput = process.StandardOutput;
+ var result = await standardOutput.ReadToEndAsync();
+ if (token.IsCancellationRequested)
+ return string.Empty;
+
+ if (string.IsNullOrEmpty(result))
+ {
+ using var standardError = process.StandardError;
+ var error = await standardError.ReadToEndAsync();
+ if (!string.IsNullOrEmpty(error))
+ {
+ Log.Error($"|JsonRPCPlugin.ExecuteAsync|{error}");
+ return string.Empty;
+ }
+
+ Log.Error("|JsonRPCPlugin.ExecuteAsync|Empty standard output and standard error.");
+ return string.Empty;
+ }
+
+ if (result.StartsWith("DEBUG:"))
+ {
+ MessageBox.Show(new Form {TopMost = true}, result.Substring(6));
+ return string.Empty;
+ }
+
+ return result;
+ }
+ catch (Exception e)
+ {
+ Log.Exception(
+ $"|JsonRPCPlugin.ExecuteAsync|Exception for filename <{startInfo.FileName}> with argument <{startInfo.Arguments}>",
+ e);
+ return string.Empty;
+ }
+ }
+
public async Task> QueryAsync(Query query, CancellationToken token)
{
string output = await ExecuteQueryAsync(query, token);
diff --git a/Flow.Launcher.Core/Plugin/PythonPlugin.cs b/Flow.Launcher.Core/Plugin/PythonPlugin.cs
index 314726735..750684954 100644
--- a/Flow.Launcher.Core/Plugin/PythonPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/PythonPlugin.cs
@@ -50,7 +50,7 @@ namespace Flow.Launcher.Core.Plugin
_startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{rpcRequest}\"";
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
// TODO: Async Action
- return ExecuteAsync(_startInfo).GetAwaiter().GetResult();
+ return Execute(_startInfo);
}
protected override string ExecuteContextMenu(Result selectedResult) {
@@ -62,7 +62,7 @@ namespace Flow.Launcher.Core.Plugin
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
// TODO: Async Action
- return ExecuteAsync(_startInfo).GetAwaiter().GetResult();
+ return Execute(_startInfo);
}
}
}
\ No newline at end of file
From f93dcaef73a9478d0c5920c9eca41ff2e91ff3a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Tue, 9 Feb 2021 14:03:22 +0800
Subject: [PATCH 03/70] use throw instead of return empty string
---
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
index 7d221b74d..5b56f9347 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
@@ -185,14 +185,18 @@ namespace Flow.Launcher.Core.Plugin
}
using var standardOutput = process.StandardOutput;
+
+ token.ThrowIfCancellationRequested();
+
var result = await standardOutput.ReadToEndAsync();
- if (token.IsCancellationRequested)
- return string.Empty;
+ token.ThrowIfCancellationRequested();
if (string.IsNullOrEmpty(result))
{
using var standardError = process.StandardError;
var error = await standardError.ReadToEndAsync();
+ token.ThrowIfCancellationRequested();
+
if (!string.IsNullOrEmpty(error))
{
Log.Error($"|JsonRPCPlugin.ExecuteAsync|{error}");
From 89ac8e5ee0a27adcc741c87078bb1c7930645c1d Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Thu, 11 Feb 2021 08:47:30 +1100
Subject: [PATCH 04/70] add port plugins documentation
---
.../Default Icons/app_missing_img.png | Bin
.../Default Icons/app_missing_img_01.png | Bin
.../Default Icons/app_missing_img_01.svg | 0
.../Default Icons/app_missing_img_02.png | Bin
.../Default Icons/app_missing_img_02.svg | 0
.../Default Icons/app_missing_img_03.png | Bin
.../Default Icons/app_missing_img_03.svg | 0
.../Default Icons/app_missing_img_buttons.png | Bin
.../Default Icons/app_missing_img_buttons.svg | 0
.../Default Icons/app_missing_img_fluent.png | Bin
.../Default Icons/app_missing_img_fluent.svg | 0
.../Default Icons/app_missing_img_huge.png | Bin
.../Default Icons/app_missing_img_huge.svg | 0
.../app_missing_img_lightblue.png | Bin
.../app_missing_img_lightblue.svg | 0
.../app_missing_img_lightblue_buttons.png | Bin
.../app_missing_img_lightblue_buttons.svg | 0
.../Default Icons/app_missing_img_minimal.png | Bin
.../Default Icons/app_missing_img_minimal.svg | 0
.../app_missing_img_minimal_buttons.png | Bin
.../app_missing_img_minimal_buttons.svg | 0
{Doc => Artworks}/Logo/app_error.png | Bin
{Doc => Artworks}/Logo/logo.ico | Bin
{Doc => Artworks}/Logo/logo.png | Bin
{Doc => Artworks}/Logo/logo.svg | 0
{Doc => Artworks}/Logo/logo128.png | Bin
{Doc => Artworks}/Logo/logo16.png | Bin
{Doc => Artworks}/Logo/logo256.png | Bin
{Doc => Artworks}/Logo/logo32.png | Bin
{Doc => Artworks}/Logo/logo48.png | Bin
{Doc => Artworks}/Logo/logo512.png | Bin
{Doc => Artworks}/Logo/logo64.png | Bin
.../flow-header-landscape-transparent.png | Bin
.../Logo/resources/flow-header-landscape.png | Bin
.../flow-header-square-transparent.png | Bin
.../Logo/resources/flow-header-square.png | Bin
{Doc => Artworks}/Logo/resources/flow-logo.ai | 0
{Doc => Artworks}/Logo/resources/preview.pdf | 0
{Doc => Artworks}/app.ico | Bin
{Doc => Artworks}/app.png | Bin
{Doc => Artworks}/app_error.png | Bin
{Doc => Artworks}/app_missing_img.png | Bin
{Doc => Artworks}/mainsearch.png | Bin
Docs/port-plugins.md | 17 +++++++++++++++++
44 files changed, 17 insertions(+)
rename {Doc => Artworks}/Default Icons/app_missing_img.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_01.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_01.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_02.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_02.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_03.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_03.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_buttons.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_buttons.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_fluent.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_fluent.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_huge.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_huge.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_lightblue.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_lightblue.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_lightblue_buttons.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_lightblue_buttons.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_minimal.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_minimal.svg (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_minimal_buttons.png (100%)
rename {Doc => Artworks}/Default Icons/app_missing_img_minimal_buttons.svg (100%)
rename {Doc => Artworks}/Logo/app_error.png (100%)
rename {Doc => Artworks}/Logo/logo.ico (100%)
rename {Doc => Artworks}/Logo/logo.png (100%)
rename {Doc => Artworks}/Logo/logo.svg (100%)
rename {Doc => Artworks}/Logo/logo128.png (100%)
rename {Doc => Artworks}/Logo/logo16.png (100%)
rename {Doc => Artworks}/Logo/logo256.png (100%)
rename {Doc => Artworks}/Logo/logo32.png (100%)
rename {Doc => Artworks}/Logo/logo48.png (100%)
rename {Doc => Artworks}/Logo/logo512.png (100%)
rename {Doc => Artworks}/Logo/logo64.png (100%)
rename {Doc => Artworks}/Logo/resources/flow-header-landscape-transparent.png (100%)
rename {Doc => Artworks}/Logo/resources/flow-header-landscape.png (100%)
rename {Doc => Artworks}/Logo/resources/flow-header-square-transparent.png (100%)
rename {Doc => Artworks}/Logo/resources/flow-header-square.png (100%)
rename {Doc => Artworks}/Logo/resources/flow-logo.ai (100%)
rename {Doc => Artworks}/Logo/resources/preview.pdf (100%)
rename {Doc => Artworks}/app.ico (100%)
rename {Doc => Artworks}/app.png (100%)
rename {Doc => Artworks}/app_error.png (100%)
rename {Doc => Artworks}/app_missing_img.png (100%)
rename {Doc => Artworks}/mainsearch.png (100%)
create mode 100644 Docs/port-plugins.md
diff --git a/Doc/Default Icons/app_missing_img.png b/Artworks/Default Icons/app_missing_img.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img.png
rename to Artworks/Default Icons/app_missing_img.png
diff --git a/Doc/Default Icons/app_missing_img_01.png b/Artworks/Default Icons/app_missing_img_01.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_01.png
rename to Artworks/Default Icons/app_missing_img_01.png
diff --git a/Doc/Default Icons/app_missing_img_01.svg b/Artworks/Default Icons/app_missing_img_01.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_01.svg
rename to Artworks/Default Icons/app_missing_img_01.svg
diff --git a/Doc/Default Icons/app_missing_img_02.png b/Artworks/Default Icons/app_missing_img_02.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_02.png
rename to Artworks/Default Icons/app_missing_img_02.png
diff --git a/Doc/Default Icons/app_missing_img_02.svg b/Artworks/Default Icons/app_missing_img_02.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_02.svg
rename to Artworks/Default Icons/app_missing_img_02.svg
diff --git a/Doc/Default Icons/app_missing_img_03.png b/Artworks/Default Icons/app_missing_img_03.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_03.png
rename to Artworks/Default Icons/app_missing_img_03.png
diff --git a/Doc/Default Icons/app_missing_img_03.svg b/Artworks/Default Icons/app_missing_img_03.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_03.svg
rename to Artworks/Default Icons/app_missing_img_03.svg
diff --git a/Doc/Default Icons/app_missing_img_buttons.png b/Artworks/Default Icons/app_missing_img_buttons.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_buttons.png
rename to Artworks/Default Icons/app_missing_img_buttons.png
diff --git a/Doc/Default Icons/app_missing_img_buttons.svg b/Artworks/Default Icons/app_missing_img_buttons.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_buttons.svg
rename to Artworks/Default Icons/app_missing_img_buttons.svg
diff --git a/Doc/Default Icons/app_missing_img_fluent.png b/Artworks/Default Icons/app_missing_img_fluent.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_fluent.png
rename to Artworks/Default Icons/app_missing_img_fluent.png
diff --git a/Doc/Default Icons/app_missing_img_fluent.svg b/Artworks/Default Icons/app_missing_img_fluent.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_fluent.svg
rename to Artworks/Default Icons/app_missing_img_fluent.svg
diff --git a/Doc/Default Icons/app_missing_img_huge.png b/Artworks/Default Icons/app_missing_img_huge.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_huge.png
rename to Artworks/Default Icons/app_missing_img_huge.png
diff --git a/Doc/Default Icons/app_missing_img_huge.svg b/Artworks/Default Icons/app_missing_img_huge.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_huge.svg
rename to Artworks/Default Icons/app_missing_img_huge.svg
diff --git a/Doc/Default Icons/app_missing_img_lightblue.png b/Artworks/Default Icons/app_missing_img_lightblue.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_lightblue.png
rename to Artworks/Default Icons/app_missing_img_lightblue.png
diff --git a/Doc/Default Icons/app_missing_img_lightblue.svg b/Artworks/Default Icons/app_missing_img_lightblue.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_lightblue.svg
rename to Artworks/Default Icons/app_missing_img_lightblue.svg
diff --git a/Doc/Default Icons/app_missing_img_lightblue_buttons.png b/Artworks/Default Icons/app_missing_img_lightblue_buttons.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_lightblue_buttons.png
rename to Artworks/Default Icons/app_missing_img_lightblue_buttons.png
diff --git a/Doc/Default Icons/app_missing_img_lightblue_buttons.svg b/Artworks/Default Icons/app_missing_img_lightblue_buttons.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_lightblue_buttons.svg
rename to Artworks/Default Icons/app_missing_img_lightblue_buttons.svg
diff --git a/Doc/Default Icons/app_missing_img_minimal.png b/Artworks/Default Icons/app_missing_img_minimal.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_minimal.png
rename to Artworks/Default Icons/app_missing_img_minimal.png
diff --git a/Doc/Default Icons/app_missing_img_minimal.svg b/Artworks/Default Icons/app_missing_img_minimal.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_minimal.svg
rename to Artworks/Default Icons/app_missing_img_minimal.svg
diff --git a/Doc/Default Icons/app_missing_img_minimal_buttons.png b/Artworks/Default Icons/app_missing_img_minimal_buttons.png
similarity index 100%
rename from Doc/Default Icons/app_missing_img_minimal_buttons.png
rename to Artworks/Default Icons/app_missing_img_minimal_buttons.png
diff --git a/Doc/Default Icons/app_missing_img_minimal_buttons.svg b/Artworks/Default Icons/app_missing_img_minimal_buttons.svg
similarity index 100%
rename from Doc/Default Icons/app_missing_img_minimal_buttons.svg
rename to Artworks/Default Icons/app_missing_img_minimal_buttons.svg
diff --git a/Doc/Logo/app_error.png b/Artworks/Logo/app_error.png
similarity index 100%
rename from Doc/Logo/app_error.png
rename to Artworks/Logo/app_error.png
diff --git a/Doc/Logo/logo.ico b/Artworks/Logo/logo.ico
similarity index 100%
rename from Doc/Logo/logo.ico
rename to Artworks/Logo/logo.ico
diff --git a/Doc/Logo/logo.png b/Artworks/Logo/logo.png
similarity index 100%
rename from Doc/Logo/logo.png
rename to Artworks/Logo/logo.png
diff --git a/Doc/Logo/logo.svg b/Artworks/Logo/logo.svg
similarity index 100%
rename from Doc/Logo/logo.svg
rename to Artworks/Logo/logo.svg
diff --git a/Doc/Logo/logo128.png b/Artworks/Logo/logo128.png
similarity index 100%
rename from Doc/Logo/logo128.png
rename to Artworks/Logo/logo128.png
diff --git a/Doc/Logo/logo16.png b/Artworks/Logo/logo16.png
similarity index 100%
rename from Doc/Logo/logo16.png
rename to Artworks/Logo/logo16.png
diff --git a/Doc/Logo/logo256.png b/Artworks/Logo/logo256.png
similarity index 100%
rename from Doc/Logo/logo256.png
rename to Artworks/Logo/logo256.png
diff --git a/Doc/Logo/logo32.png b/Artworks/Logo/logo32.png
similarity index 100%
rename from Doc/Logo/logo32.png
rename to Artworks/Logo/logo32.png
diff --git a/Doc/Logo/logo48.png b/Artworks/Logo/logo48.png
similarity index 100%
rename from Doc/Logo/logo48.png
rename to Artworks/Logo/logo48.png
diff --git a/Doc/Logo/logo512.png b/Artworks/Logo/logo512.png
similarity index 100%
rename from Doc/Logo/logo512.png
rename to Artworks/Logo/logo512.png
diff --git a/Doc/Logo/logo64.png b/Artworks/Logo/logo64.png
similarity index 100%
rename from Doc/Logo/logo64.png
rename to Artworks/Logo/logo64.png
diff --git a/Doc/Logo/resources/flow-header-landscape-transparent.png b/Artworks/Logo/resources/flow-header-landscape-transparent.png
similarity index 100%
rename from Doc/Logo/resources/flow-header-landscape-transparent.png
rename to Artworks/Logo/resources/flow-header-landscape-transparent.png
diff --git a/Doc/Logo/resources/flow-header-landscape.png b/Artworks/Logo/resources/flow-header-landscape.png
similarity index 100%
rename from Doc/Logo/resources/flow-header-landscape.png
rename to Artworks/Logo/resources/flow-header-landscape.png
diff --git a/Doc/Logo/resources/flow-header-square-transparent.png b/Artworks/Logo/resources/flow-header-square-transparent.png
similarity index 100%
rename from Doc/Logo/resources/flow-header-square-transparent.png
rename to Artworks/Logo/resources/flow-header-square-transparent.png
diff --git a/Doc/Logo/resources/flow-header-square.png b/Artworks/Logo/resources/flow-header-square.png
similarity index 100%
rename from Doc/Logo/resources/flow-header-square.png
rename to Artworks/Logo/resources/flow-header-square.png
diff --git a/Doc/Logo/resources/flow-logo.ai b/Artworks/Logo/resources/flow-logo.ai
similarity index 100%
rename from Doc/Logo/resources/flow-logo.ai
rename to Artworks/Logo/resources/flow-logo.ai
diff --git a/Doc/Logo/resources/preview.pdf b/Artworks/Logo/resources/preview.pdf
similarity index 100%
rename from Doc/Logo/resources/preview.pdf
rename to Artworks/Logo/resources/preview.pdf
diff --git a/Doc/app.ico b/Artworks/app.ico
similarity index 100%
rename from Doc/app.ico
rename to Artworks/app.ico
diff --git a/Doc/app.png b/Artworks/app.png
similarity index 100%
rename from Doc/app.png
rename to Artworks/app.png
diff --git a/Doc/app_error.png b/Artworks/app_error.png
similarity index 100%
rename from Doc/app_error.png
rename to Artworks/app_error.png
diff --git a/Doc/app_missing_img.png b/Artworks/app_missing_img.png
similarity index 100%
rename from Doc/app_missing_img.png
rename to Artworks/app_missing_img.png
diff --git a/Doc/mainsearch.png b/Artworks/mainsearch.png
similarity index 100%
rename from Doc/mainsearch.png
rename to Artworks/mainsearch.png
diff --git a/Docs/port-plugins.md b/Docs/port-plugins.md
new file mode 100644
index 000000000..d12830124
--- /dev/null
+++ b/Docs/port-plugins.md
@@ -0,0 +1,17 @@
+# Porting Wox Plugins
+
+Note:
+- When porting, please keep the author's commit history
+- Flow Launcher targets .Net Core 3.1, so plugins should also be upgraded to keep the continuity of future developments
+
+Steps:
+1. to start off, you can fork/create a new repo, either way the project's commit history must be kept. If it's forked, you can just start updating it. If it's a new repo, do this by first cloning the repo, then add your new repo as a new repo remote, remove the original remote and then push to it.
+2. use try convert tool from https://github.com/dotnet/try-convert
+3. try-convert -w path-to-folder-or-solution-or-project
+4. May need to fix on the project file, a good template to follow is the [Explorer plugin](https://github.com/Flow-Launcher/Flow.Launcher/blob/dev/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj) project:
+ - fix to netcoreapp3.1
+ - set the output location as 'Output\Release\'
+ - add true and false
+ - bump version to 2.0.0 and fix up any missing attributes if neccessary
+5. update code and fix plugin's setting layout if neccessary
+6. update readme to indicate where this port is from and the original author of the project
\ No newline at end of file
From aabb820f6f7e017bedff097ab6a03ba03433721f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Sun, 14 Feb 2021 12:02:59 +0800
Subject: [PATCH 05/70] Optimize ToString() method override
---
Flow.Launcher.Core/Plugin/JsonPRCModel.cs | 33 ++++++++--------------
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 4 +--
2 files changed, 13 insertions(+), 24 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/JsonPRCModel.cs b/Flow.Launcher.Core/Plugin/JsonPRCModel.cs
index 247fe1889..a0731f8fb 100644
--- a/Flow.Launcher.Core/Plugin/JsonPRCModel.cs
+++ b/Flow.Launcher.Core/Plugin/JsonPRCModel.cs
@@ -58,13 +58,12 @@ namespace Flow.Launcher.Core.Plugin
string rpc = string.Empty;
if (Parameters != null && Parameters.Length > 0)
{
- string parameters = Parameters.Aggregate("[", (current, o) => current + (GetParameterByType(o) + ","));
- parameters = parameters.Substring(0, parameters.Length - 1) + "]";
- rpc = string.Format(@"{{\""method\"":\""{0}\"",\""parameters\"":{1}", Method, parameters);
+ string parameters = $"[{string.Join(',', Parameters.Select(GetParameterByType))}]";
+ rpc = $@"{{\""method\"":\""{Method}\"",\""parameters\"":{parameters}";
}
else
{
- rpc = string.Format(@"{{\""method\"":\""{0}\"",\""parameters\"":[]", Method);
+ rpc = $@"{{\""method\"":\""{Method}\"",\""parameters\"":[]";
}
return rpc;
@@ -72,26 +71,16 @@ namespace Flow.Launcher.Core.Plugin
}
private string GetParameterByType(object parameter)
+ => parameter switch
{
- if (parameter == null) {
- return "null";
- }
- if (parameter is string)
- {
- return string.Format(@"\""{0}\""", ReplaceEscapes(parameter.ToString()));
- }
- if (parameter is int || parameter is float || parameter is double)
- {
- return string.Format(@"{0}", parameter);
- }
- if (parameter is bool)
- {
- return string.Format(@"{0}", parameter.ToString().ToLower());
- }
- return parameter.ToString();
- }
+ null => "null",
+ string _ => $@"\""{ReplaceEscapes(parameter.ToString())}\""",
+ bool _ => $@"{parameter.ToString().ToLower()}",
+ _ => parameter.ToString()
+ };
- private string ReplaceEscapes(string str)
+
+ private string ReplaceEscapes(string str)
{
return str.Replace(@"\", @"\\") //Escapes in ProcessStartInfo
.Replace(@"\", @"\\") //Escapes itself when passed to client
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
index 5b56f9347..a37b2b68b 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
@@ -119,7 +119,7 @@ namespace Flow.Launcher.Core.Plugin
///
/// Cancellation Token
///
- protected async Task ExecuteAsync(string fileName, string arguments, CancellationToken token = default)
+ protected Task ExecuteAsync(string fileName, string arguments, CancellationToken token = default)
{
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = fileName;
@@ -128,7 +128,7 @@ namespace Flow.Launcher.Core.Plugin
start.CreateNoWindow = true;
start.RedirectStandardOutput = true;
start.RedirectStandardError = true;
- return await ExecuteAsync(start, token);
+ return ExecuteAsync(start, token);
}
protected string Execute(ProcessStartInfo startInfo)
From 34a7a1522642f4252e6106511cb8538508bfdfa2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Sun, 14 Feb 2021 13:56:27 +0800
Subject: [PATCH 06/70] Use Stream model
---
Flow.Launcher.Core/Plugin/ExecutablePlugin.cs | 3 +-
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 141 ++++++++++--------
Flow.Launcher.Core/Plugin/PythonPlugin.cs | 2 +-
3 files changed, 78 insertions(+), 68 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs b/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
index d0d47aa58..13b6ac968 100644
--- a/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
+++ b/Flow.Launcher.Core/Plugin/ExecutablePlugin.cs
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Flow.Launcher.Plugin;
@@ -23,7 +24,7 @@ namespace Flow.Launcher.Core.Plugin
};
}
- protected override Task ExecuteQueryAsync(Query query, CancellationToken token)
+ protected override Task ExecuteQueryAsync(Query query, CancellationToken token)
{
JsonRPCServerRequestModel request = new JsonRPCServerRequestModel
{
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
index a37b2b68b..a5633b118 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.IO;
using System.Reflection;
using System.Text.Json;
using System.Threading;
@@ -26,7 +27,7 @@ namespace Flow.Launcher.Core.Plugin
///
public abstract string SupportedLanguage { get; set; }
- protected abstract Task ExecuteQueryAsync(Query query, CancellationToken token);
+ protected abstract Task ExecuteQueryAsync(Query query, CancellationToken token);
protected abstract string ExecuteCallback(JsonRPCRequestModel rpcRequest);
protected abstract string ExecuteContextMenu(Result selectedResult);
@@ -45,53 +46,66 @@ namespace Flow.Launcher.Core.Plugin
}
}
- private List DeserializedResult(string output)
+
+
+ private List ParseResults(JsonRPCQueryResponseModel queryResponseModel)
{
- if (!String.IsNullOrEmpty(output))
+ var results = new List();
+ if (queryResponseModel.Result == null) return null;
+
+ foreach (JsonRPCResult result in queryResponseModel.Result)
{
- List results = new List();
-
- JsonRPCQueryResponseModel queryResponseModel =
- JsonSerializer.Deserialize(output);
- if (queryResponseModel.Result == null) return null;
-
- foreach (JsonRPCResult result in queryResponseModel.Result)
+ result.Action = c =>
{
- result.Action = c =>
- {
- if (result.JsonRPCAction == null) return false;
+ if (result.JsonRPCAction == null) return false;
- if (!String.IsNullOrEmpty(result.JsonRPCAction.Method))
+ if (!string.IsNullOrEmpty(result.JsonRPCAction.Method))
+ {
+ if (result.JsonRPCAction.Method.StartsWith("Flow.Launcher."))
{
- if (result.JsonRPCAction.Method.StartsWith("Flow.Launcher."))
+ ExecuteFlowLauncherAPI(result.JsonRPCAction.Method.Substring(4),
+ result.JsonRPCAction.Parameters);
+ }
+ else
+ {
+ string actionReponse = ExecuteCallback(result.JsonRPCAction);
+ JsonRPCRequestModel jsonRpcRequestModel =
+ JsonSerializer.Deserialize(actionReponse);
+ if (jsonRpcRequestModel != null
+ && !string.IsNullOrEmpty(jsonRpcRequestModel.Method)
+ && jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
{
- ExecuteFlowLauncherAPI(result.JsonRPCAction.Method.Substring(4),
- result.JsonRPCAction.Parameters);
- }
- else
- {
- string actionReponse = ExecuteCallback(result.JsonRPCAction);
- JsonRPCRequestModel jsonRpcRequestModel =
- JsonSerializer.Deserialize(actionReponse);
- if (jsonRpcRequestModel != null
- && !String.IsNullOrEmpty(jsonRpcRequestModel.Method)
- && jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
- {
- ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4),
- jsonRpcRequestModel.Parameters);
- }
+ ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4),
+ jsonRpcRequestModel.Parameters);
}
}
+ }
- return !result.JsonRPCAction.DontHideAfterAction;
- };
- results.Add(result);
- }
-
- return results;
+ return !result.JsonRPCAction.DontHideAfterAction;
+ };
+ results.Add(result);
}
- return null;
+ return results;
+ }
+
+ private async Task> DeserializedResultAsync(Stream output)
+ {
+ if (output == Stream.Null) return null;
+
+ JsonRPCQueryResponseModel queryResponseModel = await
+ JsonSerializer.DeserializeAsync(output);
+
+ return ParseResults(queryResponseModel);
+ }
+
+ private List DeserializedResult(string output)
+ {
+ if (string.IsNullOrEmpty(output)) return null;
+
+ JsonRPCQueryResponseModel queryResponseModel =
+ JsonSerializer.Deserialize(output);
+ return ParseResults(queryResponseModel);
}
private void ExecuteFlowLauncherAPI(string method, object[] parameters)
@@ -119,15 +133,17 @@ namespace Flow.Launcher.Core.Plugin
///
/// Cancellation Token
///
- protected Task ExecuteAsync(string fileName, string arguments, CancellationToken token = default)
+ protected Task ExecuteAsync(string fileName, string arguments, CancellationToken token = default)
{
- ProcessStartInfo start = new ProcessStartInfo();
- start.FileName = fileName;
- start.Arguments = arguments;
- start.UseShellExecute = false;
- start.CreateNoWindow = true;
- start.RedirectStandardOutput = true;
- start.RedirectStandardError = true;
+ ProcessStartInfo start = new ProcessStartInfo
+ {
+ FileName = fileName,
+ Arguments = arguments,
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true
+ };
return ExecuteAsync(start, token);
}
@@ -137,7 +153,7 @@ namespace Flow.Launcher.Core.Plugin
{
using var process = Process.Start(startInfo);
if (process == null) return string.Empty;
-
+
using var standardOutput = process.StandardOutput;
var result = standardOutput.ReadToEnd();
@@ -157,12 +173,12 @@ namespace Flow.Launcher.Core.Plugin
if (result.StartsWith("DEBUG:"))
{
- MessageBox.Show(new Form {TopMost = true}, result.Substring(6));
+ MessageBox.Show(new Form { TopMost = true }, result.Substring(6));
return string.Empty;
}
return result;
-
+
}
catch (Exception e)
{
@@ -173,7 +189,7 @@ namespace Flow.Launcher.Core.Plugin
}
}
- protected async Task ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token = default)
+ protected async Task ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token = default)
{
try
{
@@ -181,17 +197,14 @@ namespace Flow.Launcher.Core.Plugin
if (process == null)
{
Log.Error("|JsonRPCPlugin.ExecuteAsync|Can't start new process");
- return string.Empty;
+ return Stream.Null;
}
- using var standardOutput = process.StandardOutput;
+ var result = process.StandardOutput.BaseStream;
token.ThrowIfCancellationRequested();
- var result = await standardOutput.ReadToEndAsync();
- token.ThrowIfCancellationRequested();
-
- if (string.IsNullOrEmpty(result))
+ if (!process.StandardError.EndOfStream)
{
using var standardError = process.StandardError;
var error = await standardError.ReadToEndAsync();
@@ -200,17 +213,11 @@ namespace Flow.Launcher.Core.Plugin
if (!string.IsNullOrEmpty(error))
{
Log.Error($"|JsonRPCPlugin.ExecuteAsync|{error}");
- return string.Empty;
+ return Stream.Null;
}
Log.Error("|JsonRPCPlugin.ExecuteAsync|Empty standard output and standard error.");
- return string.Empty;
- }
-
- if (result.StartsWith("DEBUG:"))
- {
- MessageBox.Show(new Form {TopMost = true}, result.Substring(6));
- return string.Empty;
+ return Stream.Null;
}
return result;
@@ -220,16 +227,18 @@ namespace Flow.Launcher.Core.Plugin
Log.Exception(
$"|JsonRPCPlugin.ExecuteAsync|Exception for filename <{startInfo.FileName}> with argument <{startInfo.Arguments}>",
e);
- return string.Empty;
+ return Stream.Null;
}
}
+
+
public async Task> QueryAsync(Query query, CancellationToken token)
{
- string output = await ExecuteQueryAsync(query, token);
+ var output = await ExecuteQueryAsync(query, token);
try
{
- return DeserializedResult(output);
+ return await DeserializedResultAsync(output);
}
catch (Exception e)
{
diff --git a/Flow.Launcher.Core/Plugin/PythonPlugin.cs b/Flow.Launcher.Core/Plugin/PythonPlugin.cs
index 750684954..356a68a81 100644
--- a/Flow.Launcher.Core/Plugin/PythonPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/PythonPlugin.cs
@@ -30,7 +30,7 @@ namespace Flow.Launcher.Core.Plugin
}
- protected override Task ExecuteQueryAsync(Query query, CancellationToken token)
+ protected override Task ExecuteQueryAsync(Query query, CancellationToken token)
{
JsonRPCServerRequestModel request = new JsonRPCServerRequestModel
{
From 824ea07ab2ca46c6563563708371f1af2d2a7f53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Sun, 14 Feb 2021 13:59:59 +0800
Subject: [PATCH 07/70] add Debug message field for debugging
---
Flow.Launcher.Core/Plugin/JsonPRCModel.cs | 2 +
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 43 ++++++++++++----------
2 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/JsonPRCModel.cs b/Flow.Launcher.Core/Plugin/JsonPRCModel.cs
index a0731f8fb..b1c8ff6ea 100644
--- a/Flow.Launcher.Core/Plugin/JsonPRCModel.cs
+++ b/Flow.Launcher.Core/Plugin/JsonPRCModel.cs
@@ -45,6 +45,8 @@ namespace Flow.Launcher.Core.Plugin
{
[JsonPropertyName("result")]
public new List Result { get; set; }
+
+ public string DebugMessage { get; set; }
}
public class JsonRPCRequestModel : JsonRPCModelBase
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
index a5633b118..e342a5f94 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
@@ -48,11 +48,35 @@ namespace Flow.Launcher.Core.Plugin
+ private async Task> DeserializedResultAsync(Stream output)
+ {
+ if (output == Stream.Null) return null;
+
+ JsonRPCQueryResponseModel queryResponseModel = await
+ JsonSerializer.DeserializeAsync(output);
+
+ return ParseResults(queryResponseModel);
+ }
+
+ private List DeserializedResult(string output)
+ {
+ if (string.IsNullOrEmpty(output)) return null;
+
+ JsonRPCQueryResponseModel queryResponseModel =
+ JsonSerializer.Deserialize(output);
+ return ParseResults(queryResponseModel);
+ }
+
private List ParseResults(JsonRPCQueryResponseModel queryResponseModel)
{
var results = new List();
if (queryResponseModel.Result == null) return null;
+ if(!string.IsNullOrEmpty(queryResponseModel.DebugMessage))
+ {
+ context.API.ShowMsg(queryResponseModel.DebugMessage);
+ }
+
foreach (JsonRPCResult result in queryResponseModel.Result)
{
result.Action = c =>
@@ -89,25 +113,6 @@ namespace Flow.Launcher.Core.Plugin
return results;
}
- private async Task> DeserializedResultAsync(Stream output)
- {
- if (output == Stream.Null) return null;
-
- JsonRPCQueryResponseModel queryResponseModel = await
- JsonSerializer.DeserializeAsync(output);
-
- return ParseResults(queryResponseModel);
- }
-
- private List DeserializedResult(string output)
- {
- if (string.IsNullOrEmpty(output)) return null;
-
- JsonRPCQueryResponseModel queryResponseModel =
- JsonSerializer.Deserialize(output);
- return ParseResults(queryResponseModel);
- }
-
private void ExecuteFlowLauncherAPI(string method, object[] parameters)
{
MethodInfo methodInfo = PluginManager.API.GetType().GetMethod(method);
From 9ebebfd0ef9fcaaada22c096adb55f093969e08b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 15 Feb 2021 18:27:02 +0800
Subject: [PATCH 08/70] No need to cancel error reporting
---
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
index e342a5f94..9caac1a47 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
@@ -213,7 +213,6 @@ namespace Flow.Launcher.Core.Plugin
{
using var standardError = process.StandardError;
var error = await standardError.ReadToEndAsync();
- token.ThrowIfCancellationRequested();
if (!string.IsNullOrEmpty(error))
{
From 033ce3051b4abd06318d9b8234775c29ff325695 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Tue, 16 Feb 2021 01:41:02 +0800
Subject: [PATCH 09/70] filter desctiption existance before passing it to
distinct
---
Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
index 372d36524..8657f0ec0 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
@@ -475,9 +475,10 @@ namespace Flow.Launcher.Plugin.Program.Programs
return programs.GroupBy(p => p.FullPath.ToLower())
.SelectMany(g =>
{
- if (g.Count() > 1)
- return DistinctBy(g.Where(p => !string.IsNullOrEmpty(p.Description)), x => x.Description);
- return g;
+ var temp = g.Where(g => !string.IsNullOrEmpty(g.Description)).ToList();
+ if (temp.Any())
+ return DistinctBy(temp, x => x.Description);
+ return g.Take(1);
}).ToArray();
}
From abd721a06cff43e1490843b8f9b995e064cc1c62 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Tue, 16 Feb 2021 06:14:13 +1100
Subject: [PATCH 10/70] fix formatting
---
Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
index 9caac1a47..7a088bd09 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
@@ -31,7 +31,6 @@ namespace Flow.Launcher.Core.Plugin
protected abstract string ExecuteCallback(JsonRPCRequestModel rpcRequest);
protected abstract string ExecuteContextMenu(Result selectedResult);
-
public List LoadContextMenus(Result selectedResult)
{
string output = ExecuteContextMenu(selectedResult);
@@ -235,8 +234,6 @@ namespace Flow.Launcher.Core.Plugin
}
}
-
-
public async Task> QueryAsync(Query query, CancellationToken token)
{
var output = await ExecuteQueryAsync(query, token);
@@ -257,4 +254,4 @@ namespace Flow.Launcher.Core.Plugin
return Task.CompletedTask;
}
}
-}
\ No newline at end of file
+}
From 307cb305f064f2dd21886f7f163a1a789e3cad3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Tue, 16 Feb 2021 10:50:48 +0800
Subject: [PATCH 11/70] Remove unused check for Stream length
---
Flow.Launcher.Core/Plugin/PluginManager.cs | 4 ++--
Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs | 4 ++--
.../SuggestionSources/Baidu.cs | 2 +-
.../SuggestionSources/Bing.cs | 7 ++-----
.../SuggestionSources/Google.cs | 7 ++-----
5 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs
index 700a7d509..66eb0f0ec 100644
--- a/Flow.Launcher.Core/Plugin/PluginManager.cs
+++ b/Flow.Launcher.Core/Plugin/PluginManager.cs
@@ -195,11 +195,11 @@ namespace Flow.Launcher.Core.Plugin
catch (OperationCanceledException)
{
// null will be fine since the results will only be added into queue if the token hasn't been cancelled
- return results = null;
+ return null;
}
catch (Exception e)
{
- Log.Exception($"|PluginManager.QueryForPlugin|Exception for plugin <{pair.Metadata.Name}> when query <{query}>", e);
+ Log.Exception($"|PluginManager.QueryForPlugin|Exception for plugin <{pair.Metadata.Name}> when query <{query}>", e);
}
return results;
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
index f76e28112..4135bb59a 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
@@ -123,12 +123,12 @@ namespace Flow.Launcher.Plugin.WebSearch
var source = _settings.SelectedSuggestion;
if (source != null)
{
- var suggestions = await source.Suggestions(keyword, token);
+ var suggestions = await source.Suggestions(keyword, token).ConfigureAwait(false);
if (token.IsCancellationRequested)
return null;
- var resultsFromSuggestion = suggestions.Select(o => new Result
+ var resultsFromSuggestion = suggestions?.Select(o => new Result
{
Title = o,
SubTitle = subtitle,
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs
index b7e2017f9..385a9f8b5 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs
@@ -32,7 +32,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
catch (HttpRequestException e)
{
Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e);
- return new List();
+ return null;
}
if (string.IsNullOrEmpty(result)) return new List();
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs
index ffde2fda2..e505d78cf 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs
@@ -24,16 +24,13 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
const string api = "https://api.bing.com/qsonhs.aspx?q=";
using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query), token).ConfigureAwait(false);
-
- if (resultStream.Length == 0)
- return new List(); // this handles the cancellation
-
+
json = (await JsonDocument.ParseAsync(resultStream, cancellationToken: token)).RootElement.GetProperty("AS");
}
catch (TaskCanceledException)
{
- return null;
+ return new List();
}
catch (HttpRequestException e)
{
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs
index c33ebd7e1..928c7aaa2 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs
@@ -24,19 +24,16 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query)).ConfigureAwait(false);
- if (resultStream.Length == 0)
- return new List();
-
json = await JsonDocument.ParseAsync(resultStream);
}
catch (TaskCanceledException)
{
- return null;
+ return new List();
}
catch (HttpRequestException e)
{
- Log.Exception("|Google.Suggestions|Can't get suggestion from google", e);
+ // Log.Exception("|Google.Suggestions|Can't get suggestion from google", e);
return new List();
}
catch (JsonException e)
From 2bc290a30208d81588b19a38c36fd542d956dae6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Tue, 16 Feb 2021 11:27:12 +0800
Subject: [PATCH 12/70] uncomment exception
---
.../Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs
index 928c7aaa2..c075f4d5d 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs
@@ -33,7 +33,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
}
catch (HttpRequestException e)
{
- // Log.Exception("|Google.Suggestions|Can't get suggestion from google", e);
+ Log.Exception("|Google.Suggestions|Can't get suggestion from google", e);
return new List();
}
catch (JsonException e)
From f14a5b92296f2d7cba3cf55cfb69c1e217725d70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Tue, 16 Feb 2021 15:54:11 +0800
Subject: [PATCH 13/70] add default win32, so we should not contain null
---
.../Programs/Win32.cs | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
index 8657f0ec0..aeb35ea39 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
@@ -35,6 +35,20 @@ namespace Flow.Launcher.Plugin.Program.Programs
private const string ShortcutExtension = "lnk";
private const string ExeExtension = "exe";
+ private static readonly Win32 Default = new Win32()
+ {
+ Name = string.Empty,
+ Description = string.Empty,
+ IcoPath = string.Empty,
+ FullPath = string.Empty,
+ LnkResolvedPath = null,
+ ParentDirectory = string.Empty,
+ ExecutableName = null,
+ UniqueIdentifier = string.Empty,
+ Valid = false,
+ Enabled = false
+ };
+
public Result Result(string query, IPublicAPI api)
{
@@ -423,12 +437,12 @@ namespace Flow.Launcher.Plugin.Program.Programs
private static Win32 GetProgramFromPath(string path)
{
if (string.IsNullOrEmpty(path))
- return null;
+ return Default;
path = Environment.ExpandEnvironmentVariables(path);
if (!File.Exists(path))
- return null;
+ return Default;
var entry = Win32Program(path);
@@ -504,7 +518,6 @@ namespace Flow.Launcher.Plugin.Program.Programs
programs = programs.Concat(startMenu);
}
-
return ProgramsHasher(programs.Where(p => p != null));
}
#if DEBUG //This is to make developer aware of any unhandled exception and add in handling.
From 5fe833f7f2dff74edd65b900c400979f7b2e7856 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Tue, 16 Feb 2021 15:55:44 +0800
Subject: [PATCH 14/70] Take user added program outside the hasher
---
.../Flow.Launcher.Plugin.Program/Programs/Win32.cs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
index aeb35ea39..a186b6613 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
@@ -484,7 +484,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
}
}
- private static Win32[] ProgramsHasher(IEnumerable programs)
+ private static IEnumerable ProgramsHasher(IEnumerable programs)
{
return programs.GroupBy(p => p.FullPath.ToLower())
.SelectMany(g =>
@@ -503,8 +503,6 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
var programs = Enumerable.Empty();
- var unregistered = UnregisteredPrograms(settings.ProgramSources, settings.ProgramSuffixes);
- programs = programs.Concat(unregistered);
if (settings.EnableRegistrySource)
{
@@ -518,7 +516,13 @@ namespace Flow.Launcher.Plugin.Program.Programs
programs = programs.Concat(startMenu);
}
- return ProgramsHasher(programs.Where(p => p != null));
+ programs = ProgramsHasher(programs.Where(p => p != null));
+
+ var unregistered = UnregisteredPrograms(settings.ProgramSources, settings.ProgramSuffixes);
+
+ programs = programs.Concat(unregistered);
+
+ return programs.ToArray();
}
#if DEBUG //This is to make developer aware of any unhandled exception and add in handling.
catch (Exception e)
From df2be9b82836c46545bb8639b9ab97178a9d4038 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Tue, 16 Feb 2021 16:09:55 +0800
Subject: [PATCH 15/70] seperate user program sources and autoindex program
source and distinct prior to user one
---
.../Programs/Win32.cs | 33 ++++++++++++++-----
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
index a186b6613..773d0c6b6 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
@@ -14,11 +14,12 @@ using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher.Infrastructure.Logger;
using System.Diagnostics;
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
+using System.Diagnostics.CodeAnalysis;
namespace Flow.Launcher.Plugin.Program.Programs
{
[Serializable]
- public class Win32 : IProgram
+ public class Win32 : IProgram, IEquatable
{
public string Name { get; set; }
public string UniqueIdentifier { get; set; }
@@ -503,26 +504,27 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
var programs = Enumerable.Empty();
+ var unregistered = UnregisteredPrograms(settings.ProgramSources, settings.ProgramSuffixes);
+
+ programs = programs.Concat(unregistered);
+
+ var autoIndexPrograms = Enumerable.Empty();
if (settings.EnableRegistrySource)
{
var appPaths = AppPathsPrograms(settings.ProgramSuffixes);
- programs = programs.Concat(appPaths);
+ autoIndexPrograms = autoIndexPrograms.Concat(appPaths);
}
if (settings.EnableStartMenuSource)
{
var startMenu = StartMenuPrograms(settings.ProgramSuffixes);
- programs = programs.Concat(startMenu);
+ autoIndexPrograms = autoIndexPrograms.Concat(startMenu);
}
- programs = ProgramsHasher(programs.Where(p => p != null));
+ autoIndexPrograms = ProgramsHasher(autoIndexPrograms);
- var unregistered = UnregisteredPrograms(settings.ProgramSources, settings.ProgramSuffixes);
-
- programs = programs.Concat(unregistered);
-
- return programs.ToArray();
+ return programs.Concat(autoIndexPrograms).Distinct().ToArray();
}
#if DEBUG //This is to make developer aware of any unhandled exception and add in handling.
catch (Exception e)
@@ -540,5 +542,18 @@ namespace Flow.Launcher.Plugin.Program.Programs
}
#endif
}
+
+ public override int GetHashCode()
+ {
+ return UniqueIdentifier.GetHashCode();
+ }
+
+ public bool Equals([AllowNull] Win32 other)
+ {
+ if (other == null)
+ return false;
+
+ return UniqueIdentifier == other.UniqueIdentifier;
+ }
}
}
\ No newline at end of file
From dfd71482294f2a7de34a16ab5e5237c9df2cf378 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Wed, 17 Feb 2021 08:50:33 +1100
Subject: [PATCH 16/70] remove duplicate entry with quick access results
---
Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 2 +-
Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 2af09bf2c..899412be6 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
var quickaccessLinks = QuickAccess.AccessLinkListMatched(query, settings.QuickAccessLinks);
if (quickaccessLinks.Count > 0)
- results.AddRange(quickaccessLinks);
+ results.Union(quickaccessLinks);
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
index 9aa54fb83..63ca66a1e 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
@@ -7,7 +7,7 @@
"Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu",
- "Version": "1.7.0",
+ "Version": "1.7.1",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
From b0ce545116ffd0b7906d7601337eb888e2959277 Mon Sep 17 00:00:00 2001
From: Zero
Date: Wed, 17 Feb 2021 19:33:07 +0800
Subject: [PATCH 17/70] Update README.md
simplify rep README
---
README.md | 30 +++---------------------------
1 file changed, 3 insertions(+), 27 deletions(-)
diff --git a/README.md b/README.md
index f0c08d8a0..9c1ae2583 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,7 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be
Remember to star it, flow will love you more :)
## Features
+

- Search everything from applications, files, bookmarks, YouTube, Twitter and more. All from the comfort of your keyboard without ever touching the mouse.
@@ -26,31 +27,6 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be
- Support of wide range of plugins.
- Fully portable.
-## Running Flow Launcher
-
-| [Windows 7 and up](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest) |
-| ---------------------------------------------------------------------------------- |
-
-Windows may complain about security due to code not being signed, this will be completed at a later stage. If you downloaded from this repo, you are good to continue the set up.
-
-**Integrations**
- - If you use Python plugins:
- - Install [Python3](https://www.python.org/downloads/), download `.exe` installer.
- - Add Python to `%PATH%` or set it in flow's settings.
- - Use `pip` to install `flowlauncher`, cmd in `pip install flowlauncher`.
- - Start to launch your Python plugins.
- - Flow searches files and contents via Windows Index Search, to use Everything, download the plugin [here](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything/releases/latest).
-
-**Usage**
-- Open flow's search window: Alt+Space is the default hotkey.
-- Open context menu: Ctrl+O/Shift+Enter.
-- Cancel/Return to previous screen: Esc.
-- Install/Uninstall plugins: in the search window, type `wpm install/uninstall` + 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
-
## Status
Flow is under heavy development, but the code base is stable, so contributions are very welcome. If you would like to help maintain it, please do not hesistate to get in touch.
@@ -63,7 +39,7 @@ You will find the main goals of flow placed under Projects board, so feel free t
Get in touch if you like to join the Flow-Launcher Team and help build this great tool.
-**Question/Suggestion**
+## Question/Suggestion
Yes please, submit an issue to let us know.
@@ -79,4 +55,4 @@ Install .Net Core 3.1 SDK via Visual Studio installer or manually from [here](ht
## Documentation
-[Wiki](https://github.com/Flow-Launcher/Flow.Launcher/wiki)
+https://flow-launcher.github.io/docs
From 4a3ad0854868f87e30401cf4bda986457db5bf3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Wed, 17 Feb 2021 22:36:35 +0800
Subject: [PATCH 18/70] Use IReadOnlyCollection to avoid avoid duplicate
iteration Add distinct to NewResults to try avoiding duplicate result
---
Flow.Launcher/ViewModel/MainViewModel.cs | 2 +-
Flow.Launcher/ViewModel/ResultsViewModel.cs | 13 ++++++-------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index c1382e51e..e0fc9ee67 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -778,7 +778,7 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void UpdateResultView(IEnumerable resultsForUpdates)
+ public void UpdateResultView(IReadOnlyCollection resultsForUpdates)
{
if (!resultsForUpdates.Any())
return;
diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs
index 41f16f4f2..2bdafca62 100644
--- a/Flow.Launcher/ViewModel/ResultsViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs
@@ -1,16 +1,13 @@
-using System;
+using Flow.Launcher.Infrastructure.UserSettings;
+using Flow.Launcher.Plugin;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Threading;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
-using Flow.Launcher.Infrastructure.UserSettings;
-using Flow.Launcher.Plugin;
namespace Flow.Launcher.ViewModel
{
@@ -146,7 +143,7 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void AddResults(IEnumerable resultsForUpdates, CancellationToken token)
+ public void AddResults(IReadOnlyCollection resultsForUpdates, CancellationToken token)
{
var newResults = NewResults(resultsForUpdates);
@@ -191,10 +188,11 @@ namespace Flow.Launcher.ViewModel
return Results.Where(r => r.Result.PluginID != resultId)
.Concat(newResults)
.OrderByDescending(r => r.Result.Score)
+ .Distinct()
.ToList();
}
- private List NewResults(IEnumerable resultsForUpdates)
+ private List NewResults(IReadOnlyCollection resultsForUpdates)
{
if (!resultsForUpdates.Any())
return Results;
@@ -202,6 +200,7 @@ namespace Flow.Launcher.ViewModel
return Results.Where(r => r != null && !resultsForUpdates.Any(u => u.ID == r.Result.PluginID))
.Concat(resultsForUpdates.SelectMany(u => u.Results, (u, r) => new ResultViewModel(r, _settings)))
.OrderByDescending(rv => rv.Result.Score)
+ .Distinct()
.ToList();
}
#endregion
From 8b30d37ff767b93f43824c834f0eb52af03f917e Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Thu, 18 Feb 2021 08:09:51 +1100
Subject: [PATCH 19/70] update
---
Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 2 +-
Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 899412be6..2af09bf2c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
var quickaccessLinks = QuickAccess.AccessLinkListMatched(query, settings.QuickAccessLinks);
if (quickaccessLinks.Count > 0)
- results.Union(quickaccessLinks);
+ results.AddRange(quickaccessLinks);
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
index 63ca66a1e..9aa54fb83 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
@@ -7,7 +7,7 @@
"Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu",
- "Version": "1.7.1",
+ "Version": "1.7.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
From 764aa4e05cf4de4c8a2207a83e1e4c7b9a7c9da5 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Thu, 18 Feb 2021 08:57:09 +1100
Subject: [PATCH 20/70] remove Docs folder
---
Docs/port-plugins.md | 17 -----------------
1 file changed, 17 deletions(-)
delete mode 100644 Docs/port-plugins.md
diff --git a/Docs/port-plugins.md b/Docs/port-plugins.md
deleted file mode 100644
index d12830124..000000000
--- a/Docs/port-plugins.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Porting Wox Plugins
-
-Note:
-- When porting, please keep the author's commit history
-- Flow Launcher targets .Net Core 3.1, so plugins should also be upgraded to keep the continuity of future developments
-
-Steps:
-1. to start off, you can fork/create a new repo, either way the project's commit history must be kept. If it's forked, you can just start updating it. If it's a new repo, do this by first cloning the repo, then add your new repo as a new repo remote, remove the original remote and then push to it.
-2. use try convert tool from https://github.com/dotnet/try-convert
-3. try-convert -w path-to-folder-or-solution-or-project
-4. May need to fix on the project file, a good template to follow is the [Explorer plugin](https://github.com/Flow-Launcher/Flow.Launcher/blob/dev/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj) project:
- - fix to netcoreapp3.1
- - set the output location as 'Output\Release\'
- - add true and false
- - bump version to 2.0.0 and fix up any missing attributes if neccessary
-5. update code and fix plugin's setting layout if neccessary
-6. update readme to indicate where this port is from and the original author of the project
\ No newline at end of file
From cba47855c7970543380a916226b6e3edba909f8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Thu, 18 Feb 2021 06:38:43 +0800
Subject: [PATCH 21/70] Use Hashset and customized equality comparator to
filter result
---
.../Search/SearchManager.cs | 28 +++++++++++++++----
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 899412be6..66d11cc39 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -22,9 +22,25 @@ namespace Flow.Launcher.Plugin.Explorer.Search
this.settings = settings;
}
+ private class PathEqualityComparator : IEqualityComparer
+ {
+ private static PathEqualityComparator instance;
+ public static PathEqualityComparator Instance => instance ??= new PathEqualityComparator();
+ public bool Equals(Result x, Result y)
+ {
+ return x.SubTitle == y.SubTitle;
+ }
+
+ public int GetHashCode(Result obj)
+ {
+ return obj.SubTitle.GetHashCode();
+ }
+
+ }
+
internal async Task> SearchAsync(Query query, CancellationToken token)
{
- var results = new List();
+ var results = new HashSet(PathEqualityComparator.Instance);
var querySearch = query.Search;
@@ -50,9 +66,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
if (!querySearch.IsLocationPathString() && !isEnvironmentVariablePath)
{
- results.AddRange(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token).ConfigureAwait(false));
+ results.UnionWith(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token).ConfigureAwait(false));
- return results;
+ return results.ToList();
}
var locationPath = querySearch;
@@ -62,7 +78,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
// Check that actual location exists, otherwise directory search will throw directory not found exception
if (!FilesFolders.LocationExists(FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)))
- return results;
+ return results.ToList();
var useIndexSearch = UseWindowsIndexForDirectorySearch(locationPath);
@@ -79,9 +95,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
token.ThrowIfCancellationRequested();
- results.AddRange(directoryResult);
+ results.UnionWith(directoryResult);
- return results;
+ return results.ToList();
}
private async Task> WindowsIndexFileContentSearchAsync(Query query, string querySearchString, CancellationToken token)
From 73ee3437f32f422b363cb5b8afd15a0f32f67366 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Thu, 18 Feb 2021 06:41:56 +0800
Subject: [PATCH 22/70] Use UnionWith
---
Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 7869b083c..ff4477336 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -54,7 +54,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
var quickaccessLinks = QuickAccess.AccessLinkListMatched(query, settings.QuickAccessLinks);
if (quickaccessLinks.Count > 0)
- results.AddRange(quickaccessLinks);
+ results.UnionWith(quickaccessLinks);
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);
From ed82662da2b0d625e83199945890ed2394e1a915 Mon Sep 17 00:00:00 2001
From: Zero
Date: Thu, 18 Feb 2021 22:00:06 +0800
Subject: [PATCH 23/70] Update README.md
---
README.md | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/README.md b/README.md
index 5fad0367b..8c652593c 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,33 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be
- Save file or folder locations for quick access.
- Fully portable.
+## Running Flow Launcher
+
+| [Windows 7 and up](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest) |
+| ---------------------------------------------------------------------------------- |
+
+Windows may complain about security due to code not being signed, this will be completed at a later stage. If you downloaded from this repo, you are good to continue the set up.
+
+### Integrations
+
+- If you use Python plugins:
+ - Install [Python3](https://www.python.org/downloads/), download `.exe` installer.
+ - Add Python to `%PATH%` or set it in flow's settings.
+ - Use `pip` to install `flowlauncher`, cmd in `pip install flowlauncher`.
+ - Start to launch your Python plugins.
+- Flow searches files and contents via Windows Index Search, to use Everything, download the plugin [here](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything/releases/latest).
+
+### Usage
+
+- Open flow's search window: Alt+Space is the default hotkey.
+- Open context menu: Ctrl+O/Shift+Enter.
+- Cancel/Return to previous screen: Esc.
+- Install/Uninstall plugins: in the search window, type `wpm install/uninstall` + 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
+
## Status
Flow is under heavy development, but the code base is stable, so contributions are very welcome. If you would like to help maintain it, please do not hesistate to get in touch.
From 43f48de2a3444159aae2da75d6a0c3437da9baef Mon Sep 17 00:00:00 2001
From: Zero
Date: Thu, 18 Feb 2021 22:04:25 +0800
Subject: [PATCH 24/70] Update README.md
missing SOFTPEDIA EDITOR'S PICK
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 8c652593c..9d52d268a 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,8 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be
- 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)
+
## Running Flow Launcher
| [Windows 7 and up](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest) |
From 81f069d8d20f5a0bc50c4f5b1591fbd6880fb3cb Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 07:33:50 +1100
Subject: [PATCH 25/70] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 9d52d268a..64fe90d50 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ Windows may complain about security due to code not being signed, this will be c
- Open flow's search window: Alt+Space is the default hotkey.
- Open context menu: Ctrl+O/Shift+Enter.
- Cancel/Return to previous screen: Esc.
-- Install/Uninstall plugins: in the search window, type `wpm install/uninstall` + the plugin name.
+- Install/Uninstall plugins: in the search window, type `pm install/uninstall` + the plugin name.
- Saved user settings are located:
- If using roaming: `%APPDATA%\FlowLauncher`
- If using portable, by default: `%localappdata%\FlowLauncher\app-\UserData`
From 926f8362f2bb8200f2c15c5884128ca4b6fa4ed9 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 08:01:54 +1100
Subject: [PATCH 26/70] Update README.md
---
README.md | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 64fe90d50..9e89053b5 100644
--- a/README.md
+++ b/README.md
@@ -39,25 +39,25 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be
Windows may complain about security due to code not being signed, this will be completed at a later stage. If you downloaded from this repo, you are good to continue the set up.
### Integrations
-
-- If you use Python plugins:
- - Install [Python3](https://www.python.org/downloads/), download `.exe` installer.
- - Add Python to `%PATH%` or set it in flow's settings.
- - Use `pip` to install `flowlauncher`, cmd in `pip install flowlauncher`.
- - Start to launch your Python plugins.
-- Flow searches files and contents via Windows Index Search, to use Everything, download the plugin [here](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything/releases/latest).
+ - If you use Python plugins:
+ - Install [Python3](https://www.python.org/downloads/), download `.exe` installer.
+ - Add Python to `%PATH%` or set it in flow's settings.
+ - Use `pip` to install `flowlauncher`, cmd in `pip install flowlauncher`.
+ - Start to launch your Python plugins.
+ - Flow searches files and contents via Windows Index Search, to use Everything, download the plugin [here](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything/releases/latest).
### Usage
-
- Open flow's search window: Alt+Space is the default hotkey.
-- Open context menu: Ctrl+O/Shift+Enter.
+- Open context menu: on the selected result, press Ctrl+O/Shift+Enter.
- Cancel/Return to previous screen: Esc.
-- Install/Uninstall plugins: in the search window, type `pm install/uninstall` + the plugin name.
+- Install/Uninstall/Update plugins: in the search window, type `pm` `install`/`uninstall`/`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
+[More tips](https://flow-launcher.github.io/docs/#/usage-tips)
+
## Status
Flow is under heavy development, but the code base is stable, so contributions are very welcome. If you would like to help maintain it, please do not hesistate to get in touch.
From a3c61c26cc632e41444252295654e59c3c391aa8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Fri, 19 Feb 2021 05:05:03 +0800
Subject: [PATCH 27/70] don't remove setting when updating
---
.../PluginsManager.cs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
index c2e392b51..e671e2e91 100644
--- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
@@ -233,7 +233,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
- Uninstall(x.PluginExistingMetadata);
+ Uninstall(x.PluginExistingMetadata, false);
var downloadToFilePath = Path.Combine(DataLocation.PluginsDirectory,
$"{x.Name}-{x.NewVersion}.zip");
@@ -414,10 +414,13 @@ namespace Flow.Launcher.Plugin.PluginsManager
return Search(results, uninstallSearch);
}
- private void Uninstall(PluginMetadata plugin)
+ private void Uninstall(PluginMetadata plugin, bool removedSetting = true)
{
- PluginManager.Settings.Plugins.Remove(plugin.ID);
- PluginManager.AllPlugins.RemoveAll(p => p.Metadata.ID == plugin.ID);
+ if (removedSetting)
+ {
+ PluginManager.Settings.Plugins.Remove(plugin.ID);
+ PluginManager.AllPlugins.RemoveAll(p => p.Metadata.ID == plugin.ID);
+ }
// Marked for deletion. Will be deleted on next start up
using var _ = File.CreateText(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt"));
From 4fdcdcdcc08c2c4bea0434beea58fe77a9e1d153 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 08:12:46 +1100
Subject: [PATCH 28/70] version bump PluginsManager
---
Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json
index f95c0d60d..7d32a40c5 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.7.0",
+ "Version": "1.7.1",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",
From 95da58534318f7f85ad3c8f82301c77bb0f3de4d Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 08:44:36 +1100
Subject: [PATCH 29/70] add documentation badge
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 9e89053b5..a0ed2d5e8 100644
--- a/README.md
+++ b/README.md
@@ -4,11 +4,12 @@
-
+
[](https://ci.appveyor.com/project/JohnTheGr8/flow-launcher/branch/dev)
[](https://github.com/Flow-Launcher/Flow.Launcher/releases)
[](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest)

+[](https://flow-launcher.github.io/docs)
[](https://discord.gg/AvgAQgh)
Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at being more than an app launcher, it searches, integrates and expands on functionalities. Flow will continue to evolve, designed to be open and built with the community at heart.
From 8b81ac004aa623e1f4a71120e02f4772573eae81 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 08:46:56 +1100
Subject: [PATCH 30/70] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a0ed2d5e8..6bc6182dc 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
[](https://github.com/Flow-Launcher/Flow.Launcher/releases)
[](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest)

-[](https://flow-launcher.github.io/docs)
+[](https://flow-launcher.github.io/docs)
[](https://discord.gg/AvgAQgh)
Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at being more than an app launcher, it searches, integrates and expands on functionalities. Flow will continue to evolve, designed to be open and built with the community at heart.
From b2ae8d08c273e0fc25bb57e7232c7d6052ce8d86 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 08:55:11 +1100
Subject: [PATCH 31/70] add contributors badge
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6bc6182dc..6d7984520 100644
--- a/README.md
+++ b/README.md
@@ -7,8 +7,9 @@

[](https://ci.appveyor.com/project/JohnTheGr8/flow-launcher/branch/dev)
[](https://github.com/Flow-Launcher/Flow.Launcher/releases)
-[](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest)

+[](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest)
+
[](https://flow-launcher.github.io/docs)
[](https://discord.gg/AvgAQgh)
From 7b22622285cd8a1a28efc60cbeacc232c912d263 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 08:58:18 +1100
Subject: [PATCH 32/70] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 6d7984520..ad3050885 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,7 @@ Windows may complain about security due to code not being signed, this will be c
- Install [Python3](https://www.python.org/downloads/), download `.exe` installer.
- Add Python to `%PATH%` or set it in flow's settings.
- Use `pip` to install `flowlauncher`, cmd in `pip install flowlauncher`.
+ - The Python plugin may require additional modules to be installed, please ensure you check by visiting the plugin's website via `pm install` + plugin name, go to context menu and select `Open website`.
- Start to launch your Python plugins.
- Flow searches files and contents via Windows Index Search, to use Everything, download the plugin [here](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything/releases/latest).
From bb42b930e367f7547cdabcdd7350b929cc88b546 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 08:59:11 +1100
Subject: [PATCH 33/70] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index ad3050885..f1647fc7f 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ Windows may complain about security due to code not being signed, this will be c
- If you use Python plugins:
- Install [Python3](https://www.python.org/downloads/), download `.exe` installer.
- Add Python to `%PATH%` or set it in flow's settings.
- - Use `pip` to install `flowlauncher`, cmd in `pip install flowlauncher`.
+ - Use `pip` to install `flowlauncher`, open cmd and type `pip install flowlauncher`.
- The Python plugin may require additional modules to be installed, please ensure you check by visiting the plugin's website via `pm install` + plugin name, go to context menu and select `Open website`.
- Start to launch your Python plugins.
- Flow searches files and contents via Windows Index Search, to use Everything, download the plugin [here](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything/releases/latest).
From 493b14ff3ddfe5b16d311cca14ad38d940c3fd36 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 13:46:12 +1100
Subject: [PATCH 34/70] Update README.md
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index f1647fc7f..db53b8bc0 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,6 @@
[](https://github.com/Flow-Launcher/Flow.Launcher/releases)

[](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest)
-
[](https://flow-launcher.github.io/docs)
[](https://discord.gg/AvgAQgh)
@@ -57,7 +56,7 @@ Windows may complain about security due to code not being signed, this will be c
- 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.
[More tips](https://flow-launcher.github.io/docs/#/usage-tips)
From dddeeabc3a16b6dc9c00d499adaa2c385c11d27f Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 13:49:56 +1100
Subject: [PATCH 35/70] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index db53b8bc0..1f7dff1a5 100644
--- a/README.md
+++ b/README.md
@@ -88,4 +88,4 @@ Install .Net Core 3.1 SDK via Visual Studio installer or manually from [here](ht
## Documentation
-https://flow-launcher.github.io/docs
+Visit [here](https://flow-launcher.github.io/docs) for more information on usage, development and design documentations
From abb11b22fc776a246880d80dedd475a7659389e3 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 21:03:23 +1100
Subject: [PATCH 36/70] update
---
Flow.Launcher/ViewModel/MainViewModel.cs | 2 +-
Flow.Launcher/ViewModel/ResultsViewModel.cs | 6 ++----
.../Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 1 -
Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +-
4 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index e0fc9ee67..c1382e51e 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -778,7 +778,7 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void UpdateResultView(IReadOnlyCollection resultsForUpdates)
+ public void UpdateResultView(IEnumerable resultsForUpdates)
{
if (!resultsForUpdates.Any())
return;
diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs
index 2bdafca62..0766c7bbc 100644
--- a/Flow.Launcher/ViewModel/ResultsViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs
@@ -143,7 +143,7 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void AddResults(IReadOnlyCollection resultsForUpdates, CancellationToken token)
+ public void AddResults(IEnumerable resultsForUpdates, CancellationToken token)
{
var newResults = NewResults(resultsForUpdates);
@@ -188,11 +188,10 @@ namespace Flow.Launcher.ViewModel
return Results.Where(r => r.Result.PluginID != resultId)
.Concat(newResults)
.OrderByDescending(r => r.Result.Score)
- .Distinct()
.ToList();
}
- private List NewResults(IReadOnlyCollection resultsForUpdates)
+ private List NewResults(IEnumerable resultsForUpdates)
{
if (!resultsForUpdates.Any())
return Results;
@@ -200,7 +199,6 @@ namespace Flow.Launcher.ViewModel
return Results.Where(r => r != null && !resultsForUpdates.Any(u => u.ID == r.Result.PluginID))
.Concat(resultsForUpdates.SelectMany(u => u.Results, (u, r) => new ResultViewModel(r, _settings)))
.OrderByDescending(rv => rv.Result.Score)
- .Distinct()
.ToList();
}
#endregion
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index ff4477336..d5f882d5c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -35,7 +35,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search
{
return obj.SubTitle.GetHashCode();
}
-
}
internal async Task> SearchAsync(Query query, CancellationToken token)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
index 9aa54fb83..63ca66a1e 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
@@ -7,7 +7,7 @@
"Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu",
- "Version": "1.7.0",
+ "Version": "1.7.1",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
From 2f9d4d129e4f278262cbe26a855186d62d21a8f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Sun, 21 Feb 2021 15:46:04 +0800
Subject: [PATCH 37/70] add taskcanceledexception to updater exception catch
---
Flow.Launcher.Core/Updater.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs
index 44c34968c..8f0de798c 100644
--- a/Flow.Launcher.Core/Updater.cs
+++ b/Flow.Launcher.Core/Updater.cs
@@ -87,7 +87,7 @@ namespace Flow.Launcher.Core
UpdateManager.RestartApp(Constant.ApplicationFileName);
}
}
- catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException)
+ catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException || e is TaskCanceledException)
{
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
From 3300523b9f64487242a3b1b83aed52c0eab96dc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Sun, 21 Feb 2021 15:46:04 +0800
Subject: [PATCH 38/70] add taskcanceledexception to updater exception catch
---
Flow.Launcher.Core/Updater.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs
index 44c34968c..8f0de798c 100644
--- a/Flow.Launcher.Core/Updater.cs
+++ b/Flow.Launcher.Core/Updater.cs
@@ -87,7 +87,7 @@ namespace Flow.Launcher.Core
UpdateManager.RestartApp(Constant.ApplicationFileName);
}
}
- catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException)
+ catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException || e is TaskCanceledException)
{
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
From 409efe41f28fed1f0a8765f3c6544d4bb8088b8f Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 05:10:44 +1100
Subject: [PATCH 39/70] version bump
---
SolutionAssemblyInfo.cs | 6 +++---
appveyor.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/SolutionAssemblyInfo.cs b/SolutionAssemblyInfo.cs
index 7f13f4130..bcddbd1bd 100644
--- a/SolutionAssemblyInfo.cs
+++ b/SolutionAssemblyInfo.cs
@@ -16,6 +16,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
-[assembly: AssemblyVersion("1.7.1")]
-[assembly: AssemblyFileVersion("1.7.1")]
-[assembly: AssemblyInformationalVersion("1.7.1")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.7.2")]
+[assembly: AssemblyFileVersion("1.7.2")]
+[assembly: AssemblyInformationalVersion("1.7.2")]
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
index 6340318d4..299a829ba 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: '1.7.1.{build}'
+version: '1.7.2.{build}'
init:
- ps: |
From f23f3d3e7fb28f6a06594e0e462101bc7b4a205f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Fri, 19 Feb 2021 05:05:03 +0800
Subject: [PATCH 40/70] don't remove setting when updating
---
.../PluginsManager.cs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
index 90d103bc7..7baa08a7b 100644
--- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
@@ -212,7 +212,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
- Uninstall(x.PluginExistingMetadata);
+ Uninstall(x.PluginExistingMetadata, false);
var downloadToFilePath = Path.Combine(DataLocation.PluginsDirectory,
$"{x.Name}-{x.NewVersion}.zip");
@@ -399,10 +399,13 @@ namespace Flow.Launcher.Plugin.PluginsManager
return Search(results, uninstallSearch);
}
- private void Uninstall(PluginMetadata plugin)
+ private void Uninstall(PluginMetadata plugin, bool removedSetting = true)
{
- PluginManager.Settings.Plugins.Remove(plugin.ID);
- PluginManager.AllPlugins.RemoveAll(p => p.Metadata.ID == plugin.ID);
+ if (removedSetting)
+ {
+ PluginManager.Settings.Plugins.Remove(plugin.ID);
+ PluginManager.AllPlugins.RemoveAll(p => p.Metadata.ID == plugin.ID);
+ }
// Marked for deletion. Will be deleted on next start up
using var _ = File.CreateText(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt"));
From c8f6853c94ff9796809eec802b5ea02231976e45 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 05:24:04 +1100
Subject: [PATCH 41/70] temporary version bump PluginsManager
temp bump for hot fix release. Release from dev should follow the existing commits- 1.7.1
---
Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json
index 4cba7ec83..66b438fd5 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.4",
+ "Version": "1.6.5",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",
From 6a62c069c80ca8bb388a2e9ce7e363c80956b53f Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 05:10:44 +1100
Subject: [PATCH 42/70] version bump
---
SolutionAssemblyInfo.cs | 6 +++---
appveyor.yml | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/SolutionAssemblyInfo.cs b/SolutionAssemblyInfo.cs
index 7f13f4130..bcddbd1bd 100644
--- a/SolutionAssemblyInfo.cs
+++ b/SolutionAssemblyInfo.cs
@@ -16,6 +16,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
-[assembly: AssemblyVersion("1.7.1")]
-[assembly: AssemblyFileVersion("1.7.1")]
-[assembly: AssemblyInformationalVersion("1.7.1")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.7.2")]
+[assembly: AssemblyFileVersion("1.7.2")]
+[assembly: AssemblyInformationalVersion("1.7.2")]
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
index 6340318d4..299a829ba 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: '1.7.1.{build}'
+version: '1.7.2.{build}'
init:
- ps: |
From 8071a6afe41cbf31343c57a3deaed31d5fde198b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 11:46:31 +0800
Subject: [PATCH 43/70] fix potential uri format issue causing program crash
---
Flow.Launcher.Infrastructure/Http/Http.cs | 40 ++++++++++++++---------
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index 3a3e770a5..e8cf39880 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -50,25 +50,35 @@ namespace Flow.Launcher.Infrastructure.Http
///
public static void UpdateProxy(ProxyProperty property)
{
- (WebProxy.Address, WebProxy.Credentials) = property switch
+ if (string.IsNullOrEmpty(Proxy.Server))
+ return;
+
+ try
{
- ProxyProperty.Enabled => Proxy.Enabled switch
+ (WebProxy.Address, WebProxy.Credentials) = property switch
{
- true => Proxy.UserName switch
+ ProxyProperty.Enabled => Proxy.Enabled switch
{
- var userName when !string.IsNullOrEmpty(userName) =>
- (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), null),
- _ => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"),
- new NetworkCredential(Proxy.UserName, Proxy.Password))
+ true when !string.IsNullOrEmpty(Proxy.Server) => Proxy.UserName switch
+ {
+ var userName when string.IsNullOrEmpty(userName) =>
+ (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), null),
+ _ => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"),
+ new NetworkCredential(Proxy.UserName, Proxy.Password))
+ },
+ _ => (null, null)
},
- false => (null, null)
- },
- ProxyProperty.Server => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
- ProxyProperty.Port => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
- ProxyProperty.UserName => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
- ProxyProperty.Password => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
- _ => throw new ArgumentOutOfRangeException()
- };
+ ProxyProperty.Server => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
+ ProxyProperty.Port => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
+ ProxyProperty.UserName => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
+ ProxyProperty.Password => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
+ _ => throw new ArgumentOutOfRangeException()
+ };
+ }
+ catch(UriFormatException e)
+ {
+ Log.Exception("Http", "Unable to parse Uri", e);
+ }
}
public static async Task DownloadAsync([NotNull] string url, [NotNull] string filePath, CancellationToken token = default)
From cfbdf294bbbac33ff5232e6d19f59853df7ebf0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 12:11:02 +0800
Subject: [PATCH 44/70] Add api to Http.cs & message shown up when error thrown
---
Flow.Launcher.Infrastructure/Http/Http.cs | 8 +++++++-
Flow.Launcher/App.xaml.cs | 5 ++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index e8cf39880..c9b2a6877 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -9,6 +9,8 @@ using Flow.Launcher.Infrastructure.UserSettings;
using System;
using System.ComponentModel;
using System.Threading;
+using System.Windows.Interop;
+using Flow.Launcher.Plugin;
namespace Flow.Launcher.Infrastructure.Http
{
@@ -18,6 +20,8 @@ namespace Flow.Launcher.Infrastructure.Http
private static HttpClient client = new HttpClient();
+ public static IPublicAPI _api { get; set; }
+
static Http()
{
// need to be added so it would work on a win10 machine
@@ -77,7 +81,9 @@ namespace Flow.Launcher.Infrastructure.Http
}
catch(UriFormatException e)
{
- Log.Exception("Http", "Unable to parse Uri", e);
+ _api.ShowMsg("Please try again", "Unable to parse Http Proxy");
+ Log.Exception("Flow.Launcher.Infrastructure.Http", "Unable to parse Uri", e);
+
}
}
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 7c4c6a367..54ede7ff7 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -61,7 +61,6 @@ namespace Flow.Launcher
_settingsVM = new SettingWindowViewModel(_updater, _portable);
_settings = _settingsVM.Settings;
- Http.Proxy = _settings.Proxy;
_alphabet.Initialize(_settings);
_stringMatcher = new StringMatcher(_alphabet);
@@ -74,6 +73,10 @@ namespace Flow.Launcher
await PluginManager.InitializePlugins(API);
var window = new MainWindow(_settings, _mainVM);
+ Http._api = API;
+ Http.Proxy = _settings.Proxy;
+
+
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
Current.MainWindow = window;
From 0981be499fb2816bae496fa6412cc627ae080c1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 13:16:48 +0800
Subject: [PATCH 45/70] Use PortablePDB instead of Full pdb for debugging
---
Flow.Launcher.Core/Flow.Launcher.Core.csproj | 2 +-
.../Flow.Launcher.Infrastructure.csproj | 2 +-
Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj | 2 +-
Flow.Launcher.Test/Flow.Launcher.Test.csproj | 2 +-
Flow.Launcher/Flow.Launcher.csproj | 2 +-
.../Flow.Launcher.Plugin.BrowserBookmark.csproj | 2 +-
.../Flow.Launcher.Plugin.Calculator.csproj | 2 +-
.../Flow.Launcher.Plugin.ControlPanel.csproj | 2 +-
.../Flow.Launcher.Plugin.PluginIndicator.csproj | 2 +-
.../Flow.Launcher.Plugin.ProcessKiller.csproj | 2 +-
.../Flow.Launcher.Plugin.Program.csproj | 2 +-
.../Flow.Launcher.Plugin.Shell.csproj | 2 +-
.../Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj | 2 +-
.../Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj | 2 +-
.../Flow.Launcher.Plugin.WebSearch.csproj | 2 +-
15 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/Flow.Launcher.Core/Flow.Launcher.Core.csproj b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
index b0cc07e1a..4f1e58893 100644
--- a/Flow.Launcher.Core/Flow.Launcher.Core.csproj
+++ b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
@@ -16,7 +16,7 @@
true
- full
+ portable
false
..\Output\Debug\
DEBUG;TRACE
diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
index 8153de6c8..66e1766c8 100644
--- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
+++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
@@ -15,7 +15,7 @@
true
- full
+ portable
false
..\Output\Debug\
DEBUG;TRACE
diff --git a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj
index 0eefe5c4f..fbcb46b1c 100644
--- a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj
+++ b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj
@@ -34,7 +34,7 @@
true
- full
+ portable
false
..\Output\Debug\
DEBUG;TRACE
diff --git a/Flow.Launcher.Test/Flow.Launcher.Test.csproj b/Flow.Launcher.Test/Flow.Launcher.Test.csproj
index e970c47b9..ba35c1c8d 100644
--- a/Flow.Launcher.Test/Flow.Launcher.Test.csproj
+++ b/Flow.Launcher.Test/Flow.Launcher.Test.csproj
@@ -15,7 +15,7 @@
true
- full
+ portable
false
bin\Debug\
DEBUG;TRACE
diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj
index 20e847f82..196a651a4 100644
--- a/Flow.Launcher/Flow.Launcher.csproj
+++ b/Flow.Launcher/Flow.Launcher.csproj
@@ -17,7 +17,7 @@
AnyCPU
true
- full
+ portable
false
..\Output\Debug\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
index d2a8736a6..f5d0a817f 100644
--- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
+++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
@@ -14,7 +14,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.BrowserBookmark\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj b/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj
index 1090926fc..14f88689b 100644
--- a/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj
@@ -16,7 +16,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.Caculator\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.ControlPanel/Flow.Launcher.Plugin.ControlPanel.csproj b/Plugins/Flow.Launcher.Plugin.ControlPanel/Flow.Launcher.Plugin.ControlPanel.csproj
index 06969a135..19a66cc7f 100644
--- a/Plugins/Flow.Launcher.Plugin.ControlPanel/Flow.Launcher.Plugin.ControlPanel.csproj
+++ b/Plugins/Flow.Launcher.Plugin.ControlPanel/Flow.Launcher.Plugin.ControlPanel.csproj
@@ -14,7 +14,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.ControlPanel\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Flow.Launcher.Plugin.PluginIndicator.csproj b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Flow.Launcher.Plugin.PluginIndicator.csproj
index cc280b9a9..7b043ad74 100644
--- a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Flow.Launcher.Plugin.PluginIndicator.csproj
+++ b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Flow.Launcher.Plugin.PluginIndicator.csproj
@@ -15,7 +15,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.PluginIndicator\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj
index a643ebf86..9c86f5238 100644
--- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj
+++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj
@@ -16,7 +16,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.ProcessKiller\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj b/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj
index a2d7b7fef..e4e4724d3 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj
@@ -16,7 +16,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.Program\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj b/Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj
index d3042722b..10597f9e0 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj
@@ -15,7 +15,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.Shell\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj b/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj
index c25e759d3..11ceafb8f 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj
@@ -15,7 +15,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.Sys\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj b/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj
index 671a8b1c2..a4b2ac1f5 100644
--- a/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj
@@ -15,7 +15,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.Url\
DEBUG;TRACE
diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj b/Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj
index af86af842..0a2811f6d 100644
--- a/Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj
+++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj
@@ -15,7 +15,7 @@
true
- full
+ portable
false
..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.WebSearch\
DEBUG;TRACE
From f940e695a1bb6591cc33f0aaabbb37c9dfec690b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 13:45:28 +0800
Subject: [PATCH 46/70] add Unit test for Http.cs setting
---
Flow.Launcher.Test/HttpTest.cs | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 Flow.Launcher.Test/HttpTest.cs
diff --git a/Flow.Launcher.Test/HttpTest.cs b/Flow.Launcher.Test/HttpTest.cs
new file mode 100644
index 000000000..96213aba6
--- /dev/null
+++ b/Flow.Launcher.Test/HttpTest.cs
@@ -0,0 +1,33 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Flow.Launcher.Infrastructure.UserSettings;
+using Flow.Launcher.Infrastructure.Http;
+
+namespace Flow.Launcher.Test
+{
+ [TestFixture]
+ class HttpTest
+ {
+ [Test]
+ public void TestSettingUpdate()
+ {
+ HttpProxy proxy = new HttpProxy();
+ Http.Proxy = proxy;
+
+ proxy.Enabled = true;
+ proxy.Server = "127.0.0.1";
+ Assert.AreEqual(Http.WebProxy.Address, new Uri($"http://{proxy.Server}:{proxy.Port}"));
+ Assert.IsNull(Http.WebProxy.Credentials);
+
+ proxy.UserName = "test";
+ Assert.NotNull(Http.WebProxy.Credentials);
+ Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").UserName, proxy.UserName);
+ Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, "");
+
+ proxy.Password = "test password";
+ Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, proxy.Password);
+ }
+ }
+}
From d41f47ddcfe106946ed2d013b1d836298eafd6fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 13:45:40 +0800
Subject: [PATCH 47/70] Migrate UrlPluginTest to Plugins folder
---
Flow.Launcher.Test/{ => Plugins}/UrlPluginTest.cs | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename Flow.Launcher.Test/{ => Plugins}/UrlPluginTest.cs (100%)
diff --git a/Flow.Launcher.Test/UrlPluginTest.cs b/Flow.Launcher.Test/Plugins/UrlPluginTest.cs
similarity index 100%
rename from Flow.Launcher.Test/UrlPluginTest.cs
rename to Flow.Launcher.Test/Plugins/UrlPluginTest.cs
From b2f841ebb958d8f49aa35a4ac43222e79e0eec6c Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Wed, 17 Feb 2021 08:50:33 +1100
Subject: [PATCH 48/70] remove duplicate entry with quick access results
---
Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 2 +-
Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 2af09bf2c..899412be6 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
var quickaccessLinks = QuickAccess.AccessLinkListMatched(query, settings.QuickAccessLinks);
if (quickaccessLinks.Count > 0)
- results.AddRange(quickaccessLinks);
+ results.Union(quickaccessLinks);
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
index 9aa54fb83..63ca66a1e 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
@@ -7,7 +7,7 @@
"Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu",
- "Version": "1.7.0",
+ "Version": "1.7.1",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
From 857ff739547e96ac3bde141ee68a4dab903f6aa1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Wed, 17 Feb 2021 22:36:35 +0800
Subject: [PATCH 49/70] Use IReadOnlyCollection to avoid avoid duplicate
iteration Add distinct to NewResults to try avoiding duplicate result
---
Flow.Launcher/ViewModel/MainViewModel.cs | 2 +-
Flow.Launcher/ViewModel/ResultsViewModel.cs | 13 ++++++-------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index afbe6e197..6d92b0c65 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -748,7 +748,7 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void UpdateResultView(IEnumerable resultsForUpdates)
+ public void UpdateResultView(IReadOnlyCollection resultsForUpdates)
{
if (!resultsForUpdates.Any())
return;
diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs
index feab3a751..a08730488 100644
--- a/Flow.Launcher/ViewModel/ResultsViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs
@@ -1,16 +1,13 @@
-using System;
+using Flow.Launcher.Infrastructure.UserSettings;
+using Flow.Launcher.Plugin;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Threading;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
-using Flow.Launcher.Infrastructure.UserSettings;
-using Flow.Launcher.Plugin;
namespace Flow.Launcher.ViewModel
{
@@ -146,7 +143,7 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void AddResults(IEnumerable resultsForUpdates, CancellationToken token)
+ public void AddResults(IReadOnlyCollection resultsForUpdates, CancellationToken token)
{
var newResults = NewResults(resultsForUpdates);
@@ -192,10 +189,11 @@ namespace Flow.Launcher.ViewModel
return results.Where(r => r.Result.PluginID != resultId)
.Concat(newResults)
.OrderByDescending(r => r.Result.Score)
+ .Distinct()
.ToList();
}
- private List NewResults(IEnumerable resultsForUpdates)
+ private List NewResults(IReadOnlyCollection resultsForUpdates)
{
if (!resultsForUpdates.Any())
return Results.ToList();
@@ -205,6 +203,7 @@ namespace Flow.Launcher.ViewModel
return results.Where(r => r != null && !resultsForUpdates.Any(u => u.Metadata.ID == r.Result.PluginID))
.Concat(resultsForUpdates.SelectMany(u => u.Results, (u, r) => new ResultViewModel(r, _settings)))
.OrderByDescending(rv => rv.Result.Score)
+ .Distinct()
.ToList();
}
#endregion
From 6543e4f335584730f3af7eaf4f90898c27c30247 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Thu, 18 Feb 2021 08:09:51 +1100
Subject: [PATCH 50/70] update
---
Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 2 +-
Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 899412be6..2af09bf2c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
var quickaccessLinks = QuickAccess.AccessLinkListMatched(query, settings.QuickAccessLinks);
if (quickaccessLinks.Count > 0)
- results.Union(quickaccessLinks);
+ results.AddRange(quickaccessLinks);
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
index 63ca66a1e..9aa54fb83 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
@@ -7,7 +7,7 @@
"Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu",
- "Version": "1.7.1",
+ "Version": "1.7.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
From 32435bcda5ae12b9cb0fed1530a44467dbfe6539 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Thu, 18 Feb 2021 06:38:43 +0800
Subject: [PATCH 51/70] Use Hashset and customized equality comparator to
filter result
---
.../Search/SearchManager.cs | 28 +++++++++++++++----
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 2af09bf2c..7869b083c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -22,9 +22,25 @@ namespace Flow.Launcher.Plugin.Explorer.Search
this.settings = settings;
}
+ private class PathEqualityComparator : IEqualityComparer
+ {
+ private static PathEqualityComparator instance;
+ public static PathEqualityComparator Instance => instance ??= new PathEqualityComparator();
+ public bool Equals(Result x, Result y)
+ {
+ return x.SubTitle == y.SubTitle;
+ }
+
+ public int GetHashCode(Result obj)
+ {
+ return obj.SubTitle.GetHashCode();
+ }
+
+ }
+
internal async Task> SearchAsync(Query query, CancellationToken token)
{
- var results = new List();
+ var results = new HashSet(PathEqualityComparator.Instance);
var querySearch = query.Search;
@@ -50,9 +66,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
if (!querySearch.IsLocationPathString() && !isEnvironmentVariablePath)
{
- results.AddRange(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token).ConfigureAwait(false));
+ results.UnionWith(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token).ConfigureAwait(false));
- return results;
+ return results.ToList();
}
var locationPath = querySearch;
@@ -62,7 +78,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
// Check that actual location exists, otherwise directory search will throw directory not found exception
if (!FilesFolders.LocationExists(FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)))
- return results;
+ return results.ToList();
var useIndexSearch = UseWindowsIndexForDirectorySearch(locationPath);
@@ -79,9 +95,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
token.ThrowIfCancellationRequested();
- results.AddRange(directoryResult);
+ results.UnionWith(directoryResult);
- return results;
+ return results.ToList();
}
private async Task> WindowsIndexFileContentSearchAsync(Query query, string querySearchString, CancellationToken token)
From a4a824dcc3e62d03f76dc2f63b42456758ccb07e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Thu, 18 Feb 2021 06:40:26 +0800
Subject: [PATCH 52/70] Merge branch 'fix_duplicate_entry_quickaccess' of
github.com:Flow-Launcher/Flow.Launcher into HEAD
From 49eb094354d93b5ac2955ee937727eb5417d8296 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Thu, 18 Feb 2021 06:41:56 +0800
Subject: [PATCH 53/70] Use UnionWith
---
Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 7869b083c..ff4477336 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -54,7 +54,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
var quickaccessLinks = QuickAccess.AccessLinkListMatched(query, settings.QuickAccessLinks);
if (quickaccessLinks.Count > 0)
- results.AddRange(quickaccessLinks);
+ results.UnionWith(quickaccessLinks);
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);
From cc48ed54a3b7eb41670fcb1ebaac97d638179f64 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Fri, 19 Feb 2021 21:03:23 +1100
Subject: [PATCH 54/70] update
---
Flow.Launcher/ViewModel/MainViewModel.cs | 2 +-
Flow.Launcher/ViewModel/ResultsViewModel.cs | 6 ++----
.../Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 1 -
Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +-
4 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 6d92b0c65..afbe6e197 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -748,7 +748,7 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void UpdateResultView(IReadOnlyCollection resultsForUpdates)
+ public void UpdateResultView(IEnumerable resultsForUpdates)
{
if (!resultsForUpdates.Any())
return;
diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs
index a08730488..344dad58e 100644
--- a/Flow.Launcher/ViewModel/ResultsViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs
@@ -143,7 +143,7 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void AddResults(IReadOnlyCollection resultsForUpdates, CancellationToken token)
+ public void AddResults(IEnumerable resultsForUpdates, CancellationToken token)
{
var newResults = NewResults(resultsForUpdates);
@@ -189,11 +189,10 @@ namespace Flow.Launcher.ViewModel
return results.Where(r => r.Result.PluginID != resultId)
.Concat(newResults)
.OrderByDescending(r => r.Result.Score)
- .Distinct()
.ToList();
}
- private List NewResults(IReadOnlyCollection resultsForUpdates)
+ private List NewResults(IEnumerable resultsForUpdates)
{
if (!resultsForUpdates.Any())
return Results.ToList();
@@ -203,7 +202,6 @@ namespace Flow.Launcher.ViewModel
return results.Where(r => r != null && !resultsForUpdates.Any(u => u.Metadata.ID == r.Result.PluginID))
.Concat(resultsForUpdates.SelectMany(u => u.Results, (u, r) => new ResultViewModel(r, _settings)))
.OrderByDescending(rv => rv.Result.Score)
- .Distinct()
.ToList();
}
#endregion
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index ff4477336..d5f882d5c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -35,7 +35,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search
{
return obj.SubTitle.GetHashCode();
}
-
}
internal async Task> SearchAsync(Query query, CancellationToken token)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
index 9aa54fb83..63ca66a1e 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
@@ -7,7 +7,7 @@
"Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu",
- "Version": "1.7.0",
+ "Version": "1.7.1",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
From b01e23bd0349af200a86a391b7ad29de567b1a4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 16:58:00 +0800
Subject: [PATCH 55/70] move http proxy initialization earlier than Plugin
initialization
---
Flow.Launcher/App.xaml.cs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 54ede7ff7..7c9697c07 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -70,11 +70,14 @@ namespace Flow.Launcher
PluginManager.LoadPlugins(_settings.PluginSettings);
_mainVM = new MainViewModel(_settings);
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet);
- await PluginManager.InitializePlugins(API);
- var window = new MainWindow(_settings, _mainVM);
Http._api = API;
Http.Proxy = _settings.Proxy;
+
+ await PluginManager.InitializePlugins(API);
+ var window = new MainWindow(_settings, _mainVM);
+
+
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
From a507cbdc60296642ba6100fe7a7d168f804db2b5 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 20:31:00 +1100
Subject: [PATCH 56/70] fix formatting
---
Flow.Launcher.Infrastructure/Http/Http.cs | 2 +-
Flow.Launcher/App.xaml.cs | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index c9b2a6877..34d3f36f0 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -68,7 +68,7 @@ namespace Flow.Launcher.Infrastructure.Http
var userName when string.IsNullOrEmpty(userName) =>
(new Uri($"http://{Proxy.Server}:{Proxy.Port}"), null),
_ => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"),
- new NetworkCredential(Proxy.UserName, Proxy.Password))
+ new NetworkCredential(Proxy.UserName, Proxy.Password))
},
_ => (null, null)
},
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 7c9697c07..56cd5b961 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -77,9 +77,6 @@ namespace Flow.Launcher
await PluginManager.InitializePlugins(API);
var window = new MainWindow(_settings, _mainVM);
-
-
-
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
Current.MainWindow = window;
From 5f44663bd7dee878154e2596999d54ecb340fd0d Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 20:33:11 +1100
Subject: [PATCH 57/70] remove space
---
Flow.Launcher.Infrastructure/Http/Http.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index 34d3f36f0..43f6237ae 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -83,7 +83,6 @@ namespace Flow.Launcher.Infrastructure.Http
{
_api.ShowMsg("Please try again", "Unable to parse Http Proxy");
Log.Exception("Flow.Launcher.Infrastructure.Http", "Unable to parse Uri", e);
-
}
}
From 9192ab755077c1752cd8808c83cfb67bb7571e4c Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 20:36:06 +1100
Subject: [PATCH 58/70] update variable naming convention
---
Flow.Launcher.Infrastructure/Http/Http.cs | 4 ++--
Flow.Launcher/App.xaml.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index 43f6237ae..b45b6adcd 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -20,7 +20,7 @@ namespace Flow.Launcher.Infrastructure.Http
private static HttpClient client = new HttpClient();
- public static IPublicAPI _api { get; set; }
+ public static IPublicAPI API { get; set; }
static Http()
{
@@ -81,7 +81,7 @@ namespace Flow.Launcher.Infrastructure.Http
}
catch(UriFormatException e)
{
- _api.ShowMsg("Please try again", "Unable to parse Http Proxy");
+ API.ShowMsg("Please try again", "Unable to parse Http Proxy");
Log.Exception("Flow.Launcher.Infrastructure.Http", "Unable to parse Uri", e);
}
}
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 56cd5b961..a2907c927 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -71,7 +71,7 @@ namespace Flow.Launcher
_mainVM = new MainViewModel(_settings);
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet);
- Http._api = API;
+ Http.API = API;
Http.Proxy = _settings.Proxy;
await PluginManager.InitializePlugins(API);
From 99193a42d87d0c04efea6524530281e0c9c862a2 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 20:58:21 +1100
Subject: [PATCH 59/70] version bump Program plugin
---
Plugins/Flow.Launcher.Plugin.Program/plugin.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/plugin.json b/Plugins/Flow.Launcher.Plugin.Program/plugin.json
index d110124ff..082f0d853 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Program/plugin.json
@@ -4,7 +4,7 @@
"Name": "Program",
"Description": "Search programs in Flow.Launcher",
"Author": "qianlifeng",
- "Version": "1.4.2",
+ "Version": "1.4.3",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Program.dll",
From 77efbffa933bafc7d39e041ef83442acb8d855bb Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 21:27:36 +1100
Subject: [PATCH 60/70] update test name
---
Flow.Launcher.Test/HttpTest.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher.Test/HttpTest.cs b/Flow.Launcher.Test/HttpTest.cs
index 96213aba6..637747a07 100644
--- a/Flow.Launcher.Test/HttpTest.cs
+++ b/Flow.Launcher.Test/HttpTest.cs
@@ -1,4 +1,4 @@
-using NUnit.Framework;
+using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
@@ -11,7 +11,7 @@ namespace Flow.Launcher.Test
class HttpTest
{
[Test]
- public void TestSettingUpdate()
+ public void GivenHttpProxy_WhenUpdated_ThenWebProxyShouldAlsoBeUpdatedToTheSame()
{
HttpProxy proxy = new HttpProxy();
Http.Proxy = proxy;
From ff5fd5738cbcef72cf4503b95151e09128c70ccf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 11:46:31 +0800
Subject: [PATCH 61/70] fix potential uri format issue causing program crash
---
Flow.Launcher.Infrastructure/Http/Http.cs | 40 ++++++++++++++---------
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index de2e82359..8c7328aa3 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -50,25 +50,35 @@ namespace Flow.Launcher.Infrastructure.Http
///
public static void UpdateProxy(ProxyProperty property)
{
- (WebProxy.Address, WebProxy.Credentials) = property switch
+ if (string.IsNullOrEmpty(Proxy.Server))
+ return;
+
+ try
{
- ProxyProperty.Enabled => Proxy.Enabled switch
+ (WebProxy.Address, WebProxy.Credentials) = property switch
{
- true => Proxy.UserName switch
+ ProxyProperty.Enabled => Proxy.Enabled switch
{
- var userName when !string.IsNullOrEmpty(userName) =>
- (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), null),
- _ => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"),
- new NetworkCredential(Proxy.UserName, Proxy.Password))
+ true when !string.IsNullOrEmpty(Proxy.Server) => Proxy.UserName switch
+ {
+ var userName when string.IsNullOrEmpty(userName) =>
+ (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), null),
+ _ => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"),
+ new NetworkCredential(Proxy.UserName, Proxy.Password))
+ },
+ _ => (null, null)
},
- false => (null, null)
- },
- ProxyProperty.Server => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
- ProxyProperty.Port => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
- ProxyProperty.UserName => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
- ProxyProperty.Password => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
- _ => throw new ArgumentOutOfRangeException()
- };
+ ProxyProperty.Server => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
+ ProxyProperty.Port => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
+ ProxyProperty.UserName => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
+ ProxyProperty.Password => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
+ _ => throw new ArgumentOutOfRangeException()
+ };
+ }
+ catch(UriFormatException e)
+ {
+ Log.Exception("Http", "Unable to parse Uri", e);
+ }
}
public static async Task DownloadAsync([NotNull] string url, [NotNull] string filePath, CancellationToken token = default)
From 4c2e306cdb663158dd18981fe8fc55c36a6eb2bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 11:46:57 +0800
Subject: [PATCH 62/70] Merge branch 'dev' of
github.com:Flow-Launcher/Flow.Launcher into fixHttpError
From a1e85778838893ac796fc7c09f6792bcdb55951c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 12:11:02 +0800
Subject: [PATCH 63/70] Add api to Http.cs & message shown up when error thrown
---
Flow.Launcher.Infrastructure/Http/Http.cs | 8 +++++++-
Flow.Launcher/App.xaml.cs | 5 ++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index 8c7328aa3..a15add76e 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -9,6 +9,8 @@ using Flow.Launcher.Infrastructure.UserSettings;
using System;
using System.ComponentModel;
using System.Threading;
+using System.Windows.Interop;
+using Flow.Launcher.Plugin;
namespace Flow.Launcher.Infrastructure.Http
{
@@ -18,6 +20,8 @@ namespace Flow.Launcher.Infrastructure.Http
private static HttpClient client = new HttpClient();
+ public static IPublicAPI _api { get; set; }
+
static Http()
{
// need to be added so it would work on a win10 machine
@@ -77,7 +81,9 @@ namespace Flow.Launcher.Infrastructure.Http
}
catch(UriFormatException e)
{
- Log.Exception("Http", "Unable to parse Uri", e);
+ _api.ShowMsg("Please try again", "Unable to parse Http Proxy");
+ Log.Exception("Flow.Launcher.Infrastructure.Http", "Unable to parse Uri", e);
+
}
}
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 7c4c6a367..54ede7ff7 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -61,7 +61,6 @@ namespace Flow.Launcher
_settingsVM = new SettingWindowViewModel(_updater, _portable);
_settings = _settingsVM.Settings;
- Http.Proxy = _settings.Proxy;
_alphabet.Initialize(_settings);
_stringMatcher = new StringMatcher(_alphabet);
@@ -74,6 +73,10 @@ namespace Flow.Launcher
await PluginManager.InitializePlugins(API);
var window = new MainWindow(_settings, _mainVM);
+ Http._api = API;
+ Http.Proxy = _settings.Proxy;
+
+
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
Current.MainWindow = window;
From da59599461032a617ed2c3d153fabdcfc24f5356 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 13:45:28 +0800
Subject: [PATCH 64/70] add Unit test for Http.cs setting
---
Flow.Launcher.Test/HttpTest.cs | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 Flow.Launcher.Test/HttpTest.cs
diff --git a/Flow.Launcher.Test/HttpTest.cs b/Flow.Launcher.Test/HttpTest.cs
new file mode 100644
index 000000000..96213aba6
--- /dev/null
+++ b/Flow.Launcher.Test/HttpTest.cs
@@ -0,0 +1,33 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Flow.Launcher.Infrastructure.UserSettings;
+using Flow.Launcher.Infrastructure.Http;
+
+namespace Flow.Launcher.Test
+{
+ [TestFixture]
+ class HttpTest
+ {
+ [Test]
+ public void TestSettingUpdate()
+ {
+ HttpProxy proxy = new HttpProxy();
+ Http.Proxy = proxy;
+
+ proxy.Enabled = true;
+ proxy.Server = "127.0.0.1";
+ Assert.AreEqual(Http.WebProxy.Address, new Uri($"http://{proxy.Server}:{proxy.Port}"));
+ Assert.IsNull(Http.WebProxy.Credentials);
+
+ proxy.UserName = "test";
+ Assert.NotNull(Http.WebProxy.Credentials);
+ Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").UserName, proxy.UserName);
+ Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, "");
+
+ proxy.Password = "test password";
+ Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, proxy.Password);
+ }
+ }
+}
From b9c37a135151f62311c4599e57ea5be20efc9986 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 13:45:40 +0800
Subject: [PATCH 65/70] Migrate UrlPluginTest to Plugins folder
---
Flow.Launcher.Test/{ => Plugins}/UrlPluginTest.cs | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename Flow.Launcher.Test/{ => Plugins}/UrlPluginTest.cs (100%)
diff --git a/Flow.Launcher.Test/UrlPluginTest.cs b/Flow.Launcher.Test/Plugins/UrlPluginTest.cs
similarity index 100%
rename from Flow.Launcher.Test/UrlPluginTest.cs
rename to Flow.Launcher.Test/Plugins/UrlPluginTest.cs
From 007583911f5c5e2b99a506ceec24e0c390722e40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?=
Date: Mon, 22 Feb 2021 16:58:00 +0800
Subject: [PATCH 66/70] move http proxy initialization earlier than Plugin
initialization
---
Flow.Launcher/App.xaml.cs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 54ede7ff7..7c9697c07 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -70,11 +70,14 @@ namespace Flow.Launcher
PluginManager.LoadPlugins(_settings.PluginSettings);
_mainVM = new MainViewModel(_settings);
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet);
- await PluginManager.InitializePlugins(API);
- var window = new MainWindow(_settings, _mainVM);
Http._api = API;
Http.Proxy = _settings.Proxy;
+
+ await PluginManager.InitializePlugins(API);
+ var window = new MainWindow(_settings, _mainVM);
+
+
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
From c8f15f898eeb37deac871eb1bb40c5d35af43cdb Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 20:31:00 +1100
Subject: [PATCH 67/70] fix formatting
---
Flow.Launcher.Infrastructure/Http/Http.cs | 2 +-
Flow.Launcher/App.xaml.cs | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index a15add76e..9dc139056 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -68,7 +68,7 @@ namespace Flow.Launcher.Infrastructure.Http
var userName when string.IsNullOrEmpty(userName) =>
(new Uri($"http://{Proxy.Server}:{Proxy.Port}"), null),
_ => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"),
- new NetworkCredential(Proxy.UserName, Proxy.Password))
+ new NetworkCredential(Proxy.UserName, Proxy.Password))
},
_ => (null, null)
},
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 7c9697c07..56cd5b961 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -77,9 +77,6 @@ namespace Flow.Launcher
await PluginManager.InitializePlugins(API);
var window = new MainWindow(_settings, _mainVM);
-
-
-
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
Current.MainWindow = window;
From ad9b5a48a6550c285fe2834537a0e81a8541ada6 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 20:33:11 +1100
Subject: [PATCH 68/70] remove space
---
Flow.Launcher.Infrastructure/Http/Http.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index 9dc139056..b7aaeb676 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -83,7 +83,6 @@ namespace Flow.Launcher.Infrastructure.Http
{
_api.ShowMsg("Please try again", "Unable to parse Http Proxy");
Log.Exception("Flow.Launcher.Infrastructure.Http", "Unable to parse Uri", e);
-
}
}
From 7c62a2ff11e83d48188c1c492f02a0633bfca5b3 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 20:36:06 +1100
Subject: [PATCH 69/70] update variable naming convention
---
Flow.Launcher.Infrastructure/Http/Http.cs | 4 ++--
Flow.Launcher/App.xaml.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs
index b7aaeb676..b3a507c90 100644
--- a/Flow.Launcher.Infrastructure/Http/Http.cs
+++ b/Flow.Launcher.Infrastructure/Http/Http.cs
@@ -20,7 +20,7 @@ namespace Flow.Launcher.Infrastructure.Http
private static HttpClient client = new HttpClient();
- public static IPublicAPI _api { get; set; }
+ public static IPublicAPI API { get; set; }
static Http()
{
@@ -81,7 +81,7 @@ namespace Flow.Launcher.Infrastructure.Http
}
catch(UriFormatException e)
{
- _api.ShowMsg("Please try again", "Unable to parse Http Proxy");
+ API.ShowMsg("Please try again", "Unable to parse Http Proxy");
Log.Exception("Flow.Launcher.Infrastructure.Http", "Unable to parse Uri", e);
}
}
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 56cd5b961..a2907c927 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -71,7 +71,7 @@ namespace Flow.Launcher
_mainVM = new MainViewModel(_settings);
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet);
- Http._api = API;
+ Http.API = API;
Http.Proxy = _settings.Proxy;
await PluginManager.InitializePlugins(API);
From 11675a98ce56a1227ef19afcc74778558750e929 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 22 Feb 2021 21:27:36 +1100
Subject: [PATCH 70/70] update test name
---
Flow.Launcher.Test/HttpTest.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher.Test/HttpTest.cs b/Flow.Launcher.Test/HttpTest.cs
index 96213aba6..637747a07 100644
--- a/Flow.Launcher.Test/HttpTest.cs
+++ b/Flow.Launcher.Test/HttpTest.cs
@@ -1,4 +1,4 @@
-using NUnit.Framework;
+using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
@@ -11,7 +11,7 @@ namespace Flow.Launcher.Test
class HttpTest
{
[Test]
- public void TestSettingUpdate()
+ public void GivenHttpProxy_WhenUpdated_ThenWebProxyShouldAlsoBeUpdatedToTheSame()
{
HttpProxy proxy = new HttpProxy();
Http.Proxy = proxy;