diff options
Diffstat (limited to '3rdparty/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp')
-rw-r--r-- | 3rdparty/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp | 83 |
1 files changed, 68 insertions, 15 deletions
diff --git a/3rdparty/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp b/3rdparty/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp index 7dba2ad5d9b..9d25a729ca0 100644 --- a/3rdparty/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +++ b/3rdparty/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp @@ -7,41 +7,93 @@ #include "ConsoleClose.h" #include "UserInputUtils.h" +static HRESULT CheckBreak2() +{ + return NConsoleClose::TestBreakSignal() ? E_ABORT : S_OK; +} + HRESULT COpenCallbackConsole::Open_CheckBreak() { - if (NConsoleClose::TestBreakSignal()) - return E_ABORT; - return S_OK; + return CheckBreak2(); } -HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *, const UInt64 *) +HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *files, const UInt64 *bytes) { - return Open_CheckBreak(); + if (!MultiArcMode && NeedPercents()) + { + if (files) + { + _totalFilesDefined = true; + // _totalFiles = *files; + _percent.Total = *files; + } + else + _totalFilesDefined = false; + + if (bytes) + { + _totalBytesDefined = true; + // _totalBytes = *bytes; + if (!files) + _percent.Total = *bytes; + } + else + _totalBytesDefined = false; + } + + return CheckBreak2(); } -HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *, const UInt64 *) +HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *files, const UInt64 *bytes) { - return Open_CheckBreak(); + if (!MultiArcMode && NeedPercents()) + { + if (files) + { + _percent.Files = *files; + if (_totalFilesDefined) + _percent.Completed = *files; + } + + if (bytes) + { + if (!_totalFilesDefined) + _percent.Completed = *bytes; + } + _percent.Print(); + } + + return CheckBreak2(); } - + +HRESULT COpenCallbackConsole::Open_Finished() +{ + ClosePercents(); + return S_OK; +} + + #ifndef _NO_CRYPTO HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password) { - PasswordWasAsked = true; - RINOK(Open_CheckBreak()); + *password = NULL; + RINOK(CheckBreak2()); + if (!PasswordIsDefined) { - Password = GetPassword(OutStream); + ClosePercents(); + Password = GetPassword(_so); PasswordIsDefined = true; } return StringToBstr(Password, password); } -HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password) +/* +HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(bool &passwordIsDefined, UString &password) { - if (PasswordIsDefined) - password = Password; + passwordIsDefined = PasswordIsDefined; + password = Password; return S_OK; } @@ -50,9 +102,10 @@ bool COpenCallbackConsole::Open_WasPasswordAsked() return PasswordWasAsked; } -void COpenCallbackConsole::Open_ClearPasswordWasAskedFlag() +void COpenCallbackConsole::Open_Clear_PasswordWasAsked_Flag () { PasswordWasAsked = false; } +*/ #endif |