5 #include "ProgressUtils.h"
7 CLocalProgress::CLocalProgress()
9 ProgressOffset = InSize = OutSize = 0;
10 SendRatio = SendProgress = true;
13 void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain)
15 _ratioProgress.Release();
17 _progress.QueryInterface(IID_ICompressProgressInfo, &_ratioProgress);
18 _inSizeIsMain = inSizeIsMain;
21 STDMETHODIMP CLocalProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
23 UInt64 inSizeNew = InSize, outSizeNew = OutSize;
25 inSizeNew += (*inSize);
27 outSizeNew += (*outSize);
28 if (SendRatio && _ratioProgress)
30 RINOK(_ratioProgress->SetRatioInfo(&inSizeNew, &outSizeNew));
32 inSizeNew += ProgressOffset;
33 outSizeNew += ProgressOffset;
35 return _progress->SetCompleted(_inSizeIsMain ? &inSizeNew : &outSizeNew);
39 HRESULT CLocalProgress::SetCur()
41 return SetRatioInfo(NULL, NULL);