public int GetInt(int pos) { GetStream().Seek(pos, SeekOrigin.Begin); byte[] bytes = new byte[sizeof(int)]; GetStream().Read(bytes, 0, sizeof(int)); return(BitConverterExt.BytesToInt32(bytes)); }
private void removeChecksum() { this.BaseStream.Seek(4, SeekOrigin.End); byte[] buffer = new byte[4]; this.BaseStream.Read(buffer, 0, 4); this.checksum = (uint)BitConverterExt.GetIntWithNetworkOrder(buffer); this.BaseStream.Seek(0, SeekOrigin.Begin); }
public override void Close() { base.Close(); if (this.mode.Equals(CompressionMode.Compress)) { this.stream.Write(BitConverterExt.GetBytesWithNetworkOrder((int)checksum), 0, sizeof(uint)); } if (!this.leaveOpen) { this.stream.Close(); } }
public void Write(int v, int pos) { GetStream().Seek(pos, SeekOrigin.Begin); byte[] bytes = BitConverterExt.Int32ToBytes(v); GetStream().Write(bytes, 0, bytes.Length); }