private void DoProcessPython(string[] ids, int gameId, int serverId) { PythonResult pythonResult = new PythonResult(); pythonResult.RunTime = DateTime.Now.ToLongTimeString(); try { if (ids.Length > 0) { int id = 0; if (int.TryParse(ids[0], out id)) { string codeText = ""; List <JsonParameter> paramList = new List <JsonParameter>(); paramList.Add(new JsonParameter() { Key = "_py_code", Value = codeText }); paramList.Add(new JsonParameter() { Key = "_py_func_arg", Value = "" }); //发送 } } } catch (Exception ex) { pythonResult.Result = ex.Message; } _context.Response.Write(JsonConvert.SerializeObject(pythonResult)); }
public List <Result> Query(Query query) { try { string jsonResult = InvokeFunc("query", query.RawQuery); if (string.IsNullOrEmpty(jsonResult)) { return(new List <Result>()); } List <PythonResult> o = JsonConvert.DeserializeObject <List <PythonResult> >(jsonResult); List <Result> r = new List <Result>(); foreach (PythonResult pythonResult in o) { PythonResult ps = pythonResult; if (!string.IsNullOrEmpty(ps.ActionName)) { ps.Action = (context) => { InvokeFunc(ps.ActionName, GetPythonActionContext(context), new PyString(ps.ActionPara)); return(true); }; } r.Add(ps); } return(r); } catch (Exception e) { #if (DEBUG) { throw new WoxPythonException(e.Message); } #endif Log.Error(string.Format("Python Plugin {0} query failed: {1}", metadata.Name, e.Message)); } return(new List <Result>()); }
private void SelectMSMQLog(int projectId, int gameId, int serverId) { PythonResult pythonResult = new PythonResult(); pythonResult.RunTime = DateTime.Now.ToLongTimeString(); try { string messageQueuePath = ""; //var gameSet = new CacheGameSet().Get(gameId, serverId); //if (gameSet != null) //{ // var dev = SvnProcesser.Project(projectId); // messageQueuePath = string.Format(gameSet.MessageQueuePath, serverId, dev.Ip); //} if (!string.IsNullOrEmpty(messageQueuePath)) { SimplePlanManagerService simplePlanManagerService = new SimplePlanManagerService();//计划任务服务对象 var planList = simplePlanManagerService.GetSimplePlanInfoList(120).FindAll(m => m.Name.StartsWith(messageQueuePath)); pythonResult.Result = planList; } else { pythonResult.Result = string.Format("服务器MessageQueuePath的GameId:{0},ServerId:{1}配置为空", gameId, serverId); } } catch (Exception ex) { pythonResult.Result = ex.Message; } var isodata = new IsoDateTimeConverter() { DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm" }; _context.Response.Write(JsonConvert.SerializeObject(pythonResult, isodata)); }
private void DoProcessPython(string[] ids, int gameId, int serverId) { PythonResult pythonResult = new PythonResult(); pythonResult.RunTime = DateTime.Now.ToLongTimeString(); try { if (ids.Length > 0) { int id = 0; if (int.TryParse(ids[0], out id)) { string codeText = ""; List<JsonParameter> paramList = new List<JsonParameter>(); paramList.Add(new JsonParameter() { Key = "_py_code", Value = codeText }); paramList.Add(new JsonParameter() { Key = "_py_func_arg", Value = "" }); //发送 } } } catch (Exception ex) { pythonResult.Result = ex.Message; } _context.Response.Write(JsonConvert.SerializeObject(pythonResult)); }