Exemplo n.º 1
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            int bytesRead = CurrentSubStream.Read(buffer, offset, count);

            if (bytesRead == 0 && count > 0)
            {
                // we reached the EOF
                Console.WriteLine("end of substream " + currentSubStreamIndex + " reached");

                if (LastSubStream)
                {
                    // we reached not only EOF, but EOF of the last stream (so we're at the very end)
                    Console.WriteLine("end of stream reached");
                    return(bytesRead);
                }

                // switch to and continue with next file stream
                CurrentSubStreamIndex++;

                return(Read(buffer, offset, count));
            }

            return(bytesRead);
        }