blob: 927d3cd57f932fb2b5bbfd79ff6e9b4cc36beaa8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
// UpdateCallback.h
#include "StdAfx.h"
#include "Common/StringConvert.h"
#include "UpdateCallback100.h"
// #include "Windows/ProcessMessages.h"
// #include "Resource/PasswordDialog/PasswordDialog.h"
#include "MessagesDialog.h"
#include "Common/Defs.h"
using namespace NWindows;
CUpdateCallback100Imp::~CUpdateCallback100Imp()
{
if (ShowMessages && !Messages.IsEmpty())
{
CMessagesDialog messagesDialog;
messagesDialog.Messages = &Messages;
messagesDialog.Create(_parentWindow);
}
}
void CUpdateCallback100Imp::AddErrorMessage(LPCWSTR message)
{
Messages.Add(message);
}
STDMETHODIMP CUpdateCallback100Imp::SetNumFiles(UInt64 numFiles)
{
ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::SetTotal(UInt64 size)
{
ProgressDialog.ProgressSynch.SetProgress(size, 0);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 *completeValue)
{
for (;;)
{
if(ProgressDialog.ProgressSynch.GetStopped())
return E_ABORT;
if(!ProgressDialog.ProgressSynch.GetPaused())
break;
::Sleep(100);
}
if (completeValue != NULL)
ProgressDialog.ProgressSynch.SetPos(*completeValue);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
{
ProgressDialog.ProgressSynch.SetRatioInfo(inSize, outSize);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t *name)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(name);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t * /* name */)
{
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::OperationResult(Int32 /* operationResult */)
{
NumFiles++;
ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::UpdateErrorMessage(const wchar_t *message)
{
AddErrorMessage(message);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
*passwordIsDefined = BoolToInt(_passwordIsDefined);
if (!_passwordIsDefined)
{
return S_OK;
/*
CPasswordDialog dialog;
if (dialog.Create(_parentWindow) == IDCANCEL)
return E_ABORT;
_password = dialog._password;
_passwordIsDefined = true;
*/
}
*passwordIsDefined = BoolToInt(_passwordIsDefined);
CMyComBSTR tempName = _password;
*password = tempName.Detach();
return S_OK;
}
|