Patch level : 10.0
Files correlati : authoriz.exe lurch.exe Ricompilazione Demo : [ ] Commento : Corretta gestione processi in autorun git-svn-id: svn://10.65.10.50/trunk@20092 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
197a61c2ac
commit
c79bb716e9
@ -946,7 +946,7 @@ bool TAuthorizationServer::Initialization()
|
||||
if (m_MaxTries < 8)
|
||||
m_MaxTries = 8;
|
||||
|
||||
const bool bTestAll = GetOemInt("OEM") == 0;
|
||||
const bool bTestAll = IsAdvanced();
|
||||
for (unsigned int i = 0; i < m_MaxTries; i++)
|
||||
{
|
||||
if (m_Dongle.Login(bTestAll))
|
||||
|
@ -526,7 +526,7 @@ void TBaseServerApp::OnSocketEvent(wxSocketEvent& e)
|
||||
case wxSOCKET_LOST:
|
||||
if (m_bLogVerbose)
|
||||
WriteLog("--- Socket lost.");
|
||||
if (GetOemInt("OEM") == 0)
|
||||
if (IsAdvanced())
|
||||
sock->Destroy();
|
||||
break;
|
||||
default:
|
||||
@ -637,52 +637,62 @@ bool TBaseServerApp::GetConfigBool(const wxChar* key, bool def, const wxChar* ap
|
||||
const wxString str = GetConfigString(key, "*", app);
|
||||
if (str != "*")
|
||||
val = (str[0u] == '1') || (str[0u] == 'X') || (str[0u] == 'Y') || (str.CmpNoCase("On") == 0);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
int TBaseServerApp::GetDefaultPort() const
|
||||
{ return GetConfigInt("Port", 3883); }
|
||||
|
||||
#define OEM_INI wxT("../setup/oem.ini")
|
||||
|
||||
int TBaseServerApp::GetOemInt(const wxChar* key, int def) const
|
||||
{
|
||||
return GetConfigInt("Port", 3883);
|
||||
static int _oem = -1;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if (_oem < 0)
|
||||
_oem = ::GetPrivateProfileInt("MAIN", "OEM", -1, OEM_INI);
|
||||
if (_oem >= 0)
|
||||
{
|
||||
if (wxStrcmp(key, wxT("OEM")) != 0)
|
||||
{
|
||||
wxString str; str.Printf(wxT("OEM_%d"), _oem);
|
||||
def = ::GetPrivateProfileInt(str, key, def, OEM_INI);
|
||||
}
|
||||
else
|
||||
def = _oem;
|
||||
}
|
||||
#endif
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
wxString TBaseServerApp::GetOemString(const wxChar* key, const wxChar* def) const
|
||||
{
|
||||
static int _oem = -1;
|
||||
wxString str;
|
||||
#ifdef __WXMSW__
|
||||
if (_oem < 0)
|
||||
_oem = ::GetPrivateProfileInt("MAIN", "OEM", 0, wxT("../setup/oem.ini"));
|
||||
if (wxStrcmp(key, "OEM") != 0)
|
||||
const int oem = GetOemInt("OEM", -1);
|
||||
wxString str = def;
|
||||
if (oem >= 0)
|
||||
{
|
||||
wxChar value[512]; memset(value, 0, sizeof(value));
|
||||
str.Printf("OEM_%d", _oem);
|
||||
::GetPrivateProfileString(str, key, def, value, sizeof(value)-1, wxT("../setup/oem.ini"));
|
||||
str = value;
|
||||
}
|
||||
else
|
||||
str.Printf("%d", _oem);
|
||||
if (wxStrcmp(key, "OEM") != 0)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
wxChar value[512]; memset(value, 0, sizeof(value));
|
||||
str.Printf("OEM_%d", oem);
|
||||
::GetPrivateProfileString(str, key, def, value, sizeof(value)-1, OEM_INI);
|
||||
str = value;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
str.Printf("%d", oem);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
int TBaseServerApp::GetOemInt(const wxChar* key, int def) const
|
||||
{
|
||||
wxString strDef;
|
||||
if (def != 0) strDef.Printf("%d", def);
|
||||
const wxString strVal = GetOemString(key, strDef);
|
||||
return wxAtoi(strVal);
|
||||
}
|
||||
|
||||
wxString TBaseServerApp::GetLogFileName() const
|
||||
{
|
||||
return GetConfigString("LogFile");
|
||||
}
|
||||
{ return GetConfigString("LogFile"); }
|
||||
|
||||
wxString TBaseServerApp::GetDocumentRoot() const
|
||||
{
|
||||
return GetConfigString("DocumentRoot", m_strPath);
|
||||
}
|
||||
{ return GetConfigString("DocumentRoot", m_strPath); }
|
||||
|
||||
bool TBaseServerApp::OnInit()
|
||||
{
|
||||
|
@ -115,7 +115,8 @@ protected:
|
||||
|
||||
wxString GetOemString(const wxChar* key, const wxChar* def = wxEmptyString) const;
|
||||
int GetOemInt(const wxChar* key, int def = 0) const;
|
||||
|
||||
bool IsAdvanced() const { return GetOemInt(wxT("OEM"), -1) == 0; }
|
||||
|
||||
public:
|
||||
// Utilities
|
||||
virtual const wxChar* GetAppName() const = 0;
|
||||
|
@ -296,7 +296,7 @@ void TLurchServer::GenerateFile(wxString& strFilename)
|
||||
wxString strHost; strHost << wxGetHostName() << wxT(":") << GetDefaultPort();
|
||||
tr1.AddChild("td").AddEnclosedText(strHost);
|
||||
|
||||
if (GetOemInt("OEM") == 0)
|
||||
if (IsAdvanced())
|
||||
{
|
||||
TXmlItem& tr2 = panel.AddChild("tr");
|
||||
tr2.AddChild("td").AddEnclosedText("Ping Frequency");
|
||||
@ -650,15 +650,18 @@ bool TLurchServer::Initialization()
|
||||
{
|
||||
const wxArrayString& arr = GetAutoRunList();
|
||||
const size_t nAuto = arr.GetCount();
|
||||
if (nAuto > 0 && GetOemInt("OEM") == 0)
|
||||
if (nAuto > 0)
|
||||
{
|
||||
for (size_t i = 0; i < nAuto; i++)
|
||||
StartProcess(arr[i]);
|
||||
const int nFreq = GetConfigInt("PingFreq");
|
||||
if (nFreq > 0)
|
||||
if (IsAdvanced())
|
||||
{
|
||||
m_PingTimer.Start(nFreq * 1000); // sec to msec
|
||||
m_Semaphore.Post(); // GREEN!
|
||||
const int nFreq = GetConfigInt("PingFreq");
|
||||
if (nFreq > 0)
|
||||
{
|
||||
m_PingTimer.Start(nFreq * 1000); // sec to msec
|
||||
m_Semaphore.Post(); // GREEN!
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user