• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // OpenCallbackConsole.cpp
2 
3 #include "StdAfx.h"
4 
5 #include "OpenCallbackConsole.h"
6 
7 #include "ConsoleClose.h"
8 #include "UserInputUtils.h"
9 
CheckBreak2()10 static HRESULT CheckBreak2()
11 {
12   return NConsoleClose::TestBreakSignal() ? E_ABORT : S_OK;
13 }
14 
Open_CheckBreak()15 HRESULT COpenCallbackConsole::Open_CheckBreak()
16 {
17   return CheckBreak2();
18 }
19 
Open_SetTotal(const UInt64 * files,const UInt64 * bytes)20 HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *files, const UInt64 *bytes)
21 {
22   if (!MultiArcMode && NeedPercents())
23   {
24     if (files)
25     {
26       _totalFilesDefined = true;
27       // _totalFiles = *files;
28       _percent.Total = *files;
29     }
30     else
31       _totalFilesDefined = false;
32 
33     if (bytes)
34     {
35       // _totalBytesDefined = true;
36       _totalBytes = *bytes;
37       if (!files)
38         _percent.Total = *bytes;
39     }
40     else
41     {
42       // _totalBytesDefined = false;
43       if (!files)
44         _percent.Total = _totalBytes;
45     }
46   }
47 
48   return CheckBreak2();
49 }
50 
Open_SetCompleted(const UInt64 * files,const UInt64 * bytes)51 HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *files, const UInt64 *bytes)
52 {
53   if (!MultiArcMode && NeedPercents())
54   {
55     if (files)
56     {
57       _percent.Files = *files;
58       if (_totalFilesDefined)
59         _percent.Completed = *files;
60     }
61 
62     if (bytes)
63     {
64       if (!_totalFilesDefined)
65         _percent.Completed = *bytes;
66     }
67     _percent.Print();
68   }
69 
70   return CheckBreak2();
71 }
72 
Open_Finished()73 HRESULT COpenCallbackConsole::Open_Finished()
74 {
75   ClosePercents();
76   return S_OK;
77 }
78 
79 
80 #ifndef _NO_CRYPTO
81 
Open_CryptoGetTextPassword(BSTR * password)82 HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
83 {
84   *password = NULL;
85   RINOK(CheckBreak2());
86 
87   if (!PasswordIsDefined)
88   {
89     ClosePercents();
90     RINOK(GetPassword_HRESULT(_so, Password));
91     PasswordIsDefined = true;
92   }
93   return StringToBstr(Password, password);
94 }
95 
96 /*
97 HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(bool &passwordIsDefined, UString &password)
98 {
99   passwordIsDefined = PasswordIsDefined;
100   password = Password;
101   return S_OK;
102 }
103 
104 bool COpenCallbackConsole::Open_WasPasswordAsked()
105 {
106   return PasswordWasAsked;
107 }
108 
109 void COpenCallbackConsole::Open_Clear_PasswordWasAsked_Flag ()
110 {
111   PasswordWasAsked = false;
112 }
113 */
114 
115 #endif
116