diff --git a/DllMain.h b/DllMain.h index e635221..d4e698b 100644 --- a/DllMain.h +++ b/DllMain.h @@ -13,7 +13,6 @@ #pragma once - #include "/EgtDev/Include/EgtILogger.h" #include diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 31f66b9..1cd538c 100644 Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ diff --git a/GeomDB.cpp b/GeomDB.cpp index ecd04aa..e126808 100644 --- a/GeomDB.cpp +++ b/GeomDB.cpp @@ -25,23 +25,19 @@ #include "/EgtDev/Include/EgtNumCollection.h" #include "/EgtDev/Include/SELkMachineId.h" #include "/EgtDev/Include/SELkKeyProc.h" +#include "/EgtDev/Include/EgtKeyCodes.h" #include using namespace std ; -//---------------------------------------------------------------------------- -const int GDB_PROD = 1231 ; -const int GDB_VER = 16 ; -const int GDB_LEV = 1 ; - //---------------------------------------------------------------------------- IGeomDB* CreateGeomDB( void) { // verifico la chiave - int nRet = VerifyKey( GetEGkKey(), GDB_PROD, GDB_VER, GDB_LEV) ; + int nRet = VerifyKey( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV) ; if ( nRet != KEY_OK) { - string sErr = "Error on Key (" + ToString( nRet) + ")" ; + string sErr = "Error on Key (GKC/" + ToString( nRet) + ")" ; LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; return nullptr ; } @@ -78,13 +74,6 @@ GeomDB::Init( void) m_GrpRadix.SetMaterial( Color()) ; // imposto riferimento griglia standard m_GridFrame = GLOB_FRM ; - // verifico la chiave - int nRet = VerifyKey( GetEGkKey(), GDB_PROD, GDB_VER, GDB_LEV) ; - if ( nRet != KEY_OK) { - string sErr = "Error on Key (" + ToString( nRet) + ")" ; - LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; - return false ; - } return true ; } @@ -111,10 +100,18 @@ GeomDB::Clear( void) bool GeomDB::Load( const string& sFileIn, int nGroupId) { - // verifico la chiave - int nRet = VerifyKey( GetEGkKey(), GDB_PROD, GDB_VER, GDB_LEV) ; + // 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 (" + ToString( nRet) + ")" ; + string sErr = "Error on Key (GKL/" + ToString( nRet) + ")" ; + LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; + return false ; + } + if ( (nOpt1 & KEYOPT_EGK_BASE) == 0 || nOptExpDays < GetCurrDay()) { + string sErr = "Error on Key (GKL/OPT)" ; LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; return false ; } @@ -251,10 +248,18 @@ GeomDB::LoadOneObj( NgeReader& ngeIn, int nGroupId, int nBaseGdbId, const INTVEC bool GeomDB::Save( const string& sFileOut, int nFlag) const { - // verifico la chiave - int nRet = VerifyKey( GetEGkKey(), GDB_PROD, GDB_VER, GDB_LEV) ; + // 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 (" + ToString( nRet) + ")" ; + 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 ; }