diff options
Diffstat (limited to 'CPP/7zip/UI/Console/UpdateCallbackConsole.h')
-rw-r--r-- | CPP/7zip/UI/Console/UpdateCallbackConsole.h | 97 |
1 files changed, 73 insertions, 24 deletions
diff --git a/CPP/7zip/UI/Console/UpdateCallbackConsole.h b/CPP/7zip/UI/Console/UpdateCallbackConsole.h index 77e0e178..ba8614eb 100644 --- a/CPP/7zip/UI/Console/UpdateCallbackConsole.h +++ b/CPP/7zip/UI/Console/UpdateCallbackConsole.h @@ -9,44 +9,91 @@ #include "PercentPrinter.h" +struct CErrorPathCodes +{ + FStringVector Paths; + CRecordVector<DWORD> Codes; + + void AddError(const FString &path, DWORD systemError) + { + Paths.Add(path); + Codes.Add(systemError); + } + void Clear() + { + Paths.Clear(); + Codes.Clear(); + } +}; + class CCallbackConsoleBase { - bool m_WarningsMode; protected: - CPercentPrinter m_PercentPrinter; + CPercentPrinter _percent; + + CStdOutStream *_so; + CStdOutStream *_se; + + void CommonError(const FString &path, DWORD systemError, bool isWarning); + + HRESULT ScanError_Base(const FString &path, DWORD systemError); + HRESULT OpenFileError_Base(const FString &name, DWORD systemError); + HRESULT ReadingFileError_Base(const FString &name, DWORD systemError); - CStdOutStream *OutStream; - HRESULT CanNotFindError_Base(const wchar_t *name, DWORD systemError); public: - bool EnablePercents; + bool NeedPercents() const { return _percent._so != NULL; }; + bool StdOutMode; + bool NeedFlush; + unsigned PercentsNameLevel; + unsigned LogLevel; + + AString _tempA; + UString _tempU; + CCallbackConsoleBase(): - m_PercentPrinter(1 << 16), StdOutMode(false), - EnablePercents(true), - m_WarningsMode(false) + NeedFlush(false), + PercentsNameLevel(1), + LogLevel(0) {} - void Init(CStdOutStream *outStream) + void SetWindowWidth(unsigned width) { _percent.MaxLen = width - 1; } + + void Init(CStdOutStream *outStream, CStdOutStream *errorStream, CStdOutStream *percentStream) { FailedFiles.Clear(); - FailedCodes.Clear(); - OutStream = outStream; - m_PercentPrinter.OutStream = outStream; + + _so = outStream; + _se = errorStream; + _percent._so = percentStream; } - UStringVector FailedFiles; - CRecordVector<HRESULT> FailedCodes; + void ClosePercents2() + { + if (NeedPercents()) + _percent.ClosePrint(true); + } + + void ClosePercents_for_so() + { + if (NeedPercents() && _so == _percent._so) + _percent.ClosePrint(false); + } + + + CErrorPathCodes FailedFiles; + CErrorPathCodes ScanErrors; + + HRESULT PrintProgress(const wchar_t *name, const char *command, bool showInLog); - UStringVector CantFindFiles; - CRecordVector<HRESULT> CantFindCodes; }; class CUpdateCallbackConsole: public IUpdateCallbackUI2, public CCallbackConsoleBase { - bool m_NeedBeClosed; - bool m_NeedNewLine; + // void PrintPropPair(const char *name, const wchar_t *val); + public: #ifndef _NO_CRYPTO bool PasswordIsDefined; @@ -54,21 +101,23 @@ public: bool AskPassword; #endif + bool DeleteMessageWasShown; + CUpdateCallbackConsole() + : DeleteMessageWasShown(false) #ifndef _NO_CRYPTO - : - PasswordIsDefined(false), - AskPassword(false) + , PasswordIsDefined(false) + , AskPassword(false) #endif {} + /* void Init(CStdOutStream *outStream) { - m_NeedBeClosed = false; - m_NeedNewLine = false; CCallbackConsoleBase::Init(outStream); } - ~CUpdateCallbackConsole() { Finilize(); } + */ + // ~CUpdateCallbackConsole() { if (NeedPercents()) _percent.ClosePrint(); } INTERFACE_IUpdateCallbackUI2(;) }; |