/// <summary> /// 执行命令 /// cmd#efwpluswebapi-efwplusbase#setmnodestate@name=111&state=1 /// data#efwplusbase-efwpluswebapi#msgtext /// </summary> /// <param name="cmd"></param> void ExecuteCmd(string cmd) { try { string bprocess = CmdObject.AnalysisCmdText(cmd).pathstr_begin; //开始发送执行命令的进程名 string eprocess = CmdObject.AnalysisCmdText(cmd).pathstr_end; //目标执行命令的进程名 if (eprocess == "efwplusserver") { //执行efwplusserver进程的命令 if (funcExecCmd != null) { string retval = funcExecCmd(CmdObject.AnalysisCmdText(cmd).methodstr, CmdObject.AnalysisCmdText(cmd).argdic);//执行命令 arg1方法名 arg2参数 string datatext = CmdObject.BuildDataText(CmdObject.AnalysisCmdText(cmd).pathstr_end, CmdObject.AnalysisCmdText(cmd).pathstr_begin, CmdObject.AnalysisCmdText(cmd).uniqueid, retval); //返回结果写回调用命令的进程 if (bprocess == "efwplusbase") { ipcw_base.WriteData(datatext, IPCType.efwplusBase, IPCType.efwplusBase); } else if (bprocess == "efwpluswebapi") { ipcw_api.WriteData(datatext, IPCType.efwplusWebAPI, IPCType.efwplusWebAPI); } else if (bprocess == "efwplusroute") { ipcw_route.WriteData(datatext, IPCType.efwplusRoute, IPCType.efwplusRoute); } } } else if (eprocess == "efwplusbase") { ipcw_base.WriteData(cmd, IPCType.efwplusBase, IPCType.efwplusBase); } else if (eprocess == "efwpluswebapi") { ipcw_api.WriteData(cmd, IPCType.efwplusWebAPI, IPCType.efwplusWebAPI); } else if (eprocess == "efwplusroute") { ipcw_route.WriteData(cmd, IPCType.efwplusRoute, IPCType.efwplusRoute); } else { return; } } catch (Exception e) { throw new Exception("命令格式错误:" + e.Message); } }
/// <summary> /// 显示信息 /// </summary> /// <param name="msg"></param> public void ShowMsg(string msg) { if (actionReceiveData != null) { actionReceiveData(msg); } string datatext = ""; if (IPCType == IPCType.efwplusBase) { datatext = CmdObject.BuildDataText("efwplusbase", "efwplusserver", Guid.NewGuid().ToString(), msg); ipcw.WriteData(datatext, IPCType.efwplusServer, IPCType); } else if (IPCType == IPCType.efwplusRoute) { datatext = CmdObject.BuildDataText("efwplusroute", "efwplusserver", Guid.NewGuid().ToString(), msg); ipcw.WriteData(datatext, IPCType.efwplusServer, IPCType); } else if (IPCType == IPCType.efwplusWebAPI) { datatext = CmdObject.BuildDataText("efwpluswebapi", "efwplusserver", Guid.NewGuid().ToString(), msg); ipcw.WriteData(datatext, IPCType.efwplusServer, IPCType); } }
/// <summary> /// 执行命令 /// cmd#efwpluswebapi-efwplusbase#setmnodestate@name=111&state=1 /// data#efwplusbase-efwpluswebapi#msgtext /// </summary> /// <param name="cmd"></param> void ExecuteCmd(string cmd) { try { //string bprocess = CmdObject.AnalysisCmdText(cmd).pathstr_begin;//开始发送执行命令的进程名 string eprocess = CmdObject.AnalysisCmdText(cmd).pathstr_end;//目标执行命令的进程名 string retval, datatext; switch (eprocess) { case "efwplusbase": retval = funcExecCmd(CmdObject.AnalysisCmdText(cmd).methodstr, CmdObject.AnalysisCmdText(cmd).argdic); //执行命令 arg1方法名 arg2参数 datatext = CmdObject.BuildDataText(CmdObject.AnalysisCmdText(cmd).pathstr_end, CmdObject.AnalysisCmdText(cmd).pathstr_begin, CmdObject.AnalysisCmdText(cmd).uniqueid, retval); ipcw.WriteData(datatext, IPCType.efwplusServer, IPCType); break; case "efwpluswebapi": retval = funcExecCmd(CmdObject.AnalysisCmdText(cmd).methodstr, CmdObject.AnalysisCmdText(cmd).argdic); //执行命令 arg1方法名 arg2参数 datatext = CmdObject.BuildDataText(CmdObject.AnalysisCmdText(cmd).pathstr_end, CmdObject.AnalysisCmdText(cmd).pathstr_begin, CmdObject.AnalysisCmdText(cmd).uniqueid, retval); ipcw.WriteData(datatext, IPCType.efwplusServer, IPCType); break; case "efwplusroute": retval = funcExecCmd(CmdObject.AnalysisCmdText(cmd).methodstr, CmdObject.AnalysisCmdText(cmd).argdic); //执行命令 arg1方法名 arg2参数 datatext = CmdObject.BuildDataText(CmdObject.AnalysisCmdText(cmd).pathstr_end, CmdObject.AnalysisCmdText(cmd).pathstr_begin, CmdObject.AnalysisCmdText(cmd).uniqueid, retval); ipcw.WriteData(datatext, IPCType.efwplusServer, IPCType); break; default: return; } } catch (Exception e) { throw new Exception("命令格式错误:" + e.Message); } }