Patch level : 4.0
Files correlati : ba2 Ricompilazione Demo : [ ] Commento : ba1700 messi in minuscolo TRUE e FALSE ba2700 corretta lettura dizionari molto grandi git-svn-id: svn://10.65.10.50/trunk@14224 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fef078f901
commit
13c66f308f
138
ba/ba1700.cpp
138
ba/ba1700.cpp
@ -46,7 +46,7 @@ HIDDEN int compare_version(const char* v1, int p1, const char* v2, int p2)
|
||||
if (ver2.len() == 4)
|
||||
ver2.insert((v2[0] == '9') ? "19" : "20", 0);
|
||||
|
||||
int res = ver1.compare(ver2, -1, TRUE);
|
||||
int res = ver1.compare(ver2, -1, true);
|
||||
if (res == 0)
|
||||
res = p1 - p2;
|
||||
|
||||
@ -64,17 +64,17 @@ HIDDEN word version2year(const char* v)
|
||||
|
||||
bool is_internet_path(const TString& addr)
|
||||
{
|
||||
if (addr.compare("www.", 4, TRUE) == 0)
|
||||
return TRUE;
|
||||
if (addr.compare("www.", 4, true) == 0)
|
||||
return true;
|
||||
|
||||
if (addr.compare("http:", 5, TRUE) == 0)
|
||||
return TRUE;
|
||||
if (addr.compare("http:", 5, true) == 0)
|
||||
return true;
|
||||
|
||||
int a1, a2, a3, a4;
|
||||
if (sscanf(addr, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) == 4)
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -108,7 +108,7 @@ protected:
|
||||
|
||||
bool add_module(TConfig& ini, const TString& module, bool patch, int pos=-1);
|
||||
bool add_header(TConfig& ini, const TString& module, bool patch);
|
||||
int precheck_modules(bool only_newer=TRUE);
|
||||
int precheck_modules(bool only_newer=true);
|
||||
void update_version();
|
||||
|
||||
int needs_reboot(const TFilename& file) const;
|
||||
@ -117,7 +117,7 @@ protected:
|
||||
|
||||
bool can_install(const char* module, TInstall_ini& ini);
|
||||
void install_selection();
|
||||
bool install_patches(const TString& module, const TString& lastrelease, int lastpatch , bool onlynew=TRUE);
|
||||
bool install_patches(const TString& module, const TString& lastrelease, int lastpatch , bool onlynew=true);
|
||||
KEY askdisk(TString & path, TFilename & cmdline, int d, int dischi, const char * modulo);
|
||||
|
||||
bool do_process(TToken_string& commands) const;
|
||||
@ -178,7 +178,7 @@ bool TInstaller_mask::add_header(TConfig& ini, const TString& module, bool patch
|
||||
row = " "; // Not selected
|
||||
row.add(ini.get("Descrizione"));
|
||||
row.add(ini.get(" "));
|
||||
enable_row(add(row),FALSE);
|
||||
enable_row(add(row),false);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -260,7 +260,7 @@ int TInstaller_mask::get_module_number(const TString& module) const
|
||||
TScanner scanner(AUT_FILE);
|
||||
for (aut = 0; scanner.line() != ""; aut++)
|
||||
if (scanner.token().starts_with(module))
|
||||
{ ok = TRUE; break; }
|
||||
{ ok = true; break; }
|
||||
}
|
||||
return ok ? aut : -1;
|
||||
}
|
||||
@ -328,7 +328,7 @@ bool TInstaller_mask::autoload()
|
||||
TFilename remote_ini = http_path;
|
||||
remote_ini << TInstall_ini::default_name();
|
||||
{
|
||||
TIndwin contacting(60,TR("Connessione al server HTTP..."),FALSE,FALSE);
|
||||
TIndwin contacting(60,TR("Connessione al server HTTP..."),false,false);
|
||||
httpresult=http_get(http_server, remote_ini, ininame);
|
||||
}
|
||||
}
|
||||
@ -361,7 +361,7 @@ bool TInstaller_mask::autoload()
|
||||
{
|
||||
|
||||
if (module[0] == '_')
|
||||
add_header(ini, module, FALSE);
|
||||
add_header(ini, module, false);
|
||||
else
|
||||
{
|
||||
TFilename mod_ini = ininame.path();
|
||||
@ -370,10 +370,10 @@ bool TInstaller_mask::autoload()
|
||||
if (mod_ini.exist())
|
||||
{
|
||||
TInstall_ini moduleini(mod_ini);
|
||||
add_module(moduleini, module, FALSE);
|
||||
add_module(moduleini, module, false);
|
||||
}
|
||||
else
|
||||
add_module(ini, module, FALSE);
|
||||
add_module(ini, module, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -392,7 +392,7 @@ bool TInstaller_mask::autoload()
|
||||
CHECKS(pos >= 2, "Invalid installation configuration: ", (const char*)ininame);
|
||||
const TString16 module = ininame.mid(pos-2, 2);
|
||||
TConfig ini(ininame, module);
|
||||
add_module(ini, module, FALSE);
|
||||
add_module(ini, module, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -484,7 +484,7 @@ bool TInstaller_mask::autoload()
|
||||
}
|
||||
}
|
||||
else
|
||||
add_module(ini, module, TRUE);
|
||||
add_module(ini, module, true);
|
||||
}
|
||||
update_version();
|
||||
const bool ok = precheck_modules() > 0;
|
||||
@ -497,7 +497,7 @@ bool TInstaller_mask::autoload()
|
||||
|
||||
bool TInstaller_mask::do_process(TToken_string& commands) const
|
||||
{
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
TFilename cmd;
|
||||
for (const char* c = commands.get(0); c && ok; c = commands.get())
|
||||
{
|
||||
@ -506,7 +506,7 @@ bool TInstaller_mask::do_process(TToken_string& commands) const
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
TExternal_app app(cmd);
|
||||
ok = app.run(FALSE,3,TRUE) == 0;
|
||||
ok = app.run(false,3,true) == 0;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
@ -557,7 +557,7 @@ bool TInstaller_mask::can_install(const char* module, TInstall_ini& ini)
|
||||
altri.add("ba");
|
||||
}
|
||||
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
TString submodule;
|
||||
for (const char* mod = altri.get(0); mod && ok; mod = altri.get())
|
||||
{
|
||||
@ -663,7 +663,7 @@ bool TInstaller_mask::move_file(const TFilename& src, const TFilename& dst) cons
|
||||
|
||||
bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool update) const
|
||||
{
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
|
||||
TFilename tempdir; tempdir.tempdir();
|
||||
const TString& destdir = get(F_CURPATH);
|
||||
@ -680,7 +680,7 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
|
||||
dst.add(file->get(0));
|
||||
const bool move_ok = move_file(src, dst);
|
||||
if (!move_ok)
|
||||
ok = update = FALSE;
|
||||
ok = update = false;
|
||||
}
|
||||
if (!update)
|
||||
::remove(src);
|
||||
@ -718,14 +718,14 @@ KEY TInstaller_mask::askdisk(TString & path, TFilename & cmdline, int d, int dis
|
||||
else
|
||||
error_box(TR("Il percorso indicato non e' valido"));
|
||||
}
|
||||
} while (TRUE);
|
||||
} while (true);
|
||||
return k;
|
||||
}
|
||||
|
||||
bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
{
|
||||
bool cancelled=FALSE;
|
||||
bool ok = FALSE;
|
||||
bool cancelled=false;
|
||||
bool ok = false;
|
||||
TString msg; // stringa per i messaggi
|
||||
TString16 lastrelease; // release che sto installando
|
||||
int lastpatch=patchlevel; // patchlevel che sto installando
|
||||
@ -769,7 +769,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
if (!can_install(module, *ini))
|
||||
{
|
||||
delete ini;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
const int dischi = ini->get_int("Dischi", module);
|
||||
ok = dischi > 0;
|
||||
@ -782,7 +782,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
if (!ok)
|
||||
{
|
||||
delete ini;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// ==============
|
||||
@ -878,7 +878,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
msg << TR("Aggiornamento del modulo '") << module << TR("' in corso...");
|
||||
xvtil_statbar_set(msg);
|
||||
|
||||
ok = move_module(module, *ini, TRUE);
|
||||
ok = move_module(module, *ini, true);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
@ -956,7 +956,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
lastpatch=ini.get_int("Patch",module);
|
||||
lastrelease=ini.get("Versione",module);
|
||||
if (!can_install(module, ini))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
TString_array list;
|
||||
const int files = ini.build_complete_list(module, list);
|
||||
@ -968,7 +968,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
if (ok)
|
||||
{
|
||||
msg.cut(0) << TR("Copia del modulo ") << module;
|
||||
TProgind pi(files, msg, TRUE, TRUE);
|
||||
TProgind pi(files, msg, true, true);
|
||||
TFilename src, dst;
|
||||
for (int f = 0; f < files && ok; f++)
|
||||
{
|
||||
@ -999,7 +999,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
}
|
||||
|
||||
if (ok) // marca sull'install.ini di destinazione l'avvenuta installazione del modulo
|
||||
ini.export_module_paragraphs(module, ini.default_name(),TRUE);
|
||||
ini.export_module_paragraphs(module, ini.default_name(),true);
|
||||
} // controllo esistenza lista di file non vuota per questo modulo
|
||||
} // controllo esistenza install.ini
|
||||
} // fine installazione da directory con eseguibili
|
||||
@ -1036,15 +1036,15 @@ bool TInstaller_mask::get_internet_path(TFilename &ininame) const
|
||||
{
|
||||
ininame.tempdir();
|
||||
ininame.add("www");
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void TInstaller_mask::parse_internet_path(TString & http_server, TFilename &http_path) const
|
||||
{
|
||||
http_server = get(F_PATH);
|
||||
if (http_server.compare("http://", 7, TRUE) == 0)
|
||||
if (http_server.compare("http://", 7, true) == 0)
|
||||
http_server.ltrim(7);
|
||||
|
||||
const int slash = http_server.find('/');
|
||||
@ -1061,7 +1061,7 @@ void TInstaller_mask::parse_internet_path(TString & http_server, TFilename &http
|
||||
|
||||
bool TInstaller_mask::install_patches(const TString& module, const TString& lastrelease, int lastpatch, bool only_newer)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
TString_array modules;
|
||||
TFilename ininame;
|
||||
get_internet_path(ininame);
|
||||
@ -1095,12 +1095,12 @@ bool TInstaller_mask::update_handler(TMask_field& f, KEY k)
|
||||
TInstaller_mask& m = (TInstaller_mask&)f.mask();
|
||||
m.autoload();
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TInstaller_mask::path_handler(TMask_field& fld, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
if (key == K_TAB && fld.focusdirty())
|
||||
{
|
||||
TFilename path = fld.get();
|
||||
@ -1145,7 +1145,7 @@ void TInstaller_mask::install_selection()
|
||||
const TString newver = row->get(C_RELEASE);
|
||||
if (newver.blank())
|
||||
{
|
||||
check(r, FALSE);
|
||||
check(r, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1161,7 +1161,7 @@ void TInstaller_mask::install_selection()
|
||||
continue;
|
||||
}
|
||||
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
bool is_patch = row->get_char(C_ISPATCH) == 'X';
|
||||
bool has_patch = row->get_char(C_ISPATCH) == '+';
|
||||
const int cmp = compare_version(oldver, oldpatch, newver, newpatch);
|
||||
@ -1181,7 +1181,7 @@ void TInstaller_mask::install_selection()
|
||||
if (oldver != newver)
|
||||
ok = error_box(FR("Il modulo '%s' installato ha versione %s:\nimpossibile installare le patch della versione %s"),(const char *)modulo,(const char *)oldver,(const char *)newver);
|
||||
} else
|
||||
ok =FALSE;//error_box("Impossibile installare le patch perche' il modulo '%s' non e' installato",(const char *)modulo);
|
||||
ok =false;//error_box("Impossibile installare le patch perche' il modulo '%s' non e' installato",(const char *)modulo);
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
@ -1195,13 +1195,13 @@ void TInstaller_mask::install_selection()
|
||||
"\nRispondendo NO verranno installate le sole patch"),
|
||||
(const char *)modulo);
|
||||
else
|
||||
is_patch = FALSE; // Quando la versione installata precede la patch base devo reinstallare il modulo!
|
||||
is_patch = false; // Quando la versione installata precede la patch base devo reinstallare il modulo!
|
||||
}
|
||||
}
|
||||
|
||||
if (is_patch)
|
||||
{
|
||||
ok = install_patches(modulo, oldver, oldpatch, FALSE) ; // installa l'ultima patch
|
||||
ok = install_patches(modulo, oldver, oldpatch, false) ; // installa l'ultima patch
|
||||
if (!ok)
|
||||
message_box(TR("Impossibile installare le patch del modulo '%s'"),(const char *)modulo);
|
||||
}
|
||||
@ -1245,7 +1245,7 @@ bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
|
||||
if (_curr_mask->items() == 1)
|
||||
_curr_mask->check(0);
|
||||
const bool check_on = _curr_mask->check_enabled();
|
||||
_curr_mask->enable_check(TRUE);
|
||||
_curr_mask->enable_check(true);
|
||||
const bool some = _curr_mask->one_checked();
|
||||
_curr_mask->enable_check(check_on);
|
||||
if (some)
|
||||
@ -1253,7 +1253,7 @@ bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
|
||||
else
|
||||
error_box(TR("Selezionare uno o piu' moduli da installare."));
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1263,13 +1263,13 @@ bool TInstaller_mask::quit_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
TInstaller_mask & m=(TInstaller_mask &) f.mask();
|
||||
const bool check_on = _curr_mask->check_enabled();
|
||||
_curr_mask->enable_check(TRUE);
|
||||
_curr_mask->enable_check(true);
|
||||
const bool some = _curr_mask->one_checked();
|
||||
_curr_mask->enable_check(check_on);
|
||||
if (some)
|
||||
return noyes_box(TR("Alcuni moduli sono selezionati per l'installazione.\nConfermare l'uscita"));
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1283,15 +1283,15 @@ bool TInstaller_mask::tutti_handler(TMask_field& f, KEY k)
|
||||
if (m.one_checked())
|
||||
m.uncheck(-1);
|
||||
else
|
||||
m.precheck_modules(FALSE);
|
||||
m.precheck_modules(false);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TInstaller_mask::on_key(KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
switch (key)
|
||||
{
|
||||
case K_F7: autoload(); break;
|
||||
@ -1307,7 +1307,7 @@ TInstaller_mask::TInstaller_mask()
|
||||
0x18, 3)
|
||||
{
|
||||
_curr_mask = this;
|
||||
_installed = FALSE;
|
||||
_installed = false;
|
||||
_reboot_program= NONE;
|
||||
|
||||
add_string(F_PATH, 0, PR("Installa da "), 1, 1, 80, "", 60);
|
||||
@ -1367,16 +1367,17 @@ TInstaller_mask::~TInstaller_mask()
|
||||
class TInstaller : public TSkeleton_application
|
||||
{
|
||||
protected:
|
||||
TInstaller_mask * _m;
|
||||
TInstaller_mask* _m;
|
||||
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool use_files() const { return FALSE; }
|
||||
virtual bool use_files() const { return false; }
|
||||
virtual bool test_assistance_year() const;
|
||||
virtual void main_loop();
|
||||
|
||||
bool testdatabase() const;
|
||||
bool testprograms() const;
|
||||
void convert_archives();
|
||||
};
|
||||
|
||||
bool TInstaller::testdatabase() const
|
||||
@ -1395,7 +1396,7 @@ bool TInstaller::testprograms() const
|
||||
bool TInstaller::test_assistance_year() const
|
||||
{
|
||||
// Per il momento lascia continuare: ci pensa poi la create
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TInstaller::create()
|
||||
@ -1407,7 +1408,7 @@ bool TInstaller::create()
|
||||
dongle().login(); // Rilegge anno assistenza
|
||||
}
|
||||
else
|
||||
update_dninst(FALSE); // Aggiorna se necessario
|
||||
update_dninst(false); // Aggiorna se necessario
|
||||
|
||||
if (testprograms())
|
||||
{
|
||||
@ -1422,14 +1423,25 @@ bool TInstaller::create()
|
||||
return error_box(FR("L'utente %s non è abilitato all'uso di questo programma"), (const char *)user());
|
||||
}
|
||||
|
||||
void TInstaller::convert_archives()
|
||||
{
|
||||
bool conv = true;
|
||||
if (is_power_station())
|
||||
conv = yesno_box(TR("Si desidera convertire gli archivi ora?"));
|
||||
if (conv)
|
||||
{
|
||||
// Lancia conversione: ba1 -0 -C -uADMIN
|
||||
TExternal_app conversion("ba1 -0 -C");
|
||||
conversion.run();
|
||||
}
|
||||
}
|
||||
|
||||
void TInstaller::main_loop()
|
||||
{
|
||||
_m->run();
|
||||
if (_m->installed() && !_m->sys_installed() && testdatabase()) // Almeno 1 modulo installato ?
|
||||
{
|
||||
// Lancia conversione: ba1 -0 -C -uADMIN
|
||||
TExternal_app conversion("ba1 -0 -C");
|
||||
conversion.run();
|
||||
convert_archives();
|
||||
}
|
||||
delete _m; _m = NULL;
|
||||
}
|
||||
@ -1450,7 +1462,7 @@ bool TExtendedInstaller::create()
|
||||
dongle().login(); // Rilegge anno assistenza
|
||||
}
|
||||
else
|
||||
update_dninst(FALSE); // Aggiorna se necessario
|
||||
update_dninst(false); // Aggiorna se necessario
|
||||
|
||||
_m = new TInstaller_mask() ;
|
||||
return TSkeleton_application::create();
|
||||
@ -1460,11 +1472,7 @@ void TExtendedInstaller::main_loop()
|
||||
{
|
||||
_m->run();
|
||||
if (_m->installed() && !_m->sys_installed() && testdatabase()) // Almeno 1 modulo installato ?
|
||||
{
|
||||
// Lancia conversione: ba1 -0 -C -uADMIN
|
||||
TExternal_app conversion("ba1 -0 -C");
|
||||
conversion.run();
|
||||
}
|
||||
convert_archives();
|
||||
|
||||
const bool reboot = _m->run_ba0close();
|
||||
delete _m; _m = NULL;
|
||||
@ -1472,13 +1480,13 @@ void TExtendedInstaller::main_loop()
|
||||
if (reboot && !fexist("ba3.exe")) //e' una prima installazione (non ha ancora installato la base)
|
||||
{
|
||||
TExternal_app ba0close("ba0close.exe");
|
||||
ba0close.run(TRUE,TRUE,TRUE); // run asynchronous...
|
||||
ba0close.run(true,true,true); // run asynchronous...
|
||||
}
|
||||
}
|
||||
|
||||
int ba1700(int argc, char* argv[])
|
||||
{
|
||||
const char* const PROGNAME = "Installazione moduli";
|
||||
const char* const PROGNAME = TR("Installazione moduli");
|
||||
|
||||
if (user() != ::dongle().administrator())
|
||||
{
|
||||
|
@ -131,12 +131,13 @@ bool TDictionary::read(const char* fname)
|
||||
destroy();
|
||||
TScanner scan(_filename);
|
||||
TString ita;
|
||||
while (scan.ok())
|
||||
for (int c = 0; scan.ok(); c++)
|
||||
{
|
||||
TString& line = scan.line();
|
||||
if (line.empty())
|
||||
break;
|
||||
pi.setstatus(scan.tellg());
|
||||
if (c % 100 == 0)
|
||||
pi.setstatus(scan.tellg());
|
||||
line.trim();
|
||||
if (line.starts_with("<ita>"))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user