Beispiel #1
0
        public override byte[] EncodeValue(ScalarValue value)
        {
#warning BUG? This used to format all values using "d-MMM-yy h:mm:ss tt" format, and now it uses constructor parameter instead
            return
                (Ascii.Encode(
                     new StringValue(
                         (((DateValue)value).Value).ToString(_format, _formatter))));
        }
        public override byte[] EncodeValue(ScalarValue value)
        {
            if (value.IsNull)
            {
                return(NullValueEncoding);
            }

            var diff = (TwinValue)value;

            byte[] subtractionLength = NullableInteger.Encode(diff.First);
            byte[] difference        = Ascii.Encode(diff.Second);
            var    encoded           = new byte[subtractionLength.Length + difference.Length];

            Array.Copy(subtractionLength, 0, encoded, 0, subtractionLength.Length);
            Array.Copy(difference, 0, encoded, subtractionLength.Length, difference.Length);

            return(encoded);
        }
Beispiel #3
0
        public override byte[] EncodeValue(ScalarValue value)
        {
            if (value == null || value == ScalarValue.Null)
            {
                throw new ArgumentNullException("value", "Cannot have null values for non-nullable string delta");
            }

            var diff = (TwinValue)value;

            byte[] subtractionLength = Integer.Encode(diff.First);
            byte[] difference        = Ascii.Encode(diff.Second);
            var    encoded           = new byte[subtractionLength.Length + difference.Length];

            Array.Copy(subtractionLength, 0, encoded, 0, subtractionLength.Length);
            Array.Copy(difference, 0, encoded, subtractionLength.Length, difference.Length);

            return(encoded);
        }