Esempio n. 1
0
 /// <summary>
 /// When overridden in a descendant class, returns the data stream from the Internet resource.
 /// </summary>
 /// <returns>
 /// An instance of the <see cref="T:System.IO.Stream"/> class for reading data from the Internet resource.
 /// </returns>
 /// <exception cref="T:System.NotSupportedException">Any attempt is made to access the method, when the method is not overridden in a descendant class. </exception><PermissionSet><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence"/></PermissionSet>
 /// <exception cref="FileNotFoundException"><c>FileNotFoundException</c>.</exception>
 public override Stream GetResponseStream()
 {
   Stream resultStream;
   using (Stream stream = PathHelper.GetReadStream(_archive))
   {
     using (ZipFile zipFile = new ZipFile(stream))
     {
       ZipEntry zipEntry = zipFile.GetEntry(_file);
       if (zipEntry == null)
       {
         throw new FileNotFoundException(string.Format("file {0} not found in archive {1}", _file, _archive));
       }
       using (Stream zipStream = zipFile.GetInputStream(zipEntry))
       {
         resultStream = PathHelper.GetSafeReadStream(zipStream);
       }
     }
   }
   return resultStream;
 }
Esempio n. 2
0
 /// <summary>
 /// When overridden in a descendant class, returns the data stream from the Internet resource.
 /// </summary>
 /// <returns>
 /// An instance of the <see cref="T:System.IO.Stream"/> class for reading data from the Internet resource.
 /// </returns>
 /// <exception cref="T:System.NotSupportedException">Any attempt is made to access the method, when the method is not overridden in a descendant class. </exception><PermissionSet><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence"/></PermissionSet>
 public override Stream GetResponseStream()
 {
     return(PathHelper.GetSafeReadStream(assembly.GetManifestResourceStream(_resource)));
 }