Exemplo n.º 1
0
 protected override string Request(JsonRPCRequestModel rpcRequest, CancellationToken token = default)
 {
     _startInfo.ArgumentList[2]  = rpcRequest.ToString();
     _startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
     // TODO: Async Action
     return(Execute(_startInfo));
 }
Exemplo n.º 2
0
        private List <Result> DeserializedResult(string output)
        {
            if (!String.IsNullOrEmpty(output))
            {
                List <Result> results = new List <Result>();

                JsonRPCQueryResponseModel queryResponseModel = JsonConvert.DeserializeObject <JsonRPCQueryResponseModel>(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 (!String.IsNullOrEmpty(result1.JsonRPCAction.Method))
                        {
                            if (result1.JsonRPCAction.Method.StartsWith("Flow.Launcher."))
                            {
                                ExecuteFlowLauncherAPI(result1.JsonRPCAction.Method.Substring(4), result1.JsonRPCAction.Parameters);
                            }
                            else
                            {
                                string actionReponse = ExecuteCallback(result1.JsonRPCAction);
                                JsonRPCRequestModel jsonRpcRequestModel = JsonConvert.DeserializeObject <JsonRPCRequestModel>(actionReponse);
                                if (jsonRpcRequestModel != null &&
                                    !String.IsNullOrEmpty(jsonRpcRequestModel.Method) &&
                                    jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
                                {
                                    ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4), jsonRpcRequestModel.Parameters);
                                }
                            }
                        }
                        return(!result1.JsonRPCAction.DontHideAfterAction);
                    };
                    results.Add(result);
                }
                return(results);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
 protected override string ExecuteCallback(JsonRPCRequestModel rpcRequest)
 {
     _startInfo.Arguments        = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{rpcRequest}\"";
     _startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
     return(Execute(_startInfo));
 }
Exemplo n.º 4
0
 protected abstract string ExecuteCallback(JsonRPCRequestModel rpcRequest);
Exemplo n.º 5
0
 protected abstract string Request(JsonRPCRequestModel rpcRequest, CancellationToken token             = default);
Exemplo n.º 6
0
 protected abstract Task <Stream> RequestAsync(JsonRPCRequestModel rpcRequest, CancellationToken token = default);
Exemplo n.º 7
0
 protected override string ExecuteCallback(JsonRPCRequestModel rpcRequest)
 {
     _startInfo.Arguments = $"\"{rpcRequest}\"";
     return(Execute(_startInfo));
 }
 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[0] = rpcRequest.ToString();
     return(Execute(_startInfo));
 }
Exemplo n.º 9
0
        protected override Task <Stream> RequestAsync(JsonRPCRequestModel request, CancellationToken token = default)
        {
            _startInfo.ArgumentList[2] = request.ToString();

            return(ExecuteAsync(_startInfo, token));
        }