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