コード例 #1
0
            protected override void Dispose( bool disposing )
            {
                if( disposing )
                {
                    if( this.binaryReader.NotNullReference() )
                    {
                        this.binaryReader.Close();
                        this.binaryReader = null;
                        this.binarySeekable = null;
                    }
                }

                base.Dispose(disposing);
            }
コード例 #2
0
 /// <summary>
 /// Wraps the specified <see cref="ISeekableBinaryReader"/>, in <see cref="Stream"/>.
 /// </summary>
 /// <param name="binaryReader">The <see cref="ISeekableBinaryReader"/> to wrap.</param>
 /// <param name="canSeek">Seekable streams require this explicit permission, because SetLength always throw a <see cref="NotSupportedException"/>! Use at your own risk.</param>
 /// <returns>The disposable wrapper created.</returns>
 public static Stream Wrap( ISeekableBinaryReader binaryReader, bool canSeek )
 {
     return new IBinaryReaderAsStream(binaryReader, canSeek);
 }
コード例 #3
0
            internal IBinaryReaderAsStream( IBinaryReader reader, bool allowSeeking )
            {
                if( reader.NullReference() )
                    throw new ArgumentNullException().StoreFileLine();

                this.binaryReader = reader;
                this.binarySeekable = allowSeeking ? reader as ISeekableBinaryReader : null;
            }