public void PutInt16(int offset, Int16 value) { ms.Position = offset; if (BitConverter.IsLittleEndian && isBigEndian) { bw.Write(BigEndianTransfer.ToBytes(value)); } else { bw.Write(value); } }
public Int16 GetInt16(int offset) { if (offset + 2 > writeOffset) { throw new IndexOutOfRangeException(); } ms.Position = offset; if (BitConverter.IsLittleEndian && isBigEndian) { return(BigEndianTransfer.ToInt16(br.ReadBytes(2))); } return(br.ReadInt16()); }
public UInt32 GetUInt32(int offset) { if (offset + 4 > writeOffset) { throw new IndexOutOfRangeException(); } ms.Position = offset; if (BitConverter.IsLittleEndian && isBigEndian) { return(BigEndianTransfer.ToUInt32(br.ReadBytes(4))); } return(br.ReadUInt32()); }
public Int64 ReadInt64(int offset) { if (offset + 8 > writeOffset) { throw new IndexOutOfRangeException(); } ms.Position = offset; readOffset = offset + 8; if (BitConverter.IsLittleEndian && isBigEndian) { return(BigEndianTransfer.ToInt64(br.ReadBytes(8))); } return(br.ReadInt64()); }
public void WriteInt64(int offset, Int64 value) { if (offset + 8 > ms.Capacity) { throw new IndexOutOfRangeException(); } ms.Position = offset; writeOffset = offset + 8; if (BitConverter.IsLittleEndian && isBigEndian) { bw.Write(BigEndianTransfer.ToBytes(value)); } else { bw.Write(value); } }