/// <summary> /// Sector access conditions /// </summary> public async Task <AccessConditions> Access() { if (_Access == null) { Byte[] data = await GetData(GetTrailerBlockIndex()); _Access = AccessBits.GetAccessConditions(data); } return(_Access); }
/// <summary> /// commit changes made to trailer datablock /// </summary> /// <remarks>may throw CardLoginException and CardWriteException</remarks> public async Task FlushTrailer(String keyA, String keyB) { DataBlock dataBlock = _DataBlocks[GetTrailerBlockIndex()]; if (dataBlock == null) { return; } await SetKeyA(keyA); await SetKeyB(keyB); Byte[] data = AccessBits.CalculateAccessBits(await Access()); Array.Copy(data, 0, dataBlock.Data, 6, 4); if (dataBlock.IsChanged) { await FlushDataBlock(dataBlock); } _Card.ActiveSector = -1; }