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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
// CompressDialog.h
#ifndef __COMPRESS_DIALOG_H
#define __COMPRESS_DIALOG_H
#include "Windows/Control/ComboBox.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/Edit.h"
#include "../Common/LoadCodecs.h"
#include "../Common/ZipRegistry.h"
#include "CompressDialogRes.h"
namespace NCompressDialog
{
namespace NUpdateMode
{
enum EEnum
{
kAdd,
kUpdate,
kFresh,
kSynchronize,
};
}
struct CInfo
{
NUpdateMode::EEnum UpdateMode;
bool SolidIsSpecified;
bool MultiThreadIsAllowed;
UInt64 SolidBlockSize;
UInt32 NumThreads;
CRecordVector<UInt64> VolumeSizes;
UInt32 Level;
UString Method;
UInt32 Dictionary;
bool OrderMode;
UInt32 Order;
UString Options;
UString EncryptionMethod;
bool SFXMode;
bool OpenShareForWrite;
UString ArchiveName; // in: Relative for ; out: abs
UString CurrentDirPrefix;
bool KeepName;
bool GetFullPathName(UString &result) const;
int ArchiverInfoIndex;
UString Password;
bool EncryptHeadersIsAllowed;
bool EncryptHeaders;
void Init()
{
Level = Dictionary = Order = UInt32(-1);
OrderMode = false;
Method.Empty();
Options.Empty();
EncryptionMethod.Empty();
}
CInfo()
{
Init();
}
};
}
class CCompressDialog: public NWindows::NControl::CModalDialog
{
NWindows::NControl::CComboBox m_ArchivePath;
NWindows::NControl::CComboBox m_Format;
NWindows::NControl::CComboBox m_Level;
NWindows::NControl::CComboBox m_Method;
NWindows::NControl::CComboBox m_Dictionary;
NWindows::NControl::CComboBox m_Order;
NWindows::NControl::CComboBox m_Solid;
NWindows::NControl::CComboBox m_NumThreads;
NWindows::NControl::CComboBox m_UpdateMode;
NWindows::NControl::CComboBox m_Volume;
NWindows::NControl::CDialogChildControl m_Params;
NWindows::NControl::CEdit _password1Control;
NWindows::NControl::CEdit _password2Control;
NWindows::NControl::CComboBox _encryptionMethod;
NCompression::CInfo m_RegistryInfo;
int m_PrevFormat;
void SetArchiveName(const UString &name);
int FindRegistryFormat(const UString &name);
int FindRegistryFormatAlways(const UString &name);
void CheckSFXNameChange();
void SetArchiveName2(bool prevWasSFX);
int GetStaticFormatIndex();
void SetNearestSelectComboBox(NWindows::NControl::CComboBox &comboBox, UInt32 value);
void SetLevel();
void SetMethod(int keepMethodId = -1);
int GetMethodID();
UString GetMethodSpec();
UString GetEncryptionMethodSpec();
bool IsZipFormat();
void SetEncryptionMethod();
int AddDictionarySize(UInt32 size, bool kilo, bool maga);
int AddDictionarySize(UInt32 size);
void SetDictionary();
UInt32 GetComboValue(NWindows::NControl::CComboBox &c, int defMax = 0);
UInt32 GetLevel() { return GetComboValue(m_Level); }
UInt32 GetLevelSpec() { return GetComboValue(m_Level, 1); }
UInt32 GetLevel2();
UInt32 GetDictionary() { return GetComboValue(m_Dictionary); }
UInt32 GetDictionarySpec() { return GetComboValue(m_Dictionary, 1); }
UInt32 GetOrder() { return GetComboValue(m_Order); }
UInt32 GetOrderSpec() { return GetComboValue(m_Order, 1); }
UInt32 GetNumThreadsSpec() { return GetComboValue(m_NumThreads, 1); }
UInt32 GetNumThreads2() { UInt32 num = GetNumThreadsSpec(); if (num == UInt32(-1)) num = 1; return num; }
UInt32 GetBlockSizeSpec() { return GetComboValue(m_Solid, 1); }
int AddOrder(UInt32 size);
void SetOrder();
bool GetOrderMode();
void SetSolidBlockSize();
void SetNumThreads();
UInt64 GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemory);
UInt64 GetMemoryUsage(UInt64 &decompressMemory);
void PrintMemUsage(UINT res, UInt64 value);
void SetMemoryUsage();
void SetParams();
void SaveOptionsInMem();
void UpdatePasswordControl();
bool IsShowPasswordChecked() const
{ return IsButtonChecked(IDC_COMPRESS_CHECK_SHOW_PASSWORD) == BST_CHECKED; }
int GetFormatIndex();
public:
CObjectVector<CArcInfoEx> m_ArchiverInfoList;
NCompressDialog::CInfo Info;
UString OriginalFileName; // for bzip2, gzip2
INT_PTR Create(HWND wndParent = 0)
{ return CModalDialog::Create(IDD_DIALOG_COMPRESS, wndParent); }
protected:
void CheckSFXControlsEnable();
void CheckVolumeEnable();
void CheckControlsEnable();
void OnButtonSetArchive();
bool IsSFX();
void OnButtonSFX();
virtual bool OnInit();
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnOK();
virtual void OnHelp();
};
#endif
|