Exemple #1
0
        public void Write(int offset, uint value)
        {
            if (offset + 4 > ms.Capacity)
            {
                throw new IndexOutOfRangeException();
            }
            ms.Position = offset;
            writeOffset = offset + 4;

            if (BitConverter.IsLittleEndian && isBigEndian)
            {
                bw.Write(BigEndianTransfer.ToBytes(value));
            }
            else
            {
                bw.Write(value);
            }
        }
Exemple #2
0
        public uint GetUInt32(int offset)
        {
            if (offset + 4 > writeOffset)
            {
                throw new IndexOutOfRangeException();
            }
            ms.Position = offset;

            uint result;

            if (BitConverter.IsLittleEndian && isBigEndian)
            {
                result = BigEndianTransfer.ToUInt32(br.ReadBytes(4));
            }
            else
            {
                result = br.ReadUInt32();
            }

            return(result);
        }
Exemple #3
0
        public short GetInt16(int offset)
        {
            if (offset + 2 > writeOffset)
            {
                throw new IndexOutOfRangeException();
            }
            ms.Position = offset;

            short result;

            if (BitConverter.IsLittleEndian && isBigEndian)
            {
                result = BigEndianTransfer.ToInt16(br.ReadBytes(2));
            }
            else
            {
                result = br.ReadInt16();
            }

            return(result);
        }