CrcCalculatorStream does not support Seek/Position

Jun 4, 2012 at 3:51 PM

Is it possible to change this class to support Seek/set the Position property? It seems that this class was intentionally designed not to support it, not sure why.

This is what I am trying to do. I have wave files stored into a zip file. I want to read those files into a stream (without having to write them on disk) and using the codeplex NAudio utility play them from memory. However when I use the ZipEntry.OpenReader() method it returns a CrcCalculatorStream when I pass this stream into the NAudio utility uses the Stram.Postion to read through the stream, that is when I get the exception of "Method not supported" from The Position property.

        /// <summary>
        ///   The getter for this property returns the total bytes read.
        ///   If you use the setter, it will throw
        /// <see cref="NotSupportedException"/>.
        /// </summary>
        public override long Position
        {
            get { return _Crc32.TotalBytesRead; }
            set { throw new NotSupportedException(); }
        }