public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            if (this.HasRequestId)
            {
                num ^= this.RequestId.GetHashCode();
            }
            if (this.HasQueued)
            {
                num ^= this.Queued.GetHashCode();
            }
            using (List <ConnectInfo> .Enumerator enumerator = this.ConnectInfo.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ConnectInfo current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            return(num);
        }
示例#2
0
        public override bool Equals(object obj)
        {
            ConnectInfo connectInfo = obj as ConnectInfo;

            if (connectInfo == null)
            {
                return(false);
            }
            if (!this.MemberId.Equals(connectInfo.MemberId))
            {
                return(false);
            }
            if (!this.Host.Equals(connectInfo.Host))
            {
                return(false);
            }
            if (!this.Port.Equals(connectInfo.Port))
            {
                return(false);
            }
            if (this.HasToken != connectInfo.HasToken || (this.HasToken && !this.Token.Equals(connectInfo.Token)))
            {
                return(false);
            }
            if (this.Attribute.Count != connectInfo.Attribute.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Attribute.Count; i++)
            {
                if (!this.Attribute[i].Equals(connectInfo.Attribute[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
 public static void Serialize(Stream stream, ConnectInfo instance)
 {
     if (instance.MemberId == null)
     {
         throw new ArgumentNullException("MemberId", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.MemberId.GetSerializedSize());
     EntityId.Serialize(stream, instance.MemberId);
     if (instance.Host == null)
     {
         throw new ArgumentNullException("Host", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Host));
     stream.WriteByte(24);
     ProtocolParser.WriteUInt64(stream, (ulong)((long)instance.Port));
     if (instance.HasToken)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteBytes(stream, instance.Token);
     }
     if (instance.Attribute.get_Count() > 0)
     {
         using (List <Attribute> .Enumerator enumerator = instance.Attribute.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Attribute current = enumerator.get_Current();
                 stream.WriteByte(42);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.attribute.Attribute.Serialize(stream, current);
             }
         }
     }
 }
 public void AddConnectInfo(ConnectInfo val)
 {
     this._ConnectInfo.Add(val);
 }
示例#5
0
 public void Serialize(Stream stream)
 {
     ConnectInfo.Serialize(stream, this);
 }
示例#6
0
 public static ConnectInfo Deserialize(Stream stream, ConnectInfo instance, long limit)
 {
     if (instance.Attribute == null)
     {
         instance.Attribute = new List <bnet.protocol.attribute.Attribute>();
     }
     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 != 24)
                 {
                     if (num != 34)
                     {
                         if (num != 42)
                         {
                             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.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                         }
                     }
                     else
                     {
                         instance.Token = ProtocolParser.ReadBytes(stream);
                     }
                 }
                 else
                 {
                     instance.Port = (int)ProtocolParser.ReadUInt64(stream);
                 }
             }
             else
             {
                 instance.Host = ProtocolParser.ReadString(stream);
             }
         }
         else if (instance.MemberId == null)
         {
             instance.MemberId = EntityId.DeserializeLengthDelimited(stream);
         }
         else
         {
             EntityId.DeserializeLengthDelimited(stream, instance.MemberId);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
示例#7
0
 public static ConnectInfo Deserialize(Stream stream, ConnectInfo instance)
 {
     return(ConnectInfo.Deserialize(stream, instance, -1L));
 }