/// <summary> /// A friendly representation of the data contained on a given <see cref="RawETicket"/>. /// </summary> public ETicket(RawETicket rawValues) { RawValues = rawValues; var validAreaType = (ValidityAreaType)RawValues.ValidityAreaType; ValidityArea = validAreaType == ValidityAreaType.Zone ? new ValidityArea((Zone)RawValues.ValidityArea) : new ValidityArea((Vehicle)RawValues.ValidityArea); ValidityLength = new ValidityLength((ValidityLengthType)RawValues.ValidityLengthType, RawValues.ValidityLength); BoardingLocationNumber = new BoardingLocationNumber((BoardingNumberLocationType)RawValues.BoardingLocationNumType, RawValues.BoardingLocationNum); BoardingArea = new ValidityArea((Zone)RawValues.BoardingArea); }
/// <summary> /// Creates a travel card object with the given byte arrays. /// </summary> public RawTravelCard(byte[] appInfoBytes, byte[] periodPassBytes, byte[] storedValueBytes, byte[] eTicketBytes, byte[] historyBytes) { // Check length of files, but don't check length of history file if ((appInfoBytes.Length >= AppInfoLength) && (periodPassBytes.Length >= PeriodPassLength) && (storedValueBytes.Length >= StoredValueLength) && (eTicketBytes.Length >= ETicketLength)) { ReadApplicationInfo(appInfoBytes); ReadPeriodPass(periodPassBytes); ReadStoredValues(storedValueBytes); RawTicket = new RawETicket(eTicketBytes, false); FriendlyTicket = new ETicket(RawTicket); ReadHistory(historyBytes, historyBytes.Length); } else { Status = CardStatus.HslCardDataFailure; } }
public SingleTicket(byte[] appInfoBytes, byte[] eTicketBytes) { ReadApplicationInfo(appInfoBytes); ValueTicket = new RawETicket(eTicketBytes, true); }