示例#1
0
文件: U16.cs 项目: nortex/d3sharp
        public static void WriteValueU16(this Stream stream, UInt16 value, bool littleEndian)
        {
            if (ShouldSwap(littleEndian))
            {
                value = value.Swap();
            }

            byte[] data = BitConverter.GetBytes(value);
            Debug.Assert(data.Length == 2);
            stream.Write(data, 0, 2);
        }
        public static void WriteValueU16(this Stream stream, UInt16 value, Endian endian)
        {
            if (ShouldSwap(endian) == true)
            {
                value = value.Swap();
            }

            var data = BitConverter.GetBytes(value);
            Debug.Assert(data.Length == 2);
            stream.WriteBytes(data);
        }
示例#3
0
 public static void WriteU16BE(this Stream stream, UInt16 value)
 {
     byte[] data = BitConverter.GetBytes(value.Swap());
     stream.Write(data, 0, 2);
 }