public uint GetSerializedSize() { uint num = 0u; if (this.Attribute.get_Count() > 0) { using (List <Attribute> .Enumerator enumerator = this.Attribute.GetEnumerator()) { while (enumerator.MoveNext()) { Attribute current = enumerator.get_Current(); num += 1u; uint serializedSize = current.GetSerializedSize(); num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize); } } } if (this.StatsBucket.get_Count() > 0) { using (List <GameStatsBucket> .Enumerator enumerator2 = this.StatsBucket.GetEnumerator()) { while (enumerator2.MoveNext()) { GameStatsBucket current2 = enumerator2.get_Current(); num += 1u; uint serializedSize2 = current2.GetSerializedSize(); num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2); } } } return(num); }
public override int GetHashCode() { int num = base.GetType().GetHashCode(); num ^= this.Id.GetHashCode(); if (this.HasName) { num ^= this.Name.GetHashCode(); } using (List <Attribute> .Enumerator enumerator = this.Attribute.GetEnumerator()) { while (enumerator.MoveNext()) { Attribute current = enumerator.get_Current(); num ^= current.GetHashCode(); } } using (List <GameStatsBucket> .Enumerator enumerator2 = this.StatsBucket.GetEnumerator()) { while (enumerator2.MoveNext()) { GameStatsBucket current2 = enumerator2.get_Current(); num ^= current2.GetHashCode(); } } if (this.HasUnseededId) { num ^= this.UnseededId.GetHashCode(); } if (this.HasAllowQueueing) { num ^= this.AllowQueueing.GetHashCode(); } return(num); }
public static void Serialize(Stream stream, GetFactoryInfoResponse instance) { if (instance.Attribute.get_Count() > 0) { using (List <Attribute> .Enumerator enumerator = instance.Attribute.GetEnumerator()) { while (enumerator.MoveNext()) { Attribute current = enumerator.get_Current(); stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); bnet.protocol.attribute.Attribute.Serialize(stream, current); } } } if (instance.StatsBucket.get_Count() > 0) { using (List <GameStatsBucket> .Enumerator enumerator2 = instance.StatsBucket.GetEnumerator()) { while (enumerator2.MoveNext()) { GameStatsBucket current2 = enumerator2.get_Current(); stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize()); GameStatsBucket.Serialize(stream, current2); } } } }
public override bool Equals(object obj) { GameStatsBucket gameStatsBucket = obj as GameStatsBucket; if (gameStatsBucket == null) { return(false); } if (this.HasBucketMin != gameStatsBucket.HasBucketMin || this.HasBucketMin && !this.BucketMin.Equals(gameStatsBucket.BucketMin)) { return(false); } if (this.HasBucketMax != gameStatsBucket.HasBucketMax || this.HasBucketMax && !this.BucketMax.Equals(gameStatsBucket.BucketMax)) { return(false); } if (this.HasWaitMilliseconds != gameStatsBucket.HasWaitMilliseconds || this.HasWaitMilliseconds && !this.WaitMilliseconds.Equals(gameStatsBucket.WaitMilliseconds)) { return(false); } if (this.HasGamesPerHour != gameStatsBucket.HasGamesPerHour || this.HasGamesPerHour && !this.GamesPerHour.Equals(gameStatsBucket.GamesPerHour)) { return(false); } if (this.HasActiveGames != gameStatsBucket.HasActiveGames || this.HasActiveGames && !this.ActiveGames.Equals(gameStatsBucket.ActiveGames)) { return(false); } if (this.HasActivePlayers != gameStatsBucket.HasActivePlayers || this.HasActivePlayers && !this.ActivePlayers.Equals(gameStatsBucket.ActivePlayers)) { return(false); } if (this.HasFormingGames != gameStatsBucket.HasFormingGames || this.HasFormingGames && !this.FormingGames.Equals(gameStatsBucket.FormingGames)) { return(false); } if (this.HasWaitingPlayers != gameStatsBucket.HasWaitingPlayers || this.HasWaitingPlayers && !this.WaitingPlayers.Equals(gameStatsBucket.WaitingPlayers)) { return(false); } if (this.HasOpenJoinableGames != gameStatsBucket.HasOpenJoinableGames || this.HasOpenJoinableGames && !this.OpenJoinableGames.Equals(gameStatsBucket.OpenJoinableGames)) { return(false); } if (this.HasPlayersInOpenJoinableGames != gameStatsBucket.HasPlayersInOpenJoinableGames || this.HasPlayersInOpenJoinableGames && !this.PlayersInOpenJoinableGames.Equals(gameStatsBucket.PlayersInOpenJoinableGames)) { return(false); } if (this.HasOpenGamesTotal != gameStatsBucket.HasOpenGamesTotal || this.HasOpenGamesTotal && !this.OpenGamesTotal.Equals(gameStatsBucket.OpenGamesTotal)) { return(false); } if (this.HasPlayersInOpenGamesTotal == gameStatsBucket.HasPlayersInOpenGamesTotal && (!this.HasPlayersInOpenGamesTotal || this.PlayersInOpenGamesTotal.Equals(gameStatsBucket.PlayersInOpenGamesTotal))) { return(true); } return(false); }
public static GetFactoryInfoResponse Deserialize(Stream stream, GetFactoryInfoResponse instance, long limit) { if (instance.Attribute == null) { instance.Attribute = new List <Attribute>(); } if (instance.StatsBucket == null) { instance.StatsBucket = new List <GameStatsBucket>(); } while (limit < 0L || stream.get_Position() < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= 0L) { throw new EndOfStreamException(); } return(instance); } else { int num2 = num; if (num2 != 10) { if (num2 != 18) { Key key = ProtocolParser.ReadKey((byte)num, stream); uint field = key.Field; if (field == 0u) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else { instance.StatsBucket.Add(GameStatsBucket.DeserializeLengthDelimited(stream)); } } else { instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream)); } } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static void Serialize(Stream stream, GetGameStatsResponse instance) { if (instance.StatsBucket.Count > 0) { foreach (GameStatsBucket statsBucket in instance.StatsBucket) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, statsBucket.GetSerializedSize()); GameStatsBucket.Serialize(stream, statsBucket); } } }
public override int GetHashCode() { int num = base.GetType().GetHashCode(); using (List <GameStatsBucket> .Enumerator enumerator = this.StatsBucket.GetEnumerator()) { while (enumerator.MoveNext()) { GameStatsBucket current = enumerator.get_Current(); num ^= current.GetHashCode(); } } return(num); }
public uint GetSerializedSize() { uint num = 0u; num += 8u; if (this.HasName) { num += 1u; uint byteCount = (uint)Encoding.get_UTF8().GetByteCount(this.Name); num += ProtocolParser.SizeOfUInt32(byteCount) + byteCount; } if (this.Attribute.get_Count() > 0) { using (List <Attribute> .Enumerator enumerator = this.Attribute.GetEnumerator()) { while (enumerator.MoveNext()) { Attribute current = enumerator.get_Current(); num += 1u; uint serializedSize = current.GetSerializedSize(); num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize); } } } if (this.StatsBucket.get_Count() > 0) { using (List <GameStatsBucket> .Enumerator enumerator2 = this.StatsBucket.GetEnumerator()) { while (enumerator2.MoveNext()) { GameStatsBucket current2 = enumerator2.get_Current(); num += 1u; uint serializedSize2 = current2.GetSerializedSize(); num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2); } } } if (this.HasUnseededId) { num += 1u; num += 8u; } if (this.HasAllowQueueing) { num += 1u; num += 1u; } num += 1u; return(num); }
public static void Serialize(Stream stream, GameFactoryDescription instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); stream.WriteByte(9); binaryWriter.Write(instance.Id); if (instance.HasName) { stream.WriteByte(18); ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Name)); } if (instance.Attribute.get_Count() > 0) { using (List <Attribute> .Enumerator enumerator = instance.Attribute.GetEnumerator()) { while (enumerator.MoveNext()) { Attribute current = enumerator.get_Current(); stream.WriteByte(26); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); bnet.protocol.attribute.Attribute.Serialize(stream, current); } } } if (instance.StatsBucket.get_Count() > 0) { using (List <GameStatsBucket> .Enumerator enumerator2 = instance.StatsBucket.GetEnumerator()) { while (enumerator2.MoveNext()) { GameStatsBucket current2 = enumerator2.get_Current(); stream.WriteByte(34); ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize()); GameStatsBucket.Serialize(stream, current2); } } } if (instance.HasUnseededId) { stream.WriteByte(41); binaryWriter.Write(instance.UnseededId); } if (instance.HasAllowQueueing) { stream.WriteByte(48); ProtocolParser.WriteBool(stream, instance.AllowQueueing); } }
public static void Serialize(Stream stream, GetGameStatsResponse instance) { if (instance.StatsBucket.get_Count() > 0) { using (List <GameStatsBucket> .Enumerator enumerator = instance.StatsBucket.GetEnumerator()) { while (enumerator.MoveNext()) { GameStatsBucket current = enumerator.get_Current(); stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); GameStatsBucket.Serialize(stream, current); } } } }
public static GetGameStatsResponse Deserialize(Stream stream, GetGameStatsResponse instance, long limit) { if (instance.StatsBucket == null) { instance.StatsBucket = new List <GameStatsBucket>(); } while (true) { if (limit < (long)0 || stream.Position < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= (long)0) { throw new EndOfStreamException(); } break; } else if (num == 10) { instance.StatsBucket.Add(GameStatsBucket.DeserializeLengthDelimited(stream)); } else { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public static void Serialize(Stream stream, GetFactoryInfoResponse instance) { if (instance.Attribute.Count > 0) { foreach (bnet.protocol.attribute.Attribute attribute in instance.Attribute) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, attribute.GetSerializedSize()); bnet.protocol.attribute.Attribute.Serialize(stream, attribute); } } if (instance.StatsBucket.Count > 0) { foreach (GameStatsBucket gameStatsBucket in instance.StatsBucket) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, gameStatsBucket.GetSerializedSize()); GameStatsBucket.Serialize(stream, gameStatsBucket); } } }
public static void Serialize(Stream stream, GameFactoryDescription instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); stream.WriteByte(9); binaryWriter.Write(instance.Id); if (instance.HasName) { stream.WriteByte(18); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Name)); } if (instance.Attribute.Count > 0) { foreach (bnet.protocol.attribute.Attribute attribute in instance.Attribute) { stream.WriteByte(26); ProtocolParser.WriteUInt32(stream, attribute.GetSerializedSize()); bnet.protocol.attribute.Attribute.Serialize(stream, attribute); } } if (instance.StatsBucket.Count > 0) { foreach (GameStatsBucket statsBucket in instance.StatsBucket) { stream.WriteByte(34); ProtocolParser.WriteUInt32(stream, statsBucket.GetSerializedSize()); GameStatsBucket.Serialize(stream, statsBucket); } } if (instance.HasUnseededId) { stream.WriteByte(41); binaryWriter.Write(instance.UnseededId); } if (instance.HasAllowQueueing) { stream.WriteByte(48); ProtocolParser.WriteBool(stream, instance.AllowQueueing); } }
public static GameFactoryDescription Deserialize(Stream stream, GameFactoryDescription instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); if (instance.Attribute == null) { instance.Attribute = new List <bnet.protocol.attribute.Attribute>(); } if (instance.StatsBucket == null) { instance.StatsBucket = new List <GameStatsBucket>(); } instance.UnseededId = (ulong)0; instance.AllowQueueing = true; while (true) { if (limit < (long)0 || stream.Position < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= (long)0) { throw new EndOfStreamException(); } break; } else if (num == 9) { instance.Id = binaryReader.ReadUInt64(); } else if (num == 18) { instance.Name = ProtocolParser.ReadString(stream); } else if (num == 26) { instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream)); } else if (num == 34) { instance.StatsBucket.Add(GameStatsBucket.DeserializeLengthDelimited(stream)); } else if (num == 41) { instance.UnseededId = binaryReader.ReadUInt64(); } else if (num == 48) { instance.AllowQueueing = ProtocolParser.ReadBool(stream); } else { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public void AddStatsBucket(GameStatsBucket val) { this._StatsBucket.Add(val); }