//---------------------------------------------------------------------------- // EgalTech 2014-2014 //---------------------------------------------------------------------------- // File : API_General.cpp Data : 01.09.14 Versione : 1.5i1 // Contenuto : Funzioni generali per API. // // // // Modifiche : 01.09.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "API.h" #include "/EgtDev/Include/EInAPI.h" #include "/EgtDev/Include/EInDllMain.h" #include "/EgtDev/Include/EGkDllMain.h" #include "/EgtDev/Include/ENkDllMain.h" #include "/EgtDev/Include/EGnDllMain.h" #include "/EgtDev/Include/EExDllMain.h" #include "/EgtDev/Include/EGrDllMain.h" #include "/EgtDev/Include/EGnStringConverter.h" #include "/EgtDev/Include/EgtLogger.h" #include using namespace std ; using namespace egtlogger ; //---------------------------------------------------------------------------- static Logger* s_pLogGen = nullptr ; //----------------------------------------------------------------------------- BOOL __stdcall EgtInit( int nDebug, const wchar_t* sLogFile) { // cancello eventuali vecchi contesti ClearAllGseContexts() ; // cancello eventuale vecchio logger if ( s_pLogGen != nullptr) delete s_pLogGen ; // creo il logger generale s_pLogGen = new Logger( ( nDebug > 0 ? LL_DEBUG : LL_INFO), "EgtInterface") ; if ( s_pLogGen == nullptr) return FALSE ; // assegno il file s_pLogGen->AddOutputStream( new ofstream( sLogFile), true) ; // lo passo alle DLL SetEGnLogger( s_pLogGen) ; SetENkLogger( s_pLogGen) ; SetEGkLogger( s_pLogGen) ; SetEExLogger( s_pLogGen) ; SetEGrLogger( s_pLogGen) ; // dichiaro inizio programma LOG_DATETIME( s_pLogGen, " Init") // versione dell'interfaccia LOG_INFO( s_pLogGen, GetEInVersion()) // versione delle librerie LOG_INFO( s_pLogGen, GetEGnVersion()) LOG_INFO( s_pLogGen, GetENkVersion()) LOG_INFO( s_pLogGen, GetEGkVersion()) LOG_INFO( s_pLogGen, GetEExVersion()) LOG_INFO( s_pLogGen, GetEGrVersion()) return TRUE ; } //----------------------------------------------------------------------------- BOOL __stdcall EgtExit( void) { // fine programma LOG_DATETIME( s_pLogGen, " Exit") // cancello tutti i contesti ClearAllGseContexts() ; // cancello il logger if ( s_pLogGen != nullptr) { delete s_pLogGen ; s_pLogGen = nullptr ; } return TRUE ; } //----------------------------------------------------------------------------- BOOL __stdcall EgtSetKey( const wchar_t* sKey) { SetEGkKey( LPSTR( WtoA( sKey))) ; return TRUE ; } //----------------------------------------------------------------------------- BOOL __stdcall EgtSetFont( const wchar_t* sNfeFontDir, const wchar_t* sDefaultFont) { // inizializzazioni gestore font Nfe InitFontManager( LPSTR( WtoA( sNfeFontDir)), LPSTR( WtoA( sDefaultFont))) ; return TRUE ; } //----------------------------------------------------------------------------- BOOL __stdcall EgtFreeMemory( void* pMem) { if ( pMem == nullptr) return FALSE ; free( pMem) ; return TRUE ; } //----------------------------------------------------------------------------- ILogger* GetLogger( void) { return s_pLogGen ; }