Esempio n. 1
0
        public override void Write(aBinaryWriter writer, string value)
        {
            if (value.Length > mMultiple)
            {
                value = value.Substring(0, mMultiple);
            }
            writer.WriteString(value);
            var count = mMultiple - value.Length;

            while (count-- > 0)
            {
                writer.WriteChar('\0');
            }
        }
Esempio n. 2
0
        public static void WritePadding(this aBinaryWriter writer, int multiple, byte padding)
        {
            aError.CheckNull(writer, "writer");
            var remainder = (writer.Position % multiple);

            if (remainder > 0)
            {
                var length = (multiple - remainder);
                var buffer = new byte[length];
                if (padding != 0)
                {
                    for (var i = 0; i < length; ++i)
                    {
                        buffer[i] = padding;
                    }
                }
                writer.Write8s(buffer);
            }
        }
Esempio n. 3
0
        public static void WritePadding(this aBinaryWriter writer, int multiple, byte[] padding)
        {
            aError.CheckNull(writer, "writer");
            aError.CheckNull(padding, "padding");
            aError.Check <ArgumentException>(padding.Length > 0, "Array is empty.", "padding");
            var remainder = (writer.Position % multiple);

            if (remainder > 0)
            {
                var length = (multiple - remainder);
                var buffer = new byte[length];
                var p      = 0;
                for (var i = 0; i < length; ++i)
                {
                    buffer[i] = padding[p];
                    if (++p >= padding.Length)
                    {
                        p = 0;
                    }
                }
                writer.Write8s(buffer);
            }
        }
Esempio n. 4
0
 public override void Write(aBinaryWriter writer, string value)
 {
     base.Write(writer, value);
     writer.WriteChar('\0');
 }
Esempio n. 5
0
 public override void Write(aBinaryWriter writer, string value)
 {
     aError.Check <ArgumentException>(value.Length <= UInt16.MaxValue, "String value is too long for a WSTR.", "value");
     writer.Write16((ushort)value.Length);
     writer.WriteString(value);
 }
Esempio n. 6
0
 public abstract void Write(aBinaryWriter writer, string value);
Esempio n. 7
0
 public override void Write(aBinaryWriter writer, string value)
 {
     aError.Check <ArgumentException>(value.Length <= Byte.MaxValue, "String value is too long for a BSTR.", "value");
     writer.Write8((byte)value.Length);
     writer.WriteString(value);
 }
Esempio n. 8
0
 public override void Write(aBinaryWriter writer, string value)
 {
     writer.WriteString(value);
     writer.WriteChar('\0');
 }