Skip to content

Commit 5cedf70

Browse files
committed
Remove Unused Code
1 parent be8abaf commit 5cedf70

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

Flow.Launcher.Core/Plugin/JsonPRCModel.cs

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-

2-
/* We basically follow the Json-RPC 2.0 spec (http://www.jsonrpc.org/specification) to invoke methods between Flow Launcher and other plugins,
1+
/* We basically follow the Json-RPC 2.0 spec (http://www.jsonrpc.org/specification) to invoke methods between Flow Launcher and other plugins,
32
* 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
43
* "id" and "jsonrpc" in the request, since it's not so useful in our request model.
54
*
@@ -62,37 +61,6 @@ public class JsonRPCRequestModel : JsonRPCModelBase
6261
public override string ToString()
6362
{
6463
return JsonSerializer.Serialize(this);
65-
66-
string rpc = string.Empty;
67-
if (Parameters != null && Parameters.Length > 0)
68-
{
69-
string parameters = $"[{string.Join(',', Parameters.Select(GetParameterByType))}]";
70-
rpc = $@"{{\""method\"":\""{Method}\"",\""parameters\"":{parameters}";
71-
}
72-
else
73-
{
74-
rpc = $@"{{\""method\"":\""{Method}\"",\""parameters\"":[]";
75-
}
76-
77-
return rpc;
78-
79-
}
80-
81-
private string GetParameterByType(object parameter)
82-
=> parameter switch
83-
{
84-
null => "null",
85-
string p => $@"\""{ReplaceEscapes(p)}\""",
86-
bool p => $@"{p.ToString().ToLower()}",
87-
_ => $@"\""{ReplaceEscapes(parameter.ToString())}\"""
88-
};
89-
90-
91-
private string ReplaceEscapes(string str)
92-
{
93-
return str.Replace(@"\", @"\\") //Escapes in ProcessStartInfo
94-
.Replace(@"\", @"\\") //Escapes itself when passed to client
95-
.Replace(@"""", @"\\""""");
9664
}
9765
}
9866

@@ -101,7 +69,7 @@ private string ReplaceEscapes(string str)
10169
/// </summary>
10270
public class JsonRPCServerRequestModel : JsonRPCRequestModel
10371
{
104-
72+
10573
}
10674

10775
/// <summary>
@@ -122,4 +90,4 @@ public class JsonRPCResult : Result
12290
{
12391
public JsonRPCClientRequestModel JsonRPCAction { get; set; }
12492
}
125-
}
93+
}

0 commit comments

Comments
 (0)