2014-09-08 1 views
1

zip 폴더 안에있는 항목 추출 진행 상태를 확인하는 방법을 아는 사람이 있습니까? 내 경우에는 사용자가 추출 할 폴더를 선택할 수 있으며 전체 진행 (선택 된 디렉터리 중 하나를 추출하는 단계입니다) 및 하위 폴더에서 추출하기위한 두 번째 진행률 막대를 만들고 싶습니다. 전체 우편 번호의 진행 상황을 알고 있지만 일부 콘텐츠를 추출하려고 할 때 또는 전체 우편 번호가 아니라 ZipEntry 진행 상황에 초점을 맞추고 있습니다.DotNetZip 항목 추출 진행률

답변

1

저장 프로세스가 있지만 추출 처리를 미러링하는 것처럼 보입니다. ExtractProgress를 처리하기 위해 아래를 변경하면 매우 유사해야합니다.

private void _archive_SaveProgress(object sender, SaveProgressEventArgs e) 
{ 
    switch (e.EventType) 
    { 
     case ZipProgressEventType.Saving_BeforeWriteEntry: 
      if (e.EntriesTotal > 0) 
      { 
       // Update the view with the total percentage progress. 
       int totalPercentage = (e.EntriesSaved/e.EntriesTotal) * 100m; 
       View.SavingStatus(e.CurrentEntry.FileName, 0, totalPercentage); 
      } 
      break; 
     case ZipProgressEventType.Saving_EntryBytesRead: 
      int filePercentage = 0; 
      if (e.BytesTransferred == 0) 
      { 
       filePercentage = 0; 
      } 
      else 
      { 
       filePercentage = (new decimal(e.BytesTransferred)/new decimal(e.TotalBytesToTransfer)) * 100m; 
      } 

      // Update the view with the current file percentage. 
      View.SavingStatus("Archiving file " + e.CurrentEntry.FileName + "...", filePercentage, -1); 
      break; 
     case ZipProgressEventType.Saving_Completed: 
      View.SavingStatus("Archive creation complete, saving data changes...", 100, 100); 
      break; 
    } 
} 

경우 문의 첫 번째 부분은 진행 상황을 처리하는 : 여기

은 zip 파일을 저장할 때 나는 전체 진행 상황과 현재 파일의 진행을 모두 추적하고있어 SaveProgress 이벤트의 내 ​​처리입니다 두 번째 case 문은 현재 파일을 처리합니다. 이 경우 View.SavingStatus를 호출하면 현재 상태 텍스트로 레이블이 업데이트되고 인터페이스에서 두 개의 진행 막대가 업데이트됩니다.

+0

고맙습니다. 유용 할 것입니다;) – Sajgoniarz