ProgramDir := LeftStr (ExtractFilePath(Application.ExeName), Length(ExtractFilePath(Application.ExeName))-15);
if ProgramDir[Length(ProgramDir)] <> '/' then ProgramDir := ProgramDir + '/';
ResourceDir := ProgramDir + 'Contents/Resources/';
RapportDir := ResourceDir + 'Reports/';
UserDir := GetUserDir + 'Documents/Referee Database 5/';
LogoDir := ResourceDir + 'Logos/';
// Waar staat het bestand met de opties.
cfgFile := ResourceDir + 'Referee5_DB.xml' ;
if FileExists(cfgFile) then
begin
XMLConfig_DB.Filename := cfgFile ;
// Check version
Code := AnsiString(XMLConfig_DB.GetValue ('/DATABASE/Version/Value', ''));
k := StrToInt(Code);
v := StrToInt(Copy(Prg_Versie,1,1));
if k <> v then begin
KleurPop := Rood;
Form_Melding.Melding(mUitroep1, bOk, 'Options File is for different version. Please go to the Option Form and set all your options!!', PrgNaam);
end; // if
RefereeDBF := AnsiString(XMLConfig_DB.GetValue ('/DATABASE/Current/Value', ''));
k := XMLConfig_DB.GetValue ('/SETUP/Color/Value', 1);
case k of
0 : KleurPop := Rood;
1 : KleurPop := Oranje;
2 : KleurPop := Blauw;
3 : KleurPop := Groen;
4 : KleurPop := Paars;
5 : KleurPop := Geel;
6 : KleurPop := Zwart;
end; // case k
Shirt_Style := XMLConfig_DB.GetValue ('/SETUP/Style/Value', 1);
Cipher:= TDCP_rc4.Create(Self);
Cipher.InitStr(cfgFile,TDCP_sha256); // initialize the cipher with a hash of the passphrase
Code := AnsiString(XMLConfig_DB.GetValue ('/SETUP/Base_MS/Value', ''));
smtpHost := MyDecryption(Code);
Code := AnsiString(XMLConfig_DB.GetValue ('/SETUP/Base_MP/Value', ''));
smtpPort := MyDecryption(Code);
Code := AnsiString(XMLConfig_DB.GetValue ('/SETUP/Base_UN/Value', ''));
smtpUser := MyDecryption(Code);
Code := AnsiString(XMLConfig_DB.GetValue ('/SETUP/Base_UP/Value', ''));
smtpPassword := MyDecryption(Code);
Code := AnsiString(XMLConfig_DB.GetValue ('/SETUP/Base_NM/Value', ''));
SenderName := MyDecryption(Code);
Code := AnsiString(XMLConfig_DB.GetValue ('/SETUP/Base_NE/Value', ''));
SenderEMail := MyDecryption(Code);
Code := AnsiString(XMLConfig_DB.GetValue ('/SETUP/Base_TI/Value', ''));
SenderTitel := MyDecryption(Code);
Code := AnsiString(XMLConfig_DB.GetValue ('/SETUP/Base_RP/Value', ''));
SenderRapportEmail := MyDecryption(Code);
Cipher.Burn;
Cipher.Free;
end
else begin
KleurPop := Rood; // Standaard keuze
smtpHost := '';
smtpPort := '';
smtpUser := '';
smtpPassword := '';
SenderName := '';
SenderEMail := '';
SenderTitel := '';
SenderRapportEmail := '';
// Maak een XML-file aan.
AssignFile(F,cfgFile);
try
Rewrite(F);
Writeln(F,'<?xml version="1.0" encoding="utf-8"?>');
Writeln(F,'<REFEREE_5>');
Writeln(F,' <DATABASE>');
Writeln(F,' </DATABASE>');
Writeln(F,' <SETUP>');
Writeln(F,' <Color Value="0"/>');
Writeln(F,' </SETUP>');
Writeln(F,'</REFEREE_5>');
finally
CloseFile(F);
end; // try
end; // if