예제 #1
0
        public static BindRequest Deserialize(Stream stream, BindRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.ImportedServiceHash == null)
            {
                instance.ImportedServiceHash = new List <uint>();
            }
            if (instance.ExportedService == null)
            {
                instance.ExportedService = new List <BoundService>();
            }
            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)
                    {
                        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.ExportedService.Add(BoundService.DeserializeLengthDelimited(stream));
                    }
                }
                else
                {
                    long num2 = (long)((ulong)ProtocolParser.ReadUInt32(stream));
                    num2 += stream.Position;
                    while (stream.Position < num2)
                    {
                        instance.ImportedServiceHash.Add(binaryReader.ReadUInt32());
                    }
                    if (stream.Position != num2)
                    {
                        throw new ProtocolBufferException("Read too many bytes in packed data");
                    }
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
예제 #2
0
        public static BindRequest DeserializeLengthDelimited(Stream stream)
        {
            BindRequest bindRequest = new BindRequest();

            BindRequest.DeserializeLengthDelimited(stream, bindRequest);
            return(bindRequest);
        }
예제 #3
0
        public static BindRequest DeserializeLengthDelimited(Stream stream, BindRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(BindRequest.Deserialize(stream, instance, num));
        }
예제 #4
0
        public override bool Equals(object obj)
        {
            BindRequest bindRequest = obj as BindRequest;

            if (bindRequest == null)
            {
                return(false);
            }
            if (this.ImportedServiceHash.Count != bindRequest.ImportedServiceHash.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.ImportedServiceHash.Count; i++)
            {
                if (!this.ImportedServiceHash[i].Equals(bindRequest.ImportedServiceHash[i]))
                {
                    return(false);
                }
            }
            if (this.ExportedService.Count != bindRequest.ExportedService.Count)
            {
                return(false);
            }
            for (int j = 0; j < this.ExportedService.Count; j++)
            {
                if (!this.ExportedService[j].Equals(bindRequest.ExportedService[j]))
                {
                    return(false);
                }
            }
            return(true);
        }
        public override bool Equals(object obj)
        {
            BindRequest bindRequest = obj as BindRequest;

            if (bindRequest == null)
            {
                return(false);
            }
            if (this.ImportedServiceHash.get_Count() != bindRequest.ImportedServiceHash.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.ImportedServiceHash.get_Count(); i++)
            {
                if (!this.ImportedServiceHash.get_Item(i).Equals(bindRequest.ImportedServiceHash.get_Item(i)))
                {
                    return(false);
                }
            }
            if (this.ExportedService.get_Count() != bindRequest.ExportedService.get_Count())
            {
                return(false);
            }
            for (int j = 0; j < this.ExportedService.get_Count(); j++)
            {
                if (!this.ExportedService.get_Item(j).Equals(bindRequest.ExportedService.get_Item(j)))
                {
                    return(false);
                }
            }
            return(true);
        }
        public static void Serialize(Stream stream, BindRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.ImportedServiceHash.get_Count() > 0)
            {
                stream.WriteByte(10);
                ProtocolParser.WriteUInt32(stream, (uint)(4 * instance.ImportedServiceHash.get_Count()));
                using (List <uint> .Enumerator enumerator = instance.ImportedServiceHash.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        uint current = enumerator.get_Current();
                        binaryWriter.Write(current);
                    }
                }
            }
            if (instance.ExportedService.get_Count() > 0)
            {
                using (List <BoundService> .Enumerator enumerator2 = instance.ExportedService.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        BoundService current2 = enumerator2.get_Current();
                        stream.WriteByte(18);
                        ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                        BoundService.Serialize(stream, current2);
                    }
                }
            }
        }
예제 #7
0
 public static ConnectRequest Deserialize(Stream stream, ConnectRequest 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.BindRequest == null)
                 {
                     instance.BindRequest = BindRequest.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     BindRequest.DeserializeLengthDelimited(stream, instance.BindRequest);
                 }
             }
             else if (instance.ClientId == null)
             {
                 instance.ClientId = ProcessId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 ProcessId.DeserializeLengthDelimited(stream, instance.ClientId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
예제 #8
0
 public static void Serialize(Stream stream, ConnectRequest instance)
 {
     if (instance.HasClientId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.ClientId.GetSerializedSize());
         ProcessId.Serialize(stream, instance.ClientId);
     }
     if (instance.HasBindRequest)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.BindRequest.GetSerializedSize());
         BindRequest.Serialize(stream, instance.BindRequest);
     }
 }
예제 #9
0
        public static void Serialize(Stream stream, BindRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.ImportedServiceHash.Count > 0)
            {
                stream.WriteByte(10);
                ProtocolParser.WriteUInt32(stream, (uint)(4 * instance.ImportedServiceHash.Count));
                foreach (uint value in instance.ImportedServiceHash)
                {
                    binaryWriter.Write(value);
                }
            }
            if (instance.ExportedService.Count > 0)
            {
                foreach (BoundService boundService in instance.ExportedService)
                {
                    stream.WriteByte(18);
                    ProtocolParser.WriteUInt32(stream, boundService.GetSerializedSize());
                    BoundService.Serialize(stream, boundService);
                }
            }
        }
예제 #10
0
 public void Serialize(Stream stream)
 {
     BindRequest.Serialize(stream, this);
 }
예제 #11
0
 public static BindRequest Deserialize(Stream stream, BindRequest instance)
 {
     return(BindRequest.Deserialize(stream, instance, -1L));
 }
예제 #12
0
 public void SetBindRequest(BindRequest val)
 {
     this.BindRequest = val;
 }