This commit is contained in:
Hongtao Zhang 2023-03-26 14:21:36 -05:00
parent b425aac159
commit 1551567269
No known key found for this signature in database
GPG key ID: 75F655B91C7AC9BB
2 changed files with 5 additions and 7 deletions

View file

@ -47,7 +47,7 @@ namespace Flow.Launcher.Core.Plugin
public abstract List<Result> LoadContextMenus(Result selectedResult);
protected static readonly JsonSerializerOptions options = new()
protected static readonly JsonSerializerOptions DeserializeOption = new()
{
PropertyNameCaseInsensitive = true,
#pragma warning disable SYSLIB0020
@ -63,13 +63,11 @@ namespace Flow.Launcher.Core.Plugin
}
};
private static readonly JsonSerializerOptions settingSerializeOption = new()
protected static readonly JsonSerializerOptions RequestSerializeOption = new()
{
WriteIndented = true
PropertyNameCaseInsensitive = true, PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};
private readonly Dictionary<string, FrameworkElement> _settingControls = new();
protected abstract Task<bool> ExecuteResultAsync(JsonRPCResult result);
protected abstract Task<List<Result>> QueryRequestAsync(JsonRPCRequestModel request, CancellationToken token);

View file

@ -39,7 +39,7 @@ namespace Flow.Launcher.Core.Plugin
protected override Task<Stream> RequestAsync(JsonRPCRequestModel request, CancellationToken token = default)
{
_startInfo.ArgumentList[2] = JsonSerializer.Serialize(request);
_startInfo.ArgumentList[2] = JsonSerializer.Serialize(request, RequestSerializeOption);
return ExecuteAsync(_startInfo, token);
}
@ -47,7 +47,7 @@ namespace Flow.Launcher.Core.Plugin
protected override string Request(JsonRPCRequestModel rpcRequest, CancellationToken token = default)
{
// since this is not static, request strings will build up in ArgumentList if index is not specified
_startInfo.ArgumentList[2] = JsonSerializer.Serialize(rpcRequest);
_startInfo.ArgumentList[2] = JsonSerializer.Serialize(rpcRequest, RequestSerializeOption);
_startInfo.WorkingDirectory = Context.CurrentPluginMetadata.PluginDirectory;
// TODO: Async Action
return Execute(_startInfo);