#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, lm_autostart };
////////////////////////////////////////////////////////////////////////////////////////////
//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 W9XFIRST	1
#define W95			  1
#define W95SP1		2
#define W95OSR2		3
#define W98			  4
#define W98SP1		5
#define W98SE		  6
#define WME			  7
#define W9XLAST	 99

#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 WNTLAST		199

#define WCEFIRST	201
#define WCE			  201
#define WCELAST		299

//metodi generici
//finestre messaggio,errore,ecc...
bool ErrorBox(const wxString str);
bool WarningBox(const wxString str);
bool YesNoBox(const wxString str);

//trattamento files
void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg);
bool UnzipFile(const char* strZipFile, const char* strDestdir);
bool CopiaFile(const wxString& file1, const wxString& file2);
void NormalizeSlash(wxString& strFileName);

//interfaccia con windows
wxString GetWindowsProgramDirectory();
int GetSessionId();
bool GetWinVer(LPTSTR lpszVersion, int nVersionSize, int *pnVersion);

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