mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
add Debug message field for debugging
This commit is contained in:
parent
34a7a15226
commit
824ea07ab2
2 changed files with 26 additions and 19 deletions
|
|
@ -45,6 +45,8 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
{
|
{
|
||||||
[JsonPropertyName("result")]
|
[JsonPropertyName("result")]
|
||||||
public new List<JsonRPCResult> Result { get; set; }
|
public new List<JsonRPCResult> Result { get; set; }
|
||||||
|
|
||||||
|
public string DebugMessage { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JsonRPCRequestModel : JsonRPCModelBase
|
public class JsonRPCRequestModel : JsonRPCModelBase
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,35 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private async Task<List<Result>> DeserializedResultAsync(Stream output)
|
||||||
|
{
|
||||||
|
if (output == Stream.Null) return null;
|
||||||
|
|
||||||
|
JsonRPCQueryResponseModel queryResponseModel = await
|
||||||
|
JsonSerializer.DeserializeAsync<JsonRPCQueryResponseModel>(output);
|
||||||
|
|
||||||
|
return ParseResults(queryResponseModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Result> DeserializedResult(string output)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(output)) return null;
|
||||||
|
|
||||||
|
JsonRPCQueryResponseModel queryResponseModel =
|
||||||
|
JsonSerializer.Deserialize<JsonRPCQueryResponseModel>(output);
|
||||||
|
return ParseResults(queryResponseModel);
|
||||||
|
}
|
||||||
|
|
||||||
private List<Result> ParseResults(JsonRPCQueryResponseModel queryResponseModel)
|
private List<Result> ParseResults(JsonRPCQueryResponseModel queryResponseModel)
|
||||||
{
|
{
|
||||||
var results = new List<Result>();
|
var results = new List<Result>();
|
||||||
if (queryResponseModel.Result == null) return null;
|
if (queryResponseModel.Result == null) return null;
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(queryResponseModel.DebugMessage))
|
||||||
|
{
|
||||||
|
context.API.ShowMsg(queryResponseModel.DebugMessage);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (JsonRPCResult result in queryResponseModel.Result)
|
foreach (JsonRPCResult result in queryResponseModel.Result)
|
||||||
{
|
{
|
||||||
result.Action = c =>
|
result.Action = c =>
|
||||||
|
|
@ -89,25 +113,6 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<Result>> DeserializedResultAsync(Stream output)
|
|
||||||
{
|
|
||||||
if (output == Stream.Null) return null;
|
|
||||||
|
|
||||||
JsonRPCQueryResponseModel queryResponseModel = await
|
|
||||||
JsonSerializer.DeserializeAsync<JsonRPCQueryResponseModel>(output);
|
|
||||||
|
|
||||||
return ParseResults(queryResponseModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Result> DeserializedResult(string output)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(output)) return null;
|
|
||||||
|
|
||||||
JsonRPCQueryResponseModel queryResponseModel =
|
|
||||||
JsonSerializer.Deserialize<JsonRPCQueryResponseModel>(output);
|
|
||||||
return ParseResults(queryResponseModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExecuteFlowLauncherAPI(string method, object[] parameters)
|
private void ExecuteFlowLauncherAPI(string method, object[] parameters)
|
||||||
{
|
{
|
||||||
MethodInfo methodInfo = PluginManager.API.GetType().GetMethod(method);
|
MethodInfo methodInfo = PluginManager.API.GetType().GetMethod(method);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue