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 AtrInterfaceByteGroupToken(TokenizedAtr owner, AtrReadStream atr, NextInterfaceBytesIndicator nextInterfaceBytesIndicator) { this.owner = owner; this.InterfaceBytesIndicator = nextInterfaceBytesIndicator; this.InterfaceBytesIndicator.PropertyChanged += this.interfaceBytesIndicatorForThisGroup_PropertyChanged; if (nextInterfaceBytesIndicator.TaExists) { this.ta = atr.GetNextByte(); } if (nextInterfaceBytesIndicator.TbExists) { this.tb = atr.GetNextByte(); } if (nextInterfaceBytesIndicator.TcExists) { this.tc = atr.GetNextByte(); } }