KeyGenerator 2.1c2 :
- nel caso di calcolo diretto della licenza il nome del file di licenza coincide con quello del file dati e non si incrementa il conto.
This commit is contained in:
Binary file not shown.
+5
-5
@@ -115,7 +115,7 @@ CKeyGeneratorDlg::CKeyGeneratorDlg( const string& sFileToOpen, int nFlag, CWnd*
|
||||
m_hIcon = AfxGetApp()->LoadIcon( IDR_MAINFRAME) ;
|
||||
// eventuale file da caricare all'avvio
|
||||
m_sFileToOpen = sFileToOpen ;
|
||||
m_nFlag = nFlag ;
|
||||
m_bSpecial = ( ! m_sFileToOpen.empty() && nFlag == 1) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -161,7 +161,7 @@ CKeyGeneratorDlg::OnInitDialog( void)
|
||||
if ( ! m_sFileToOpen.empty()) {
|
||||
// leggo il file e genero
|
||||
if ( LoadFile( m_sFileToOpen.c_str())) {
|
||||
if ( m_nFlag == 1)
|
||||
if ( m_bSpecial)
|
||||
PostMessage( WM_COMMAND, IDC_GENER, 0) ;
|
||||
return TRUE ;
|
||||
}
|
||||
@@ -417,14 +417,14 @@ CKeyGeneratorDlg::OnGenerate( void)
|
||||
mKey.GetKey( sKey) ;
|
||||
|
||||
// salvo i dati
|
||||
if ( ! mKey.SaveData())
|
||||
if ( ! mKey.SaveData( m_bSpecial))
|
||||
AfxMessageBox( L"Errore nel salvataggio dei dati") ;
|
||||
|
||||
// visualizzo i risultanti
|
||||
CKeyDlg dlgKey( sKey) ;
|
||||
dlgKey.DoModal() ;
|
||||
|
||||
// se lanciato con file, esco dal programma
|
||||
if ( ! m_sFileToOpen.empty() && m_nFlag == 1)
|
||||
// se lanciato con file e flag 1, esco dal programma
|
||||
if ( m_bSpecial)
|
||||
PostMessage( WM_CLOSE, 0, 0) ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class CKeyGeneratorDlg : public CDialogEx
|
||||
private :
|
||||
HICON m_hIcon ;
|
||||
std::string m_sFileToOpen ;
|
||||
int m_nFlag ;
|
||||
bool m_bSpecial ;
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
} ;
|
||||
|
||||
+4
-3
@@ -175,7 +175,7 @@ KeyMaker::GetKey( string& sKey)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
KeyMaker::SaveData( void)
|
||||
KeyMaker::SaveData( bool bSpecial)
|
||||
{
|
||||
// direttorio di salvataggio
|
||||
string sDataDir = GetPrivateProfileStringUtf8( "General", "DataDir", "C:/EgtProg/KeyGenerator", AfxGetApp()->m_pszProfileName) ;
|
||||
@@ -190,7 +190,8 @@ KeyMaker::SaveData( void)
|
||||
// se cambiati i dati, aggiungo nuova versione di licenza
|
||||
if ( DiffLicence( sLogFile.c_str())) {
|
||||
// salvo nuovo indice salvataggio
|
||||
++ nLast ;
|
||||
if ( ! bSpecial)
|
||||
++ nLast ;
|
||||
WritePrivateProfileInt( "Index", "Last", nLast, sLogFile.c_str()) ;
|
||||
// aggiorno nome sezione
|
||||
sSec = "Licence" + ToString( nLast) ;
|
||||
@@ -200,7 +201,7 @@ KeyMaker::SaveData( void)
|
||||
}
|
||||
|
||||
// path file licenza
|
||||
string sLicFile = sDataDir + "\\" + m_sCustomer + "_" + sSec + ".lic" ;
|
||||
string sLicFile = sDataDir + "\\" + m_sCustomer + ( bSpecial ? "" : "_" + sSec) + ".lic" ;
|
||||
// linea per evitare problemi con BOM
|
||||
ofstream ofOut( stringtoW( sLicFile), ios_base::out | ios_base::trunc) ;
|
||||
if ( ! ofOut.good())
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ class KeyMaker
|
||||
bool SetOptExpirDays( int nOptExpDays) ;
|
||||
bool CalcKey( void) ;
|
||||
bool GetKey( std::string& sKey) ;
|
||||
bool SaveData( void) ;
|
||||
bool SaveData( bool bSpecial) ;
|
||||
|
||||
private :
|
||||
bool DiffLicence( const char* szFile) ;
|
||||
|
||||
Reference in New Issue
Block a user