From 5cedf7084ce5cd2c3cbe975155579d8d562656e6 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 10 Jun 2021 15:08:10 +0800 Subject: [PATCH] Remove Unused Code --- Flow.Launcher.Core/Plugin/JsonPRCModel.cs | 38 ++--------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/JsonPRCModel.cs b/Flow.Launcher.Core/Plugin/JsonPRCModel.cs index 1dac4e25d..2b3bd61b0 100644 --- a/Flow.Launcher.Core/Plugin/JsonPRCModel.cs +++ b/Flow.Launcher.Core/Plugin/JsonPRCModel.cs @@ -1,5 +1,4 @@ - -/* We basically follow the Json-RPC 2.0 spec (http://www.jsonrpc.org/specification) to invoke methods between Flow Launcher and other plugins, +/* We basically follow the Json-RPC 2.0 spec (http://www.jsonrpc.org/specification) to invoke methods between Flow Launcher and other plugins, * like python or other self-execute program. But, we added addtional infos (proxy and so on) into rpc request. Also, we didn't use the * "id" and "jsonrpc" in the request, since it's not so useful in our request model. * @@ -62,37 +61,6 @@ namespace Flow.Launcher.Core.Plugin public override string ToString() { return JsonSerializer.Serialize(this); - - string rpc = string.Empty; - if (Parameters != null && Parameters.Length > 0) - { - string parameters = $"[{string.Join(',', Parameters.Select(GetParameterByType))}]"; - rpc = $@"{{\""method\"":\""{Method}\"",\""parameters\"":{parameters}"; - } - else - { - rpc = $@"{{\""method\"":\""{Method}\"",\""parameters\"":[]"; - } - - return rpc; - - } - - private string GetParameterByType(object parameter) - => parameter switch - { - null => "null", - string p => $@"\""{ReplaceEscapes(p)}\""", - bool p => $@"{p.ToString().ToLower()}", - _ => $@"\""{ReplaceEscapes(parameter.ToString())}\""" - }; - - - private string ReplaceEscapes(string str) - { - return str.Replace(@"\", @"\\") //Escapes in ProcessStartInfo - .Replace(@"\", @"\\") //Escapes itself when passed to client - .Replace(@"""", @"\\"""""); } } @@ -101,7 +69,7 @@ namespace Flow.Launcher.Core.Plugin /// public class JsonRPCServerRequestModel : JsonRPCRequestModel { - + } /// @@ -122,4 +90,4 @@ namespace Flow.Launcher.Core.Plugin { public JsonRPCClientRequestModel JsonRPCAction { get; set; } } -} +} \ No newline at end of file