Beispiel #1
0
        private void AsyncDoReceiveData(IProcessor processor, string data)
        {
            //CLocalSystem.WriteDebugLog(string.Format("CRemoteManagerClient.AsyncDoReceiveData: 接收到 {0} 发送数据: {1}", processor.Name, data));

            try
            {
                int index = data.IndexOf("<RemoteSystem>");
                if (index >= 0 && CLocalSystem.RemoteManageServer != null)
                {
                    CLocalSystem.RemoteManageServer.Send(data);
                }

                IMonitorSystemContext context = null;
                string contextname            = "";

                index = data.IndexOf("<SystemContext>");
                if (index > 0)
                {
                    contextname = data.Substring(0, index);
                    context     = CLocalSystem.GetSystemContext(contextname);
                    data        = data.Remove(0, index + 15);
                }

                if (context == null)
                {
                    context = mSystemContext;
                }

                if (data.IndexOf("<RemoteConfig>") > 0)
                {
                    if (!contextname.Equals(""))
                    {
                        ReceiveRemoteConfigData(contextname, processor, data);
                    }
                    return;
                }
                else if (!ReceiveRemoteData(contextname, processor, data))
                {
                    if (OnReceiveData != null)
                    {
                        if (CLocalSystem.MainForm != null)
                        {
                            MethodInvoker form_invoker = delegate
                            {
                                OnReceiveData(context, processor, data);
                            };
                            CLocalSystem.MainForm.Invoke(form_invoker);
                        }
                        else
                        {
                            OnReceiveData(context, processor, data);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                CLocalSystem.WriteErrorLog(string.Format("CRemoteManageClient.AsyncDoReceiveData Exception: {0}", e));
            }
        }