public ICommand Create(SyncInfo info) { ICommand cmd; // string CmdId = info.CommandID; string CmdId = Config.CmdIdType == "16" ? (Convert.ToInt32(info.CommandID, 16)).ToString() : info.CommandID; ulong _devid = ulong.Parse(info.EQID); byte[] _content = MyLibrary.ConverUtil.StrToBytes(info.Content); DateTime _time; if (!DateTime.TryParse(info.Time, out _time)) { _time = DateTime.Now; } switch (CmdId) { case "5": cmd = new MJ_5(_content, _devid, _time); //放到新的生成XML程序里Heartbeat_COL break; case "33": cmd = new MJ_33(_content, _devid, _time); break; case "67": cmd = new MJ_67(_content, _devid, _time); //放到新的生成XML程序里SIMSN_COL break; default: cmd = new IgnoreCommand(); break; } return(cmd); }
public List <SyncInfo> GetSyncInfo() { SyncInfo info; List <SyncInfo> infos = new List <SyncInfo>(); XmlNode datas = doc.SelectSingleNode("Datas"); foreach (XmlNode node in datas.ChildNodes) { info = new SyncInfo(); if (node.SelectSingleNode("CommandID") != null) { info.CommandID = node.SelectSingleNode("CommandID").InnerText; } else { MyLibrary.Log.Error("CommandID node is null.Node info : " + node.ToString()); continue; } if (node.SelectSingleNode("Content") != null) { info.Content = node.SelectSingleNode("Content").InnerText; } else { MyLibrary.Log.Error("Content node is null.Node info : " + node.ToString()); continue; } info.EQID = node.SelectSingleNode("EQID").InnerText; info.EQType = node.SelectSingleNode("EQType").InnerText; info.Time = node.SelectSingleNode("Time").InnerText; infos.Add(info); } return(infos); }
public List <SyncInfo> GetSyncInfo() { SyncInfo info; List <SyncInfo> infos = new List <SyncInfo>(); XmlNode datas = doc.SelectSingleNode("Datas"); foreach (XmlNode node in datas.ChildNodes) { info = new SyncInfo(); info.CardId = uint.Parse(node.SelectSingleNode("CardID").InnerText); info.CardType = byte.Parse(node.SelectSingleNode("CardType").InnerText); info.Identity = node.SelectSingleNode("Identity").InnerText; info.DevID = uint.Parse(node.SelectSingleNode("DevID").InnerText); infos.Add(info); } return(infos); }
public ICommand Create(SyncInfo info) { throw new NotImplementedException(); }
public ICommand Create(SyncInfo info) { ICommand cmd; string QYCode = info.EQID; string Content = info.Content; DateTime _time = DateTime.Now; switch (info.CommandID) { case "01": cmd = new QYKQ_01(QYCode, Content, _time); break; case "02": cmd = new QYKQ_02(QYCode, Content, _time); break; case "03": cmd = new QYKQ_03(QYCode, Content, _time); break; case "04": cmd = new QYKQ_04(QYCode, Content, _time); break; default: cmd = new IgnoreCommand(); break; } return(cmd); #region 注释 //ICommand cmd; //ushort _command = 0; //if (info.CommandID.Length != 4) // info.CommandID = info.CommandID.PadLeft(4, '0'); //byte[] _cmds = Utils.StrToBytes(info.CommandID); //_command = (ushort)(_cmds[0] << 8 | _cmds[1]); //string json = info.Content; //DateTime _time = DateTime.Now; //switch (_command) //{ // case 0x0001: // cmd = new FaKaCommand(info.EQID, json, _time); // break; // case 0x0002: // cmd = new ShuaKaCommand(info.EQID, json, _time); // break; // case 0x0003: // cmd = new XiaoKaCommand(info.EQID, json, _time); // break; // case 0x0004: // cmd = new AllFaKaCommand(info.EQID, json, _time); // break; // default: // cmd = new NotImplementedCommand(_command.ToString(), null, null, _time.ToString()); // break; //} //return cmd; #endregion }