public static CardType GetCardType(ByteArray atr) { foreach (CardType type in Types) { try { bool next = false; if (type.ATRmask.Length == 0) { continue; } for (int i = 0; i < type.ATRmask.ToString("", true).Length; i++) { if (type.ATRmask.ToString("", true)[i] == 'F') { if (atr.ToString("", true)[i] != type.ATR.ToString("", true)[i]) { next = true; break; } } } if (next) { continue; } return(type); } catch { continue; } } return(Types[0]); }