private int CabCreateStatus(NativeMethods.FCI.STATUS typeStatus, uint cb1, uint cb2, IntPtr pv) { switch (typeStatus) { case NativeMethods.FCI.STATUS.FILE: if (cb2 > 0 && this.currentFileBytesProcessed < this.currentFileTotalBytes) { if (this.currentFileBytesProcessed + cb2 > this.currentFileTotalBytes) { cb2 = (uint)this.currentFileTotalBytes - (uint)this.currentFileBytesProcessed; } this.currentFileBytesProcessed += cb2; this.fileBytesProcessed += cb2; this.OnProgress(ArchiveProgressType.PartialFile); } break; case NativeMethods.FCI.STATUS.FOLDER: if (cb1 == 0) { this.currentFolderTotalBytes = cb2 - this.totalFolderBytesProcessedInCurrentCab; this.totalFolderBytesProcessedInCurrentCab = cb2; } else if (this.currentFolderTotalBytes == 0) { this.OnProgress(ArchiveProgressType.PartialArchive); } break; case NativeMethods.FCI.STATUS.CABINET: break; } return(0); }
private int CabCreateStatus(NativeMethods.FCI.STATUS typeStatus, uint cb1, uint cb2, IntPtr pv) { checked { switch (typeStatus) { case NativeMethods.FCI.STATUS.FILE: if (cb2 != 0 && currentFileBytesProcessed < currentFileTotalBytes) { if (currentFileBytesProcessed + unchecked ((long)cb2) > currentFileTotalBytes) { cb2 = (uint)currentFileTotalBytes - (uint)currentFileBytesProcessed; } currentFileBytesProcessed += cb2; fileBytesProcessed += cb2; OnProgress(ArchiveProgressType.PartialFile); } break; case NativeMethods.FCI.STATUS.FOLDER: if (cb1 == 0) { currentFolderTotalBytes = unchecked ((long)cb2) - totalFolderBytesProcessedInCurrentCab; totalFolderBytesProcessedInCurrentCab = cb2; } else if (currentFolderTotalBytes == 0L) { OnProgress(ArchiveProgressType.PartialArchive); } break; } return(0); } }
private int CabCreateStatus(NativeMethods.FCI.STATUS typeStatus, uint cb1, uint cb2, IntPtr pv) { switch (typeStatus) { case NativeMethods.FCI.STATUS.FILE: { if (cb2 > 0 && CurrentFileBytesProcessed < CurrentFileTotalBytes) { if (CurrentFileBytesProcessed + cb2 > CurrentFileTotalBytes) { cb2 = (uint)CurrentFileTotalBytes - (uint)CurrentFileBytesProcessed; } CurrentFileBytesProcessed += cb2; FileBytesProcessed += cb2; OnProgress(ArchiveProgressType.PartialFile); } break; } case NativeMethods.FCI.STATUS.FOLDER: { if (cb1 == 0) { CurrentFolderTotalBytes = cb2 - _totalFolderBytesProcessedInCurrentCab; _totalFolderBytesProcessedInCurrentCab = cb2; } else if (CurrentFolderTotalBytes == 0) { OnProgress(ArchiveProgressType.PartialArchive); } break; } case NativeMethods.FCI.STATUS.CABINET: break; } return(0); }