EgtInterface 1.5i2 :
- estensione e razionalizzazione della interfaccia.
This commit is contained in:
+15
-45
@@ -14,6 +14,7 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "API.h"
|
||||
#include "API_Macro.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EGkGdbExecutor.h"
|
||||
#include "/EgtDev/Include/EExExcExecutor.h"
|
||||
@@ -29,13 +30,8 @@ using namespace std ;
|
||||
BOOL
|
||||
__stdcall EgtInitTscExec( int nGseCtx)
|
||||
{
|
||||
// recupero il contesto
|
||||
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
|
||||
// verifico GeomDB
|
||||
if ( pGseCtx == nullptr || pGseCtx->m_pGeomDB == nullptr) {
|
||||
LOG_ERROR( GetLogger(), "GeomDB invalid (EgtInitTscExec)")
|
||||
return FALSE ;
|
||||
}
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
|
||||
|
||||
// eventuale pulizia esecutore e suoi oggetti
|
||||
if ( pGseCtx->m_pTscExec != nullptr) {
|
||||
@@ -45,36 +41,24 @@ __stdcall EgtInitTscExec( int nGseCtx)
|
||||
|
||||
// creo esecutore
|
||||
PtrOwner<ICmdParser> pCmdParser( CreateCmdParser()) ;
|
||||
if ( IsNull( pCmdParser)) {
|
||||
LOG_ERROR( GetLogger(), "Error in CreateCmdParser")
|
||||
return FALSE ;
|
||||
}
|
||||
VERIFY_NULL( Get( pCmdParser), "Error in CreateCmdParser", FALSE)
|
||||
|
||||
// creo oggetto per esecuzione funzioni di GeomKernel
|
||||
PtrOwner<IGdbExecutor> pGdbExec( CreateGdbExecutor()) ;
|
||||
if ( IsNull( pGdbExec)) {
|
||||
LOG_ERROR( GetLogger(), "Error in CreateGdbExecutor")
|
||||
return FALSE ;
|
||||
}
|
||||
VERIFY_NULL( Get( pGdbExec), "Error in CreateGdbExecutor", FALSE)
|
||||
pGdbExec->SetGeomDB( pGseCtx->m_pGeomDB) ;
|
||||
pCmdParser->SetExecutor( Release( pGdbExec)) ;
|
||||
|
||||
// creazione oggetto per esecuzione funzioni di Exchange
|
||||
PtrOwner<IExcExecutor> pExcExec( CreateExcExecutor()) ;
|
||||
if ( IsNull( pExcExec)) {
|
||||
LOG_ERROR( GetLogger(), "Error in CreateExcExecutor")
|
||||
return FALSE ;
|
||||
}
|
||||
VERIFY_NULL( Get( pExcExec), "Error in CreateExcExecutor", FALSE)
|
||||
pExcExec->SetGeomDB( pGseCtx->m_pGeomDB) ;
|
||||
pCmdParser->AddExecutor( Release( pExcExec)) ;
|
||||
|
||||
// eventuale creazione oggetto per esecuzione funzioni di Scene
|
||||
if ( pGseCtx->m_pScene != nullptr) {
|
||||
PtrOwner<ISceExecutor> pSceExec( CreateSceExecutor()) ;
|
||||
if ( IsNull( pSceExec)) {
|
||||
LOG_ERROR( GetLogger(), "Error in CreateSceExecutor")
|
||||
return FALSE ;
|
||||
}
|
||||
VERIFY_NULL( Get( pSceExec), "Error in CreateSceExecutor", FALSE)
|
||||
pSceExec->SetScene( pGseCtx->m_pScene) ;
|
||||
pCmdParser->AddExecutor( Release( pSceExec)) ;
|
||||
}
|
||||
@@ -90,14 +74,11 @@ __stdcall EgtInitTscExec( int nGseCtx)
|
||||
BOOL
|
||||
__stdcall EgtTscFileExec( int nGseCtx, const wchar_t* wsFilePath)
|
||||
{
|
||||
// verifico TscExecutor
|
||||
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
|
||||
if ( pGseCtx == nullptr || pGseCtx->m_pTscExec == nullptr) {
|
||||
LOG_ERROR( GetLogger(), "TscExecutor invalid (EgtFileExec)")
|
||||
return FALSE ;
|
||||
}
|
||||
ICmdParser* pTscExec = GetTscExecutor( nGseCtx) ;
|
||||
VERIFY_TSCEXEC( pTscExec, FALSE)
|
||||
|
||||
// converto nome file
|
||||
string sFilePath = LPSTR( WtoA( wsFilePath)) ;
|
||||
string sFilePath = wstrztoA( wsFilePath) ;
|
||||
// emetto info
|
||||
string sInfo = "Exec File = " + sFilePath ;
|
||||
LOG_INFO( GetLogger(), sInfo.c_str())
|
||||
@@ -105,29 +86,18 @@ __stdcall EgtTscFileExec( int nGseCtx, const wchar_t* wsFilePath)
|
||||
// imposto il direttorio dello script
|
||||
string sFileDir, sFileName ;
|
||||
SplitLast( sFilePath, "\\", sFileDir, sFileName) ;
|
||||
pGseCtx->m_pTscExec->SetDirReplace( "<TSCDIR>", sFileDir) ;
|
||||
pTscExec->SetDirReplace( "<TSCDIR>", sFileDir) ;
|
||||
|
||||
// esecuzione script
|
||||
if ( pGseCtx->m_pTscExec->Run( sFilePath))
|
||||
return TRUE ;
|
||||
else
|
||||
return FALSE ;
|
||||
return ( pTscExec->Run( sFilePath) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtTscLineExec( int nGseCtx, const wchar_t* wsLine)
|
||||
{
|
||||
// verifico TscExecutor
|
||||
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
|
||||
if ( pGseCtx == nullptr || pGseCtx->m_pTscExec == nullptr) {
|
||||
LOG_ERROR( GetLogger(), "TscExecutor invalid (EgtLineExec)")
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
ICmdParser* pTscExec = GetTscExecutor( nGseCtx) ;
|
||||
VERIFY_TSCEXEC( pTscExec, FALSE)
|
||||
// eseguo il comando
|
||||
if ( pGseCtx->m_pTscExec->ExecLine( LPSTR( WtoA( wsLine))))
|
||||
return TRUE ;
|
||||
else
|
||||
return FALSE ;
|
||||
return ( pTscExec->ExecLine( wstrztoA( wsLine)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user