Exemple #1
0
        public static RegisterUtilitiesRequest DeserializeLengthDelimited(Stream stream, RegisterUtilitiesRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

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

            if (registerUtilitiesRequest == null)
            {
                return(false);
            }
            if (this.Attribute.Count != registerUtilitiesRequest.Attribute.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Attribute.Count; i++)
            {
                if (!this.Attribute[i].Equals(registerUtilitiesRequest.Attribute[i]))
                {
                    return(false);
                }
            }
            if (this.HasState != registerUtilitiesRequest.HasState || this.HasState && !this.State.Equals(registerUtilitiesRequest.State))
            {
                return(false);
            }
            if (!this.ProgramId.Equals(registerUtilitiesRequest.ProgramId))
            {
                return(false);
            }
            return(true);
        }
Exemple #3
0
        public static RegisterUtilitiesRequest DeserializeLengthDelimited(Stream stream)
        {
            RegisterUtilitiesRequest registerUtilitiesRequest = new RegisterUtilitiesRequest();

            RegisterUtilitiesRequest.DeserializeLengthDelimited(stream, registerUtilitiesRequest);
            return(registerUtilitiesRequest);
        }
        public static RegisterUtilitiesRequest DeserializeLengthDelimited(Stream stream, RegisterUtilitiesRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(RegisterUtilitiesRequest.Deserialize(stream, instance, num));
        }
        public static void Serialize(Stream stream, RegisterUtilitiesRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            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.HasState)
            {
                stream.WriteByte(18);
                ProtocolParser.WriteUInt32(stream, instance.State.GetSerializedSize());
                ServerState.Serialize(stream, instance.State);
            }
            stream.WriteByte(29);
            binaryWriter.Write(instance.ProgramId);
        }
Exemple #6
0
        public static RegisterUtilitiesRequest Deserialize(Stream stream, RegisterUtilitiesRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            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 != 29)
                        {
                            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.ProgramId = binaryReader.ReadUInt32();
                        }
                    }
                    else if (instance.State == null)
                    {
                        instance.State = ServerState.DeserializeLengthDelimited(stream);
                    }
                    else
                    {
                        ServerState.DeserializeLengthDelimited(stream, instance.State);
                    }
                }
                else
                {
                    instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
        public override bool Equals(object obj)
        {
            RegisterUtilitiesRequest registerUtilitiesRequest = obj as RegisterUtilitiesRequest;

            if (registerUtilitiesRequest == null)
            {
                return(false);
            }
            if (this.Attribute.get_Count() != registerUtilitiesRequest.Attribute.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Attribute.get_Count(); i++)
            {
                if (!this.Attribute.get_Item(i).Equals(registerUtilitiesRequest.Attribute.get_Item(i)))
                {
                    return(false);
                }
            }
            return(this.HasState == registerUtilitiesRequest.HasState && (!this.HasState || this.State.Equals(registerUtilitiesRequest.State)) && this.ProgramId.Equals(registerUtilitiesRequest.ProgramId));
        }
Exemple #8
0
        public static void Serialize(Stream stream, RegisterUtilitiesRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            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.HasState)
            {
                stream.WriteByte(18);
                ProtocolParser.WriteUInt32(stream, instance.State.GetSerializedSize());
                ServerState.Serialize(stream, instance.State);
            }
            stream.WriteByte(29);
            binaryWriter.Write(instance.ProgramId);
        }
Exemple #9
0
 public static RegisterUtilitiesRequest Deserialize(Stream stream, RegisterUtilitiesRequest instance)
 {
     return(RegisterUtilitiesRequest.Deserialize(stream, instance, (long)-1));
 }
Exemple #10
0
 public void Deserialize(Stream stream)
 {
     RegisterUtilitiesRequest.Deserialize(stream, this);
 }