public void Decode(byte[] array) { reader = new KrosmagaReader(); reader.SetData(array); int tag; while (reader.B.BaseStream.Position < reader.B.BaseStream.Length && (tag = reader.ReadTag()) != 0) { if (tag == 10) { Data.GameEvent gameEvent = new Data.GameEvent(); int size = (int)reader.ReadRawVarint32(); gameEvent.Decode(reader.ReadMessage(size)); EventsList.Add(gameEvent); continue; } } }
public void Decode(byte[] array) { reader = new KrosmagaReader(); reader.SetData(array); int tag; while (reader.B.BaseStream.Position < reader.B.BaseStream.Length && (tag = reader.ReadTag()) != 0) { if (tag <= 88) { if (tag <= 40) { if (tag <= 18) { if (tag != 8) { if (tag == 18) { Data.GameEvent gameEvent = new Data.GameEvent(); int size = (int)reader.ReadRawVarint32(); gameEvent.Decode(reader.ReadMessage(size)); TriggeredEvents.Add(gameEvent); continue; } } else { EventType = (Enums.EventType)Enum.Parse(typeof(Enums.EventType), reader.ReadRawVarint32().ToString()); continue; } } else { if (tag == 24) { RelatedCardInstance = (int)reader.ReadRawVarint32(); continue; } if (tag == 32) { RelatedTradingCardId = (int)reader.ReadRawVarint32(); continue; } if (tag == 40) { Triggerer = (int)reader.ReadRawVarint32(); continue; } } } else if (tag <= 64) { if (tag == 48) { Int1 = (int)reader.ReadRawVarint32(); continue; } if (tag == 56) { Int2 = (int)reader.ReadRawVarint32(); continue; } if (tag == 64) { Int3 = (int)reader.ReadRawVarint32(); continue; } } else { if (tag == 72) { Int4 = (int)reader.ReadRawVarint32(); continue; } if (tag == 80) { Int5 = (int)reader.ReadRawVarint32(); continue; } if (tag == 88) { Bool1 = reader.ReadBool(); continue; } } } else if (tag <= 138) { if (tag <= 114) { if (tag == 96) { Bool2 = reader.ReadBool(); continue; } if (tag == 104) { UInt1 = reader.ReadRawVarint32(); continue; } if (tag == 114) { Data.Location location = new Data.Location(); int size = (int)reader.ReadRawVarint32(); location.Decode(reader.ReadMessage(size)); Location1 = location; continue; } } else { if (tag == 122) { Data.Location location = new Data.Location(); int size = (int)reader.ReadRawVarint32(); location.Decode(reader.ReadMessage(size)); Location2 = location; continue; } if (tag == 130) { Data.ValueModification valueModification = new Data.ValueModification(); int size = (int)reader.ReadRawVarint32(); valueModification.Decode(reader.ReadMessage(size)); ValueModification1 = valueModification; continue; } if (tag == 138) { Data.ValueModification valueModification = new Data.ValueModification(); int size = (int)reader.ReadRawVarint32(); valueModification.Decode(reader.ReadMessage(size)); ValueModification2 = valueModification; continue; } } } else if (tag <= 160) { if (tag == 146) { Data.CellCoord cellCoord = new Data.CellCoord(); int size = (int)reader.ReadRawVarint32(); cellCoord.Decode(reader.ReadMessage(size)); CellCoord1 = cellCoord; continue; } if (tag == 154) { Data.CellCoord cellCoord = new Data.CellCoord(); int size = (int)reader.ReadRawVarint32(); cellCoord.Decode(reader.ReadMessage(size)); CellCoord2 = cellCoord; continue; } if (tag == 160) { MovementType = (Enums.MovementType)Enum.Parse(typeof(Enums.MovementType), reader.ReadRawVarint32().ToString()); continue; } } else { if (tag == 168) { SInt1 = reader.DecodeZigZag32(reader.ReadRawVarint32()); continue; } if (tag == 178) { String1 = reader.ReadString(); continue; } if (tag == 184) { TriggerableCapacityType1 = (Enums.TriggerableCapacityType)Enum.Parse(typeof(Enums.TriggerableCapacityType), reader.ReadRawVarint32().ToString()); continue; } } } }