Esempio n. 1
0
 public void GetStream(uint index, out ISequentialOutStream outStream, ExtractMode extractMode)
 {
     if (!files.ContainsKey(index))
     {
         outStream = null;
         mode      = ExtractMode.Skip;
         return;
     }
     if (extractMode == ExtractMode.Extract)
     {
         if (stream != null)
         {
             stream.Dispose();
         }
         current = index;
         var args = new ExtractFileEventArgs(owner.Archive, files[current], ExtractionStage.Extracting);
         owner.ExtractFile(owner, args);
         if (!args.ContinueOperation)
         {
             throw new IOException("User aborted!");
         }
         var ostream = new SevenZipOutFileStream(files[index].Destination, (long)files[index].Size, owner.priority);
         ostream.ProgressHandler += owner.ExtractProgress;
         stream = ostream;
     }
     else
     {
         if (stream != null)
         {
             stream.Dispose();
         }
         stream = new SevenZipNullStream();
     }
     outStream = stream;
     mode      = extractMode;
 }
Esempio n. 2
0
 public void GetStream(uint index, out ISequentialOutStream outStream, ExtractMode extractMode)
 {
     if (!files.ContainsKey(index)) {
       outStream = null;
       mode = ExtractMode.Skip;
       return;
     }
     if (extractMode == ExtractMode.Extract) {
       if (stream != null) {
     stream.Dispose();
       }
       current = index;
       var args = new ExtractFileEventArgs(owner.Archive, files[current], ExtractionStage.Extracting);
       owner.ExtractFile(owner, args);
       if (!args.ContinueOperation) {
     throw new IOException("User aborted!");
       }
       var ostream = new SevenZipOutFileStream(files[index].Destination, (long)files[index].Size, owner.priority);
       ostream.ProgressHandler += owner.ExtractProgress;
       stream = ostream;
     }
     else {
       if (stream != null) {
     stream.Dispose();
       }
       stream = new SevenZipNullStream();
     }
     outStream = stream;
     mode = extractMode;
 }