1 // UpdateCallbackConsole.h
2 
3 #ifndef __UPDATE_CALLBACK_CONSOLE_H
4 #define __UPDATE_CALLBACK_CONSOLE_H
5 
6 #include "../../../Common/StdOutStream.h"
7 
8 #include "../Common/Update.h"
9 
10 #include "PercentPrinter.h"
11 
12 class CCallbackConsoleBase
13 {
14   bool m_WarningsMode;
15 protected:
16   CPercentPrinter m_PercentPrinter;
17 
18   CStdOutStream *OutStream;
19   HRESULT CanNotFindError_Base(const wchar_t *name, DWORD systemError);
20 public:
21   bool EnablePercents;
22   bool StdOutMode;
23 
CCallbackConsoleBase()24   CCallbackConsoleBase():
25       m_PercentPrinter(1 << 16),
26       StdOutMode(false),
27       EnablePercents(true),
28       m_WarningsMode(false)
29       {}
30 
Init(CStdOutStream * outStream)31   void Init(CStdOutStream *outStream)
32   {
33     FailedFiles.Clear();
34     FailedCodes.Clear();
35     OutStream = outStream;
36     m_PercentPrinter.OutStream = outStream;
37   }
38 
39   UStringVector FailedFiles;
40   CRecordVector<HRESULT> FailedCodes;
41 
42   UStringVector CantFindFiles;
43   CRecordVector<HRESULT> CantFindCodes;
44 };
45 
46 class CUpdateCallbackConsole: public IUpdateCallbackUI2, public CCallbackConsoleBase
47 {
48   bool m_NeedBeClosed;
49   bool m_NeedNewLine;
50 public:
51   #ifndef _NO_CRYPTO
52   bool PasswordIsDefined;
53   UString Password;
54   bool AskPassword;
55   #endif
56 
CUpdateCallbackConsole()57   CUpdateCallbackConsole()
58       #ifndef _NO_CRYPTO
59       :
60       PasswordIsDefined(false),
61       AskPassword(false)
62       #endif
63       {}
64 
Init(CStdOutStream * outStream)65   void Init(CStdOutStream *outStream)
66   {
67     m_NeedBeClosed = false;
68     m_NeedNewLine = false;
69     CCallbackConsoleBase::Init(outStream);
70   }
~CUpdateCallbackConsole()71   ~CUpdateCallbackConsole() { Finilize(); }
72   INTERFACE_IUpdateCallbackUI2(;)
73 };
74 
75 #endif
76