protected override void PacketReceived(UDPPacketBuffer buffer) { TCmdHead xCmd = new TCmdHead(); xCmd = (TCmdHead)funs.ByteToStruct(buffer.Data, xCmd.GetType()); switch (xCmd.cmd) { case 0x04FD: { UIForm._doAddRfData(buffer); if (UIForm.flag == false) { UIForm.flag = true; } } break; default: break; } }
protected override void PacketReceived(UDPPacketBuffer buffer) { TCmdHead xCmd = new TCmdHead(); IWin32Window win32Window = UIForm; xCmd = (TCmdHead)funs.ByteToStruct(buffer.Data, xCmd.GetType()); int len = Marshal.SizeOf(xCmd); switch (xCmd.cmd) { case 0x00FD: //查询返回指令 { netdata_ex_new _data; netdata_new xcfg = new netdata_new(); byte[] newdata = funs.SubByte(buffer.Data, len, buffer.DataLength - len); xcfg.xdata = (netdata)funs.ByteToStruct(newdata, xcfg.xdata.GetType()); UIForm._curMac = funs.Byte2Mac(xCmd.mac); IPEndPoint Ip = (IPEndPoint)buffer.RemoteEndPoint; xcfg.IP = Ip.Address.GetAddressBytes(); xcfg.ipEndPoint = Ip; _data.xCmd = xCmd; _data.xdata = xcfg; UIForm._doAddItem(_data); } break; case 0x01FD: { udpclient.send(funs.Byte2Mac(xCmd.mac), 0x03fe); } break; case 0x02FD: { string sMac = funs.Byte2Mac(xCmd.mac); MessageBox.Show(win32Window, translate.getInfo("form1", "cmd_result_mac")); } break; case 0x03FD: { if (UIForm.flag == 1) { UIForm._doClearList(1); udpclient.send(Encoding.Default.GetBytes("www.cdebyte.comwww.cdebyte.com")); flag = false; MessageBox.Show(win32Window, translate.getInfo("form1", "cmd_result_cfg")); UIForm._doPatchUI(2000); } if (UIForm.flag == 2) { MessageBox.Show(win32Window, translate.getInfo("form1", "cmd_result_reboot")); } UIForm.flag = 0; } break; default: break; } }