Patch level : 2.2
Files correlati : Authoriz.exe Ricompilazione Demo : [ ] Commento : Migliorata ricerca file di configurazione servers.ini in modo da funzionare anche come servizio git-svn-id: svn://10.65.10.50/trunk@13716 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3d784beef6
commit
6a9bf22635
@ -19,13 +19,12 @@
|
||||
#include "baseserv.h"
|
||||
|
||||
#include <wx/config.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/mimetype.h>
|
||||
#include <wx/sckstrm.h>
|
||||
#ifdef WIN32
|
||||
#include <wx/fileconf.h>
|
||||
#else
|
||||
#include <wx/filename.h>
|
||||
#endif
|
||||
|
||||
#include <wx/app.h>
|
||||
@ -466,9 +465,16 @@ void TBaseServerApp::OnSocketEvent(wxSocketEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
const wxChar* TBaseServerApp::GetConfigName() const
|
||||
const wxString& TBaseServerApp::GetConfigName() const
|
||||
{
|
||||
return "./servers.ini";
|
||||
if (m_strIni.IsEmpty())
|
||||
{
|
||||
wxFileName name(argv[0]);
|
||||
name.SetName("servers");
|
||||
name.SetExt("ini");
|
||||
(wxString&)m_strIni = name.GetFullPath();
|
||||
}
|
||||
return m_strIni;
|
||||
}
|
||||
|
||||
void TBaseServerApp::SetConfigString(const wxChar* key, const wxChar* val, const wxChar* app) const
|
||||
@ -502,19 +508,16 @@ wxString TBaseServerApp::GetConfigString(const wxChar* key, const wxChar* def, c
|
||||
|
||||
int TBaseServerApp::GetConfigInt(const wxChar* key, int def, const wxChar* app) const
|
||||
{
|
||||
wxString str = GetConfigString(key, "*", app);
|
||||
int val = def;
|
||||
if (str != "*")
|
||||
val = atoi(str);
|
||||
return val;
|
||||
const wxString str = GetConfigString(key, "*", app);
|
||||
return str != "*" ? atoi(str) : def;
|
||||
}
|
||||
|
||||
bool TBaseServerApp::GetConfigBool(const wxChar* key, bool def, const wxChar* app) const
|
||||
{
|
||||
wxString str = GetConfigString(key, "*", app);
|
||||
bool val = def;
|
||||
const wxString str = GetConfigString(key, "*", app);
|
||||
if (str != "*")
|
||||
val = (str[0u] == '1') || (str[0u] == 'X') || (str[0u] == 'Y');
|
||||
val = (str[0u] == '1') || (str[0u] == 'X') || (str[0u] == 'Y') || (str.CmpNoCase("On")==0);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ class TBaseServerApp : public wxApp
|
||||
private:
|
||||
wxSocketServer* m_server;
|
||||
wxFileOutputStream* m_log;
|
||||
wxString m_strTempDir;
|
||||
wxString m_strTempDir, m_strIni;
|
||||
bool m_bRunning;
|
||||
int m_nTmpCounter;
|
||||
|
||||
@ -109,7 +109,7 @@ protected:
|
||||
public:
|
||||
// Utilities
|
||||
virtual const wxChar* GetAppName() const = 0;
|
||||
virtual const wxChar* GetConfigName() const;
|
||||
virtual const wxString& GetConfigName() const;
|
||||
virtual int GetDefaultPort() const; // Retrieves Port usig GetConfigInt
|
||||
virtual void SetConfigString(const wxChar* key, const wxChar* val, const wxChar* app = NULL) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user