specify name for property to avoid property collision

This commit is contained in:
弘韬 张 2021-02-03 17:50:36 +08:00
parent eeaa6f920d
commit d0b94c5b81
2 changed files with 32 additions and 35 deletions

View file

@ -15,6 +15,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Core.Plugin
@ -42,6 +43,7 @@ namespace Flow.Launcher.Core.Plugin
public class JsonRPCQueryResponseModel : JsonRPCResponseModel
{
[JsonPropertyName("result")]
public new List<JsonRPCResult> Result { get; set; }
}

View file

@ -147,47 +147,42 @@ namespace Flow.Launcher.Core.Plugin
{
try
{
using (var process = Process.Start(startInfo))
using var process = Process.Start(startInfo);
if (process == null)
{
if (process != null)
Log.Error("|JsonRPCPlugin.Execute|Can't start new process");
return string.Empty;
}
using var standardOutput = process.StandardOutput;
var result = standardOutput.ReadToEnd();
if (string.IsNullOrEmpty(result))
{
using (var standardError = process.StandardError)
{
using (var standardOutput = process.StandardOutput)
var error = standardError.ReadToEnd();
if (!string.IsNullOrEmpty(error))
{
var result = standardOutput.ReadToEnd();
if (string.IsNullOrEmpty(result))
{
using (var standardError = process.StandardError)
{
var error = standardError.ReadToEnd();
if (!string.IsNullOrEmpty(error))
{
Log.Error($"|JsonRPCPlugin.Execute|{error}");
return string.Empty;
}
else
{
Log.Error("|JsonRPCPlugin.Execute|Empty standard output and standard error.");
return string.Empty;
}
}
}
else if (result.StartsWith("DEBUG:"))
{
MessageBox.Show(new Form { TopMost = true }, result.Substring(6));
return string.Empty;
}
else
{
return result;
}
Log.Error($"|JsonRPCPlugin.Execute|{error}");
return string.Empty;
}
else
{
Log.Error("|JsonRPCPlugin.Execute|Empty standard output and standard error.");
return string.Empty;
}
}
else
{
Log.Error("|JsonRPCPlugin.Execute|Can't start new process");
return string.Empty;
}
}
else if (result.StartsWith("DEBUG:"))
{
MessageBox.Show(new Form { TopMost = true }, result.Substring(6));
return string.Empty;
}
else
{
return result;
}
}
catch (Exception e)
{