Beispiel #1
0
        public byte[] ExtendSrv(ClientInfo clientinfo, byte[] context)
        {
            EventHandler <ExtendEventArgs> handle = this.ExtendHandle;

            if (null == handle)
            {
                return(context);
            }
            ExtendEventArgs args = new ExtendEventArgs(this, clientinfo, context);

            ThreadManager.QueueUserWorkItem(delegate(object obj) { handle(this, obj as ExtendEventArgs); }, args);
            byte[] header            = GetFileheader(context);
            NameValueCollection info = ParseInfo(header);

            if ("false" == info["response"])
            {
                return(new byte[0]);
            }
            info["len"]     = "0";
            info["success"] = "true";
            info["msg"]     = "触发扩展事件";
            return(ParseInfo(info));
        }
Beispiel #2
0
 public byte[] ExtendSrv(ClientInfo clientinfo, byte[] context)
 {
     EventHandler<ExtendEventArgs> handle = this.ExtendHandle;
     if (null == handle)
         return context;
     ExtendEventArgs args = new ExtendEventArgs(this, clientinfo, context);
     ThreadManager.QueueUserWorkItem(delegate(object obj) { handle(this, obj as ExtendEventArgs); }, args);
     byte[] header = GetFileheader(context);
     NameValueCollection info = ParseInfo(header);
     if ("false" == info["response"])
         return new byte[0];
     info["len"] = "0";
     info["success"] = "true";
     info["msg"] = "������չ�¼�";
     return ParseInfo(info);
 }
Beispiel #3
0
 /// <summary>
 /// 传输服务接收扩展服务事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void svrfile_ExtendHandle(object sender, ExtendEventArgs e)
 {
     if (null == sender || null == e || null == e.Request || e.Request.Length < 1)
         return;
     byte[] header = SvrFileTrans.GetFileheader(e.Request);
     NameValueCollection info = SvrFileTrans.ParseInfo(header);
     string cmdext = info["service"];
     if (string.IsNullOrEmpty(cmdext))
         return;
     string op = "";
     try
     {
         switch (cmdext)
         {
             case "updateparam":
                 op = "更新设备控制参数";
                 this.synDevice.CommiDevice();
                 break;
             case "monitor":
                 // 指令内容:service='monitor',device,id,patrol='true'
                 if (null == e.Client) break;
                 op = "巡检设备";
                 MoniDevice.Monitordev(info, e.Client);
                 break;
             case "halt":
                 // 指令内容:service='halt',device,id,all='true'
                 if (null == e.Client) break;
                 op = "停止巡检";
                 MoniDevice.Haltdev(info, e.Client);
                 break;
             case "readinfo":
                 // 指令内容:service='readinfo',device,id
                 if(null==e.Client) break;
                 op = "读取设备信息";
                 moniDevice.ReadInfodev(info, e.Client);
                 break;
         }
     }
     catch (Exception ex)
     {
         string msg = ex.Message;
         NameValueCollection data = new NameValueCollection();
         data["操作"] = op;
         LogMessage(ex, data, EventLogEntryType.Error);
     }
 }
Beispiel #4
0
 /// <summary>
 /// 传输服务接收扩展服务事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void svrfile_ExtendHandle(object sender, ExtendEventArgs e)
 {
     if (null == sender || null == e || null == e.Request || e.Request.Length < 1)
         return;
     Monitor.Enter(argsExtendList);
     argsExtendList.Add(e);
     Monitor.PulseAll(argsExtendList);
     Monitor.Exit(argsExtendList);
     hdlWh.Set();
     if (!isRunExtend)
         ThreadManager.QueueUserWorkItem(ExtendHandle, null);
 }