diff --git a/EExDllMain.h b/EExDllMain.h index e806d7f..8e9dae0 100644 --- a/EExDllMain.h +++ b/EExDllMain.h @@ -34,4 +34,36 @@ extern "C" { EEX_EXPORT void SetEExLogger( ILogger* pLogger) ; // imposta la chiave di protezione EEX_EXPORT void SetEExKey( const std::string& sKey) ; -} \ No newline at end of file +} + + +//----------------------------------------------------------------------------- +#include "/EgtDev/Include/EGnStringUtils.h" +#include "/EgtDev/Include/EgtILogger.h" +#include "/EgtDev/Include/EgtKeyCodes.h" +#include "/EgtDev/Include/SELkKeyProc.h" + +//----------------------------------------------------------------------------- +// Test della chiave per caricare la DLL +inline bool +TestKeyForEEx( const std::string& sKey, int nKeyOpt, ILogger* pLogger) +{ + // verifico la chiave e le opzioni + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetKeyOptions( sKey, KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( nRet != KEY_OK) { + std::string sErr = "Error on Key (EXC/" + ToString( nRet) + ")" ; + LOG_ERROR( pLogger, sErr.c_str()) ; + return false ; + } + if ( ( nOpt1 & ( KEYOPT_EEX_INPBASE|KEYOPT_EEX_EXPBASE)) == 0 || + ( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) || + nOptExpDays < GetCurrDay()) { + std::string sErr = "Error on Key (EXC/OPT)" ; + LOG_ERROR( pLogger, sErr.c_str()) ; + return false ; + } + return true ; +} diff --git a/EGkObjUserFactory.h b/EGkObjUserFactory.h index 7cb7015..5a829e0 100644 --- a/EGkObjUserFactory.h +++ b/EGkObjUserFactory.h @@ -30,6 +30,7 @@ ObjUserRegister::DoRegister( sName) #define OBJUSER_GETNAME( T) ObjUserRegister::GetName() #define OBJUSER_CREATE( sName) ObjUserFactory::Create( sName) +#define OBJUSER_GETLIST( vsList) ObjUserFactory::GetList( vsList) //---------------------------------------------------------------------------- template @@ -64,6 +65,8 @@ class ObjUserFactory EGK_EXPORT static bool Register( const std::string& sName, ObjUserCreator Creator) ; // per creare l'oggetto richiesto EGK_EXPORT static IObjUser* Create( const std::string& sName) ; + // per restituire la lista degli oggetti registrati + EGK_EXPORT static bool GetList( STRVECTOR& vsList) ; private : ObjUserFactory( void) {} diff --git a/EGnStringKeyVal.h b/EGnStringKeyVal.h index 104094a..a87ec74 100644 --- a/EGnStringKeyVal.h +++ b/EGnStringKeyVal.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- // EgalTech 2015-2015 //---------------------------------------------------------------------------- -// File : EgnStringKeyVal.h Data : 23.05.15 Versione : 1.6e3 +// File : EGnStringKeyVal.h Data : 23.05.15 Versione : 1.6e3 // Contenuto : Funzioni per gestione coppie chiave-valore in stringhe. // // @@ -45,6 +45,14 @@ IsValidVal( const std::string& sString) sString.find_first_not_of( " \t\r\n") != std::string::npos)) ; } +//---------------------------------------------------------------------------- +inline bool +ValidateKeyVal( std::string& sString) + { std::string::size_type i ; + while ( ( i = sString.find_first_of( "\t\r\n")) != std::string::npos) + sString[i] = '_' ; + return true ; } + //---------------------------------------------------------------------------- inline bool SetVal( const std::string& sKey, const std::string& sVal, std::string& sString) diff --git a/EGrDllMain.h b/EGrDllMain.h index 1a234f3..29bf373 100644 --- a/EGrDllMain.h +++ b/EGrDllMain.h @@ -13,7 +13,6 @@ #pragma once - class ILogger ; //----------------------- Macro per import/export ---------------------------- @@ -33,4 +32,36 @@ extern "C" { EGR_EXPORT void SetEGrLogger( ILogger* pLogger) ; // imposta la chiave di protezione EGR_EXPORT void SetEGrKey( const std::string& sKey) ; -} \ No newline at end of file +} + + +//----------------------------------------------------------------------------- +#include "/EgtDev/Include/EGnStringUtils.h" +#include "/EgtDev/Include/EgtILogger.h" +#include "/EgtDev/Include/EgtKeyCodes.h" +#include "/EgtDev/Include/SELkKeyProc.h" + +//----------------------------------------------------------------------------- +// Test della chiave per caricare la DLL +inline bool +TestKeyForEGr( const std::string& sKey, int nKeyOpt, ILogger* pLogger) +{ + // verifico la chiave e le opzioni + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetKeyOptions( sKey, KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( nRet != KEY_OK) { + std::string sErr = "Error on Key (GRC/" + ToString( nRet) + ")" ; + LOG_ERROR( pLogger, sErr.c_str()) ; + return false ; + } + if ( ( nOpt1 & KEYOPT_EGR_BASE) == 0 || + ( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) || + nOptExpDays < GetCurrDay()) { + std::string sErr = "Error on Key (GRC/OPT)" ; + LOG_ERROR( pLogger, sErr.c_str()) ; + return false ; + } + return true ; +} diff --git a/EMkDllMain.h b/EMkDllMain.h index 87f6ead..7575c10 100644 --- a/EMkDllMain.h +++ b/EMkDllMain.h @@ -34,4 +34,36 @@ extern "C" { EMK_EXPORT void SetEMkLogger( ILogger* pLogger) ; // imposta la chiave di protezione EMK_EXPORT void SetEMkKey( const std::string& sKey) ; -} \ No newline at end of file +} + + +//----------------------------------------------------------------------------- +#include "/EgtDev/Include/EGnStringUtils.h" +#include "/EgtDev/Include/EgtILogger.h" +#include "/EgtDev/Include/EgtKeyCodes.h" +#include "/EgtDev/Include/SELkKeyProc.h" + +//----------------------------------------------------------------------------- +// Test della chiave per caricare la DLL +inline bool +TestKeyForEMk( const std::string& sKey, int nKeyOpt, ILogger* pLogger) +{ + // verifico la chiave e le opzioni + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetKeyOptions( sKey, KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( nRet != KEY_OK) { + std::string sErr = "Error on Key (MKC/" + ToString( nRet) + ")" ; + LOG_ERROR( pLogger, sErr.c_str()) ; + return false ; + } + if ( ( nOpt1 & KEYOPT_EMK_BASE) == 0 || + ( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) || + nOptExpDays < GetCurrDay()) { + std::string sErr = "Error on Key (MKC/OPT)" ; + LOG_ERROR( pLogger, sErr.c_str()) ; + return false ; + } + return true ; +}