From 13774ba26a2ea874e95ccf4eab64a024b069c7db Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 17 May 2022 08:22:20 +0200 Subject: [PATCH] EgtGeomKernel 2.4e3 : - modifiche per prima gestione chiave di rete. --- DllMain.h | 1 + EGkDllMain.cpp | 15 ++++++++ EgtGeomKernel.rc | Bin 11718 -> 11718 bytes GeomDB.cpp | 92 ++++++++++++++++++++++++++--------------------- 4 files changed, 67 insertions(+), 41 deletions(-) diff --git a/DllMain.h b/DllMain.h index d7ecbb1..7da7299 100644 --- a/DllMain.h +++ b/DllMain.h @@ -20,4 +20,5 @@ int GetEGkDebugLev( void) ; ILogger* GetEGkLogger( void) ; const std::string& GetEGkKey( void) ; +bool GetEGkNetHwKey( void) ; int ProcessEvents( int nProg, int nPause) ; diff --git a/EGkDllMain.cpp b/EGkDllMain.cpp index cefba90..0ee5a33 100644 --- a/EGkDllMain.cpp +++ b/EGkDllMain.cpp @@ -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) diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index a846373e5b7e777cc9b8b882a5d98eb83950d51e..546657493057735f4d67abfc7caa3f987ee595b8 100644 GIT binary patch delta 263 zcmX>WeJpyzI%aKGhCGIJh8%`WhGK>c1_cHUhESkLCPN8BDnkm89}HwAf_cT0FKS6| z{=m$}%xJv%w%B>5$yHoBlN&fWCja7;V>F(8P*8WX8`lIDu&gam5ky4FgK=}0Z~#OT zk}y;uR%6tZ>_~Ol!O8b@=1qR3Cc+EygD2S4ISiE`H&6b+oV9t1x(+j{)aHv?Uzq?) Chf0M2 delta 255 zcmX>WeJpyzI%aiGhCGIJh8%`ehGHOAV9;O)W+-7u1ma8}FBB-731Uyas3kpFPd#gM z9LpRgM#Ihb#m+NLuH({~{EbtM(QvXNx9(;yt_dt)8CzzUh?EE8=04#7ARnj!Nf@dS w!w4-UJ5pS9aPmE!d6Pe>i3sL{UG52Xc@EIUi6HlG)>EIxj48GGqSjX?0P0gk7XSbN diff --git a/GeomDB.cpp b/GeomDB.cpp index 2de393f..7cf67a4 100644 --- a/GeomDB.cpp +++ b/GeomDB.cpp @@ -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 ( 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 ; }