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); } }
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); }
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); }