public static PythonEvalReply Eval(string code) { PythonEvalMessage msg = new PythonEvalMessage { Code = code }; string replyString = KodiBridge.SendMessage(msg); PythonEvalReply reply = JsonConvert.DeserializeObject <PythonEvalReply>(replyString); return(reply); }
public static PythonEvalReply Eval(string code) { PythonEvalMessage msg = new PythonEvalMessage { Code = code }; KodiBridgeInstance bridge = KodiBridge.RunningAddon?.Bridge ?? KodiBridge.GlobalStaticBridge; string replyString = bridge.SendMessage(msg); Console.Error.WriteLine(replyString); PythonEvalReply reply = JsonConvert.DeserializeObject <PythonEvalReply>(replyString); if (reply.ExitCode == 1) { throw new InvalidOperationException($"eval of '{code}' failed: '{reply.Error}'"); } return(reply); }