internal StreamAsIBinaryStream( Stream stream ) { if( stream.NullReference() ) throw new ArgumentNullException().StoreFileLine(); if( !stream.CanRead ) throw new ArgumentException("Stream not readable!").StoreFileLine(); if( !stream.CanWrite ) throw new ArgumentException("Stream not writable!").StoreFileLine(); if( !stream.CanSeek ) throw new ArgumentException("Stream not seekable!").StoreFileLine(); this.stream = stream; this.reader = new BinaryStreamReaderLE(this.stream); this.writer = new BinaryStreamWriterLE(this.stream); }
/// <summary> /// Called when the object is being disposed of. Inheritors must call base.OnDispose to be properly disposed. /// </summary> /// <param name="disposing">If set to <c>true</c>, release both managed and unmanaged resources; otherwise release only the unmanaged resources.</param> protected override void OnDispose( bool disposing ) { if( disposing ) { //// dispose-only (i.e. non-finalizable) logic //// (managed, disposable resources you own) if( this.stream.NotNullReference() ) { this.stream.Dispose(); this.stream = null; } } //// shared cleanup logic //// (unmanaged resources) this.reader = null; this.writer = null; base.OnDispose(disposing); }