Esempio n. 1
0
        private Object syncObj = new Object();                          //定义一个静态对象用于线程部份代码块的锁定,用于lock操作
        public NormalIPCManager(IPCType _ipctype, Func <string, Dictionary <string, string>, string> _funcExecCmd, Action <string> _actionReceiveData)
        {
            IPCType           = _ipctype;
            funcExecCmd       = _funcExecCmd;
            actionReceiveData = _actionReceiveData;
            ipcw = new IPCWriteHelper();
            ipcr = new IPCReceiveHelper();

            Action <string> action = ((string text) =>
            {
                if (CmdObject.AnalysisCmdText(text).typestr == "cmd")
                {
                    ExecuteCmd(text);
                }
                else if (CmdObject.AnalysisCmdText(text).typestr == "data")
                {
                    ReceiveData(text);
                }
                else
                {
                    return;//无效的文本
                }
            });

            ipcr.Init(action, _ipctype, _ipctype);
        }
Esempio n. 2
0
        private Object syncObj = new Object();                          //定义一个静态对象用于线程部份代码块的锁定,用于lock操作

        public efwplusServerIPCManager(Func <string, Dictionary <string, string>, string> _funcExecCmd, Action <string> _actionReceiveData)
        {
            funcExecCmd       = _funcExecCmd;
            actionReceiveData = _actionReceiveData;
            Action <string> action = ((string text) =>
            {
                if (CmdObject.AnalysisCmdText(text).typestr == "cmd")
                {
                    ExecuteCmd(text);
                }
                else if (CmdObject.AnalysisCmdText(text).typestr == "data")
                {
                    ReceiveData(text);
                }
                else
                {
                    return;//无效的文本
                }
            });


            ipcw_base  = new IPCWriteHelper();
            ipcw_api   = new IPCWriteHelper();
            ipcw_route = new IPCWriteHelper();
            IPCReceiveHelper ipcr_base = new IPCReceiveHelper();

            ipcr_base.Init(action, IPCType.efwplusServer, IPCType.efwplusBase);

            IPCReceiveHelper ipcr_api = new IPCReceiveHelper();

            ipcr_api.Init(action, IPCType.efwplusServer, IPCType.efwplusWebAPI);

            IPCReceiveHelper ipcr_route = new IPCReceiveHelper();

            ipcr_route.Init(action, IPCType.efwplusServer, IPCType.efwplusRoute);
        }