diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2009-08-17 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:00 +0300 |
commit | c99f3ebdd639c2adb03d8b44001b10af18516504 (patch) | |
tree | 92aaf34e5edbd7287c3f55037190da75ab0a8000 /CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp | |
parent | 829409452d85cd6dd9dfc9151f109d6e13a2bb1c (diff) |
9.06 beta
Diffstat (limited to 'CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp')
-rwxr-xr-x | CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp index e5353c21..cc561090 100755 --- a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +++ b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp @@ -19,9 +19,6 @@ static LPCWSTR kCantOpenArchive = L"Can not open the file as archive"; struct CThreadExtracting { - #ifndef _NO_PROGRESS - bool ShowProgress; - #endif CCodecs *Codecs; UString FileName; UString DestFolder; @@ -33,7 +30,7 @@ struct CThreadExtracting HRESULT Result; UString ErrorMessage; - void Process() + void Process2() { NFile::NFind::CFileInfoW fi; if (!fi.Find(FileName)) @@ -67,15 +64,19 @@ struct CThreadExtracting ExtractCallbackSpec->Init(ArchiveLink.GetArchive(), dirPath, L"Default", fi.MTime, 0); - #ifndef _NO_PROGRESS - if (ShowProgress) - ExtractCallbackSpec->ProgressDialog.WaitCreating(); - #endif Result = ArchiveLink.GetArchive()->Extract(0, (UInt32)-1 , BoolToInt(false), ExtractCallback); - #ifndef _NO_PROGRESS - if (ShowProgress) - ExtractCallbackSpec->ProgressDialog.MyClose(); - #endif + } + + void Process() + { + try + { + #ifndef _NO_PROGRESS + CProgressCloser closer(ExtractCallbackSpec->ProgressDialog); + #endif + Process2(); + } + catch(...) { Result = E_FAIL; } } static THREAD_FUNC_DECL MyThreadFunction(void *param) @@ -100,9 +101,9 @@ HRESULT ExtractArchive(CCodecs *codecs,const UString &fileName, const UString &d #ifndef _NO_PROGRESS - t.ShowProgress = showProgress; if (showProgress) { + t.ExtractCallbackSpec->ProgressDialog.IconID = IDI_ICON; NWindows::CThread thread; RINOK(thread.Create(CThreadExtracting::MyThreadFunction, &t)); @@ -112,13 +113,13 @@ HRESULT ExtractArchive(CCodecs *codecs,const UString &fileName, const UString &d #else title = NWindows::MyLoadStringW(IDS_PROGRESS_EXTRACTING); #endif - t.ExtractCallbackSpec->StartProgressDialog(title); + t.ExtractCallbackSpec->StartProgressDialog(title, thread); } else #endif { - t.Process(); + t.Process2(); } errorMessage = t.ErrorMessage; |