Example #1
0
 protected void OnExtractProgress(ExtractProgressEventArgs eventArgs)
 {
     if (ExtractProgress != null)
     {
         ExtractProgress(this, eventArgs);
     }
 }
Example #2
0
        private void ExtractEntries(string folderPath, ICollection <EPFArchiveEntry> entries)
        {
            try
            {
                _extractProgressEventArgs = new ExtractProgressEventArgs();

                _extractProgressEventArgs.EventType    = ExtractProgressEventType.ExtractionStarted;
                _extractProgressEventArgs.EntriesTotal = entries.Count;
                OnExtractProgress(_extractProgressEventArgs);

                var count = 0;

                foreach (var entry in entries)
                {
                    if (entry.Archive != this)
                    {
                        throw new InvalidOperationException("At least one of enties is invalid.");
                    }

                    count++;

                    _extractProgressEventArgs.CurrentEntry = entry;
                    _extractProgressEventArgs.EventType    = ExtractProgressEventType.ExtractionBeforeReadEntry;
                    OnExtractProgress(_extractProgressEventArgs);

                    entry.ExtractTo(folderPath);

                    _extractProgressEventArgs.EventType        = ExtractProgressEventType.ExtractionAfterReadEntry;
                    _extractProgressEventArgs.EntriesExtracted = count;
                    OnExtractProgress(_extractProgressEventArgs);
                }

                _extractProgressEventArgs.EventType = ExtractProgressEventType.ExtractionCompleted;
                OnExtractProgress(_extractProgressEventArgs);
            }
            finally
            {
                _extractProgressEventArgs = null;
            }
        }