コード例 #1
0
        /// <summary>
        /// Creates a new duplicate of a stream.
        /// </summary>
        /// <param name="source">source of the duplicate</param>
        internal DuplicateStream(Stream source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            this.source = DuplicateStream.OriginalStream(source);
        }
コード例 #2
0
        /// <summary>
        /// Retrieves the original stream from a possible duplicate stream.
        /// </summary>
        /// <param name="stream">Possible duplicate stream.</param>
        /// <returns>If the stream is a DuplicateStream, returns
        /// the duplicate's source; otherwise returns the same stream.</returns>
        internal static Stream OriginalStream(Stream stream)
        {
            DuplicateStream dupStream = stream as DuplicateStream;

            return(dupStream != null ? dupStream.Source : stream);
        }