Include :

- aggiunto corpo di ToString per interi
- aggiunte dichiarazioni per EgtLock (libreria statica).
This commit is contained in:
Dario Sassi
2014-09-13 21:24:52 +00:00
parent 964381af0e
commit dacb205b73
5 changed files with 129 additions and 1 deletions
+22 -1
View File
@@ -129,7 +129,28 @@ bool FromString( const std::string& sVal, double (&dVal)[size])
}
return ( *pStop == '\0' && errno == 0) ;
}
EGN_EXPORT const std::string ToString( int nVal, int nPrec = 1) ;
//----------------------------------------------------------------------------
inline const std::string
ToString( int nVal, int nPrec = 1)
{
// eseguo conversione
char szBuff[24] ;
int nErr = _itoa_s( nVal, szBuff, 10) ;
// se errore, ritorno stringa opportuna
if ( nErr != 0) {
_ASSERT( 0) ;
return "#Error" ;
}
// verifico lunghezza minima
int nLen = (int) strlen( szBuff) ;
if ( nLen >= nPrec)
return szBuff ;
// porto la stringa alla minima lunghezza
std::string sBuff( szBuff) ;
sBuff.insert( 0, ( nPrec - nLen), '0') ;
return sBuff ;
}
inline const std::string
ToString( bool bVal)
{ return std::string( ( bVal ? "1" : "0")) ; }
+20
View File
@@ -0,0 +1,20 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : SELkBase64.h Data : 10.09.14 Versione : 1.5i1
// Contenuto : Dichiarazione funzioni per codifica/decodifica Base64.
//
//
//
// Modifiche : 10.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
//-----------------------------------------------------------------------------
bool B64Encode( const std::string& sSou, std::string& sB64Dest) ;
bool B64Decode( const std::string& sB64Sou, std::string& sDest) ;
+22
View File
@@ -0,0 +1,22 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : SELkCrc32.h Data : 08.09.14 Versione : 1.5i1
// Contenuto : Dichiarazione funzioni per calcolo CRC32.
//
//
//
// Modifiche : 08.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
//-----------------------------------------------------------------------------
void AddCrc32ToString( std::string& sVal) ;
bool TestCrc32AndRemoveFromString( std::string& sVal) ;
bool TestCrc32OfString( const std::string& sVal) ;
unsigned int GetCrc32( unsigned int current_remainder, size_t count, const void* p) ;
+41
View File
@@ -0,0 +1,41 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : SELkKeyProc.h Data : 10.09.14 Versione : 1.5i2
// Contenuto : Dichiarazione funzioni per la gestione della chiave.
//
//
//
// Modifiche : 10.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
//-----------------------------------------------------------------------------
bool MakeKey( int nProd, int nVer, int nLev, int nExpDays,
unsigned int nOpt1, unsigned int nOpt2, int nOptExpDays,
const std::string& sScramKey, std::string& sKey) ;
bool ReadKey( const std::string& sKey, const std::string& sScramKey,
unsigned int& nProd, unsigned int& nVer, int& nLev, int& nExpDays,
int& nOpt1, int& nOpt2, int& nOptExpDays) ;
int VerifyKey( const std::string& sKey, int nProd, int nVer, int nLev) ;
int GetKeyLevel( const std::string& sKey, int nProd, int nVer, int nLev,
int& nKLev, int& nKExpDays) ;
int GetKeyOptions( const std::string& sKey, int nProd, int nVer, int nLev,
unsigned int& nKOpt1, unsigned int& nKOpt2, int& nKOptExpDays) ;
int GetCurrDay( void) ;
//-------------------------- Constants ----------------------------------------
const int KEY_OK = 0 ;
const int KEY_ERR_MACHID = 1 ;
const int KEY_ERR_SCRAMKEY = 2 ;
const int KEY_ERR_KEYDECODE = 3 ;
const int KEY_ERR_PROD = 4 ;
const int KEY_ERR_VER = 5 ;
const int KEY_ERR_LEV = 6 ;
const int KEY_ERR_WRONG_TIME = 7 ;
const int KEY_ERR_TIME = 8 ;
+24
View File
@@ -0,0 +1,24 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : SELkMachineId.cpp Data : 10.09.14 Versione : 1.5i2
// Contenuto : Dichiarazione funzioni per gestione/calcolo Id macchina.
//
//
//
// Modifiche : 10.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
//-------------------------------------------------------------------------------
bool CalcMachineId( bool bForceNew) ;
bool GetMachineId( std::string& sMachineId) ;
bool GetMachineId2( std::string& sMachineId) ;
bool GetMachineId3( std::string& sMachineId) ;
bool ConvertMachineId2ToMachineId( const std::string& sMachId2, std::string& sMachId) ;
bool ConvertMachineId2ToScramKey( const std::string& sMachId2, std::string& sScramKey) ;