Пример #1
0
        public override byte[] EncodeValue(ScalarValue value)
        {
            DateTime date     = ((DateValue)value).Value;
            int      intValue = Util.TimestampToInt(date);

            return(Uint.Encode(new IntegerValue(intValue)));
        }
Пример #2
0
        public override byte[] Encode(ScalarValue value)
        {
            byte[] bytes      = value.Bytes;
            int    lengthSize = IntegerCodec.GetUnsignedIntegerSize(bytes.Length);
            var    encoding   = new byte[bytes.Length + lengthSize];

            byte[] length = Uint.Encode(new IntegerValue(bytes.Length));
            Array.Copy(length, 0, encoding, 0, lengthSize);
            Array.Copy(bytes, 0, encoding, lengthSize, bytes.Length);
            return(encoding);
        }