|
|
@@ -0,0 +1,14 @@
|
|
|
+using Newtonsoft.Json;
|
|
|
+namespace IvfTl.ControlHost.Debug
|
|
|
+{
|
|
|
+ /// <summary>命令/借用统一返回体。code 见 spec §4。</summary>
|
|
|
+ public class DebugCommandResult
|
|
|
+ {
|
|
|
+ [JsonProperty("ok")] public bool Ok { get; set; }
|
|
|
+ [JsonProperty("result", NullValueHandling = NullValueHandling.Ignore)] public object Result { get; set; }
|
|
|
+ [JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)] public string Error { get; set; }
|
|
|
+ [JsonProperty("code", NullValueHandling = NullValueHandling.Ignore)] public string Code { get; set; }
|
|
|
+ public static DebugCommandResult Okay(object result = null) => new DebugCommandResult { Ok = true, Result = result };
|
|
|
+ public static DebugCommandResult Fail(string code, string error) => new DebugCommandResult { Ok = false, Code = code, Error = error };
|
|
|
+ }
|
|
|
+}
|