Supporto per SSA remoto
git-svn-id: svn://10.65.10.50/branches/R_10_00@22642 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
09c99c0bae
commit
b61ac80695
1040
xvaga/agasys.cpp
1040
xvaga/agasys.cpp
File diff suppressed because it is too large
Load Diff
@ -3504,6 +3504,27 @@ int xvt_sys_get_profile_string(const char* file, const char* paragraph, const ch
|
||||
if (file == NULL || *file == '\0')
|
||||
file = xvt_fsys_get_campo_ini();
|
||||
|
||||
if (wxStricmp(file, "ssa.ini") == 0)
|
||||
{
|
||||
wxTextFile ssa;
|
||||
if (ssa.Open(file))
|
||||
{
|
||||
for (wxString str = ssa.GetFirstLine(); !ssa.Eof(); str = ssa.GetNextLine())
|
||||
{
|
||||
str.Trim(false);
|
||||
if (str.StartsWith(name))
|
||||
{
|
||||
str = str.AfterFirst('=');
|
||||
str.Trim(true); str.Trim(false);
|
||||
wxStrncpy(value, str, maxsize-1);
|
||||
return str.Len();
|
||||
}
|
||||
}
|
||||
}
|
||||
wxStrncpy(value, defval, maxsize-1);
|
||||
return wxStrlen(defval);
|
||||
}
|
||||
|
||||
if (paragraph == NULL || *paragraph == '\0')
|
||||
paragraph = "Main";
|
||||
|
||||
@ -3953,7 +3974,13 @@ long xvt_vobj_get_attr(WINDOW win, long data)
|
||||
ret = (long)(const char*)_appl_version;
|
||||
break;
|
||||
case ATTR_APPL_VERSION_YEAR:
|
||||
ret = wxAtoi(_appl_version.Left(4));
|
||||
if (_appl_version.IsEmpty())
|
||||
{
|
||||
const wxString str = wxVERSION_STRING;
|
||||
ret = str >= wxT("wxWidgets 2.8.12") ? 2121 : 2091;
|
||||
}
|
||||
else
|
||||
ret = wxAtoi(_appl_version.Left(4));
|
||||
break;
|
||||
case ATTR_APPL_ALREADY_RUNNING:
|
||||
ret = _appl_already_running;
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "wxinc.h"
|
||||
#include "xvt.h"
|
||||
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include "../ssa/h/ssadll.h"
|
||||
#include "../ssa/h/ssaerr.h"
|
||||
|
||||
@ -23,18 +25,59 @@ static const char* xvt_dongle_sa_id()
|
||||
return id;
|
||||
}
|
||||
|
||||
static BOOLEAN xvt_dongle_sa_is_remote()
|
||||
{
|
||||
char ssaagent[128];
|
||||
const int len = xvt_sys_get_profile_string("ssa.ini", "", "SSA-PORT", "", ssaagent, sizeof(ssaagent));
|
||||
return len > 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSSA_Pinger
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TSSA_Pinger : public wxTimer
|
||||
{
|
||||
protected:
|
||||
virtual void Notify();
|
||||
|
||||
public:
|
||||
TSSA_Pinger();
|
||||
};
|
||||
|
||||
static TSSA_Pinger* _ssa_timer = NULL;
|
||||
|
||||
void TSSA_Pinger::Notify()
|
||||
{ SSA_Ping(xvt_dongle_sa_id()); }
|
||||
|
||||
TSSA_Pinger::TSSA_Pinger()
|
||||
{
|
||||
const int sec = xvt_sys_get_profile_int("ssa.ini", "", "PING-DELAY", 60);
|
||||
if (sec > 0)
|
||||
Start(sec*1000);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// xvt_dongle_sa_...
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
int xvt_dongle_sa_login(const char* module)
|
||||
{
|
||||
int err = _ssa_serial;
|
||||
|
||||
const int nAssYear = xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_VERSION_YEAR);
|
||||
if (nAssYear > 2091)
|
||||
if (nAssYear >= 2121)
|
||||
{
|
||||
if (_ssa_serial < 0)
|
||||
{
|
||||
err = SSA_Login(xvt_dongle_sa_id(), "Campo");
|
||||
if (err == 0)
|
||||
{
|
||||
err = _ssa_serial = SSA_NumeroSerie("Campo");
|
||||
|
||||
if (_ssa_timer == NULL && xvt_dongle_sa_is_remote())
|
||||
_ssa_timer = new TSSA_Pinger;
|
||||
}
|
||||
}
|
||||
|
||||
if (_ssa_serial >= 0 && module && *module)
|
||||
@ -87,6 +130,11 @@ int xvt_dongle_sa_logout(const char* module)
|
||||
{
|
||||
_ssa_serial = SSA_UTENTE_NON_LOGGATO;
|
||||
_ssa_module.Empty();
|
||||
if (_ssa_timer)
|
||||
{
|
||||
delete _ssa_timer;
|
||||
_ssa_timer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user