public override ResultStatus Execute(Cloud47x0 cloud47x0) { try { //if (KeyData == "QvzVmm9D") // KeyData = "MxpY8AME"; ResultStatus = ResultStatus.ERROR; // Assume the worst if (cloud47x0.CardStillPresent()) { byte[] keyBytes = Convert.FromBase64String(KeyData); if ("A".Equals(Key)) { if (cloud47x0.MifareLoadKey(Cloud47x0.MifareKey.A, keyBytes) && cloud47x0.MifareAuthenticate(Cloud47x0.MifareKey.A, Sector)) { ResultStatus = ResultStatus.OK; } } else if ("B".Equals(Key)) { if (cloud47x0.MifareLoadKey(Cloud47x0.MifareKey.B, keyBytes) && cloud47x0.MifareAuthenticate(Cloud47x0.MifareKey.B, Sector)) { ResultStatus = ResultStatus.OK; } } } } catch { ResultStatus = ResultStatus.ERROR; } return(ResultStatus); }
public override ResultStatus Execute(Cloud47x0 cloud47x0) { try { ResultStatus = ResultStatus.ERROR; // Assume the worst if (cloud47x0.CardStillPresent()) { byte[] dataBytes = new byte[Length * BLOCK_SIZE]; for (int n = 0; n < Length; n++) { byte[] blockBytes = cloud47x0.MifareReadBlock(Block + n); Array.Copy(blockBytes, 0, dataBytes, n * BLOCK_SIZE, BLOCK_SIZE); } Data = Convert.ToBase64String(dataBytes); ResultStatus = ResultStatus.OK; } } catch { ResultStatus = ResultStatus.ERROR; } return(ResultStatus); }
public override ResultStatus Execute(Cloud47x0 cloud47x0) { try { ResultStatus = ResultStatus.ERROR; // Assume the worst if (cloud47x0.CardStillPresent()) { byte[] dataBytes = Convert.FromBase64String(Data); byte[] blockBytes = new byte[BLOCK_SIZE]; for (int n = 0; n < Length; n++) { Array.Copy(dataBytes, n * BLOCK_SIZE, blockBytes, 0, BLOCK_SIZE); cloud47x0.MifareWriteBlock(Block + n, blockBytes); } ResultStatus = ResultStatus.OK; } } catch { ResultStatus = ResultStatus.ERROR; } return(ResultStatus); }