Patch level :10.0 setup
Files correlati : Ricompilazione Demo : [ ] Commento :modifiche per l'aggiornamento via disco git-svn-id: svn://10.65.10.50/trunk@15773 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fda95cd14e
commit
eebf489dbf
183
setup/Setup.cpp
183
setup/Setup.cpp
@ -94,6 +94,8 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
|
//metodi principali dell'applicazione
|
||||||
void OnTimer(wxTimerEvent& e);
|
void OnTimer(wxTimerEvent& e);
|
||||||
void DiskUpdate();
|
void DiskUpdate();
|
||||||
void InternetUpdate();
|
void InternetUpdate();
|
||||||
@ -101,24 +103,28 @@ protected:
|
|||||||
void NormalSetup();
|
void NormalSetup();
|
||||||
bool CampoRunning(const wxString& strAppName, const wxString& strMsg) const;
|
bool CampoRunning(const wxString& strAppName, const wxString& strMsg) const;
|
||||||
|
|
||||||
|
//metodi di interfaccia con Windows
|
||||||
bool CreateIcon(unsigned int csidl, const wxFileName& strExeFile, const wxString& strLinkName) const;
|
bool CreateIcon(unsigned int csidl, const wxFileName& strExeFile, const wxString& strLinkName) const;
|
||||||
bool CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath);
|
bool CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath);
|
||||||
void AssociateExtension(const wxFileName& strExeFile, const wxString strExt);
|
void AssociateExtension(const wxFileName& strExeFile, const wxString strExt);
|
||||||
|
|
||||||
|
//metodi di interfaccia con il registry di Windows
|
||||||
wxString ReadRootRegistryKey(const wxString strKey) const;
|
wxString ReadRootRegistryKey(const wxString strKey) const;
|
||||||
wxString ReadLocalMachineRegistryKey(const wxString strKey) const;
|
wxString ReadLocalMachineRegistryKey(const wxString strKey) const;
|
||||||
bool WriteRootRegistryKey(const wxString strKey, const wxString& strValue) const;
|
bool WriteRootRegistryKey(const wxString strKey, const wxString& strValue) const;
|
||||||
bool WriteLocalMachineRegistryKey(const wxString strKey, const wxString& strValue) const;
|
bool WriteLocalMachineRegistryKey(const wxString strKey, const wxString& strValue) const;
|
||||||
|
|
||||||
|
//metodi di utility per i vari modi di aggiornamento
|
||||||
const wxString GetSourceDir(const wxString strDirName) const;
|
const wxString GetSourceDir(const wxString strDirName) const;
|
||||||
void EmptyOutDir(const wxString& strDir) const;
|
void EmptyOutDir(const wxString& strDir) const;
|
||||||
bool UnzipModule(const wxString& strPrgLocPath, const wxString& strSrc, const wxString& strModule) const;
|
bool UnzipModule(const wxString& strPrgLocPath, const wxString& strSrc, const wxString& strModule) const;
|
||||||
bool CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCurr, const bool bIni) const;
|
bool CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCurr, const bool bIni) const;
|
||||||
|
void UpdateInstallIni(const wxString strSourcePath, const wxString strDestPath, const wxString& strModule) const;
|
||||||
void UpdateSyInstallIni(const wxString strSourcePath, const wxString strDestPath) const;
|
|
||||||
int UpdateModule(const wxString& strLocalPath, const wxString& strRemotePath, const wxString strModule) const;
|
|
||||||
|
|
||||||
bool HTTPGet(const wxString& strLocalPath, const wxString& strWebPath) const;
|
bool HTTPGet(const wxString& strLocalPath, const wxString& strWebPath) const;
|
||||||
|
|
||||||
|
//metodi di aggiornamento non standard (client, da disco e via web con installazione moduli)
|
||||||
|
int ClientUpdateModule(const wxString& strLocalPath, const wxString& strRemotePath, const wxString strModule) const;
|
||||||
|
bool DiskUpdateModule(const wxString& strLocalPath, const wxString& strWebPath, const wxString strModule) const;
|
||||||
bool InternetUpdateModule(const wxString& strLocalPath, const wxString& strWebPath, const wxString strModule) const;
|
bool InternetUpdateModule(const wxString& strLocalPath, const wxString& strWebPath, const wxString strModule) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -131,8 +137,9 @@ BEGIN_EVENT_TABLE(CampoSetup, wxApp)
|
|||||||
EVT_TIMER(883, OnTimer)
|
EVT_TIMER(883, OnTimer)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
//metodi di lettura/scrittura registry di windows (fantastici!)
|
// Metodi di lettura/scrittura registry di Windows (fantastici!)
|
||||||
|
//----------------------------------------------------------------
|
||||||
wxString CampoSetup::ReadRegistryKey(HKEY hBaseKey, const wxString strKey) const
|
wxString CampoSetup::ReadRegistryKey(HKEY hBaseKey, const wxString strKey) const
|
||||||
{
|
{
|
||||||
wxString strValue;
|
wxString strValue;
|
||||||
@ -193,6 +200,9 @@ bool CampoSetup::WriteLocalMachineRegistryKey(const wxString strKey, const wxStr
|
|||||||
return WriteRegistryKey(HKEY_LOCAL_MACHINE, strKey, strValue);
|
return WriteRegistryKey(HKEY_LOCAL_MACHINE, strKey, strValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------
|
||||||
|
// Metodi di interfaccia con Windows
|
||||||
|
//----------------------------------
|
||||||
wxString CampoSetup::GetFolderPath(unsigned int uPathID) const
|
wxString CampoSetup::GetFolderPath(unsigned int uPathID) const
|
||||||
{
|
{
|
||||||
TCHAR szPath[MAX_PATH] = wxT("");
|
TCHAR szPath[MAX_PATH] = wxT("");
|
||||||
@ -318,8 +328,9 @@ bool CampoSetup::CreateIcon(unsigned int csidl, const wxFileName& strExeFile, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
// Metodi di utility per i vari tipi di aggiornamento
|
||||||
|
//----------------------------------------------------------------
|
||||||
static int PatchCompare(const wxString& first, const wxString& second)
|
static int PatchCompare(const wxString& first, const wxString& second)
|
||||||
{
|
{
|
||||||
const wxFileName fn1(first);
|
const wxFileName fn1(first);
|
||||||
@ -347,11 +358,11 @@ const wxString CampoSetup::GetSourceDir(const wxString strDirName) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//metodo per aggiornare il modulo SY in install.ini
|
//metodo per aggiornare il modulo SY in install.ini
|
||||||
void CampoSetup::UpdateSyInstallIni(const wxString strSourcePath, const wxString strDestPath) const
|
void CampoSetup::UpdateInstallIni(const wxString strSourcePath, const wxString strDestPath, const wxString& strModule) const
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 2; j++)
|
for (int j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
wxString strParagraph = "sy";
|
wxString strParagraph = strModule;
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
strParagraph << j;
|
strParagraph << j;
|
||||||
CampoIniFile InstallIniSource(strSourcePath, strParagraph);
|
CampoIniFile InstallIniSource(strSourcePath, strParagraph);
|
||||||
@ -393,7 +404,7 @@ bool CampoSetup::UnzipModule(const wxString& strPrgLocPath, const wxString& strS
|
|||||||
//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
|
||||||
UpdateSyInstallIni(strWrk, strPrgLocPath + "/install.ini");
|
UpdateInstallIni(strWrk, strPrgLocPath + "/install.ini", "sy");
|
||||||
}
|
}
|
||||||
return uFilesToCopy > 0;
|
return uFilesToCopy > 0;
|
||||||
}
|
}
|
||||||
@ -439,8 +450,30 @@ bool CampoSetup::CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCu
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//metodo per accoppare tutti i files di una directory
|
||||||
|
void CampoSetup::EmptyOutDir(const wxString& strDir) const
|
||||||
|
{
|
||||||
|
wxArrayString asFilesList;
|
||||||
|
const size_t uFilesToKill = wxDir::GetAllFiles(strDir, &asFilesList, "*.*");
|
||||||
|
if (uFilesToKill > 0)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < uFilesToKill; i++)
|
||||||
|
{
|
||||||
|
::wxRemoveFile(asFilesList[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int CampoSetup::UpdateModule(const wxString& strLocalPath, const wxString& strRemotePath, const wxString strModule) const
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// METODI BASSO LIVELLO PER AGGIORNAMENTI NON STANDARD
|
||||||
|
//-----------------------------------------------------
|
||||||
|
//----------------------------
|
||||||
|
// 1) AGGIORNAMENTO CLIENT
|
||||||
|
//----------------------------
|
||||||
|
//Aggiornatore client. Copia i files del programma da una directory remota su un server campo nella directory...
|
||||||
|
//...locale di campo
|
||||||
|
int CampoSetup::ClientUpdateModule(const wxString& strLocalPath, const wxString& strRemotePath, const wxString strModule) const
|
||||||
{
|
{
|
||||||
int nLocVer, nLocPatch, nRemVer, nRemPatch;
|
int nLocVer, nLocPatch, nRemVer, nRemPatch;
|
||||||
{
|
{
|
||||||
@ -548,6 +581,22 @@ int CampoSetup::UpdateModule(const wxString& strLocalPath, const wxString& strRe
|
|||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------
|
||||||
|
// 2) AGGIORNAMENTO DA DISCO
|
||||||
|
//----------------------------
|
||||||
|
//Aggiornatore da disco. Copia i files delle patch da una directory su disco in una directory di appoggio...
|
||||||
|
//...temporanea dove esegue lo scompattamento con destinazione la directory locale
|
||||||
|
bool CampoSetup::DiskUpdateModule(const wxString& strLocalPath, const wxString& strDiskPath, const wxString strModule) const
|
||||||
|
{
|
||||||
|
//puo' chiamare direttamente il metodo che scompatta tutte le patch del modulo a partire dal pacco iniziale...
|
||||||
|
//...fino all'ultima;il metodo le ordina gia' in modo crescente di numero d'ordine
|
||||||
|
return UnzipModule(strLocalPath, strDiskPath, strModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------
|
||||||
|
// 3) AGGIORNAMENTO DA INTERNET
|
||||||
|
//-------------------------------
|
||||||
bool CampoSetup::HTTPGet(const wxString& strLocalPath, const wxString& strWebPath) const
|
bool CampoSetup::HTTPGet(const wxString& strLocalPath, const wxString& strWebPath) const
|
||||||
{
|
{
|
||||||
wxString strServer, strPath;
|
wxString strServer, strPath;
|
||||||
@ -572,20 +621,8 @@ bool CampoSetup::HTTPGet(const wxString& strLocalPath, const wxString& strWebPat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//metodo per accoppare tutti i files di una directory
|
//Aggiornatore via web. Copia i files delle patch da una directory web remota in una directory di appoggio...
|
||||||
void CampoSetup::EmptyOutDir(const wxString& strDir) const
|
//...temporanea dove esegue lo scompattamento con destinazione la directory locale
|
||||||
{
|
|
||||||
wxArrayString asFilesList;
|
|
||||||
const size_t uFilesToKill = wxDir::GetAllFiles(strDir, &asFilesList, "*.*");
|
|
||||||
if (uFilesToKill > 0)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < uFilesToKill; i++)
|
|
||||||
{
|
|
||||||
::wxRemoveFile(asFilesList[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CampoSetup::InternetUpdateModule(const wxString& strLocalPath, const wxString& strWebPath, const wxString strModule) const
|
bool CampoSetup::InternetUpdateModule(const wxString& strLocalPath, const wxString& strWebPath, const wxString strModule) const
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -596,11 +633,12 @@ bool CampoSetup::InternetUpdateModule(const wxString& strLocalPath, const wxStri
|
|||||||
nLocPatch = iniLocalInstall.GetInt("Patch");
|
nLocPatch = iniLocalInstall.GetInt("Patch");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Svuota,elimina e ricrea una directory temporanea di appoggio ove mettere i files delle patch da scompattare
|
||||||
|
//E' necessaria questa operazione per non trovarsi ancora files di vecchie patch parcheggiati nella dir!
|
||||||
const wxString strTempDir = wxFileName::GetTempDir() + "/setup/";
|
const wxString strTempDir = wxFileName::GetTempDir() + "/setup/";
|
||||||
EmptyOutDir(strTempDir); //deve svuotare la directory dai files per poterla eliminare
|
EmptyOutDir(strTempDir); //deve svuotare la directory dai files per poterla eliminare!!!
|
||||||
if (::wxRmdir(strTempDir))
|
if (::wxRmdir(strTempDir)) //elimina la dir adesso vuota
|
||||||
//::wxMkdir(strTempDir);
|
::wxMkDir(strTempDir); //la ricrea
|
||||||
CheckAndMakeDir(strTempDir, "setup");
|
|
||||||
|
|
||||||
const wxString strTempFile = strTempDir + "httpdir.txt";
|
const wxString strTempFile = strTempDir + "httpdir.txt";
|
||||||
if (HTTPGet(strTempFile, strWebPath))
|
if (HTTPGet(strTempFile, strWebPath))
|
||||||
@ -639,10 +677,52 @@ bool CampoSetup::InternetUpdateModule(const wxString& strLocalPath, const wxStri
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// METODI ALTO LIVELLO PER AGGIORNAMENTI NON STANDARD
|
||||||
|
//-----------------------------------------------------
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// 1) metodo per l'aggiornamento dei client di rete in automatico
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
void CampoSetup::ClientUpdate()
|
||||||
|
{
|
||||||
|
wxFileName fn(m_strSetupPath, "install.ini");
|
||||||
|
fn.AppendDir("..");
|
||||||
|
fn.MakeAbsolute();
|
||||||
|
const wxString strLocalPath = fn.GetPath();
|
||||||
|
wxString strRemotePath;
|
||||||
|
{
|
||||||
|
CampoIniFile iniLocalInstall(fn.GetFullPath(), "Main");
|
||||||
|
strRemotePath = iniLocalInstall.Get("DiskPath");
|
||||||
|
}
|
||||||
|
ClientUpdateModule(strLocalPath, strRemotePath, "sy");
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
wxSetWorkingDirectory(strLocalPath);
|
||||||
//metodo per l'aggiornamento via internet attraverso Manutenzione/Installazione moduli
|
wxExecute("ba1 -6 /uADMIN");
|
||||||
//------------------------------------------------------------------------------------
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
// 2) metodo per l'aggiornamento da disco attraverso il menu di Manutenzione/Installazione moduli
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
void CampoSetup::DiskUpdate()
|
||||||
|
{
|
||||||
|
wxFileName fn(m_strSetupPath, "install.ini");
|
||||||
|
fn.AppendDir("..");
|
||||||
|
fn.MakeAbsolute();
|
||||||
|
const wxString strLocalPath = fn.GetPath();
|
||||||
|
wxString strRemotePath;
|
||||||
|
{
|
||||||
|
CampoIniFile iniLocalInstall(fn.GetFullPath(), "Main");
|
||||||
|
strRemotePath = iniLocalInstall.Get("DiskPath");
|
||||||
|
}
|
||||||
|
DiskUpdateModule(strLocalPath, strRemotePath, "sy");
|
||||||
|
|
||||||
|
wxSetWorkingDirectory(strLocalPath);
|
||||||
|
wxExecute("ba1 -6 /uADMIN");
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
// 3) metodo per l'aggiornamento via internet attraverso Manutenzione/Installazione moduli
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
void CampoSetup::InternetUpdate()
|
void CampoSetup::InternetUpdate()
|
||||||
{
|
{
|
||||||
//install.ini locale dove setup.exe e' in esecuzione
|
//install.ini locale dove setup.exe e' in esecuzione
|
||||||
@ -667,36 +747,9 @@ void CampoSetup::InternetUpdate()
|
|||||||
wxExecute("ba1 -6 /uADMIN");
|
wxExecute("ba1 -6 /uADMIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
//metodo per l'aggiornamento dei client di rete in automatico
|
//metodo per tutte le installazioni e gli aggiornamenti automatici in locale
|
||||||
//-----------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
void CampoSetup::ClientUpdate()
|
|
||||||
{
|
|
||||||
wxFileName fn(m_strSetupPath, "install.ini");
|
|
||||||
fn.AppendDir("..");
|
|
||||||
fn.MakeAbsolute();
|
|
||||||
const wxString strLocalPath = fn.GetPath();
|
|
||||||
wxString strRemotePath;
|
|
||||||
{
|
|
||||||
CampoIniFile iniLocalInstall(fn.GetFullPath(), "Main");
|
|
||||||
strRemotePath = iniLocalInstall.Get("DiskPath");
|
|
||||||
}
|
|
||||||
UpdateModule(strLocalPath, strRemotePath, "sy");
|
|
||||||
|
|
||||||
wxSetWorkingDirectory(strLocalPath);
|
|
||||||
wxExecute("ba1 -6 /uADMIN");
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//metodo per l'aggiornamento da CD attraverso il menu di Manutenzione/Installazione moduli
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
void CampoSetup::DiskUpdate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
//metodo per tutte le installazioni e gli aggiornamenti in locale
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
void CampoSetup::NormalSetup()
|
void CampoSetup::NormalSetup()
|
||||||
{
|
{
|
||||||
m_pWizard = new CampoWizard(m_pMainFrame);
|
m_pWizard = new CampoWizard(m_pMainFrame);
|
||||||
@ -863,7 +916,7 @@ void CampoSetup::NormalSetup()
|
|||||||
} //if (!strFileCurr.IsEmpty()..
|
} //if (!strFileCurr.IsEmpty()..
|
||||||
} //for(size_t...
|
} //for(size_t...
|
||||||
|
|
||||||
UpdateSyInstallIni(strSrc + "/install.ini", strPrgLocPath + "/install.ini");
|
UpdateInstallIni(strSrc + "/install.ini", strPrgLocPath + "/install.ini", "sy");
|
||||||
|
|
||||||
// 3) INSTALLAZIONE DATI DEMO
|
// 3) INSTALLAZIONE DATI DEMO
|
||||||
//---------------------------
|
//---------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user