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,
3
2
* 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
4
3
* "id" and "jsonrpc" in the request, since it's not so useful in our request model.
5
4
*
@@ -62,37 +61,6 @@ public class JsonRPCRequestModel : JsonRPCModelBase
62
61
public override string ToString ( )
63
62
{
64
63
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 ( @"""" , @"\\""""" ) ;
96
64
}
97
65
}
98
66
@@ -101,7 +69,7 @@ private string ReplaceEscapes(string str)
101
69
/// </summary>
102
70
public class JsonRPCServerRequestModel : JsonRPCRequestModel
103
71
{
104
-
72
+
105
73
}
106
74
107
75
/// <summary>
@@ -122,4 +90,4 @@ public class JsonRPCResult : Result
122
90
{
123
91
public JsonRPCClientRequestModel JsonRPCAction { get ; set ; }
124
92
}
125
- }
93
+ }
0 commit comments