public static CurrencyRestriction DeserializeLengthDelimited(Stream stream) { CurrencyRestriction currencyRestriction = new CurrencyRestriction(); CurrencyRestriction.DeserializeLengthDelimited(stream, currencyRestriction); return(currencyRestriction); }
public static CurrencyRestriction DeserializeLengthDelimited(Stream stream, CurrencyRestriction instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(CurrencyRestriction.Deserialize(stream, instance, position)); }
public static CurrencyRestriction DeserializeLengthDelimited(Stream stream, CurrencyRestriction instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.get_Position(); return(CurrencyRestriction.Deserialize(stream, instance, num)); }
public static void Serialize(Stream stream, GetEBalanceRestrictionsResponse instance) { if (instance.CurrencyRestrictions.Count > 0) { foreach (CurrencyRestriction currencyRestriction in instance.CurrencyRestrictions) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, currencyRestriction.GetSerializedSize()); CurrencyRestriction.Serialize(stream, currencyRestriction); } } }
public static CurrencyRestriction Deserialize(Stream stream, CurrencyRestriction 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) { if (num2 != 26) { 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.SoftCap = ProtocolParser.ReadString(stream); } } else { instance.AuthenticatorCap = ProtocolParser.ReadString(stream); } } else { instance.Currency = ProtocolParser.ReadString(stream); } } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public override int GetHashCode() { int num = base.GetType().GetHashCode(); using (List <CurrencyRestriction> .Enumerator enumerator = this.CurrencyRestrictions.GetEnumerator()) { while (enumerator.MoveNext()) { CurrencyRestriction current = enumerator.get_Current(); num ^= current.GetHashCode(); } } return(num); }
public static CurrencyRestriction Deserialize(Stream stream, CurrencyRestriction 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) { instance.Currency = ProtocolParser.ReadString(stream); } else if (num == 18) { instance.AuthenticatorCap = ProtocolParser.ReadString(stream); } else if (num == 26) { instance.SoftCap = ProtocolParser.ReadString(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 (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public static void Serialize(Stream stream, GetEBalanceRestrictionsResponse instance) { if (instance.CurrencyRestrictions.get_Count() > 0) { using (List <CurrencyRestriction> .Enumerator enumerator = instance.CurrencyRestrictions.GetEnumerator()) { while (enumerator.MoveNext()) { CurrencyRestriction current = enumerator.get_Current(); stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); CurrencyRestriction.Serialize(stream, current); } } } }
public static GetEBalanceRestrictionsResponse Deserialize(Stream stream, GetEBalanceRestrictionsResponse instance, long limit) { if (instance.CurrencyRestrictions == null) { instance.CurrencyRestrictions = new List <CurrencyRestriction>(); } 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.CurrencyRestrictions.Add(CurrencyRestriction.DeserializeLengthDelimited(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 (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public uint GetSerializedSize() { uint num = 0u; if (this.CurrencyRestrictions.get_Count() > 0) { using (List <CurrencyRestriction> .Enumerator enumerator = this.CurrencyRestrictions.GetEnumerator()) { while (enumerator.MoveNext()) { CurrencyRestriction current = enumerator.get_Current(); num += 1u; uint serializedSize = current.GetSerializedSize(); num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize); } } } return(num); }
public static void Serialize(Stream stream, CurrencyRestriction instance) { if (instance.Currency == null) { throw new ArgumentNullException("Currency", "Required by proto specification."); } stream.WriteByte(10); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Currency)); if (instance.AuthenticatorCap == null) { throw new ArgumentNullException("AuthenticatorCap", "Required by proto specification."); } stream.WriteByte(18); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.AuthenticatorCap)); if (instance.SoftCap == null) { throw new ArgumentNullException("SoftCap", "Required by proto specification."); } stream.WriteByte(26); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.SoftCap)); }
public override bool Equals(object obj) { CurrencyRestriction currencyRestriction = obj as CurrencyRestriction; if (currencyRestriction == null) { return(false); } if (!this.Currency.Equals(currencyRestriction.Currency)) { return(false); } if (!this.AuthenticatorCap.Equals(currencyRestriction.AuthenticatorCap)) { return(false); } if (!this.SoftCap.Equals(currencyRestriction.SoftCap)) { return(false); } return(true); }
public static CurrencyRestriction Deserialize(Stream stream, CurrencyRestriction instance) { return(CurrencyRestriction.Deserialize(stream, instance, (long)-1)); }
public void Deserialize(Stream stream) { CurrencyRestriction.Deserialize(stream, this); }
public void AddCurrencyRestrictions(CurrencyRestriction val) { this._CurrencyRestrictions.Add(val); }
public override bool Equals(object obj) { CurrencyRestriction currencyRestriction = obj as CurrencyRestriction; return(currencyRestriction != null && this.Currency.Equals(currencyRestriction.Currency) && this.AuthenticatorCap.Equals(currencyRestriction.AuthenticatorCap) && this.SoftCap.Equals(currencyRestriction.SoftCap)); }