public ORCACard(PhysicalCard.PhysicalCard card) : base(card) { // get serial no and friends. PhysicalCard.Desfire.DesfireCard c = card as PhysicalCard.Desfire.DesfireCard; serial = (int)c.getApplication(AID_SPECIAL).getFile(0xF).Data.MakeLong(5, 3); balance = c.getApplication(AID_ORCA).getFile(0x04).Data.MakeUint16(41, false); }
public static TransitCard parseTransitCard(PhysicalCard.PhysicalCard card) { foreach (TransitCardFilter f in filters) { if (f.filterFunc(card)) { return((TransitCard)(Activator.CreateInstance(f.InstanciationType, card))); } } return(null); }
public ORCACard(PhysicalCard.PhysicalCard card) : base(card) { // get serial no and friends. PhysicalCard.Desfire.DesfireCard c = card as PhysicalCard.Desfire.DesfireCard; serial = (int)c.getApplication(AID_SPECIAL).getFile(0xF).Data.MakeLong(5, 3); balance = c.getApplication(AID_ORCA).getFile(0x04).Data.MakeUint16(41, false); PhysicalCard.Desfire.File.RecordFile recFile = (PhysicalCard.Desfire.File.RecordFile)(c.getApplication(AID_ORCA).getFile(0x02)); PhysicalCard.Desfire.File.Settings.RecordSettings recSettings = (PhysicalCard.Desfire.File.Settings.RecordSettings)recFile.Settings; ORCATransitEvent[] evs = new ORCATransitEvent[recSettings.CurRecords]; for (int evIdx = 0; evIdx < recSettings.CurRecords; evIdx++) { evs[evIdx] = ORCATransitEvent.parseRecrd(recFile[evIdx]); } events = evs; }
public MykiCard(PhysicalCard.PhysicalCard c) : base(c) { if (c is PhysicalCard.Desfire.DesfireCard) { PhysicalCard.Desfire.DesfireCard dCard = (c as PhysicalCard.Desfire.DesfireCard); try { byte[] meta = dCard.getApplication(AID_MYKI_A).getFile(15).Data.CopyReverseFrom(0, 16); serialUpper = meta.getBitsFromBuffer(96, 32); serialLower = meta.getBitsFromBuffer(64, 32); } catch { throw new ArgumentException("Could not parse Myki data."); } } else { throw new ArgumentException("Not a Myki card"); } }
/// <summary> /// This is to make sure that every TransitCard implementation has a constructor. /// What this gives is a member, mCard, which is available to children of the implementation so that they are not required to remember where they put it... /// </summary> /// <param name="c">a PhysicalCard snapshot.</param> protected TransitCard(PhysicalCard.PhysicalCard c) { mCard = c; }
/// <summary> /// This is to make sure that every TransitCard implementation has a constructor. /// What this gives is a member, mCard, which is available to children of the implementation so that they are not required to remember where they put it... /// </summary> /// <param name="c">a PhysicalCard snapshot.</param> protected TransitCard(PhysicalCard.PhysicalCard c) { mCard = c; }