Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@15662 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
860283dd97
commit
107df0858c
@ -3,6 +3,7 @@
|
||||
|
||||
#ifdef WIN32
|
||||
#include <shlobj.h>
|
||||
#include <lm.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -34,6 +35,53 @@ wxString GetDefaultDestination()
|
||||
return strDest;
|
||||
}
|
||||
|
||||
//Magico metodo per stabilire se una directory e' condivisa!!
|
||||
bool IsWriteShared (const wxString& strDir)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
wxString strDataDir = strDir.Lower();
|
||||
strDataDir.Replace ("/", "\\");
|
||||
|
||||
UINT nDataDriveType = GetDriveType(strDataDir.Left(3));
|
||||
|
||||
//l'area dati e' su un disco locale?
|
||||
if (nDataDriveType == DRIVE_FIXED)
|
||||
{
|
||||
NET_API_STATUS res = ERROR_MORE_DATA;
|
||||
while (res==ERROR_MORE_DATA && !found)
|
||||
{
|
||||
PSHARE_INFO_502 shi;
|
||||
DWORD nEntriesRead =0, nTotalEntries = 0, nResume = 0;
|
||||
res = NetShareEnum(NULL, 502, (LPBYTE *)&shi, -1, &nEntriesRead, &nTotalEntries, &nResume);
|
||||
if(res == ERROR_SUCCESS || res == ERROR_MORE_DATA)
|
||||
{
|
||||
for (DWORD i = 0; i < nEntriesRead; i++)
|
||||
{
|
||||
/*Oh ignaro programmatore, questa parte commentata utilizza funzioni native di windows che non si sono riuscite..
|
||||
..a far funzionare! Se osi, prova la tua forza rendendole utili!
|
||||
//la directory dei dati deve essere leggibile,scrivibile,e filecreabile
|
||||
int Result = NetShareGetInfo(NULL, shi[i].shi502_netname, 502, (LPBYTE *)&shi[i]);
|
||||
if (shi[i].shi502_permissions & (PERM_FILE_READ | PERM_FILE_WRITE | PERM_FILE_CREATE))*/
|
||||
{
|
||||
wxString strPath(shi[i].shi502_path);
|
||||
strPath.MakeLower();
|
||||
//se trova la directory di studio condivisa ed e' su disco locale -> server
|
||||
if (strDir.StartsWith(strPath))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
NetApiBufferFree(shi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
|
||||
}
|
||||
|
||||
//finestre per messaggi vari
|
||||
//---------------------------------------------------------------------------------
|
||||
bool ErrorBox(const wxString str)
|
||||
@ -88,19 +136,25 @@ bool CampoIniFile::Set(const wxString strVariable, const int uValue)//, const wx
|
||||
return Write(strVariable, uValue);
|
||||
}
|
||||
|
||||
int CampoIniFile::GetInstallationType() const
|
||||
//metodo per sapere che cavolo di tipo di installazione sta esaminando (serve per leggere e scrivere...
|
||||
//...correttamente il campo.ini
|
||||
int CampoIniFile::GetInstallationTypeNumber() const
|
||||
{
|
||||
int nType = GetInt("Type");
|
||||
if (nType < 1 || nType > 3)
|
||||
{
|
||||
const bool bTestDataBase = GetBool("TestDatabase");
|
||||
const bool bTestPrograms = GetBool("TestPrograms");
|
||||
nType = 1;
|
||||
if (bTestDataBase)
|
||||
nType = 1; //di base e' standalone
|
||||
if (bTestDataBase) //se puo' manipolare i dati e' StandAlone o Server..
|
||||
{
|
||||
nType = 2;
|
||||
//ma e' Standalone o Server?
|
||||
//se la directory dei dati e' condivisa in scrittura e' un server (almeno al 99%)
|
||||
const wxString strStudy = Get("Study");
|
||||
if (IsWriteShared(strStudy))
|
||||
nType = 2; //e' server
|
||||
}
|
||||
else
|
||||
else //..senno' e' client
|
||||
nType = 3;
|
||||
}
|
||||
return nType;
|
||||
|
@ -11,7 +11,7 @@ public:
|
||||
bool GetBool(const wxString strVariable) const;
|
||||
int GetInt (const wxString strVariable) const;
|
||||
bool Set(const wxString strVariable, const wxString strValue);
|
||||
int GetInstallationType() const;
|
||||
int GetInstallationTypeNumber() const;
|
||||
bool Set(const wxString strVariable, const int uValue);
|
||||
|
||||
CampoIniFile(const wxString strIniPath, wxString strValue);
|
||||
|
@ -243,19 +243,13 @@ bool CampoWizardPage3::ForwardValidate()
|
||||
//analizza il campo.ini dell'installazione selezionata (si usa < perche' l'ultima row e' la nuova installazione!)
|
||||
if (iSelectedRow < iLastRow)
|
||||
{
|
||||
strPrgPath = m_pRadioBox->GetStringSelection();
|
||||
strPrgPath = m_pRadioBox->GetStringSelection().BeforeLast('(');
|
||||
strPrgPath.Trim();
|
||||
CampoIniFile CampoIni(strPrgPath + "/campo.ini", "Main");
|
||||
|
||||
//cerca il tipo dell'installazione
|
||||
int nType = CampoIni.GetInt("Type");
|
||||
//se non trova Type (vecchia versione) prova con testdatabase e testprograms
|
||||
if (nType == 0)
|
||||
{
|
||||
//non si puo' aggiornare un client da cd!! va fatto dal programma
|
||||
const bool bTestPrograms = CampoIni.GetBool("TestPrograms");
|
||||
if (bTestPrograms)
|
||||
nType = 3;
|
||||
}
|
||||
int nType = CampoIni.GetInstallationTypeNumber();
|
||||
|
||||
//se risulta un client...
|
||||
if (nType == 3)
|
||||
{
|
||||
@ -338,17 +332,33 @@ CampoWizardPage3::CampoWizardPage3(wxWizard* parent) : CampoWizardPage(parent)
|
||||
strCampoAut << "/campo.aut";
|
||||
if (wxFileName::FileExists(strCampoIni) && wxFileName::FileExists(strCampoAut))
|
||||
{
|
||||
asCampi.Add(strPath);
|
||||
//cerca l'eventuale installazione server se ci sono piu' installazioni sulla stessa macchina
|
||||
if (prechecked < 0)
|
||||
//controlla il tipo di installazione rilevata (Standalone,Server,Client)
|
||||
CampoIniFile iniCampo(strCampoIni, "Main");
|
||||
const int nType = iniCampo.GetInstallationTypeNumber();
|
||||
switch (nType)
|
||||
{
|
||||
CampoIniFile iniCampo(strCampoIni, "Main");
|
||||
const int nType = iniCampo.GetInstallationType();
|
||||
case 1:
|
||||
strPath << " (Standard)";
|
||||
break;
|
||||
case 2:
|
||||
strPath << " (Server)";
|
||||
break;
|
||||
case 3:
|
||||
strPath << " (Client)";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
asCampi.Add(strPath);
|
||||
//prechecca l'eventuale installazione server o standalone se ci sono piu' installazioni..
|
||||
//..sulla stessa macchina
|
||||
if (prechecked < 0)
|
||||
{
|
||||
if (nType == 1 || nType == 2)
|
||||
prechecked = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //if(wxFileName::...
|
||||
} //for(unsigned int i=0...
|
||||
|
||||
wxString strTitle, strBody;
|
||||
//se non ci sono delle installazioni da aggiornare propone solo installazioni..
|
||||
@ -378,10 +388,7 @@ CampoWizardPage3::CampoWizardPage3(wxWizard* parent) : CampoWizardPage(parent)
|
||||
if (prechecked > 0)
|
||||
m_pRadioBox->SetSelection(prechecked);
|
||||
}
|
||||
|
||||
strBody += wxT("<p>Prima di proseguire accertarsi che non vi sia alcuna sessione di <b><i>APPNAME</i></b> attiva! ");
|
||||
strBody += wxT("Terminare quindi le eventuali sessioni di <b><i>APPNAME</i></b> attive e proseguire.</p>");
|
||||
|
||||
|
||||
GetSizer()->Add(m_pRadioBox);
|
||||
|
||||
//se NON ci sono installazioni gia' presenti e NON c'e' alcuna chiave collegata -> puo' installare la DEMO
|
||||
|
Loading…
x
Reference in New Issue
Block a user