Beispiel #1
0
        public void WriteInt(int value)
        {
            if (BitConverter.IsLittleEndian)
            {
                value = ByteSwapper.Swap(value);
            }

            byte[] bytes = BitConverter.GetBytes(value);

            WriteBytes(bytes);
        }
        public int ReadInt()
        {
            byte[] buffer = new byte[4];
            ReadBytes(buffer);

            int value = BitConverter.ToInt32(buffer, 0);

            if (BitConverter.IsLittleEndian)
            {
                value = ByteSwapper.Swap(value);
            }

            return(value);
        }