public void Deserialise(Header header, Packet payload) { ShortPacket sp = (ShortPacket)payload; SessionId = StringUtils.ASCIIBytesToString(sp.Data, 1, sp.Data.Length - 1); EventType = (EventType)sp.ShortDatum; }
public void Deserialise(Header header, Packet payload) { ShortPacket sp = (ShortPacket)payload; _unkData = sp.Data; _unkShortDatum = sp.ShortDatum; }
public void Deserialise(Header header, Packet payload) { ShortPacket sp = (ShortPacket)payload; DetailedType = (WeatherType)sp.ShortDatum; BaseData = (sp.Data == null) ? String.Empty : StringUtils.ASCIIBytesToString(sp.Data); OnDeserialiseComplete(); }
public void Deserialise(Header header, Packet payload) { ShortPacket sp = (ShortPacket)payload; Debug.Assert(sp.Data.Length == 2); FrameNumber = (sp.Data[1] << 8 & 0xff00) | (sp.Data[0] & 0xff); _unkShortDatum = sp.ShortDatum; }
public void Deserialise(Header header, Packet payload) { LongPacket p = (LongPacket)payload; CarId = header.CarId; PositionHistory = new int[ p.Data.Length ]; p.Data.CopyTo(PositionHistory, 0); }
public void Deserialise(Header header, Packet payload) { LongPacket sp = (LongPacket)payload; if( sp.Data[0] >= 32 ) { // old style commentary message (i.e. no magic 2 bytes) Encoding oldEncoding = Encoding.GetEncoding("ISO-8859-1"); Message = oldEncoding.GetString(sp.Data, 0, sp.Data.Length); } else if( (sp.Data[1] & 0x02) == 0x02 ) { // Unicode string Message = Encoding.Unicode.GetString(sp.Data, 2, sp.Data.Length - 2); } else { // Not unicode, but new UTF8 style of message. Message = Encoding.UTF8.GetString(sp.Data, 2, sp.Data.Length - 2); } EndMessage = ((int)sp.Data[1] > 0); }
public void Deserialise(Header header, Packet payload) { LongPacket lp = (LongPacket)payload; Message = StringUtils.ASCIIBytesToString(lp.Data); }
public void Deserialise(Header header, Packet payload) { ShortPacket sp = (ShortPacket)payload; if (sp.ShortDatum == 1) { int status = int.Parse(StringUtils.ASCIIBytesToString(sp.Data), CultureInfo.InvariantCulture); switch (status) { case 1: Status = Colour.Green; break; case 2: Status = Colour.Yellow; break; case 3: Status = Colour.Yellow; Message = "SCS"; break; case 4: Status = Colour.Yellow; Message = "SCD"; break; case 5: Status = Colour.Red; break; default: throw new DeserialiseException("Unknown track status, status: " + status); } } else { throw new DeserialiseException("Unknown track status, short: " + sp.ShortDatum + ", data: " + HexString.BytesToHex(sp.Data)); } }
public void Deserialise(Header header, Packet payload) { _unkDatum = header.Datum; }
public void Deserialise(Header header, Packet payload) { LongPacket sp = (LongPacket)payload; Message = StringUtils.ASCIIBytesToString(sp.Data, 0, sp.Data.Length); }
public void Deserialise(Header header, Packet payload) { SimplePacket sp = (SimplePacket) payload; Time = sp.Data[1] << 8 & 0xff00 | (sp.Data[0] & 0xff | header.Datum << 16 & 0xff0000); }
public void Deserialise(Header header, Packet payload) { Rate = header.Datum; }
public void Deserialise(Header header, Packet payload) { CarId = header.CarId; Position = header.Datum; }
public void Deserialise(Header header, Packet payload) { }
public void Deserialise(Header header, Packet payload) { ShortPacket p = (ShortPacket) payload; CarId = header.CarId; CarType = header.CarType; BaseShort = p.ShortDatum; BaseData = (p.Data == null) ? String.Empty : StringUtils.ASCIIBytesToString(p.Data); OnDeserialiseComplete(); }
public void Deserialise(Header header, Packet payload) { LongPacket lp = (LongPacket)payload; int col = lp.Data[0] - 1; Column = (ColumnType)(col); string decoded = StringUtils.ASCIIBytesToString(lp.Data, 1, lp.Data.Length - 1); if( col >= 0 && col <= 3 && lp.Data.Length > 0 ) { string[] pairs = decoded.Split('\r'); List<SpeedPair> fsSectorBuilder = new List<SpeedPair>(); for( int i=0; i < pairs.Length / 2; ++i ) { if (!string.IsNullOrEmpty(pairs[i * 2]) && !string.IsNullOrEmpty(pairs[(i * 2) + 1])) { fsSectorBuilder.Add(new SpeedPair { Driver = pairs[i*2], Speed = double.Parse(pairs[(i*2) + 1], CultureInfo.InvariantCulture) }); } else { break; } } FastestSectors = fsSectorBuilder.ToArray(); } else if( decoded.Length > 0 ) { MetaData = decoded; } }