public static RoleSetConfig DeserializeLengthDelimited(Stream stream, RoleSetConfig instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.get_Position(); return(RoleSetConfig.Deserialize(stream, instance, num)); }
public override bool Equals(object obj) { RoleSetConfig roleSetConfig = obj as RoleSetConfig; if (roleSetConfig == null) { return(false); } if (this.Privilege.Count != roleSetConfig.Privilege.Count) { return(false); } for (int i = 0; i < this.Privilege.Count; i++) { if (!this.Privilege[i].Equals(roleSetConfig.Privilege[i])) { return(false); } } if (!this.RoleSet.Equals(roleSetConfig.RoleSet)) { return(false); } return(true); }
public static RoleSetConfig DeserializeLengthDelimited(Stream stream) { RoleSetConfig roleSetConfig = new RoleSetConfig(); RoleSetConfig.DeserializeLengthDelimited(stream, roleSetConfig); return(roleSetConfig); }
public static RoleSetConfig DeserializeLengthDelimited(Stream stream, RoleSetConfig instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(RoleSetConfig.Deserialize(stream, instance, position)); }
public static RoleSetConfig Deserialize(Stream stream, RoleSetConfig instance, long limit) { if (instance.Privilege == null) { instance.Privilege = new List <Privilege>(); } 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.RoleSet == null) { instance.RoleSet = RoleSet.DeserializeLengthDelimited(stream); } else { RoleSet.DeserializeLengthDelimited(stream, instance.RoleSet); } } else { instance.Privilege.Add(bnet.protocol.Privilege.DeserializeLengthDelimited(stream)); } } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static RoleSetConfig Deserialize(Stream stream, RoleSetConfig instance, long limit) { if (instance.Privilege == null) { instance.Privilege = new List <bnet.protocol.Privilege>(); } 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.Privilege.Add(bnet.protocol.Privilege.DeserializeLengthDelimited(stream)); } else if (num != 18) { 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 (instance.RoleSet != null) { bnet.protocol.RoleSet.DeserializeLengthDelimited(stream, instance.RoleSet); } else { instance.RoleSet = bnet.protocol.RoleSet.DeserializeLengthDelimited(stream); } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public static void Serialize(Stream stream, RoleSetConfig instance) { if (instance.Privilege.Count > 0) { foreach (bnet.protocol.Privilege privilege in instance.Privilege) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, privilege.GetSerializedSize()); bnet.protocol.Privilege.Serialize(stream, privilege); } } if (instance.RoleSet == null) { throw new ArgumentNullException("RoleSet", "Required by proto specification."); } stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.RoleSet.GetSerializedSize()); bnet.protocol.RoleSet.Serialize(stream, instance.RoleSet); }
public override bool Equals(object obj) { RoleSetConfig roleSetConfig = obj as RoleSetConfig; if (roleSetConfig == null) { return(false); } if (this.Privilege.get_Count() != roleSetConfig.Privilege.get_Count()) { return(false); } for (int i = 0; i < this.Privilege.get_Count(); i++) { if (!this.Privilege.get_Item(i).Equals(roleSetConfig.Privilege.get_Item(i))) { return(false); } } return(this.RoleSet.Equals(roleSetConfig.RoleSet)); }
public static void Serialize(Stream stream, RoleSetConfig instance) { if (instance.Privilege.get_Count() > 0) { using (List <Privilege> .Enumerator enumerator = instance.Privilege.GetEnumerator()) { while (enumerator.MoveNext()) { Privilege current = enumerator.get_Current(); stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, current.GetSerializedSize()); bnet.protocol.Privilege.Serialize(stream, current); } } } if (instance.RoleSet == null) { throw new ArgumentNullException("RoleSet", "Required by proto specification."); } stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.RoleSet.GetSerializedSize()); RoleSet.Serialize(stream, instance.RoleSet); }
public static RoleSetConfig Deserialize(Stream stream, RoleSetConfig instance) { return(RoleSetConfig.Deserialize(stream, instance, -1L)); }
public void Deserialize(Stream stream) { RoleSetConfig.Deserialize(stream, this); }