예제 #1
0
    public override ByteArray Serialize(ByteArray stream = null, bool skipHead = false)
    {
        stream = base.Serialize(stream, skipHead);

        if (this.hasUsername)
        {
            WriteUtils.WriteTag(stream, WireType.LengthDelimited, 1);
            WriteUtils.Write_TYPE_STRING(stream, this.username);
        }
        else
        {
            throw new ProtobufException("Required field username not set");
        }

        if (this.hasPassword)
        {
            WriteUtils.WriteTag(stream, WireType.LengthDelimited, 2);
            WriteUtils.Write_TYPE_STRING(stream, this.password);
        }
        else
        {
            throw new ProtobufException("Required field password not set");
        }


        return(stream);
    }