| OLD | NEW |
| (Empty) |
| 1 // ProgressUtils.h | |
| 2 | |
| 3 #include "StdAfx.h" | |
| 4 | |
| 5 #include "ProgressUtils.h" | |
| 6 | |
| 7 CLocalProgress::CLocalProgress() | |
| 8 { | |
| 9 ProgressOffset = InSize = OutSize = 0; | |
| 10 SendRatio = SendProgress = true; | |
| 11 } | |
| 12 | |
| 13 void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain) | |
| 14 { | |
| 15 _ratioProgress.Release(); | |
| 16 _progress = progress; | |
| 17 _progress.QueryInterface(IID_ICompressProgressInfo, &_ratioProgress); | |
| 18 _inSizeIsMain = inSizeIsMain; | |
| 19 } | |
| 20 | |
| 21 STDMETHODIMP CLocalProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *ou
tSize) | |
| 22 { | |
| 23 UInt64 inSizeNew = InSize, outSizeNew = OutSize; | |
| 24 if (inSize) | |
| 25 inSizeNew += (*inSize); | |
| 26 if (outSize) | |
| 27 outSizeNew += (*outSize); | |
| 28 if (SendRatio && _ratioProgress) | |
| 29 { | |
| 30 RINOK(_ratioProgress->SetRatioInfo(&inSizeNew, &outSizeNew)); | |
| 31 } | |
| 32 inSizeNew += ProgressOffset; | |
| 33 outSizeNew += ProgressOffset; | |
| 34 if (SendProgress) | |
| 35 return _progress->SetCompleted(_inSizeIsMain ? &inSizeNew : &outSizeNew); | |
| 36 return S_OK; | |
| 37 } | |
| 38 | |
| 39 HRESULT CLocalProgress::SetCur() | |
| 40 { | |
| 41 return SetRatioInfo(NULL, NULL); | |
| 42 } | |
| OLD | NEW |