예제 #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;
 }
예제 #2
0
            public void SetOperationResult(OperationResult resultEOperationResult)
            {
                if (mode != ExtractMode.Skip && resultEOperationResult != OperationResult.OK)
                {
                    throw new IOException(resultEOperationResult.ToString());
                }

                if (stream != null)
                {
                    stream.SetOK();
                    stream.Dispose();
                    stream = null;
                }

                if (mode == ExtractMode.Extract && owner.ExtractFile != null)
                {
                    var args = new ExtractFileEventArgs(owner.Archive, files[current], ExtractionStage.Done);
                    owner.ExtractFile(owner, args);
                    if (!args.ContinueOperation)
                    {
                        throw new IOException("User aborted!");
                    }
                }
            }
예제 #3
0
            public void SetOperationResult(OperationResult resultEOperationResult)
            {
                if (mode != ExtractMode.Skip && resultEOperationResult != OperationResult.OK) {
                  throw new IOException(resultEOperationResult.ToString());
                }

                if (stream != null) {
                  stream.SetOK();
                  stream.Dispose();
                  stream = null;
                }

                if (mode == ExtractMode.Extract && owner.ExtractFile != null) {
                  var args = new ExtractFileEventArgs(owner.Archive, files[current], ExtractionStage.Done);
                  owner.ExtractFile(owner, args);
                  if (!args.ContinueOperation) {
                throw new IOException("User aborted!");
                  }
                }
            }
예제 #4
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;
 }
예제 #5
0
파일: Main.cs 프로젝트: vaginessa/unrarit
 private void OnExtractFile(object sender, ExtractFileEventArgs e)
 {
     files.Add(e.Item.Destination.FullName);
     var fn = e.Item.Name;
     owner.BeginInvoke
     (new SetStatus(status =>
     {
       Item.SubStatus = status;
     }),
       String.Format(CultureInfo.CurrentCulture, "Extracting - {0}", fn)
     );
     if (e.Stage == ExtractionStage.Done) {
       unpackedSize += e.Item.Size;
       extractedFiles++;
     }
     e.ContinueOperation = !owner.aborted;
 }