#ifndef __UTILS_H #define __UTILS_H // lista dei tipi di installazione 0=non si sa, 1=standalone, 2=server, 3=client enum InstallationType { it_none, it_standalone, it_server, it_client, it_upgrade = 9 }; enum LurchMode { lm_none, lm_service }; //////////////////////////////////////////////////////////////////////////////////////////// //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); }; //progind class CampoProgressDialog : public wxProgressDialog { public: CampoProgressDialog(const wxString& strTitle, int nMaximum = 100, wxWindow* pParent = NULL); }; //numeri delle versioni di windows #define WUNKNOWN 0 #define WNTFIRST 101 #define WNT351 101 #define WNT4 102 #define W2K 103 #define WXP 104 #define W2003 105 #define WVISTA 106 #define W2008 107 #define W7 108 #define W8 109 #define WNTLAST 199 //metodi generici //finestre messaggio,errore,ecc... bool ErrorBox(const wxString str); bool MessageBox(const wxString str); bool WarningBox(const wxString str); bool YesNoBox(const wxString str); //trattamento files bool CheckAndMakeDir(const wxString& strDir, const wxString& strMsg); bool UnzipFile(const wxString& strZipFile, const wxString& strDestdir); bool CopiaFile(const wxString& file1, const wxString& file2); void NormalizeSlash(wxString& strFileName); //interfaccia con windows wxString GetWindowsProgramDirectory(); wxString GetWindowsDesktopDirectory(); unsigned long FindProcessId(LPCTSTR strProcess); int GetSessionId(); bool GetWinVer(LPTSTR lpszVersion, int nVersionSize, int& nVersion, bool& bIsServer); size_t ListNetworkDisks(wxArrayString& asList); size_t ListSharedDirectories(wxArrayString& asList); bool IsSharedDirectory (const wxString& strDir); //cerca il reseller del CD per proporre le finestre corrette int FindReseller(); #endif