diff --git a/EXE_Exchange.cpp b/EXE_Exchange.cpp index b61f316..f14018b 100644 --- a/EXE_Exchange.cpp +++ b/EXE_Exchange.cpp @@ -273,6 +273,29 @@ ExeImportStl( const string& sFilePath, double dScaleFactor) return bOk ; } +//----------------------------------------------------------------------------- +bool +ExeAdvancedImportIsEnabled( void) +{ + // verifico la chiave e le opzioni per l'import avanzato + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetKeyOptions( ExeGetKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( nRet != KEY_OK) { + std::string sErr = "Error on Key (EXA/" + ToString( nRet) + ")" ; + LOG_ERROR( GetLogger(), sErr.c_str()) ; + return false ; + } + if ( ( nOpt1 & ( KEYOPT_EEX_INPADV)) == 0 || + nOptExpDays < GetCurrDay()) { + std::string sErr = "Warning on Key (EXA/OPT)" ; + LOG_ERROR( GetLogger(), sErr.c_str()) ; + return false ; + } + return true ; +} + //----------------------------------------------------------------------------- bool ExeAdvancedImport( const string& sFilePath) @@ -293,21 +316,8 @@ ExeAdvancedImport( const string& sFilePath) return false ; } // verifico la chiave e le opzioni per l'import avanzato - unsigned int nOpt1, nOpt2 ; - int nOptExpDays ; - int nRet = GetKeyOptions( ExeGetKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, - nOpt1, nOpt2, nOptExpDays) ; - if ( nRet != KEY_OK) { - std::string sErr = "Error on Key (EXA/" + ToString( nRet) + ")" ; - LOG_ERROR( GetLogger(), sErr.c_str()) ; + if ( ! ExeAdvancedImportIsEnabled()) return false ; - } - if ( ( nOpt1 & ( KEYOPT_EEX_INPADV)) == 0 || - nOptExpDays < GetCurrDay()) { - std::string sErr = "Warning on Key (EXA/OPT)" ; - LOG_ERROR( GetLogger(), sErr.c_str()) ; - return false ; - } // file intermedio stl string sTempDir ; ExeGetTempDir( sTempDir) ; string sFileOut = sTempDir + "\\AdvImp.stl" ;