コード例 #1
0
        public static CredentialUpdateRequest DeserializeLengthDelimited(Stream stream, CredentialUpdateRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(CredentialUpdateRequest.Deserialize(stream, instance, num));
        }
コード例 #2
0
        public static CredentialUpdateRequest DeserializeLengthDelimited(Stream stream)
        {
            CredentialUpdateRequest credentialUpdateRequest = new CredentialUpdateRequest();

            CredentialUpdateRequest.DeserializeLengthDelimited(stream, credentialUpdateRequest);
            return(credentialUpdateRequest);
        }
コード例 #3
0
 public static void Serialize(Stream stream, CredentialUpdateRequest instance)
 {
     if (instance.Account == null)
     {
         throw new ArgumentNullException("Account", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.Account.GetSerializedSize());
     AccountId.Serialize(stream, instance.Account);
     if (instance.OldCredentials.Count > 0)
     {
         foreach (AccountCredential accountCredential in instance.OldCredentials)
         {
             stream.WriteByte(18);
             ProtocolParser.WriteUInt32(stream, accountCredential.GetSerializedSize());
             AccountCredential.Serialize(stream, accountCredential);
         }
     }
     if (instance.NewCredentials.Count > 0)
     {
         foreach (AccountCredential accountCredential2 in instance.NewCredentials)
         {
             stream.WriteByte(26);
             ProtocolParser.WriteUInt32(stream, accountCredential2.GetSerializedSize());
             AccountCredential.Serialize(stream, accountCredential2);
         }
     }
     if (instance.HasRegion)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteUInt32(stream, instance.Region);
     }
 }
        public static CredentialUpdateRequest DeserializeLengthDelimited(Stream stream, CredentialUpdateRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(CredentialUpdateRequest.Deserialize(stream, instance, position));
        }
コード例 #5
0
 public static void Serialize(Stream stream, CredentialUpdateRequest instance)
 {
     if (instance.Account == null)
     {
         throw new ArgumentNullException("Account", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.Account.GetSerializedSize());
     AccountId.Serialize(stream, instance.Account);
     if (instance.OldCredentials.get_Count() > 0)
     {
         using (List <AccountCredential> .Enumerator enumerator = instance.OldCredentials.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 AccountCredential current = enumerator.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 AccountCredential.Serialize(stream, current);
             }
         }
     }
     if (instance.NewCredentials.get_Count() > 0)
     {
         using (List <AccountCredential> .Enumerator enumerator2 = instance.NewCredentials.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 AccountCredential current2 = enumerator2.get_Current();
                 stream.WriteByte(26);
                 ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                 AccountCredential.Serialize(stream, current2);
             }
         }
     }
     if (instance.HasRegion)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteUInt32(stream, instance.Region);
     }
 }
        public override bool Equals(object obj)
        {
            CredentialUpdateRequest credentialUpdateRequest = obj as CredentialUpdateRequest;

            if (credentialUpdateRequest == null)
            {
                return(false);
            }
            if (!this.Account.Equals(credentialUpdateRequest.Account))
            {
                return(false);
            }
            if (this.OldCredentials.Count != credentialUpdateRequest.OldCredentials.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.OldCredentials.Count; i++)
            {
                if (!this.OldCredentials[i].Equals(credentialUpdateRequest.OldCredentials[i]))
                {
                    return(false);
                }
            }
            if (this.NewCredentials.Count != credentialUpdateRequest.NewCredentials.Count)
            {
                return(false);
            }
            for (int j = 0; j < this.NewCredentials.Count; j++)
            {
                if (!this.NewCredentials[j].Equals(credentialUpdateRequest.NewCredentials[j]))
                {
                    return(false);
                }
            }
            if (this.HasRegion == credentialUpdateRequest.HasRegion && (!this.HasRegion || this.Region.Equals(credentialUpdateRequest.Region)))
            {
                return(true);
            }
            return(false);
        }
コード例 #7
0
        public override bool Equals(object obj)
        {
            CredentialUpdateRequest credentialUpdateRequest = obj as CredentialUpdateRequest;

            if (credentialUpdateRequest == null)
            {
                return(false);
            }
            if (!this.Account.Equals(credentialUpdateRequest.Account))
            {
                return(false);
            }
            if (this.OldCredentials.get_Count() != credentialUpdateRequest.OldCredentials.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.OldCredentials.get_Count(); i++)
            {
                if (!this.OldCredentials.get_Item(i).Equals(credentialUpdateRequest.OldCredentials.get_Item(i)))
                {
                    return(false);
                }
            }
            if (this.NewCredentials.get_Count() != credentialUpdateRequest.NewCredentials.get_Count())
            {
                return(false);
            }
            for (int j = 0; j < this.NewCredentials.get_Count(); j++)
            {
                if (!this.NewCredentials.get_Item(j).Equals(credentialUpdateRequest.NewCredentials.get_Item(j)))
                {
                    return(false);
                }
            }
            return(this.HasRegion == credentialUpdateRequest.HasRegion && (!this.HasRegion || this.Region.Equals(credentialUpdateRequest.Region)));
        }
コード例 #8
0
 public void Deserialize(Stream stream)
 {
     CredentialUpdateRequest.Deserialize(stream, this);
 }
コード例 #9
0
 public static CredentialUpdateRequest Deserialize(Stream stream, CredentialUpdateRequest instance, long limit)
 {
     if (instance.OldCredentials == null)
     {
         instance.OldCredentials = new List <AccountCredential>();
     }
     if (instance.NewCredentials == null)
     {
         instance.NewCredentials = new List <AccountCredential>();
     }
     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)
                         {
                             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.Region = ProtocolParser.ReadUInt32(stream);
                         }
                     }
                     else
                     {
                         instance.NewCredentials.Add(AccountCredential.DeserializeLengthDelimited(stream));
                     }
                 }
                 else
                 {
                     instance.OldCredentials.Add(AccountCredential.DeserializeLengthDelimited(stream));
                 }
             }
             else if (instance.Account == null)
             {
                 instance.Account = AccountId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 AccountId.DeserializeLengthDelimited(stream, instance.Account);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
コード例 #10
0
 public static CredentialUpdateRequest Deserialize(Stream stream, CredentialUpdateRequest instance)
 {
     return(CredentialUpdateRequest.Deserialize(stream, instance, -1L));
 }