Ejemplo n.º 1
0
        public override long Seek(long offset, SeekOrigin origin)
        {
            switch (origin)
            {
            case SeekOrigin.Begin:
                position = offset;
                break;

            case SeekOrigin.Current:
                position += offset;
                break;

            case SeekOrigin.End:
                position  = Length;
                position += offset;
                break;
            }

            if (position >= Stream1.Length)
            {
                position = Stream1.Length + Stream2.Seek(offset - Stream1.Length, SeekOrigin.Begin);
            }
            else
            {
                position = Stream1.Seek(offset, SeekOrigin.Begin);
            }

            return(position);
        }