| 2263 |
kivins |
1 |
//---------------------------------------------------------------------------
|
|
|
2 |
|
|
|
3 |
#include <vcl.h>
|
|
|
4 |
#pragma hdrstop
|
|
|
5 |
|
|
|
6 |
#include "GenerationProperties.h"
|
|
|
7 |
//---------------------------------------------------------------------------
|
|
|
8 |
#pragma package(smart_init)
|
|
|
9 |
#pragma link "AdvDirectoryEdit"
|
|
|
10 |
#pragma link "AdvEdBtn"
|
|
|
11 |
#pragma link "AdvEdit"
|
|
|
12 |
#pragma link "AdvPanel"
|
|
|
13 |
#pragma link "advlued"
|
|
|
14 |
#pragma link "dbadvle"
|
|
|
15 |
#pragma resource "*.dfm"
|
|
|
16 |
TGenerationPropertiesForm *GenerationPropertiesForm;
|
|
|
17 |
//---------------------------------------------------------------------------
|
|
|
18 |
__fastcall TGenerationPropertiesForm::TGenerationPropertiesForm(TComponent* Owner)
|
|
|
19 |
: TForm(Owner)
|
|
|
20 |
{
|
|
|
21 |
}
|
|
|
22 |
//---------------------------------------------------------------------------
|
|
|
23 |
|
|
|
24 |
void __fastcall TGenerationPropertiesForm::FormShow(TObject *Sender)
|
|
|
25 |
{
|
|
|
26 |
TRegistry * registry = 0;
|
|
|
27 |
|
|
|
28 |
try
|
|
|
29 |
{
|
|
|
30 |
registry = new TRegistry();
|
|
|
31 |
registry->RootKey = HKEY_CURRENT_USER;
|
|
|
32 |
|
|
|
33 |
// Create the key if it doesn't exist.
|
|
|
34 |
registry->OpenKey( "Software\\ERG\\TxnTestManager", true );
|
|
|
35 |
|
|
|
36 |
AnsiString profile;
|
|
|
37 |
AnsiString securityServer;
|
|
|
38 |
AnsiString keyNumber;
|
|
|
39 |
AnsiString keyVersion;
|
|
|
40 |
AnsiString macAlgorithm;
|
|
|
41 |
|
|
|
42 |
profile = registry->ReadString( "Profile" );
|
|
|
43 |
if ( profile.IsEmpty() )
|
|
|
44 |
{
|
|
|
45 |
profile = "TDS";
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
securityServer = registry->ReadString( "SecurityServerPipe" );
|
|
|
49 |
if ( securityServer.IsEmpty() )
|
|
|
50 |
{
|
|
|
51 |
securityServer = "CryptoServer";
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
keyNumber = registry->ReadString( "KeyNumber" );
|
|
|
55 |
if ( keyNumber.IsEmpty() )
|
|
|
56 |
{
|
|
|
57 |
keyNumber = "5";
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
keyVersion = registry->ReadString( "KeyVersion" );
|
|
|
61 |
if ( keyVersion.IsEmpty() )
|
|
|
62 |
{
|
|
|
63 |
keyVersion = "-2";
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
GenerationProfileComboBox->Text = profile;
|
|
|
67 |
GenerationProfileComboBox->ItemIndex = -1;
|
|
|
68 |
int index = 0;
|
|
|
69 |
for ( index = 0; index < GenerationProfileComboBox->Items->Count; ++index )
|
|
|
70 |
{
|
|
|
71 |
if ( GenerationProfileComboBox->Items->Strings[ index ] == profile )
|
|
|
72 |
{
|
|
|
73 |
GenerationProfileComboBox->ItemIndex = index;
|
|
|
74 |
break;
|
|
|
75 |
}
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
SecurityServerPipeEdit->Text = securityServer;
|
|
|
79 |
KeyNumberEdit->Text = keyNumber;
|
|
|
80 |
KeyVersionEdit->Text = keyVersion;
|
|
|
81 |
|
|
|
82 |
macAlgorithm = registry->ReadString( "MacAlgorithm" );
|
|
|
83 |
if ( macAlgorithm.IsEmpty() )
|
|
|
84 |
{
|
|
|
85 |
macAlgorithm = "MAC";
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
for ( index = 0; index < MacAlgorithmComboBox->Items->Count; ++index )
|
|
|
89 |
{
|
|
|
90 |
if ( MacAlgorithmComboBox->Items->Strings[ index ] == macAlgorithm )
|
|
|
91 |
{
|
|
|
92 |
MacAlgorithmComboBox->ItemIndex = index;
|
|
|
93 |
break;
|
|
|
94 |
}
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
readProfile( *registry, profile );
|
|
|
98 |
}
|
|
|
99 |
__finally
|
|
|
100 |
{
|
|
|
101 |
delete registry;
|
|
|
102 |
}
|
|
|
103 |
}
|
|
|
104 |
//---------------------------------------------------------------------------
|
|
|
105 |
|
|
|
106 |
void __fastcall TGenerationPropertiesForm::OKClick(TObject *Sender)
|
|
|
107 |
{
|
|
|
108 |
TRegistry * registry = 0;
|
|
|
109 |
|
|
|
110 |
try
|
|
|
111 |
{
|
|
|
112 |
registry = new TRegistry();
|
|
|
113 |
registry->RootKey = HKEY_CURRENT_USER;
|
|
|
114 |
|
|
|
115 |
// Create the key if it doesn't exist.
|
|
|
116 |
registry->OpenKey( "Software\\ERG\\TxnTestManager", true );
|
|
|
117 |
registry->WriteString( "Profile", GenerationProfileComboBox->Text );
|
|
|
118 |
|
|
|
119 |
registry->WriteString( "SecurityServerPipe", SecurityServerPipeEdit->Text );
|
|
|
120 |
registry->WriteString( "KeyNumber", KeyNumberEdit->Text );
|
|
|
121 |
registry->WriteString( "KeyVersion", KeyVersionEdit->Text );
|
|
|
122 |
registry->WriteString( "MacAlgorithm", MacAlgorithmComboBox->Text );
|
|
|
123 |
|
|
|
124 |
if ( registry->OpenKey( GenerationProfileComboBox->Text, true ) )
|
|
|
125 |
{
|
|
|
126 |
registry->WriteString( "Folder", GenerationFolderDirectoryEdit->Text );
|
|
|
127 |
|
|
|
128 |
registry->WriteBool( "GenerateHeaders", GenerateHeadersCheckBox->Checked );
|
|
|
129 |
registry->WriteString( "DrainFilePrefix", DrainFilePrefixEdit->Text );
|
|
|
130 |
registry->WriteString( "DrainFileSuffix", DrainFileSuffixEdit->Text );
|
|
|
131 |
|
|
|
132 |
registry->WriteBool( "BuildManifest", BuildManifestCheckBox->Checked );
|
|
|
133 |
registry->WriteString( "ManifestPrefix", ManifestPrefixEdit->Text );
|
|
|
134 |
registry->WriteString( "ManifestSuffix", ManifestSuffixEdit->Text );
|
|
|
135 |
registry->WriteString( "PathmapTarget", PathmapTargetEdit->Text );
|
|
|
136 |
}
|
|
|
137 |
}
|
|
|
138 |
__finally
|
|
|
139 |
{
|
|
|
140 |
delete registry;
|
|
|
141 |
}
|
|
|
142 |
}
|
|
|
143 |
//---------------------------------------------------------------------------
|
|
|
144 |
|
|
|
145 |
void __fastcall TGenerationPropertiesForm::GenerationProfileComboBoxChange(
|
|
|
146 |
TObject *Sender)
|
|
|
147 |
{
|
|
|
148 |
TRegistry * registry = 0;
|
|
|
149 |
|
|
|
150 |
try
|
|
|
151 |
{
|
|
|
152 |
registry = new TRegistry();
|
|
|
153 |
registry->RootKey = HKEY_CURRENT_USER;
|
|
|
154 |
|
|
|
155 |
// Create the key if it doesn't exist.
|
|
|
156 |
registry->OpenKey( "Software\\ERG\\TxnTestManager", true );
|
|
|
157 |
|
|
|
158 |
readProfile( *registry, GenerationProfileComboBox->Text );
|
|
|
159 |
}
|
|
|
160 |
__finally
|
|
|
161 |
{
|
|
|
162 |
delete registry;
|
|
|
163 |
}
|
|
|
164 |
}
|
|
|
165 |
//---------------------------------------------------------------------------
|
|
|
166 |
|
|
|
167 |
void __fastcall TGenerationPropertiesForm::readProfile( TRegistry & registry, const AnsiString & profile )
|
|
|
168 |
{
|
|
|
169 |
if ( registry.OpenKey( profile, true ) )
|
|
|
170 |
{
|
|
|
171 |
AnsiString folder;
|
|
|
172 |
bool generateHeaders = true;
|
|
|
173 |
AnsiString drainFilePrefix;
|
|
|
174 |
AnsiString drainFileSuffix = ".devud";
|
|
|
175 |
bool buildManifest = true;
|
|
|
176 |
AnsiString manifestPrefix = "udMan";
|
|
|
177 |
AnsiString manifestSuffix = ".txt";
|
|
|
178 |
AnsiString pathmapTarget = "";
|
|
|
179 |
|
|
|
180 |
folder = registry.ReadString( "Folder" );
|
|
|
181 |
if ( folder.IsEmpty() )
|
|
|
182 |
{
|
|
|
183 |
folder = "../UD";
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
|
|
|
187 |
try
|
|
|
188 |
{
|
|
|
189 |
generateHeaders = registry.ReadBool( "GenerateHeaders" );
|
|
|
190 |
}
|
|
|
191 |
catch ( ... )
|
|
|
192 |
{
|
|
|
193 |
generateHeaders = true;
|
|
|
194 |
}
|
|
|
195 |
drainFilePrefix = registry.ReadString( "DrainFilePrefix" );
|
|
|
196 |
drainFileSuffix = registry.ReadString( "DrainFileSuffix" );
|
|
|
197 |
if ( drainFileSuffix.IsEmpty() )
|
|
|
198 |
{
|
|
|
199 |
drainFileSuffix = ".devud";
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
try
|
|
|
203 |
{
|
|
|
204 |
buildManifest = registry.ReadBool( "BuildManifest" );
|
|
|
205 |
}
|
|
|
206 |
catch ( ... )
|
|
|
207 |
{
|
|
|
208 |
buildManifest = false;
|
|
|
209 |
}
|
|
|
210 |
manifestPrefix = registry.ReadString( "ManifestPrefix" );
|
|
|
211 |
if ( manifestPrefix.IsEmpty() )
|
|
|
212 |
{
|
|
|
213 |
manifestPrefix = "udMan";
|
|
|
214 |
}
|
|
|
215 |
manifestSuffix = registry.ReadString( "ManifestSuffix" );
|
|
|
216 |
if ( manifestSuffix.IsEmpty() )
|
|
|
217 |
{
|
|
|
218 |
manifestSuffix = ".txt";
|
|
|
219 |
}
|
|
|
220 |
pathmapTarget = registry.ReadString( "PathmapTarget" );
|
|
|
221 |
if ( pathmapTarget.IsEmpty() )
|
|
|
222 |
{
|
|
|
223 |
pathmapTarget = "../UD";
|
|
|
224 |
}
|
|
|
225 |
folder = registry.ReadString( "Folder" );
|
|
|
226 |
if ( folder.IsEmpty() )
|
|
|
227 |
{
|
|
|
228 |
folder = "../UD";
|
|
|
229 |
}
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
GenerationFolderDirectoryEdit->Text = folder;
|
|
|
234 |
GenerateHeadersCheckBox->Checked = generateHeaders;
|
|
|
235 |
DrainFilePrefixEdit->Text = drainFilePrefix;
|
|
|
236 |
DrainFileSuffixEdit->Text = drainFileSuffix;
|
|
|
237 |
|
|
|
238 |
BuildManifestCheckBox->Checked = buildManifest;
|
|
|
239 |
ManifestPrefixEdit->Text = manifestPrefix;
|
|
|
240 |
ManifestSuffixEdit->Text = manifestSuffix;
|
|
|
241 |
PathmapTargetEdit->Text = pathmapTarget;
|
|
|
242 |
ManifestPrefixEdit->Enabled = BuildManifestCheckBox->Checked;
|
|
|
243 |
ManifestSuffixEdit->Enabled = BuildManifestCheckBox->Checked;
|
|
|
244 |
PathmapTargetEdit->Enabled = BuildManifestCheckBox->Checked;
|
|
|
245 |
}
|
|
|
246 |
}
|
|
|
247 |
//---------------------------------------------------------------------------
|
|
|
248 |
|
|
|
249 |
void __fastcall TGenerationPropertiesForm::BuildManifestCheckBoxClick(
|
|
|
250 |
TObject *Sender)
|
|
|
251 |
{
|
|
|
252 |
ManifestPrefixEdit->Enabled = BuildManifestCheckBox->Checked;
|
|
|
253 |
ManifestSuffixEdit->Enabled = BuildManifestCheckBox->Checked;
|
|
|
254 |
PathmapTargetEdit->Enabled = BuildManifestCheckBox->Checked;
|
|
|
255 |
}
|
|
|
256 |
//---------------------------------------------------------------------------
|
|
|
257 |
|