Files
EgtInterface/API_General.cpp
T
Dario Sassi 98748bbac5 EgtInterface 1.6e3 :
- corretto errore mancanza EgtOutLog.
2015-05-07 07:03:16 +00:00

176 lines
5.2 KiB
C++

//----------------------------------------------------------------------------
// 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/EXeExecutor.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnStringConverter.h"
using namespace std ;
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtInit( int nDebug, const wchar_t* wsLogFile, const wchar_t* wsLogMsg)
{
string sLogMsg = wstrztoA( wsLogMsg) ;
sLogMsg += "\n" ;
sLogMsg += GetEInVersion() ;
return ( ExeInit( nDebug, wstrztoA( wsLogFile), sLogMsg) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtExit( void)
{
return ( ExeExit() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetKey( const wchar_t* wsKey)
{
return ( ExeSetKey( wstrztoA( wsKey)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetFont( const wchar_t* wsNfeFontDir, const wchar_t* wsDefaultFont)
{
return ( ExeSetFont( wstrztoA( wsNfeFontDir), wstrztoA( wsDefaultFont)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetNfeFontDir( wchar_t*& wsNfeFontDir)
{
if ( &wsNfeFontDir == nullptr)
return FALSE ;
// recupero il nome del direttorio dei font Nfe
string sNfeFontDir ;
ExeGetNfeFontDir( sNfeFontDir) ;
wsNfeFontDir = _wcsdup( stringtoW( sNfeFontDir)) ;
return (( wsNfeFontDir == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetDefaultFont( wchar_t*& wsDefaultFont)
{
if ( &wsDefaultFont == nullptr)
return false ;
// recupero il nome del font di default
string sDefaultFont ;
ExeGetDefaultFont( sDefaultFont) ;
wsDefaultFont = _wcsdup( stringtoW( sDefaultFont)) ;
return (( wsDefaultFont == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetLuaLibs( const wchar_t* wsLuaLibsDir)
{
return ( ExeSetLuaLibs( wstrztoA( wsLuaLibsDir)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCommandLogger( const wchar_t* wsLogFile)
{
return ( ExeSetCommandLogger( wstrztoA( wsLogFile)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
void
__stdcall EgtEnableCommandLogger( void)
{
ExeEnableCommandLogger() ;
}
//-----------------------------------------------------------------------------
void
__stdcall EgtDisableCommandLogger( void)
{
ExeDisableCommandLogger() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetVersionInfo( wchar_t*& wsVer)
{
// recupero le informazioni sulle DLL
string sVer ;
sVer = GetEInVersion() ;
sVer += "\r\n" ;
if ( ! ExeGetVersionInfo( sVer, "\r\n"))
return FALSE ;
wsVer = _wcsdup( stringtoW( sVer)) ;
return (( wsVer == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetOsInfo( wchar_t*& wsOs)
{
// recupero le informazioni sul sistema operativo
string sOs ;
if ( ! ExeGetOsInfo( sOs))
return FALSE ;
wsOs = _wcsdup( stringtoW( sOs)) ;
return (( wsOs == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCpuInfo( wchar_t*& wsCpu)
{
// recupero le informazioni sulla Cpu
string sCpu ;
if ( ! ExeGetCpuInfo( sCpu))
return FALSE ;
wsCpu = _wcsdup( stringtoW( sCpu)) ;
return (( wsCpu == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMemoryInfo( wchar_t*& wsMem)
{
// recupero le informazioni sulla memoria presente
string sMem ;
if ( ! ExeGetMemoryInfo( sMem))
return FALSE ;
wsMem = _wcsdup( stringtoW( sMem)) ;
return (( wsMem == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtFreeMemory( void* pMem)
{
if ( pMem == nullptr)
return FALSE ;
free( pMem) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtOutLog( const wchar_t* wsMsg)
{
return ( ExeOutLog( wstrztoA( wsMsg)) ? TRUE : FALSE) ;
}