public override void Deserialize(ByteArray stream) { base.Deserialize(stream); int retCodeCount = 0; while (stream.bytesAvailable > 0) { var tag = ReadUtils.ReadTag(stream); switch (tag.number) { case 0: throw new ProtobufException("Invalid field id: 0, wrong stream"); case 1: this.retCode = ReadUtils.Read_TYPE_UINT32(stream); retCodeCount++; break; default: ReadUtils.Skip(stream, tag.wireType); break; } } if (retCodeCount == 0) { throw new ProtobufException("Required field retCode not readed"); } }
public override void Deserialize(ByteArray stream) { base.Deserialize(stream); int usernameCount = 0; int passwordCount = 0; while (stream.bytesAvailable > 0) { var tag = ReadUtils.ReadTag(stream); switch (tag.number) { case 0: throw new ProtobufException("Invalid field id: 0, wrong stream"); case 1: this.username = ReadUtils.Read_TYPE_STRING(stream); usernameCount++; break; case 2: this.password = ReadUtils.Read_TYPE_STRING(stream); passwordCount++; break; default: ReadUtils.Skip(stream, tag.wireType); break; } } if (usernameCount == 0) { throw new ProtobufException("Required field username not readed"); } if (passwordCount == 0) { throw new ProtobufException("Required field password not readed"); } }