mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 20:57:22 +02:00
ContextMenu 2: Extract DeserializedResult #1366
This commit is contained in:
committed by
bao-qian
parent
de12208d4a
commit
5198f70ebf
@@ -33,10 +33,21 @@ namespace Wox.Core.Plugin
|
|||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
string output = ExecuteQuery(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<Result> DeserializedResult(string output)
|
||||||
|
{
|
||||||
if (!String.IsNullOrEmpty(output))
|
if (!String.IsNullOrEmpty(output))
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
|
|
||||||
JsonRPCQueryResponseModel queryResponseModel = JsonConvert.DeserializeObject<JsonRPCQueryResponseModel>(output);
|
JsonRPCQueryResponseModel queryResponseModel = JsonConvert.DeserializeObject<JsonRPCQueryResponseModel>(output);
|
||||||
@@ -72,15 +83,11 @@ namespace Wox.Core.Plugin
|
|||||||
results.Add(result);
|
results.Add(result);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Log.Exception($"|JsonRPCPlugin.Query|Exception when query <{query}>", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ExecuteWoxAPI(string method, object[] parameters)
|
private void ExecuteWoxAPI(string method, object[] parameters)
|
||||||
{
|
{
|
||||||
MethodInfo methodInfo = PluginManager.API.GetType().GetMethod(method);
|
MethodInfo methodInfo = PluginManager.API.GetType().GetMethod(method);
|
||||||
|
|||||||
Reference in New Issue
Block a user