EgtGeomKernel 2.4e3 :

- modifiche per prima gestione chiave di rete.
This commit is contained in:
DarioS
2022-05-17 08:22:20 +02:00
parent d1b22114d0
commit 13774ba26a
4 changed files with 67 additions and 41 deletions
+1
View File
@@ -20,4 +20,5 @@
int GetEGkDebugLev( void) ;
ILogger* GetEGkLogger( void) ;
const std::string& GetEGkKey( void) ;
bool GetEGkNetHwKey( void) ;
int ProcessEvents( int nProg, int nPause) ;
+15
View File
@@ -115,6 +115,7 @@ GetEGkLogger( void)
//-----------------------------------------------------------------------------
static string s_sKey ;
static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
static bool s_bNetHwKey = false ;
//-----------------------------------------------------------------------------
void
@@ -130,6 +131,13 @@ SetEGkKeyType( int nType)
s_nKeyType = nType ;
}
//-----------------------------------------------------------------------------
void
SetEGkNetHwKey( bool bNetHwKey)
{
s_bNetHwKey = bNetHwKey ;
}
//-----------------------------------------------------------------------------
const string&
GetEGkKey( void)
@@ -138,6 +146,13 @@ GetEGkKey( void)
return s_sKey ;
}
//-----------------------------------------------------------------------------
bool
GetEGkNetHwKey( void)
{
return s_bNetHwKey ;
}
//-----------------------------------------------------------------------------
void
InitFontManager( const string& sNfeFontDir, const string& sDefaultFont)
BIN
View File
Binary file not shown.
+51 -41
View File
@@ -37,22 +37,25 @@ IGeomDB*
CreateGeomDB( void)
{
// verifico la chiave e le opzioni
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK && ! EqualNoCase( GetEGkKey(), "EGkBase")) {
if ( nRet != KEY_OK) {
string sErr = "Error on Key (GKC/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return nullptr ;
}
if ( (nOpt1 & KEYOPT_EGK_BASE) == 0 || nOptExpDays < GetCurrDay()) {
string sErr = "Error on Key (GKC/OPT)" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return nullptr ;
if ( ! GetEGkNetHwKey()) {
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK && ! EqualNoCase( GetEGkKey(), "EGkBase")) {
if ( nRet != KEY_OK) {
string sErr = "Error on Key (GKC/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return nullptr ;
}
if ( (nOpt1 & KEYOPT_EGK_BASE) == 0 || nOptExpDays < GetCurrDay()) {
string sErr = "Error on Key (GKC/OPT)" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return nullptr ;
}
}
}
// creo il GeomDB
return static_cast<IGeomDB*> ( new( nothrow) GeomDB) ;
}
@@ -272,19 +275,21 @@ bool
GeomDB::Save( int nId, const string& sFileOut, int nFlag) const
{
// verifico la chiave e le opzioni
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (GKS/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
if ( (nOpt1 & KEYOPT_EGK_SAVE) == 0 || nOptExpDays < GetCurrDay()) {
string sErr = "Error on Key (GKS/OPT)" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
if ( ! GetEGkNetHwKey()) {
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (GKS/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
if ( (nOpt1 & KEYOPT_EGK_SAVE) == 0 || nOptExpDays < GetCurrDay()) {
string sErr = "Error on Key (GKS/OPT)" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
}
// assegno Id base
@@ -382,19 +387,21 @@ bool
GeomDB::Save( const INTVECTOR& vId, const string& sFileOut, int nFlag) const
{
// verifico la chiave e le opzioni
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (GKS/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
if ( (nOpt1 & KEYOPT_EGK_SAVE) == 0 || nOptExpDays < GetCurrDay()) {
string sErr = "Error on Key (GKS/OPT)" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
if ( ! GetEGkNetHwKey()) {
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (GKS/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
if ( (nOpt1 & KEYOPT_EGK_SAVE) == 0 || nOptExpDays < GetCurrDay()) {
string sErr = "Error on Key (GKS/OPT)" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
}
// assegno Id base (nessuna riduzione degli Id)
@@ -513,7 +520,10 @@ GeomDB::SaveHeader( NgeWriter& ngeOut) const
// LockId del sistema come commento
string sLockId ;
if ( ! GetLockId( sLockId)) {
if ( GetEGkNetHwKey()) {
sLockId = "NET-000000" ;
}
else if ( ! GetLockId( sLockId)) {
LOG_ERROR( GetEGkLogger(), "Error on Key (1)")
return false ;
}