コード例 #1
0
        /// <summary>
        /// Writes a string with the given encoding to the given offset of the file
        /// </summary>
        /// <param name="index">Index of the file to write</param>
        /// <param name="e">The encoding to use</param>
        /// <param name="value">The string to write.  The entire string will be written with an ending null character.</param>
        public static void WriteNullTerminatedString(this IWriteOnlyBinaryDataAccessor accessor, long index, Encoding e, string value)
        {
            var nullChar = e.GetBytes(new[] { Convert.ToChar(0) });
            var data     = e.GetBytes(value);

            accessor.Write(index, data.Length, data);
            accessor.Write(index + data.Length, nullChar.Length, nullChar);
        }
コード例 #2
0
 /// <summary>
 /// Writes a signed 16 bit little endian integer
 /// </summary>
 /// <param name="offset">Offset of the integer to write.</param>
 /// <param name="value">The integer to write</param>
 public static void WriteInt16(this IWriteOnlyBinaryDataAccessor accessor, long offset, Int16 value)
 {
     accessor.Write(offset, 2, BitConverter.GetBytes(value));
 }
コード例 #3
0
 /// <summary>
 /// Writes all of the given data to the desired index
 /// </summary>
 /// <param name="index">Index of the data to write</param>
 /// <param name="value">Data to write</param>
 public static void Write(this IWriteOnlyBinaryDataAccessor accessor, long index, byte[] value)
 {
     accessor.Write(index, value.Length, value);
 }
コード例 #4
0
 /// <summary>
 /// Writes a string with the given encoding to the given offset of the file
 /// </summary>
 /// <param name="index">Index of the file to write</param>
 /// <param name="e">The encoding to use</param>
 /// <param name="value">The string to write.  The entire string will be written without an ending null character.</param>
 public static void WriteString(this IWriteOnlyBinaryDataAccessor accessor, long index, Encoding e, string value)
 {
     accessor.Write(index, e.GetBytes(value));
 }
コード例 #5
0
 /// <summary>
 /// Writes an unsigned 64 bit little endian integer
 /// </summary>
 /// <param name="offset">Offset of the integer to write.</param>
 /// <param name="value">The integer to write</param>
 public static void WriteUInt64(this IWriteOnlyBinaryDataAccessor accessor, long offset, UInt64 value)
 {
     accessor.Write(offset, 8, BitConverter.GetBytes(value));
 }