Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void
示例#1
0
        public VorbisReader(Stream stream, bool closeStreamOnDispose)
            : this()
        {
            var bufferedStream = new BufferedReadStream(stream);
            bufferedStream.CloseBaseStream = closeStreamOnDispose;

            // try Ogg first
            var oggContainer = new Ogg.ContainerReader(bufferedStream, closeStreamOnDispose);
            if (!LoadContainer(oggContainer))
            {
                // oops, not Ogg!
                // we don't support any other container types yet, so error out
                bufferedStream.Dispose();
                throw new ArgumentException("Could not determine container type!");
            }
            _containerReader = oggContainer;

            if (_decoders.Count == 0) throw new ArgumentException("No Vorbis data found!");
        }
示例#2
0
        public VorbisReader(Stream stream, bool closeStreamOnDispose)
            : this()
        {
            BufferedReadStream bufferedReadStream = new BufferedReadStream(stream)
            {
                CloseBaseStream = closeStreamOnDispose
            };
            ContainerReader containerReader = new ContainerReader(bufferedReadStream, closeStreamOnDispose);

            if (!LoadContainer(containerReader))
            {
                bufferedReadStream.Dispose();
                throw new InvalidDataException("Could not determine container type!");
            }
            _containerReader = containerReader;
            if (_decoders.Count == 0)
            {
                throw new InvalidDataException("No Vorbis data found!");
            }
        }
        public VorbisReader(Stream stream, bool closeStreamOnDispose)
            : this()
        {
            var bufferedStream = new BufferedReadStream(stream);

            bufferedStream.CloseBaseStream = closeStreamOnDispose;

            // try Ogg first
            var oggContainer = new Ogg.ContainerReader(bufferedStream, closeStreamOnDispose);

            if (!LoadContainer(oggContainer))
            {
                // oops, not Ogg!
                // we don't support any other container types yet, so error out
                bufferedStream.Dispose();
                throw new InvalidDataException("Could not determine container type!");
            }
            _containerReader = oggContainer;

            if (_decoders.Count == 0)
            {
                throw new InvalidDataException("No Vorbis data found!");
            }
        }