public static void RemoveCardInfo(IGreenCardReaderInfo info) { if (ListCardInfo != null) { var cif = ListCardInfo.FirstOrDefault(c => c.Type == info.Type && ((c.Type == "ModWinsCard" && c.SerialNumber == info.SerialNumber) || (c.Type != "ModWinsCard" && c.TcpIp == info.TcpIp && c.Port == info.Port) ) ); if (cif != null) { ListCardInfo.Remove(cif); } cif = ListCardInfo.FirstOrDefault(c => c.Type == info.Type && ((c.Type == "ModWinsCard" && c.SerialNumber == info.SerialNumber) || (c.Type != "ModWinsCard" && c.TcpIp == info.TcpIp && c.Port == info.Port) ) ); if (cif == null && ListCard != null) { var crd = ListCard.FirstOrDefault(c => c.Info.Type == info.Type && ((c.Info.Type == "ModWinsCard" && c.Info.SerialNumber == info.SerialNumber) || (c.Info.Type != "ModWinsCard" && c.Info.TcpIp == info.TcpIp && c.Info.Port == info.Port) ) ); if (crd != null) { crd.DisConnect(); ListCard.Remove(crd); } } } }
public ModWinsCardReader(IGreenCardReaderInfo info) { this._info = new GreenCardReaderInfo() { Type = "ModWinsCard", SerialNumber = info.SerialNumber }; _cardHandle = -1; _activeProtocol = -1; _recvBuff = new byte[128]; _sendBuff = new byte[128]; this._state = CardState.IsDisable; GetReady(); ReleaseContext(); }
public static void AddCardInfo(IGreenCardReaderInfo info) { if (ListCardInfo == null) { ListCardInfo = new List <IGreenCardReaderInfo>(); } var cif = ListCardInfo.FirstOrDefault(c => c.Type == info.Type && ((c.Type == "ModWinsCard" && c.SerialNumber == info.SerialNumber) || (c.Type != "ModWinsCard" && c.TcpIp == info.TcpIp && c.Port == info.Port) ) ); if (cif == null) { ListCardInfo.Add(info); } if (ListCard == null) { ListCard = new List <IGreenCardReader>(); } var crd = ListCard.FirstOrDefault(c => c.Info.Type == info.Type && ((c.Info.Type == "ModWinsCard" && c.Info.SerialNumber == info.SerialNumber) || (c.Info.Type != "ModWinsCard" && c.Info.TcpIp == info.TcpIp && c.Info.Port == info.Port) ) ); if (crd == null) { switch (info.Type) { //'ModWinsCard', 'Tcp Ip Client', 'Tcp Ip Server', 'Remode Card' case "ModWinsCard": ListCard.Add(new ModWinsCardReader(info)); break; } } }