/// <summary>
        /// Wraps PackWebResponse to ensure correct lifetime handling and stream length functionality
        /// </summary>
        /// <param name="s">stream to read from (baseStream)</param>
        /// <param name="owningStream">stream under the container</param>
        /// <param name="response">response</param>
        /// <param name="container">container to hold on to</param>
        private void Init(Stream s, PackWebResponse response, Stream owningStream, Package container)
        {
            Debug.Assert(s != null, "Logic error: base stream cannot be null");
            Debug.Assert(response != null, "Logic error: response cannot be null");

            _innerStream = s;
            _response = response;
            _owningStream = owningStream;
            _container = container;
        }
Exemple #2
0
            //------------------------------------------------------
            //
            //  Internal Methods
            //
            //------------------------------------------------------

            internal CachedResponse(PackWebResponse parent, Package cacheEntry, bool cachedPackageIsThreadSafe)
            {
                _parent     = parent;
                _cacheEntry = cacheEntry;
                _cachedPackageIsThreadSafe = cachedPackageIsThreadSafe;
            }
 //------------------------------------------------------
 //
 //  Constructors
 //
 //------------------------------------------------------
 /// <summary>
 /// Wraps PackWebResponse to ensure correct lifetime handling and stream length functionality
 /// </summary>
 /// <param name="s">stream to read from (baseStream)</param>
 /// <param name="response">response</param>
 /// <param name="owningStream">stream under the package</param>
 /// <param name="container">container to hold on to</param>
 internal ResponseStream(Stream s, PackWebResponse response, Stream owningStream, Package container)
 {
     Debug.Assert(container != null, "Logic error: use other constructor for full package request streams");
     Debug.Assert(owningStream != null, "Logic error: use other constructor for full package request streams");
     Init(s, response, owningStream, container);
 }
 /// <summary>
 /// Wraps stream returned by PackWebResponse to ensure correct lifetime handlingy
 /// </summary>
 /// <param name="s">stream to read from (baseStream)</param>
 /// <param name="response">webresponse to close when we close</param>
 internal ResponseStream(Stream s, PackWebResponse response)
 {
     Init(s, response, null, null);
 }
            //------------------------------------------------------
            // 
            //  Internal Methods
            // 
            //----------------------------------------------------- 

            internal CachedResponse(PackWebResponse parent, Package cacheEntry, bool cachedPackageIsThreadSafe) 
            {
                _parent = parent;
                _cacheEntry = cacheEntry;
                _cachedPackageIsThreadSafe = cachedPackageIsThreadSafe; 
            }