示例#1
0
        public static GameLevelInfo DeserializeLengthDelimited(Stream stream)
        {
            GameLevelInfo gameLevelInfo = new GameLevelInfo();

            GameLevelInfo.DeserializeLengthDelimited(stream, gameLevelInfo);
            return(gameLevelInfo);
        }
示例#2
0
        public static GameLevelInfo DeserializeLengthDelimited(Stream stream, GameLevelInfo instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(GameLevelInfo.Deserialize(stream, instance, num));
        }
        public static GameLevelInfo DeserializeLengthDelimited(Stream stream, GameLevelInfo instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(GameLevelInfo.Deserialize(stream, instance, position));
        }
 public static void Serialize(Stream stream, AccountState instance)
 {
     if (instance.HasAccountLevelInfo)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AccountLevelInfo.GetSerializedSize());
         AccountLevelInfo.Serialize(stream, instance.AccountLevelInfo);
     }
     if (instance.HasPrivacyInfo)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.PrivacyInfo.GetSerializedSize());
         PrivacyInfo.Serialize(stream, instance.PrivacyInfo);
     }
     if (instance.HasParentalControlInfo)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
         ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
     }
     if (instance.GameLevelInfo.get_Count() > 0)
     {
         using (List <GameLevelInfo> .Enumerator enumerator = instance.GameLevelInfo.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 GameLevelInfo current = enumerator.get_Current();
                 stream.WriteByte(42);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.account.GameLevelInfo.Serialize(stream, current);
             }
         }
     }
     if (instance.GameStatus.get_Count() > 0)
     {
         using (List <GameStatus> .Enumerator enumerator2 = instance.GameStatus.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 GameStatus current2 = enumerator2.get_Current();
                 stream.WriteByte(50);
                 ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                 bnet.protocol.account.GameStatus.Serialize(stream, current2);
             }
         }
     }
     if (instance.GameAccounts.get_Count() > 0)
     {
         using (List <GameAccountList> .Enumerator enumerator3 = instance.GameAccounts.GetEnumerator())
         {
             while (enumerator3.MoveNext())
             {
                 GameAccountList current3 = enumerator3.get_Current();
                 stream.WriteByte(58);
                 ProtocolParser.WriteUInt32(stream, current3.GetSerializedSize());
                 GameAccountList.Serialize(stream, current3);
             }
         }
     }
 }
 public static GameAccountState Deserialize(Stream stream, GameAccountState instance, long limit)
 {
     while (limit < 0L || stream.Position < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else if (num != 10)
         {
             if (num != 18)
             {
                 if (num != 26)
                 {
                     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 if (instance.GameStatus == null)
                 {
                     instance.GameStatus = GameStatus.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     GameStatus.DeserializeLengthDelimited(stream, instance.GameStatus);
                 }
             }
             else if (instance.GameTimeInfo == null)
             {
                 instance.GameTimeInfo = GameTimeInfo.DeserializeLengthDelimited(stream);
             }
             else
             {
                 GameTimeInfo.DeserializeLengthDelimited(stream, instance.GameTimeInfo);
             }
         }
         else if (instance.GameLevelInfo == null)
         {
             instance.GameLevelInfo = GameLevelInfo.DeserializeLengthDelimited(stream);
         }
         else
         {
             GameLevelInfo.DeserializeLengthDelimited(stream, instance.GameLevelInfo);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
示例#6
0
        public static void Serialize(Stream stream, GameLevelInfo instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.HasIsStarterEdition)
            {
                stream.WriteByte(24);
                ProtocolParser.WriteBool(stream, instance.IsStarterEdition);
            }
            if (instance.HasIsTrial)
            {
                stream.WriteByte(32);
                ProtocolParser.WriteBool(stream, instance.IsTrial);
            }
            if (instance.HasIsLifetime)
            {
                stream.WriteByte(40);
                ProtocolParser.WriteBool(stream, instance.IsLifetime);
            }
            if (instance.HasIsRestricted)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteBool(stream, instance.IsRestricted);
            }
            if (instance.HasIsBeta)
            {
                stream.WriteByte(56);
                ProtocolParser.WriteBool(stream, instance.IsBeta);
            }
            if (instance.HasName)
            {
                stream.WriteByte(66);
                ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Name));
            }
            if (instance.HasProgram)
            {
                stream.WriteByte(77);
                binaryWriter.Write(instance.Program);
            }
            if (instance.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator = instance.Licenses.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AccountLicense current = enumerator.get_Current();
                        stream.WriteByte(82);
                        ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                        AccountLicense.Serialize(stream, current);
                    }
                }
            }
            if (instance.HasRealmPermissions)
            {
                stream.WriteByte(88);
                ProtocolParser.WriteUInt32(stream, instance.RealmPermissions);
            }
        }
示例#7
0
        public static void Serialize(Stream stream, GameLevelInfo instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.HasIsStarterEdition)
            {
                stream.WriteByte(24);
                ProtocolParser.WriteBool(stream, instance.IsStarterEdition);
            }
            if (instance.HasIsTrial)
            {
                stream.WriteByte(32);
                ProtocolParser.WriteBool(stream, instance.IsTrial);
            }
            if (instance.HasIsLifetime)
            {
                stream.WriteByte(40);
                ProtocolParser.WriteBool(stream, instance.IsLifetime);
            }
            if (instance.HasIsRestricted)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteBool(stream, instance.IsRestricted);
            }
            if (instance.HasIsBeta)
            {
                stream.WriteByte(56);
                ProtocolParser.WriteBool(stream, instance.IsBeta);
            }
            if (instance.HasName)
            {
                stream.WriteByte(66);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Name));
            }
            if (instance.HasProgram)
            {
                stream.WriteByte(77);
                binaryWriter.Write(instance.Program);
            }
            if (instance.Licenses.Count > 0)
            {
                foreach (AccountLicense accountLicense in instance.Licenses)
                {
                    stream.WriteByte(82);
                    ProtocolParser.WriteUInt32(stream, accountLicense.GetSerializedSize());
                    AccountLicense.Serialize(stream, accountLicense);
                }
            }
            if (instance.HasRealmPermissions)
            {
                stream.WriteByte(88);
                ProtocolParser.WriteUInt32(stream, instance.RealmPermissions);
            }
        }
        public override bool Equals(object obj)
        {
            GameLevelInfo gameLevelInfo = obj as GameLevelInfo;

            if (gameLevelInfo == null)
            {
                return(false);
            }
            if (this.HasIsStarterEdition != gameLevelInfo.HasIsStarterEdition || this.HasIsStarterEdition && !this.IsStarterEdition.Equals(gameLevelInfo.IsStarterEdition))
            {
                return(false);
            }
            if (this.HasIsTrial != gameLevelInfo.HasIsTrial || this.HasIsTrial && !this.IsTrial.Equals(gameLevelInfo.IsTrial))
            {
                return(false);
            }
            if (this.HasIsLifetime != gameLevelInfo.HasIsLifetime || this.HasIsLifetime && !this.IsLifetime.Equals(gameLevelInfo.IsLifetime))
            {
                return(false);
            }
            if (this.HasIsRestricted != gameLevelInfo.HasIsRestricted || this.HasIsRestricted && !this.IsRestricted.Equals(gameLevelInfo.IsRestricted))
            {
                return(false);
            }
            if (this.HasIsBeta != gameLevelInfo.HasIsBeta || this.HasIsBeta && !this.IsBeta.Equals(gameLevelInfo.IsBeta))
            {
                return(false);
            }
            if (this.HasName != gameLevelInfo.HasName || this.HasName && !this.Name.Equals(gameLevelInfo.Name))
            {
                return(false);
            }
            if (this.HasProgram != gameLevelInfo.HasProgram || this.HasProgram && !this.Program.Equals(gameLevelInfo.Program))
            {
                return(false);
            }
            if (this.Licenses.Count != gameLevelInfo.Licenses.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Licenses.Count; i++)
            {
                if (!this.Licenses[i].Equals(gameLevelInfo.Licenses[i]))
                {
                    return(false);
                }
            }
            if (this.HasRealmPermissions == gameLevelInfo.HasRealmPermissions && (!this.HasRealmPermissions || this.RealmPermissions.Equals(gameLevelInfo.RealmPermissions)))
            {
                return(true);
            }
            return(false);
        }
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            if (this.HasAccountLevelInfo)
            {
                num ^= this.AccountLevelInfo.GetHashCode();
            }
            if (this.HasPrivacyInfo)
            {
                num ^= this.PrivacyInfo.GetHashCode();
            }
            if (this.HasParentalControlInfo)
            {
                num ^= this.ParentalControlInfo.GetHashCode();
            }
            using (List <GameLevelInfo> .Enumerator enumerator = this.GameLevelInfo.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    GameLevelInfo current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            using (List <GameStatus> .Enumerator enumerator2 = this.GameStatus.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    GameStatus current2 = enumerator2.get_Current();
                    num ^= current2.GetHashCode();
                }
            }
            using (List <GameAccountList> .Enumerator enumerator3 = this.GameAccounts.GetEnumerator())
            {
                while (enumerator3.MoveNext())
                {
                    GameAccountList current3 = enumerator3.get_Current();
                    num ^= current3.GetHashCode();
                }
            }
            return(num);
        }
 public static void Serialize(Stream stream, GameAccountState instance)
 {
     if (instance.HasGameLevelInfo)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.GameLevelInfo.GetSerializedSize());
         GameLevelInfo.Serialize(stream, instance.GameLevelInfo);
     }
     if (instance.HasGameTimeInfo)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.GameTimeInfo.GetSerializedSize());
         GameTimeInfo.Serialize(stream, instance.GameTimeInfo);
     }
     if (instance.HasGameStatus)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.GameStatus.GetSerializedSize());
         GameStatus.Serialize(stream, instance.GameStatus);
     }
 }
 public void SetGameLevelInfo(GameLevelInfo val)
 {
     this.GameLevelInfo = val;
 }
示例#12
0
 public void Serialize(Stream stream)
 {
     GameLevelInfo.Serialize(stream, this);
 }
示例#13
0
        public static GameLevelInfo Deserialize(Stream stream, GameLevelInfo instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Licenses == null)
            {
                instance.Licenses = new List <AccountLicense>();
            }
            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 != 24)
                    {
                        if (num2 != 32)
                        {
                            if (num2 != 40)
                            {
                                if (num2 != 48)
                                {
                                    if (num2 != 56)
                                    {
                                        if (num2 != 66)
                                        {
                                            if (num2 != 77)
                                            {
                                                if (num2 != 82)
                                                {
                                                    if (num2 != 88)
                                                    {
                                                        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.RealmPermissions = ProtocolParser.ReadUInt32(stream);
                                                    }
                                                }
                                                else
                                                {
                                                    instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream));
                                                }
                                            }
                                            else
                                            {
                                                instance.Program = binaryReader.ReadUInt32();
                                            }
                                        }
                                        else
                                        {
                                            instance.Name = ProtocolParser.ReadString(stream);
                                        }
                                    }
                                    else
                                    {
                                        instance.IsBeta = ProtocolParser.ReadBool(stream);
                                    }
                                }
                                else
                                {
                                    instance.IsRestricted = ProtocolParser.ReadBool(stream);
                                }
                            }
                            else
                            {
                                instance.IsLifetime = ProtocolParser.ReadBool(stream);
                            }
                        }
                        else
                        {
                            instance.IsTrial = ProtocolParser.ReadBool(stream);
                        }
                    }
                    else
                    {
                        instance.IsStarterEdition = ProtocolParser.ReadBool(stream);
                    }
                }
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
示例#14
0
 public static GameLevelInfo Deserialize(Stream stream, GameLevelInfo instance)
 {
     return(GameLevelInfo.Deserialize(stream, instance, -1L));
 }
 public void AddGameLevelInfo(GameLevelInfo val)
 {
     this._GameLevelInfo.Add(val);
 }
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.HasAccountLevelInfo)
            {
                num += 1u;
                uint serializedSize = this.AccountLevelInfo.GetSerializedSize();
                num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
            }
            if (this.HasPrivacyInfo)
            {
                num += 1u;
                uint serializedSize2 = this.PrivacyInfo.GetSerializedSize();
                num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2);
            }
            if (this.HasParentalControlInfo)
            {
                num += 1u;
                uint serializedSize3 = this.ParentalControlInfo.GetSerializedSize();
                num += serializedSize3 + ProtocolParser.SizeOfUInt32(serializedSize3);
            }
            if (this.GameLevelInfo.get_Count() > 0)
            {
                using (List <GameLevelInfo> .Enumerator enumerator = this.GameLevelInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        GameLevelInfo current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize4 = current.GetSerializedSize();
                        num += serializedSize4 + ProtocolParser.SizeOfUInt32(serializedSize4);
                    }
                }
            }
            if (this.GameStatus.get_Count() > 0)
            {
                using (List <GameStatus> .Enumerator enumerator2 = this.GameStatus.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        GameStatus current2 = enumerator2.get_Current();
                        num += 1u;
                        uint serializedSize5 = current2.GetSerializedSize();
                        num += serializedSize5 + ProtocolParser.SizeOfUInt32(serializedSize5);
                    }
                }
            }
            if (this.GameAccounts.get_Count() > 0)
            {
                using (List <GameAccountList> .Enumerator enumerator3 = this.GameAccounts.GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        GameAccountList current3 = enumerator3.get_Current();
                        num += 1u;
                        uint serializedSize6 = current3.GetSerializedSize();
                        num += serializedSize6 + ProtocolParser.SizeOfUInt32(serializedSize6);
                    }
                }
            }
            return(num);
        }