Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@15930 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-12-20 10:44:31 +00:00
parent 1aafb67bc7
commit edd1a66d5e
2 changed files with 88 additions and 86 deletions

View File

@ -232,16 +232,18 @@ bool CampoSetup::CreateAutostartMode(const LurchMode iSrvAutostartMode, const wx
//stringa path della cartella Servers in base alle scelte dell'utente //stringa path della cartella Servers in base alle scelte dell'utente
const wxString strSrvPath = strExe.GetPath(); const wxString strSrvPath = strExe.GetPath();
//Eliminatore di precedenti servers installati come servizi //1) Eliminatore di precedenti servers installati come servizi
//cerca se non esiste per caso gia' da una precedente installazione.. //cerca se non esiste per caso gia' da una precedente installazione..
//..non serve piu' a un cazzo ma si e' tenuto come prova in debug di lettura del registry! //..non serve piu' a un cazzo ma si e' tenuto come prova in debug di lettura del registry!
wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application"); wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application");
//elimina un eventuale servizio precedente (senno' col cavolo che lo riesce a modificare!) //elimina un eventuale servizio precedente (senno' col cavolo che lo riesce a modificare!)
//utilizza il programma instsrv.exe dentro la cartella servers installata //utilizza il programma instsrv.exe dentro la cartella servers installata
wxString strRemove = strSrvPath + "\\instsrv Lurch REMOVE"; wxString strRemove = strSrvPath + "\\instsrv Lurch REMOVE";
const long lRemove = wxExecute(strRemove, wxEXEC_SYNC); const long lRemove = wxExecute(strRemove, wxEXEC_SYNC);
//2) Eliminatore di precedenti servers installati come programmi in esecuzione automatica
switch (iSrvAutostartMode) switch (iSrvAutostartMode)
{ {
//esecuzione server come servizi (magia!) //esecuzione server come servizi (magia!)

View File

@ -212,107 +212,107 @@ bool WarningBox(const wxString str)
//classe per gestire i .Ini di campo //classe per gestire i .Ini di campo
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
bool CampoIniFile::GetFirstGroup(wxString& strGroup, long& nIndex) bool CampoIniFile::GetFirstGroup(wxString& strGroup, long& nIndex)
{ {
m_asGroups.Clear(); m_asGroups.Clear();
char bufferone[1024*16]; char bufferone[1024*16];
::GetPrivateProfileSectionNames(bufferone, sizeof(bufferone), m_strIniName); ::GetPrivateProfileSectionNames(bufferone, sizeof(bufferone), m_strIniName);
const char* inizio = bufferone; const char* inizio = bufferone;
for (const char* b = bufferone; ; b++) if (*b == '\0') for (const char* b = bufferone; ; b++) if (*b == '\0')
{
if (*inizio)
{ {
if (*inizio) m_asGroups.Add(inizio);
{ inizio = b+1;
m_asGroups.Add(inizio);
inizio = b+1;
}
else
break;
} }
else
nIndex = 0; break;
return GetNextGroup(strGroup, nIndex);
} }
bool CampoIniFile::GetNextGroup(wxString& strGroup, long& nIndex) nIndex = 0;
{ return GetNextGroup(strGroup, 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) bool CampoIniFile::GetNextGroup(wxString& strGroup, long& nIndex)
{ {
return WritePrivateProfileString(m_strGroup, NULL, NULL, m_strIniName) != 0; const bool ok = nIndex >= 0 && nIndex < (long)m_asGroups.GetCount();
} if (ok)
strGroup = m_asGroups[nIndex++];
return ok;
}
bool CampoIniFile::GetFirstEntry(wxString& strEntry, long& nIndex) bool CampoIniFile::DeleteGroup(const wxString strGroup)
{ {
m_asEntries.Clear(); return WritePrivateProfileString(m_strGroup, NULL, NULL, m_strIniName) != 0;
}
char bufferone[1024*32]; bool CampoIniFile::GetFirstEntry(wxString& strEntry, long& nIndex)
::GetPrivateProfileSection(m_strGroup, bufferone, sizeof(bufferone), m_strIniName); {
const char* pInizio = bufferone; m_asEntries.Clear();
for (const char* b = bufferone; ; b++) if (*b == '\0')
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)
{ {
if (*pInizio) wxString strWrk = pInizio;
{ strWrk = strWrk.BeforeFirst('=');
wxString strWrk = pInizio; strWrk.Trim();
strWrk = strWrk.BeforeFirst('='); //prende solo il nome della variabile per completare la lista! dopo l'= ci sarebbe il valore
strWrk.Trim(); m_asEntries.Add(strWrk);
//prende solo il nome della variabile per completare la lista! dopo l'= ci sarebbe il valore pInizio = b+1;
m_asEntries.Add(strWrk);
pInizio = b+1;
}
else
break;
} }
else
nIndex = 0; break;
return GetNextEntry(strEntry, nIndex);
} }
bool CampoIniFile::GetNextEntry(wxString& strEntry, long& nIndex) nIndex = 0;
{ return GetNextEntry(strEntry, 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 bool CampoIniFile::GetNextEntry(wxString& strEntry, long& nIndex)
{ {
wxString strOutString; const bool ok = nIndex >= 0 && nIndex < (long)m_asEntries.GetCount();
char* buffer = strOutString.GetWriteBuf(256); if (ok)
GetPrivateProfileString(m_strGroup, strVariable, "", buffer, 256, m_strIniName); strEntry = m_asEntries[nIndex++];
strOutString.UngetWriteBuf(); //sblocca la memoria senno' la stringa resta per sempre!!! return ok;
}
return strOutString; wxString CampoIniFile::Get(const wxString strVariable) const
} {
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!!!
bool CampoIniFile::GetBool(const wxString strVariable) const return strOutString;
{ }
const char chVal = Get(strVariable)[0];
return chVal == 'X' || chVal == 'Y' || chVal == '1';
}
int CampoIniFile::GetInt(const wxString strVariable) const bool CampoIniFile::GetBool(const wxString strVariable) const
{ {
return atoi(Get(strVariable)); const char chVal = Get(strVariable)[0];
} return chVal == 'X' || chVal == 'Y' || chVal == '1';
}
bool CampoIniFile::Set(const wxString strVariable, const wxString strValue) int CampoIniFile::GetInt(const wxString strVariable) const
{ {
return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0; return atoi(Get(strVariable));
} }
bool CampoIniFile::Set(const wxString strVariable, const int uValue) bool CampoIniFile::Set(const wxString strVariable, const wxString strValue)
{ {
wxString strValue; return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0;
strValue << uValue; }
return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0;
} bool CampoIniFile::Set(const wxString strVariable, const int uValue)
{
wxString strValue;
strValue << uValue;
return WritePrivateProfileString(m_strGroup, strVariable, strValue, m_strIniName) != 0;
}
//costruttore //costruttore
CampoIniFile::CampoIniFile(const wxString strIniPath, wxString strGroup) CampoIniFile::CampoIniFile(const wxString strIniPath, wxString strGroup)