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; 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; 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 LongPacket(Header header, Stream input) : base(input) { int longPacketSize = header.Datum; if (longPacketSize > 0 && longPacketSize < 128) { AcquirePayload(longPacketSize); } }
public ShortPacket(Header header, Stream input) : base(input) { /* 6 5 4 3 2 1 0 * [ | | | | | | ] * +-len-+ +-d-+ */ int size = (header.Datum >> 3); if (size != NO_DATA && size > 0) { // Instruct the Packet to begin the data read AcquirePayload(size); } ShortDatum = (header.Datum & 0x07); }
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) { 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 Packet CreatePacketType(Header header, Stream rawStream, Stream decryptStream) { return null; }
public void Deserialise(Header header, Packet payload) { _unkDatum = header.Datum; }
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 sp = (LongPacket)payload; Message = StringUtils.ASCIIBytesToString(sp.Data, 0, sp.Data.Length); }
public void Deserialise(Header header, Packet payload) { }
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; } }
public Packet CreatePacketType(Header header, Stream rawStream, Stream decryptStream) { return new LongPacket(header, decryptStream); }
public void Deserialise(Header header, Packet payload) { CarId = header.CarId; Position = header.Datum; }
public void Deserialise(Header header, Packet payload) { Rate = header.Datum; }
public Packet CreatePacketType(Header header, Stream rawStream, Stream decryptStream) { return new SimplePacket(2, decryptStream); }
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) { LongPacket lp = (LongPacket)payload; Message = StringUtils.ASCIIBytesToString(lp.Data); }
void Run() { IMessage msg; Header h; while (true) { h = new Header(_infile); msg = null; if (h.IsSystemMessage) { msg = MessageFactory.CreateMessage(h.SystemType, h.Datum); UpdateEventType(msg); } else { msg = MessageFactory.CreateMessage(h.CarType, _evtType); } try { Packet p = msg.CreatePacketType(h, _infile, null); msg.Deserialise(h, p); //Console.WriteLine(msg); } catch (NullReferenceException) { //Console.WriteLine("*" + msg); break; } } if( msg is F1.Messages.System.Notice ) { LongPacket packet = new LongPacket(h, _infile); Test((byte[])packet.Data.Clone(), StringUtils.StringToASCIIBytes(_rawMessage)); Crack(packet.Data, StringUtils.StringToASCIIBytes(_rawMessage)); } else { Console.WriteLine("Notice is not the first encrypted packet."); } }