public void WriteIntArrayToBuffer()
        {
            var buffer = new byte[12 + Offset];

            // Value
            converter.Write(buffer, Offset, Value);
            Assert.Equal(ValueBytes, buffer);

            // ValueShortage
            converter.Write(buffer, Offset, ValueShortage);
            Assert.Equal(ValueShortageBytes, buffer);

            // Null
            converter.Write(buffer, Offset, null);
            Assert.Equal(NullBytes, buffer);
        }
Пример #2
0
        public void WriteLittleEndianDoubleBinaryToBuffer()
        {
            var buffer = new byte[8 + Offset];

            converter.Write(buffer, Offset, Value);

            Assert.Equal(ValueBytes, buffer);
        }
Пример #3
0
        public void WriteByteToBuffer()
        {
            var buffer = new byte[1 + Offset];

            converter.Write(buffer, Offset, Value);

            Assert.Equal(ValueBytes, buffer);
        }
        public void WriteBigEndianShortBinaryToBuffer()
        {
            var buffer = new byte[2 + Offset];

            converter.Write(buffer, Offset, Value);

            Assert.Equal(ValueBytes, buffer);
        }
        public void Write(byte[] buffer, int index, object value)
        {
            if (value is null)
            {
                BytesHelper.Fill(buffer, index, length * elementSize, filler);
            }
            else
            {
                var array = (Array)value;

                for (var i = 0; i < array.Length; i++)
                {
                    elementConverter.Write(buffer, index, array.GetValue(i));
                    index += elementSize;
                }

                if (array.Length < length)
                {
                    BytesHelper.Fill(buffer, index, (length - array.Length) * elementSize, filler);
                }
            }
        }
 public void WriteDateTime8()
 {
     dateTime8Converter.Write(dateTime8Buffer, 0, DateTime8);
 }
 public void WriteDecimal28Zero()
 {
     decimal28Converter.Write(decimal28ZeroBuffer, 0, ZeroDecimal);
 }
 public void WriteLong18Zero()
 {
     long18Converter.Write(long18ZeroBuffer, 0, ZeroLong);
 }
 public void WriteInteger8Zero()
 {
     int8Converter.Write(int8ZeroBuffer, 0, ZeroInteger);
 }
 public void WriteBytes20()
 {
     bytes20Converter.Write(bytes20Buffer, 0, Bytes20);
 }
 public void WriteDateTimeText8()
 {
     dateTimeText8Converter.Write(dateTimeText8Buffer, 0, DateTime14);
 }
 public void WriteNumberTextLong18Zero()
 {
     numberTextLong18Converter.Write(numberTextLong18ZeroBuffer, 0, ZeroLong);
 }
 public void WriteNumberTextDecimal28Zero()
 {
     numberTextDecimal28Converter.Write(numberTextDecimal28ZeroBuffer, 0, ZeroDecimal);
 }
 public void WriteNumberTextInt8Zero()
 {
     numberTextInt8Converter.Write(numberTextInt8ZeroBuffer, 0, ZeroInteger);
 }
 public void WriteNumberTextShort4Zero()
 {
     numberTextShort4Converter.Write(numberTextShort4ZeroBuffer, 0, ZeroShort);
 }
 public void WriteSjisText20Single20()
 {
     text20Converter.Write(text20Single20Buffer, 0, Text20Single10);
 }
 public void WriteDateTime14()
 {
     dateTime14Converter.Write(dateTime14Buffer, 0, DateTime14);
 }
 public void WriteAscii13Code()
 {
     ascii13Converter.Write(ascii13Buffer, 0, Ascii13);
 }
 public void WriteDateTime17()
 {
     dateTime17Converter.Write(dateTime17Buffer, 0, DateTime17);
 }
 public void WriteIntBinary()
 {
     intBinaryConverter.Write(intBinaryBuffer, 0, 0);
 }
Пример #21
0
 public void Write(byte[] buffer, int index, object target)
 {
     converter.Write(buffer, index + offset, getter(target));
 }
 public void WriteIntegerShort4Zero()
 {
     short4Converter.Write(short4ZeroBuffer, 0, ZeroShort);
 }
 public void WriteUnicode30Wide15()
 {
     unicode30Converter.Write(unicode30Buffer, 0, Unicode30Wide15);
 }
 public void WriteBoolean()
 {
     booleanConverter.Write(booleanBuffer, 0, false);
 }