internal TokenizedAtr(Atr owner, byte[] atr) { this.owner = owner; AtrReadStream AtrStream = new AtrReadStream(atr); //Read preamble this.Preamble = new AtrPreambleToken(this, AtrStream); //read interface byte groups this.InterfaceByteGroups = new AtrInterfaceByteGroupTokenCollection(this); NextInterfaceBytesIndicator NextInterfaceBytesIndicator = this.Preamble.NextInterfaceBytesIndicator; while (NextInterfaceBytesIndicator != null) { AtrInterfaceByteGroupToken InterfaceByteGroup = new AtrInterfaceByteGroupToken(this, AtrStream, NextInterfaceBytesIndicator); this.InterfaceByteGroups.AppendGroup(InterfaceByteGroup); NextInterfaceBytesIndicator = NextInterfaceBytesIndicator.TdExists ? new NextInterfaceBytesIndicator(AtrStream.GetNextByte(), false) : null; } //Read and parse historical characters if (this.Preamble.NumberOfHistoricalCharacters > 0) { byte[] HistoricalCharacters = AtrStream.GetNextBytes(this.Preamble.NumberOfHistoricalCharacters); this.HistoricalCharacters = new AtrHistoricalCharactersToken(this, HistoricalCharacters); } else { this.HistoricalCharacters = new AtrHistoricalCharactersToken(this, new byte[0]); } //Read checksum if needed if (this.ChecksumRequired) { this.atrChecksum = new AtrChecksumToken(AtrStream); } //Read additional bytes int AdditionalBytes = AtrStream.GetRemainingLength(); if (AdditionalBytes > 0) { this.ExtraBytes = new AtrExtraBytesToken(AtrStream, AdditionalBytes); } }
internal AtrExtraBytesToken(AtrReadStream atrStream, int additionalBytes) { this.Bytes = atrStream.GetNextBytes(additionalBytes); }