Ejemplo n.º 1
0
        private void WriteHeader(int fieldIndex, RawProtobufWireType fieldType)
        {
            // Write field type and first 4 bits of field index
            var wireType = (int)fieldType & 7;

            this.buffer.WriteByte((byte)(wireType | ((fieldIndex & 15) << 3) | (fieldIndex >= 16 ? 128 : 0)));

            fieldIndex >>= 4;

            // Write remaining part of field index if any
            while (fieldIndex > 0)
            {
                this.buffer.WriteByte((byte)((fieldIndex & 127) | (fieldIndex >= 128 ? 128 : 0)));

                fieldIndex >>= 7;
            }
        }
Ejemplo n.º 2
0
 public RawProtobufValue(string value, RawProtobufWireType storage)
 {
     this.Number  = default;
     this.Storage = storage;
     this.String  = value;
 }
Ejemplo n.º 3
0
 public RawProtobufValue(long number, RawProtobufWireType storage)
 {
     this.Number  = number;
     this.Storage = storage;
     this.String  = default;
 }