public override bool analyzeCardId(IFelica f) { byte[] data = f.ReadWithoutEncryption(0x110b, 0); if (data == null) { return false; } mAccountId = binString(data, 2, 8); return true; }
public override bool analyzeCardId(IFelica f) { byte[] data = f.ReadWithoutEncryption(0x110b, 0); if (data == null) { return(false); } mAccountId = binString(data, 2, 8); return(true); }
/// <summary> /// カード ID 取得 /// </summary> /// <param name="f"></param> /// <returns></returns> public virtual bool analyzeCardId(IFelica f) { // デフォルトでは、IDm を用いる。 byte[] data = f.IDm(); if (data == null) { return(false); } mAccountId = binString(data, 0, 8); return(true); }
protected int mSystemCode; // システムコード #endregion Fields #region Methods /// <summary> /// カード ID 取得 /// </summary> /// <param name="f"></param> /// <returns></returns> public virtual bool analyzeCardId(IFelica f) { // デフォルトでは、IDm を用いる。 byte[] data = f.IDm(); if (data == null) { return false; } mAccountId = binString(data, 0, 8); return true; }
public override bool analyzeCardId(IFelica f) { byte[] data = f.ReadWithoutEncryption(0x67cf, 0); byte[] data2 = f.ReadWithoutEncryption(0x67cf, 1); if (data == null || data2 == null) { return(false); } mAccountId = binString(data, 12, 4) + binString(data2, 0, 4); return(true); }
/// <summary> /// カード読み込み /// Note: 本来はこのメソッドは private で良いが、UnitTest 用に public にしてある。 /// </summary> /// <param name="f"></param> /// <returns></returns> public TransactionList ReadTransactions(IFelica f) { TransactionList transactions = new TransactionList(); f.Polling(mSystemCode); if (!analyzeCardId(f)) { throw new Exception(Properties.Resources.CantReadCardNo); } for (int i = 0; i < mMaxTransactions; i++) { byte[] data = new byte[16 * mBlocksPerTransaction]; byte[] block = null; for (int j = 0; j < mBlocksPerTransaction; j++) { block = f.ReadWithoutEncryption(mServiceCode, i * mBlocksPerTransaction + j); if (block == null) { break; } block.CopyTo(data, j * 16); } if (block == null) { break; } Transaction t = new Transaction(); // データが全0かどうかチェック int x = 0; foreach (int xx in data) { x |= xx; } if (x == 0) { // データが全0なら無視(空エントリ) t.Invalidate(); } // トランザクション解析 else if (!analyzeTransaction(t, data)) { t.Invalidate(); } transactions.Add(t); } if (mNeedReverse) { transactions.Reverse(); } if (mNeedCalcValue) { CalcValueFromBalance(transactions); } PostProcess(transactions); return(transactions); }
/// <summary> /// カード読み込み /// Note: 本来はこのメソッドは private で良いが、UnitTest 用に public にしてある。 /// </summary> /// <param name="f"></param> /// <returns></returns> public TransactionList ReadTransactions(IFelica f) { TransactionList transactions = new TransactionList(); f.Polling(mSystemCode); if (!analyzeCardId(f)) { throw new Exception(Properties.Resources.CantReadCardNo); } for (int i = 0; i < mMaxTransactions; i++) { byte[] data = new byte[16 * mBlocksPerTransaction]; byte[] block = null; for (int j = 0; j < mBlocksPerTransaction; j++) { block = f.ReadWithoutEncryption(mServiceCode, i * mBlocksPerTransaction + j); if (block == null) { break; } block.CopyTo(data, j * 16); } if (block == null) { break; } Transaction t = new Transaction(); // データが全0かどうかチェック int x = 0; foreach (int xx in data) { x |= xx; } if (x == 0) { // データが全0なら無視(空エントリ) t.Invalidate(); } // トランザクション解析 else if (!analyzeTransaction(t, data)) { t.Invalidate(); } transactions.Add(t); } if (mNeedReverse) { transactions.Reverse(); } if (mNeedCalcValue) { CalcValueFromBalance(transactions); } PostProcess(transactions); return transactions; }