public static void Serialize(Stream stream, AddMemberRequest instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.MemberIdentity == null)
     {
         throw new ArgumentNullException("MemberIdentity", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.MemberIdentity.GetSerializedSize());
     Identity.Serialize(stream, instance.MemberIdentity);
     if (instance.MemberState == null)
     {
         throw new ArgumentNullException("MemberState", "Required by proto specification.");
     }
     stream.WriteByte(26);
     ProtocolParser.WriteUInt32(stream, instance.MemberState.GetSerializedSize());
     MemberState.Serialize(stream, instance.MemberState);
     stream.WriteByte(32);
     ProtocolParser.WriteUInt64(stream, instance.ObjectId);
     if (instance.HasSubscribe)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteBool(stream, instance.Subscribe);
     }
 }
Exemple #2
0
        public static MemberState DeserializeLengthDelimited(Stream stream, MemberState instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

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

            position += stream.Position;
            return(MemberState.Deserialize(stream, instance, position));
        }
Exemple #4
0
        public override bool Equals(object obj)
        {
            MemberState memberState = obj as MemberState;

            if (memberState == null)
            {
                return(false);
            }
            if (this.Attribute.Count != memberState.Attribute.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Attribute.Count; i++)
            {
                if (!this.Attribute[i].Equals(memberState.Attribute[i]))
                {
                    return(false);
                }
            }
            if (this.Role.Count != memberState.Role.Count)
            {
                return(false);
            }
            for (int j = 0; j < this.Role.Count; j++)
            {
                if (!this.Role[j].Equals(memberState.Role[j]))
                {
                    return(false);
                }
            }
            return(this.HasPrivileges == memberState.HasPrivileges && (!this.HasPrivileges || this.Privileges.Equals(memberState.Privileges)) && this.HasInfo == memberState.HasInfo && (!this.HasInfo || this.Info.Equals(memberState.Info)) && this.HasHidden == memberState.HasHidden && (!this.HasHidden || this.Hidden.Equals(memberState.Hidden)));
        }
        public static MemberState DeserializeLengthDelimited(Stream stream)
        {
            MemberState memberState = new MemberState();

            MemberState.DeserializeLengthDelimited(stream, memberState);
            return(memberState);
        }
 public static Member Deserialize(Stream stream, Member instance, long limit)
 {
     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)
             {
                 if (instance.Identity != null)
                 {
                     bnet.protocol.Identity.DeserializeLengthDelimited(stream, instance.Identity);
                 }
                 else
                 {
                     instance.Identity = bnet.protocol.Identity.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num != 18)
             {
                 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 (instance.State != null)
             {
                 MemberState.DeserializeLengthDelimited(stream, instance.State);
             }
             else
             {
                 instance.State = MemberState.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Exemple #7
0
 public static void Serialize(Stream stream, MemberState 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.Role.get_Count() > 0)
     {
         stream.WriteByte(18);
         uint num = 0u;
         using (List <uint> .Enumerator enumerator2 = instance.Role.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 uint current2 = enumerator2.get_Current();
                 num += ProtocolParser.SizeOfUInt32(current2);
             }
         }
         ProtocolParser.WriteUInt32(stream, num);
         using (List <uint> .Enumerator enumerator3 = instance.Role.GetEnumerator())
         {
             while (enumerator3.MoveNext())
             {
                 uint current3 = enumerator3.get_Current();
                 ProtocolParser.WriteUInt32(stream, current3);
             }
         }
     }
     if (instance.HasPrivileges)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt64(stream, instance.Privileges);
     }
     if (instance.HasInfo)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteUInt32(stream, instance.Info.GetSerializedSize());
         AccountInfo.Serialize(stream, instance.Info);
     }
     if (instance.HasHidden)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteBool(stream, instance.Hidden);
     }
 }
 public static Member Deserialize(Stream stream, Member instance, long limit)
 {
     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 if (instance.State == null)
                 {
                     instance.State = MemberState.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     MemberState.DeserializeLengthDelimited(stream, instance.State);
                 }
             }
             else if (instance.Identity == null)
             {
                 instance.Identity = Identity.DeserializeLengthDelimited(stream);
             }
             else
             {
                 Identity.DeserializeLengthDelimited(stream, instance.Identity);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static void Serialize(Stream stream, Member instance)
 {
     if (instance.Identity == null)
     {
         throw new ArgumentNullException("Identity", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.Identity.GetSerializedSize());
     bnet.protocol.Identity.Serialize(stream, instance.Identity);
     if (instance.State == null)
     {
         throw new ArgumentNullException("State", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.State.GetSerializedSize());
     MemberState.Serialize(stream, instance.State);
 }
 public static void Serialize(Stream stream, CreateChannelRequest instance)
 {
     if (instance.HasAgentIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize());
         Identity.Serialize(stream, instance.AgentIdentity);
     }
     if (instance.HasMemberState)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.MemberState.GetSerializedSize());
         MemberState.Serialize(stream, instance.MemberState);
     }
     if (instance.HasChannelState)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.ChannelState.GetSerializedSize());
         ChannelState.Serialize(stream, instance.ChannelState);
     }
     if (instance.HasChannelId)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
         EntityId.Serialize(stream, instance.ChannelId);
     }
     if (instance.HasObjectId)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteUInt64(stream, instance.ObjectId);
     }
     if (instance.HasLocalAgent)
     {
         stream.WriteByte(50);
         ProtocolParser.WriteUInt32(stream, instance.LocalAgent.GetSerializedSize());
         EntityId.Serialize(stream, instance.LocalAgent);
     }
     if (instance.HasLocalMemberState)
     {
         stream.WriteByte(58);
         ProtocolParser.WriteUInt32(stream, instance.LocalMemberState.GetSerializedSize());
         MemberState.Serialize(stream, instance.LocalMemberState);
     }
 }
 public static void Serialize(Stream stream, MemberState 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.Role.Count > 0)
     {
         stream.WriteByte(18);
         uint num = 0;
         foreach (uint role in instance.Role)
         {
             num += ProtocolParser.SizeOfUInt32(role);
         }
         ProtocolParser.WriteUInt32(stream, num);
         foreach (uint role1 in instance.Role)
         {
             ProtocolParser.WriteUInt32(stream, role1);
         }
     }
     if (instance.HasPrivileges)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt64(stream, instance.Privileges);
     }
     if (instance.HasInfo)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteUInt32(stream, instance.Info.GetSerializedSize());
         AccountInfo.Serialize(stream, instance.Info);
     }
     if (instance.HasHidden)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteBool(stream, instance.Hidden);
     }
 }
Exemple #12
0
 public static void Serialize(Stream stream, JoinChannelRequest instance)
 {
     if (instance.HasAgentIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize());
         Identity.Serialize(stream, instance.AgentIdentity);
     }
     if (instance.HasMemberState)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.MemberState.GetSerializedSize());
         MemberState.Serialize(stream, instance.MemberState);
     }
     if (instance.ChannelId == null)
     {
         throw new ArgumentNullException("ChannelId", "Required by proto specification.");
     }
     stream.WriteByte(26);
     ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
     EntityId.Serialize(stream, instance.ChannelId);
     stream.WriteByte(32);
     ProtocolParser.WriteUInt64(stream, instance.ObjectId);
     if (instance.FriendAccountId.get_Count() > 0)
     {
         using (List <EntityId> .Enumerator enumerator = instance.FriendAccountId.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 EntityId current = enumerator.get_Current();
                 stream.WriteByte(42);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 EntityId.Serialize(stream, current);
             }
         }
     }
     if (instance.HasLocalSubscriber)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteBool(stream, instance.LocalSubscriber);
     }
 }
 public static void Serialize(Stream stream, JoinChannelRequest instance)
 {
     if (instance.HasAgentIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize());
         Identity.Serialize(stream, instance.AgentIdentity);
     }
     if (instance.HasMemberState)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.MemberState.GetSerializedSize());
         MemberState.Serialize(stream, instance.MemberState);
     }
     if (instance.ChannelId == null)
     {
         throw new ArgumentNullException("ChannelId", "Required by proto specification.");
     }
     stream.WriteByte(26);
     ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
     EntityId.Serialize(stream, instance.ChannelId);
     stream.WriteByte(32);
     ProtocolParser.WriteUInt64(stream, instance.ObjectId);
     if (instance.FriendAccountId.Count > 0)
     {
         foreach (EntityId entityId in instance.FriendAccountId)
         {
             stream.WriteByte(42);
             ProtocolParser.WriteUInt32(stream, entityId.GetSerializedSize());
             EntityId.Serialize(stream, entityId);
         }
     }
     if (instance.HasLocalSubscriber)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteBool(stream, instance.LocalSubscriber);
     }
 }
 public void Serialize(Stream stream)
 {
     MemberState.Serialize(stream, this);
 }
 public void SetMemberState(bnet.protocol.channel.MemberState val)
 {
     this.MemberState = val;
 }
 public void SetMemberState(MemberState val)
 {
     this.MemberState = val;
 }
 public void SetLocalMemberState(MemberState val)
 {
     this.LocalMemberState = val;
 }
 public static JoinChannelRequest Deserialize(Stream stream, JoinChannelRequest instance, long limit)
 {
     if (instance.FriendAccountId == null)
     {
         instance.FriendAccountId = new List <EntityId>();
     }
     instance.LocalSubscriber = true;
     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)
                 {
                     if (num != 32)
                     {
                         if (num != 42)
                         {
                             if (num != 48)
                             {
                                 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.LocalSubscriber = ProtocolParser.ReadBool(stream);
                             }
                         }
                         else
                         {
                             instance.FriendAccountId.Add(EntityId.DeserializeLengthDelimited(stream));
                         }
                     }
                     else
                     {
                         instance.ObjectId = ProtocolParser.ReadUInt64(stream);
                     }
                 }
                 else if (instance.ChannelId == null)
                 {
                     instance.ChannelId = EntityId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.ChannelId);
                 }
             }
             else if (instance.MemberState == null)
             {
                 instance.MemberState = MemberState.DeserializeLengthDelimited(stream);
             }
             else
             {
                 MemberState.DeserializeLengthDelimited(stream, instance.MemberState);
             }
         }
         else if (instance.AgentIdentity == null)
         {
             instance.AgentIdentity = Identity.DeserializeLengthDelimited(stream);
         }
         else
         {
             Identity.DeserializeLengthDelimited(stream, instance.AgentIdentity);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static MemberState Deserialize(Stream stream, MemberState instance)
 {
     return(MemberState.Deserialize(stream, instance, (long)-1));
 }
Exemple #20
0
 public static MemberState Deserialize(Stream stream, MemberState instance, long limit)
 {
     if (instance.Attribute == null)
     {
         instance.Attribute = new List <Attribute>();
     }
     if (instance.Role == null)
     {
         instance.Role = new List <uint>();
     }
     instance.Privileges = 0uL;
     instance.Hidden     = false;
     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)
                 {
                     if (num2 != 24)
                     {
                         if (num2 != 34)
                         {
                             if (num2 != 40)
                             {
                                 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.Hidden = ProtocolParser.ReadBool(stream);
                             }
                         }
                         else if (instance.Info == null)
                         {
                             instance.Info = AccountInfo.DeserializeLengthDelimited(stream);
                         }
                         else
                         {
                             AccountInfo.DeserializeLengthDelimited(stream, instance.Info);
                         }
                     }
                     else
                     {
                         instance.Privileges = ProtocolParser.ReadUInt64(stream);
                     }
                 }
                 else
                 {
                     long num3 = (long)((ulong)ProtocolParser.ReadUInt32(stream));
                     num3 += stream.get_Position();
                     while (stream.get_Position() < num3)
                     {
                         instance.Role.Add(ProtocolParser.ReadUInt32(stream));
                     }
                     if (stream.get_Position() != num3)
                     {
                         throw new ProtocolBufferException("Read too many bytes in packed data");
                     }
                 }
             }
             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 AddMemberRequest Deserialize(Stream stream, AddMemberRequest instance, long limit)
 {
     instance.Subscribe = true;
     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)
                 {
                     if (num2 != 26)
                     {
                         if (num2 != 32)
                         {
                             if (num2 != 40)
                             {
                                 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.Subscribe = ProtocolParser.ReadBool(stream);
                             }
                         }
                         else
                         {
                             instance.ObjectId = ProtocolParser.ReadUInt64(stream);
                         }
                     }
                     else if (instance.MemberState == null)
                     {
                         instance.MemberState = MemberState.DeserializeLengthDelimited(stream);
                     }
                     else
                     {
                         MemberState.DeserializeLengthDelimited(stream, instance.MemberState);
                     }
                 }
                 else if (instance.MemberIdentity == null)
                 {
                     instance.MemberIdentity = Identity.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     Identity.DeserializeLengthDelimited(stream, instance.MemberIdentity);
                 }
             }
             else if (instance.AgentId == null)
             {
                 instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static MemberState Deserialize(Stream stream, MemberState instance, long limit)
 {
     if (instance.Attribute == null)
     {
         instance.Attribute = new List <bnet.protocol.attribute.Attribute>();
     }
     if (instance.Role == null)
     {
         instance.Role = new List <uint>();
     }
     instance.Privileges = (ulong)0;
     instance.Hidden     = false;
     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.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
             }
             else if (num == 18)
             {
                 long position = (long)ProtocolParser.ReadUInt32(stream);
                 position += stream.Position;
                 while (stream.Position < position)
                 {
                     instance.Role.Add(ProtocolParser.ReadUInt32(stream));
                 }
                 if (stream.Position != position)
                 {
                     throw new ProtocolBufferException("Read too many bytes in packed data");
                 }
             }
             else if (num == 24)
             {
                 instance.Privileges = ProtocolParser.ReadUInt64(stream);
             }
             else if (num != 34)
             {
                 if (num == 40)
                 {
                     instance.Hidden = 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 (instance.Info != null)
             {
                 AccountInfo.DeserializeLengthDelimited(stream, instance.Info);
             }
             else
             {
                 instance.Info = AccountInfo.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }