Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@15732 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9f480c4a3f
commit
851dbcdcd5
@ -110,6 +110,7 @@ protected:
|
|||||||
const wxString GetSourceDir(const wxString strDirName) const;
|
const wxString GetSourceDir(const wxString strDirName) const;
|
||||||
void UnzipSystem(const wxString& strPrgLocPath) const;
|
void UnzipSystem(const wxString& strPrgLocPath) const;
|
||||||
bool CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCurr, const bool bIni) const;
|
bool CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCurr, const bool bIni) const;
|
||||||
|
void UpdateSyInstallIni(const wxString strSourcePath, const wxString strDestPath) const;
|
||||||
|
|
||||||
int UpdateModule(const wxString& strLocalPath, const wxString& strRemotePath, const wxString strModule) const;
|
int UpdateModule(const wxString& strLocalPath, const wxString& strRemotePath, const wxString strModule) const;
|
||||||
|
|
||||||
@ -338,6 +339,26 @@ const wxString CampoSetup::GetSourceDir(const wxString strDirName) const
|
|||||||
return strSrc;
|
return strSrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//metodo per aggiornare il modulo SY in install.ini
|
||||||
|
void CampoSetup::UpdateSyInstallIni(const wxString strSourcePath, const wxString strDestPath) const
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 2; j++)
|
||||||
|
{
|
||||||
|
wxString strParagraph = "sy";
|
||||||
|
if (j > 0)
|
||||||
|
strParagraph << j;
|
||||||
|
CampoIniFile InstallIniSource(strSourcePath, strParagraph);
|
||||||
|
CampoIniFile InstallIniDest(strDestPath, strParagraph);
|
||||||
|
|
||||||
|
wxString strWrk;
|
||||||
|
long nIndex;
|
||||||
|
for (bool ok = InstallIniSource.GetFirstEntry(strWrk, nIndex); ok; ok = InstallIniSource.GetNextEntry(strWrk, nIndex))
|
||||||
|
{
|
||||||
|
InstallIniDest.Set(strWrk, InstallIniSource.Get(strWrk));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CampoSetup::UnzipSystem(const wxString& strPrgLocPath) const
|
void CampoSetup::UnzipSystem(const wxString& strPrgLocPath) const
|
||||||
{
|
{
|
||||||
wxArrayString asFilesList;
|
wxArrayString asFilesList;
|
||||||
@ -365,19 +386,7 @@ void CampoSetup::UnzipSystem(const wxString& strPrgLocPath) const
|
|||||||
//adesso che ha trovato quello sporco ultimo .ini prende versione e patch e le copia nell'install.ini..
|
//adesso che ha trovato quello sporco ultimo .ini prende versione e patch e le copia nell'install.ini..
|
||||||
//..nella dir dei programmi; lo fa paragrafo x paragrafo ([sy],[sy1]..)
|
//..nella dir dei programmi; lo fa paragrafo x paragrafo ([sy],[sy1]..)
|
||||||
//potrebbe sembrare assurdo un for, ma e' per futuri sottomoduli con numero > 1
|
//potrebbe sembrare assurdo un for, ma e' per futuri sottomoduli con numero > 1
|
||||||
for (int j = 0; j < 2; j++)
|
UpdateSyInstallIni(strWrk, strPrgLocPath + "/install.ini");
|
||||||
{
|
|
||||||
wxString strParagraph = "sy";
|
|
||||||
if (j > 0)
|
|
||||||
strParagraph << j;
|
|
||||||
CampoIniFile SyLastPatch(strWrk, strParagraph);
|
|
||||||
const wxString strVersion = SyLastPatch.Get("Versione");
|
|
||||||
const wxString strPatch = SyLastPatch.Get("Patch");
|
|
||||||
|
|
||||||
CampoIniFile InstallIni(strPrgLocPath + "/install.ini", strParagraph);
|
|
||||||
InstallIni.Set("Versione", strVersion);
|
|
||||||
InstallIni.Set("Patch", strPatch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,12 +472,17 @@ int CampoSetup::UpdateModule(const wxString& strLocalPath, const wxString& strRe
|
|||||||
{
|
{
|
||||||
const wxString& strParagraph = asGroups[i];
|
const wxString& strParagraph = asGroups[i];
|
||||||
CampoIniFile iniRemoteInstallModule(strRemotePath + "/install.ini", strParagraph);
|
CampoIniFile iniRemoteInstallModule(strRemotePath + "/install.ini", strParagraph);
|
||||||
|
|
||||||
|
//install.ini locale che deve essere aggiornato durante la copia dei files!
|
||||||
|
CampoIniFile iniLocalInstall(strLocalPath + "/install.ini", strParagraph);
|
||||||
|
|
||||||
//ogni file dell'elenco del sottomodulo corrente va copiato
|
//ogni file dell'elenco del sottomodulo corrente va copiato
|
||||||
for (int j = 0;; j++)
|
for (int j = 0;; j++)
|
||||||
{
|
{
|
||||||
pi.Pulse(); //magica barra modello supercar!
|
pi.Pulse(); //magica barra modello supercar!
|
||||||
|
|
||||||
wxString strCurrFile = iniRemoteInstallModule.Get(wxString::Format("File(%d)", j));
|
const wxString strVarName = wxString::Format("File(%d)", j);
|
||||||
|
wxString strCurrFile = iniRemoteInstallModule.Get(strVarName);
|
||||||
if (strCurrFile.IsEmpty())
|
if (strCurrFile.IsEmpty())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -501,11 +515,15 @@ int CampoSetup::UpdateModule(const wxString& strLocalPath, const wxString& strRe
|
|||||||
{
|
{
|
||||||
UnzipFile(strDstPath, strLocalPath + "/res");
|
UnzipFile(strDstPath, strLocalPath + "/res");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//se riesce la copia del file aggiorna l'install.ini sul file (se non lo facesse non comparirebbero...
|
||||||
|
//...eventuali nuovi files
|
||||||
|
iniLocalInstall.Set(strVarName, strCurrFile);
|
||||||
|
|
||||||
} //for(int j...
|
} //for(int j...
|
||||||
|
|
||||||
//una volta termiata la copia dei files del sottmodulo[i] scatta l'aggiornamento dell'install.ini locale...
|
//una volta termiata la copia dei files del sottmodulo[i] scatta l'aggiornamento dell'install.ini locale...
|
||||||
//...al livello versione/patch appena copiate sempre del sottomodulo[i]
|
//...al livello versione/patch appena copiate sempre del sottomodulo[i]
|
||||||
CampoIniFile iniLocalInstall(strLocalPath + "/install.ini", strParagraph);
|
|
||||||
iniLocalInstall.Set("Versione", nRemVer);
|
iniLocalInstall.Set("Versione", nRemVer);
|
||||||
iniLocalInstall.Set("Patch", nRemPatch);
|
iniLocalInstall.Set("Patch", nRemPatch);
|
||||||
|
|
||||||
@ -655,8 +673,19 @@ void CampoSetup::NormalSetup()
|
|||||||
//per ogni file da copiare controlla i path sorgente e destinazione(problema con sottodirectory tipo..
|
//per ogni file da copiare controlla i path sorgente e destinazione(problema con sottodirectory tipo..
|
||||||
//..dati); strFileCurr va lasciato qui perche' DEVE ESSERE AZZERATO ad ogni cambio file!!!!!!
|
//..dati); strFileCurr va lasciato qui perche' DEVE ESSERE AZZERATO ad ogni cambio file!!!!!!
|
||||||
wxString strFileCurr;
|
wxString strFileCurr;
|
||||||
|
|
||||||
|
//controlla se il file corrente e' dentro una sottodirectory (tipo dati,servers,setup...) oppure e' al..
|
||||||
|
//..primo livello (quindi e' un file di programma)
|
||||||
|
wxString strSourceFile = asFilesList[i].Lower();
|
||||||
|
strSourceFile.Replace("\\", "/");
|
||||||
|
//e' in una subdir se la lunghezza del suo path prima dell'ultimo '/' e' > della lunghezza del path di root
|
||||||
|
const bool bIsSubDir = strSourceFile.Find('/', true) > (int)nPathLenght;
|
||||||
|
|
||||||
|
//2A) files con subdirectory
|
||||||
|
if (bIsSubDir)
|
||||||
|
{
|
||||||
//files dei dati standard! solo in caso di nuova installazione!!
|
//files dei dati standard! solo in caso di nuova installazione!!
|
||||||
if (asFilesList[i].Lower().Find("\\dati\\") > 0)
|
if (strSourceFile.Find("\\dati\\") > 0)
|
||||||
{
|
{
|
||||||
//i DATI NON VANNO MAI installati in caso di aggiornamento!!!
|
//i DATI NON VANNO MAI installati in caso di aggiornamento!!!
|
||||||
//e nemmeno in caso si scelga di installare i dati demo (senno' sporca la dir dati e i datidemo non si installano)
|
//e nemmeno in caso si scelga di installare i dati demo (senno' sporca la dir dati e i datidemo non si installano)
|
||||||
@ -667,11 +696,8 @@ void CampoSetup::NormalSetup()
|
|||||||
strFileCurr = strDataPath;
|
strFileCurr = strDataPath;
|
||||||
strFileCurr += asFilesList[i].Mid(nPathLenght + 5);
|
strFileCurr += asFilesList[i].Mid(nPathLenght + 5);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
if (strSourceFile.Find("\\servers\\") > 0) //che fare con i servers? copiare la directory...
|
||||||
{
|
|
||||||
//che fare con i servers? copiare la directory...
|
|
||||||
if (asFilesList[i].Lower().Find("\\servers\\") > 0)
|
|
||||||
{
|
{
|
||||||
if (bInstallLurch) //..ma solo se devi installare i servers
|
if (bInstallLurch) //..ma solo se devi installare i servers
|
||||||
{
|
{
|
||||||
@ -680,12 +706,18 @@ void CampoSetup::NormalSetup()
|
|||||||
strFileCurr += asFilesList[i].Mid(nPathLenght + 8);
|
strFileCurr += asFilesList[i].Mid(nPathLenght + 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else //files dei programmi
|
else //files vari di altre subdirectory che si installano sempre (es. setup)
|
||||||
{
|
{
|
||||||
strFileCurr = strPrgLocPath;
|
strFileCurr = strPrgLocPath;
|
||||||
strFileCurr += asFilesList[i].Mid(nPathLenght);
|
strFileCurr += asFilesList[i].Mid(nPathLenght);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//2B) files senza subdirectory (programmi!)
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strFileCurr = strPrgLocPath;
|
||||||
|
strFileCurr += asFilesList[i].Mid(nPathLenght);
|
||||||
|
}
|
||||||
//copia i files nella cartella di destinazione (programmi,dati,cazzi e mazzi);se il nome del file..
|
//copia i files nella cartella di destinazione (programmi,dati,cazzi e mazzi);se il nome del file..
|
||||||
//..di destinazione e' vuoto significa che non lo deve copiare!! (es. dati in aggiornamento)
|
//..di destinazione e' vuoto significa che non lo deve copiare!! (es. dati in aggiornamento)
|
||||||
if (!strFileCurr.IsEmpty())
|
if (!strFileCurr.IsEmpty())
|
||||||
@ -700,6 +732,8 @@ void CampoSetup::NormalSetup()
|
|||||||
} //if (!strFileCurr.IsEmpty()..
|
} //if (!strFileCurr.IsEmpty()..
|
||||||
} //for(size_t...
|
} //for(size_t...
|
||||||
|
|
||||||
|
UpdateSyInstallIni(strSrc + "/install.ini", strPrgLocPath + "/install.ini");
|
||||||
|
|
||||||
// 3) INSTALLAZIONE DATI DEMO
|
// 3) INSTALLAZIONE DATI DEMO
|
||||||
//---------------------------
|
//---------------------------
|
||||||
//installazione dei dati dimostrativi (che schifo!).Non si puo' fare in aggiornamento!
|
//installazione dei dati dimostrativi (che schifo!).Non si puo' fare in aggiornamento!
|
||||||
@ -777,7 +811,6 @@ void CampoSetup::NormalSetup()
|
|||||||
CampoInstall.Set("DiskPath", m_pWizard->GetPrgNetPath());
|
CampoInstall.Set("DiskPath", m_pWizard->GetPrgNetPath());
|
||||||
else //e' il path assoluto dell'install.ini che sta in 'program' (es. D:\program)
|
else //e' il path assoluto dell'install.ini che sta in 'program' (es. D:\program)
|
||||||
{
|
{
|
||||||
wxFileName strSourcePath(m_strSetupPath + "/install.ini");
|
|
||||||
const wxString strSrc = GetSourceDir("program");
|
const wxString strSrc = GetSourceDir("program");
|
||||||
CampoInstall.Set("DiskPath", strSrc);
|
CampoInstall.Set("DiskPath", strSrc);
|
||||||
}
|
}
|
||||||
|
104
setup/utils.cpp
104
setup/utils.cpp
@ -98,43 +98,115 @@ bool WarningBox(const wxString str)
|
|||||||
|
|
||||||
//classe per gestire i .Ini di campo
|
//classe per gestire i .Ini di campo
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
CampoIniFile::CampoIniFile(const wxString strIniPath, const wxString strParagraph)
|
bool CampoIniFile::GetFirstGroup(wxString& strGroup, long& nIndex)
|
||||||
: wxFileConfig (wxEmptyString, wxEmptyString, strIniPath, wxEmptyString,
|
|
||||||
wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS)
|
|
||||||
{
|
{
|
||||||
if (!strParagraph.IsEmpty())
|
m_asGroups.Clear();
|
||||||
SetPath(strParagraph);
|
|
||||||
|
char bufferone[1024*16];
|
||||||
|
::GetPrivateProfileSectionNames(bufferone, sizeof(bufferone), m_strIniName);
|
||||||
|
const char* inizio = bufferone;
|
||||||
|
for (const char* b = bufferone; ; b++) if (*b == '\0')
|
||||||
|
{
|
||||||
|
if (*inizio)
|
||||||
|
{
|
||||||
|
m_asGroups.Add(inizio);
|
||||||
|
inizio = b+1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
nIndex = 0;
|
||||||
|
return GetNextGroup(strGroup, nIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CampoIniFile::GetNextGroup(wxString& strGroup, long& nIndex)
|
||||||
|
{
|
||||||
|
const bool ok = nIndex >= 0 && nIndex < (long)m_asGroups.GetCount();
|
||||||
|
if (ok)
|
||||||
|
strGroup = m_asGroups[nIndex++];
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CampoIniFile::DeleteGroup(const wxString strGroup)
|
||||||
|
{
|
||||||
|
return WritePrivateProfileString(m_strGroup, NULL, NULL, m_strIniName) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CampoIniFile::GetFirstEntry(wxString& strEntry, long& nIndex)
|
||||||
|
{
|
||||||
|
m_asEntries.Clear();
|
||||||
|
|
||||||
|
char bufferone[1024*32];
|
||||||
|
::GetPrivateProfileSection(m_strGroup, bufferone, sizeof(bufferone), m_strIniName);
|
||||||
|
const char* pInizio = bufferone;
|
||||||
|
for (const char* b = bufferone; ; b++) if (*b == '\0')
|
||||||
|
{
|
||||||
|
if (*pInizio)
|
||||||
|
{
|
||||||
|
wxString strWrk = pInizio;
|
||||||
|
strWrk = strWrk.BeforeFirst('=');
|
||||||
|
strWrk.Trim();
|
||||||
|
//prende solo il nome della variabile per completare la lista! dopo l'= ci sarebbe il valore
|
||||||
|
m_asEntries.Add(strWrk);
|
||||||
|
pInizio = b+1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
nIndex = 0;
|
||||||
|
return GetNextEntry(strEntry, nIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CampoIniFile::GetNextEntry(wxString& strEntry, long& nIndex)
|
||||||
|
{
|
||||||
|
const bool ok = nIndex >= 0 && nIndex < (long)m_asEntries.GetCount();
|
||||||
|
if (ok)
|
||||||
|
strEntry = m_asEntries[nIndex++];
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString CampoIniFile::Get(const wxString strVariable) const
|
wxString CampoIniFile::Get(const wxString strVariable) const
|
||||||
{
|
{
|
||||||
return Read(strVariable);
|
wxString strOutString;
|
||||||
|
char* buffer = strOutString.GetWriteBuf(256);
|
||||||
|
GetPrivateProfileString(m_strGroup, strVariable, "", buffer, 256, m_strIniName);
|
||||||
|
strOutString.UngetWriteBuf(); //sblocca la memoria senno' la stringa resta per sempre!!!
|
||||||
|
|
||||||
|
return strOutString;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CampoIniFile::GetBool(const wxString strVariable) const
|
bool CampoIniFile::GetBool(const wxString strVariable) const
|
||||||
{
|
{
|
||||||
wxString strBool = Get(strVariable);
|
const char chVal = Get(strVariable)[0];
|
||||||
return strBool == "X" || strBool == "Y";
|
return chVal == 'X' || chVal == 'Y' || chVal == '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
int CampoIniFile::GetInt(const wxString strVariable) const
|
int CampoIniFile::GetInt(const wxString strVariable) const
|
||||||
{
|
{
|
||||||
wxString str = Get(strVariable);
|
return atoi(Get(strVariable));
|
||||||
long val = 0;
|
|
||||||
str.ToLong(&val);
|
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CampoIniFile::Set(const wxString strVariable, const wxString strValue)//, const wxString strParagraph) const
|
bool CampoIniFile::Set(const wxString strVariable, const wxString strValue)
|
||||||
{
|
{
|
||||||
return Write(strVariable, strValue);
|
return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CampoIniFile::Set(const wxString strVariable, const int uValue)//, const wxString strParagraph) const
|
bool CampoIniFile::Set(const wxString strVariable, const int uValue)
|
||||||
{
|
{
|
||||||
return Write(strVariable, uValue);
|
wxString strValue;
|
||||||
|
strValue << uValue;
|
||||||
|
return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//costruttore
|
||||||
|
CampoIniFile::CampoIniFile(const wxString strIniPath, wxString strGroup)
|
||||||
|
: m_strIniName(strIniPath), m_strGroup(strGroup)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//metodo per sapere che cavolo di tipo di installazione sta esaminando (serve per leggere e scrivere...
|
//metodo per sapere che cavolo di tipo di installazione sta esaminando (serve per leggere e scrivere...
|
||||||
//...correttamente il campo.ini
|
//...correttamente il campo.ini
|
||||||
InstallationType CampoIniFile::GetInstallationType() const
|
InstallationType CampoIniFile::GetInstallationType() const
|
||||||
|
@ -7,6 +7,28 @@ enum InstallationType { it_none, it_standalone, it_server, it_client, it_upgrade
|
|||||||
enum LurchMode {lm_none, lm_service, lm_autostart};
|
enum LurchMode {lm_none, lm_service, lm_autostart};
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//Classe per la gestione dei files di configurazione tipo campo.ini
|
//Classe per la gestione dei files di configurazione tipo campo.ini
|
||||||
|
class CampoIniFile : public wxObject
|
||||||
|
{
|
||||||
|
wxString m_strIniName, m_strGroup;
|
||||||
|
wxArrayString m_asGroups, m_asEntries;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool GetFirstGroup(wxString& strGroup, long& nIndex);
|
||||||
|
bool GetNextGroup(wxString& strGroup, long& nIndex);
|
||||||
|
bool DeleteGroup(const wxString strGroup);
|
||||||
|
bool GetFirstEntry(wxString& strEntry, long& nIndex);
|
||||||
|
bool GetNextEntry(wxString& strEntry, long& nIndex);
|
||||||
|
|
||||||
|
wxString Get(const wxString strVariable) const;
|
||||||
|
bool GetBool(const wxString strVariable) const;
|
||||||
|
int GetInt (const wxString strVariable) const;
|
||||||
|
bool Set(const wxString strVariable, const wxString strValue);
|
||||||
|
InstallationType GetInstallationType() const;
|
||||||
|
bool Set(const wxString strVariable, const int uValue);
|
||||||
|
|
||||||
|
CampoIniFile(const wxString strIniPath, wxString strGroup);
|
||||||
|
};
|
||||||
|
/*
|
||||||
class CampoIniFile : public wxFileConfig
|
class CampoIniFile : public wxFileConfig
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -20,6 +42,7 @@ public:
|
|||||||
|
|
||||||
CampoIniFile(const wxString strIniPath, wxString strValue);
|
CampoIniFile(const wxString strIniPath, wxString strValue);
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
bool ErrorBox(const wxString str);
|
bool ErrorBox(const wxString str);
|
||||||
|
@ -424,7 +424,7 @@ CampoWizardPage3::CampoWizardPage3(wxWizard* parent) : CampoWizardPage(parent)
|
|||||||
asCampi.Add("Nuova installazione");
|
asCampi.Add("Nuova installazione");
|
||||||
m_pRadioBox = new wxRadioBox(this, 301, "Selezionare l'installazione da aggiornare (consigliato) o Nuova installazione",
|
m_pRadioBox = new wxRadioBox(this, 301, "Selezionare l'installazione da aggiornare (consigliato) o Nuova installazione",
|
||||||
wxDefaultPosition, wxDefaultSize, asCampi, 0, wxRA_SPECIFY_ROWS);
|
wxDefaultPosition, wxDefaultSize, asCampi, 0, wxRA_SPECIFY_ROWS);
|
||||||
if (prechecked > 0)
|
if (prechecked >= 0)
|
||||||
m_pRadioBox->SetSelection(prechecked);
|
m_pRadioBox->SetSelection(prechecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user