EgtMachKernel :

- aggiunta ImportSetup.
This commit is contained in:
Dario Sassi
2017-01-28 07:56:32 +00:00
parent 5ffbaab0e4
commit 0bafc660b5
5 changed files with 175 additions and 6 deletions
+33
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "DllMain.h"
#include "MachMgr.h"
#include "/EgtDev/Include/EgtIniFile.h"
using namespace std ;
@@ -24,3 +25,35 @@ MachMgr::GetCurrSetup( void) const
{
return GetCurrSetupGroupId() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ImportSetup( const string& sName)
{
// definisco path completa del file di attrezzaggio
string sFileName = GetCurrSetupDir() + "\\" ;
// se ricevuto nome
if ( ! IsEmptyOrSpaces( sName)) {
sFileName += sName + "." + SETUP_EXT ;
}
// altrimenti cerco default
else {
string sMachIni = m_sMachinesDir + "\\" + GetCurrMGeoName() + "\\" + GetCurrMGeoName() + ".ini" ;
string sDefault = GetPrivateProfileStringUtf8( SETUP_SEC.c_str(), SETUP_DEF_KEY.c_str(), "", sMachIni.c_str()) ;
if ( ! IsEmptyOrSpaces( sDefault))
sFileName += sDefault + "." + SETUP_EXT ;
else
return false ;
}
// gestione attrezzaggio
SetupMgr stuMgr ;
stuMgr.Init( this) ;
// importo l'attrezzaggio
if ( ! stuMgr.Import( sFileName))
return false ;
// lo inserisco nel progetto
return stuMgr.Save() ;
}