1// ZipRegistry.h
2
3#ifndef ZIP7_INC_ZIP_REGISTRY_H
4#define ZIP7_INC_ZIP_REGISTRY_H
5
6#include "../../../Common/MyTypes.h"
7#include "../../../Common/MyString.h"
8
9#include "../../Common/MethodProps.h"
10
11#include "ExtractMode.h"
12
13/*
14CBoolPair::Def in writing functions means:
15  if (  CBoolPair::Def ), we write CBoolPair::Val
16  if ( !CBoolPair::Def )
17  {
18    in NCompression functions we delete registry value
19    in another functions we do nothing
20  }
21*/
22
23namespace NExtract
24{
25  struct CInfo
26  {
27    NPathMode::EEnum PathMode;
28    NOverwriteMode::EEnum OverwriteMode;
29    bool PathMode_Force;
30    bool OverwriteMode_Force;
31
32    CBoolPair SplitDest;
33    CBoolPair ElimDup;
34    // CBoolPair AltStreams;
35    CBoolPair NtSecurity;
36    CBoolPair ShowPassword;
37
38    UStringVector Paths;
39
40    void Save() const;
41    void Load();
42  };
43
44  void Save_ShowPassword(bool showPassword);
45  bool Read_ShowPassword();
46}
47
48namespace NCompression
49{
50  struct CMemUse
51  {
52    // UString Str;
53    bool IsDefined;
54    bool IsPercent;
55    UInt64 Val;
56
57    CMemUse():
58      IsDefined(false),
59      IsPercent(false),
60      Val(0)
61      {}
62
63    void Clear()
64    {
65      // Str.Empty();
66      IsDefined = false;
67      IsPercent = false;
68      Val = 0;
69    }
70
71    UInt64 GetBytes(UInt64 ramSize) const
72    {
73      if (!IsPercent)
74        return Val;
75      return Calc_From_Val_Percents(ramSize, Val);
76    }
77    void Parse(const UString &s);
78  };
79
80  struct CFormatOptions
81  {
82    UInt32 Level;
83    UInt32 Dictionary;
84    // UInt32 DictionaryChain;
85    UInt32 Order;
86    UInt32 BlockLogSize;
87    UInt32 NumThreads;
88
89    UInt32 TimePrec;
90    CBoolPair MTime;
91    CBoolPair ATime;
92    CBoolPair CTime;
93    CBoolPair SetArcMTime;
94
95    CSysString FormatID;
96    UString Method;
97    UString Options;
98    UString EncryptionMethod;
99    UString MemUse;
100
101    void Reset_TimePrec()
102    {
103      TimePrec = (UInt32)(Int32)-1;
104    }
105
106    bool IsSet_TimePrec() const
107    {
108      return TimePrec != (UInt32)(Int32)-1;
109    }
110
111
112    void Reset_BlockLogSize()
113    {
114      BlockLogSize = (UInt32)(Int32)-1;
115    }
116
117    void ResetForLevelChange()
118    {
119      BlockLogSize = NumThreads = Level = Dictionary = Order = (UInt32)(Int32)-1;
120      // DictionaryChain = (UInt32)(Int32)-1;
121      Method.Empty();
122      // Options.Empty();
123      // EncryptionMethod.Empty();
124    }
125    CFormatOptions()
126    {
127      // TimePrec = 0;
128      Reset_TimePrec();
129      ResetForLevelChange();
130    }
131  };
132
133  struct CInfo
134  {
135    UInt32 Level;
136    bool ShowPassword;
137    bool EncryptHeaders;
138
139    CBoolPair NtSecurity;
140    CBoolPair AltStreams;
141    CBoolPair HardLinks;
142    CBoolPair SymLinks;
143
144    CBoolPair PreserveATime;
145
146    UString ArcType;
147    UStringVector ArcPaths;
148
149    CObjectVector<CFormatOptions> Formats;
150
151    void Save() const;
152    void Load();
153  };
154}
155
156namespace NWorkDir
157{
158  namespace NMode
159  {
160    enum EEnum
161    {
162      kSystem,
163      kCurrent,
164      kSpecified
165    };
166  }
167  struct CInfo
168  {
169    NMode::EEnum Mode;
170    bool ForRemovableOnly;
171    FString Path;
172
173    void SetForRemovableOnlyDefault() { ForRemovableOnly = true; }
174    void SetDefault()
175    {
176      Mode = NMode::kSystem;
177      Path.Empty();
178      SetForRemovableOnlyDefault();
179    }
180
181    void Save() const;
182    void Load();
183  };
184}
185
186
187struct CContextMenuInfo
188{
189  CBoolPair Cascaded;
190  CBoolPair MenuIcons;
191  CBoolPair ElimDup;
192
193  bool Flags_Def;
194  UInt32 Flags;
195  UInt32 WriteZone;
196
197  /*
198  CContextMenuInfo():
199      Flags_Def(0),
200      WriteZone((UInt32)(Int32)-1),
201      Flags((UInt32)(Int32)-1)
202      {}
203  */
204
205  void Save() const;
206  void Load();
207};
208
209#endif
210