Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@15607 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f3f2ae5e9a
commit
5674651824
162
setup/Setup.cpp
162
setup/Setup.cpp
@ -11,6 +11,7 @@
|
|||||||
#include <wx/mimetype.h>
|
#include <wx/mimetype.h>
|
||||||
#include <wx/progdlg.h>
|
#include <wx/progdlg.h>
|
||||||
#include <wx/radiobox.h>
|
#include <wx/radiobox.h>
|
||||||
|
#include <wx/socket.h>
|
||||||
#include <wx/txtstrm.h>
|
#include <wx/txtstrm.h>
|
||||||
#include <wx/wfstream.h>
|
#include <wx/wfstream.h>
|
||||||
#include <wx/wizard.h>
|
#include <wx/wizard.h>
|
||||||
@ -605,15 +606,13 @@ CampoWizardPage3::CampoWizardPage3(wxWizard* parent) : CampoWizardPage(parent)
|
|||||||
class CampoWizardPage4 : public CampoWizardPage
|
class CampoWizardPage4 : public CampoWizardPage
|
||||||
{
|
{
|
||||||
int _dongle_type;
|
int _dongle_type;
|
||||||
wxButton* _butt_HL;
|
|
||||||
wxButton* _butt_EU;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
void OnHLPick(wxCommandEvent& e);
|
void OnHLPick(wxCommandEvent& e);
|
||||||
void OnEUPick(wxCommandEvent& e);
|
void OnEUPick(wxCommandEvent& e);
|
||||||
|
|
||||||
int DongleTest();
|
int DongleTest(const wxString& strSrvName = wxEmptyString);
|
||||||
int ThisYear();
|
int ThisYear();
|
||||||
wxString DecodeString(const wxString& data);
|
wxString DecodeString(const wxString& data);
|
||||||
int VersionYear();
|
int VersionYear();
|
||||||
@ -625,6 +624,10 @@ protected:
|
|||||||
void EncodeEutronPassword(char* str);
|
void EncodeEutronPassword(char* str);
|
||||||
unsigned short EutronLogin(int& year);
|
unsigned short EutronLogin(int& year);
|
||||||
|
|
||||||
|
unsigned short InquireSocketNumber(wxSocketClient& sc, const wxString& strCommand);
|
||||||
|
unsigned short InquireServer(const wxString& strSrvName, int& year);
|
||||||
|
unsigned short ServerLogin(int& year, const wxString& strSrvName);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CampoWizardPage4(wxWizard* parent);
|
CampoWizardPage4(wxWizard* parent);
|
||||||
};
|
};
|
||||||
@ -745,6 +748,54 @@ unsigned short CampoWizardPage4::EutronLogin(int& year)
|
|||||||
return serno;
|
return serno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////
|
||||||
|
// Gestione Server di chiavi //
|
||||||
|
//////////////////////////////////
|
||||||
|
unsigned short CampoWizardPage4::InquireSocketNumber(wxSocketClient& sc, const wxString& strCommand)
|
||||||
|
{
|
||||||
|
sc.Write(strCommand, (wxUint32)strCommand.Len());
|
||||||
|
long number[2] = { 0L, 0L };
|
||||||
|
sc.Read(number, sizeof(number));
|
||||||
|
return (unsigned short)number[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short CampoWizardPage4::InquireServer(const wxString& strSrvName, int& year)
|
||||||
|
{
|
||||||
|
wxIPV4address ip;
|
||||||
|
if (!ip.Hostname(strSrvName) || !ip.Service("1883")) //indirizzo NON valido o porta scazzata!
|
||||||
|
{
|
||||||
|
ErrorBox("Indirizzo IP errato!");
|
||||||
|
return 0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSocketClient sc;
|
||||||
|
if (!sc.Connect(ip)) //il computer remoto risponde ma il server no (non c'e' o e' spento)
|
||||||
|
{
|
||||||
|
ErrorBox("Il server specificato non e' raggiungibile!");
|
||||||
|
return 0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short serno = InquireSocketNumber(sc, "DongleNumber()");
|
||||||
|
year = InquireSocketNumber(sc, "DongleYear()");
|
||||||
|
|
||||||
|
return serno;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short CampoWizardPage4::ServerLogin(int& year, const wxString& strSrvName)
|
||||||
|
{
|
||||||
|
unsigned short serno = 0xFFFF;
|
||||||
|
//se non specificato un nome/indirizzo di server, lo cerca tra i miei "cpu fratelli" in rete
|
||||||
|
if (strSrvName.IsEmpty())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else //se invece e' specificato un server vede se il server di chiavi c'e' e funziona davvero
|
||||||
|
{
|
||||||
|
}
|
||||||
|
serno = InquireServer("localhost", year);
|
||||||
|
return serno;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
// Metodi generici per le chiavi ed i relativi codici //
|
// Metodi generici per le chiavi ed i relativi codici //
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
@ -788,25 +839,46 @@ int CampoWizardPage4::VersionYear()
|
|||||||
return atoi(ver);
|
return atoi(ver);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CampoWizardPage4::DongleTest()
|
int CampoWizardPage4::DongleTest(const wxString& strSrvName)
|
||||||
{
|
{
|
||||||
_dongle_type = 0;
|
_dongle_type = 0;
|
||||||
int yearKey = 0;
|
int yearKey = 0;
|
||||||
|
|
||||||
unsigned int serno = HardlockLogin(yearKey);
|
unsigned int serno = 0xFFFF;
|
||||||
|
|
||||||
|
if (!strSrvName.IsEmpty())
|
||||||
|
{
|
||||||
|
serno = ServerLogin(yearKey, strSrvName);
|
||||||
|
if (serno != 0xFFFF)
|
||||||
|
_dongle_type = 3; //chiave remota
|
||||||
|
}
|
||||||
|
|
||||||
if (serno == 0xFFFF)
|
if (serno == 0xFFFF)
|
||||||
{
|
{
|
||||||
serno = EutronLogin(yearKey);
|
serno = HardlockLogin(yearKey);
|
||||||
if (serno != 0xFFFF)
|
if (serno == 0xFFFF)
|
||||||
_dongle_type = 2; //chiave eutron
|
{
|
||||||
}
|
serno = EutronLogin(yearKey);
|
||||||
else
|
if (serno != 0xFFFF)
|
||||||
_dongle_type = 1; //chiave hardlock
|
_dongle_type = 2; //chiave eutron
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strSrvName.IsEmpty())
|
||||||
|
{
|
||||||
|
serno = ServerLogin(yearKey, strSrvName);
|
||||||
|
if (serno != 0xFFFF)
|
||||||
|
_dongle_type = 3; //chiave remota
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_dongle_type = 1; //chiave hardlock
|
||||||
|
}
|
||||||
|
|
||||||
if (serno == 0) // Chiave di sviluppo
|
if (serno == 0) // Chiave di sviluppo
|
||||||
return _dongle_type;
|
return _dongle_type;
|
||||||
if (serno == 0xFFFF) // Chiave inesistente o invisibile = Prima installazione o demo
|
if (serno == 0xFFFF) // Chiave inesistente o invisibile = Prima installazione o demo
|
||||||
return _dongle_type;
|
return _dongle_type;
|
||||||
|
|
||||||
const int verYear = VersionYear();
|
const int verYear = VersionYear();
|
||||||
if (yearKey < verYear) // Chiave già programmata con assistenza pagata
|
if (yearKey < verYear) // Chiave già programmata con assistenza pagata
|
||||||
@ -874,32 +946,58 @@ CampoWizardPage4::CampoWizardPage4(wxWizard* parent) : CampoWizardPage(parent)
|
|||||||
strBody += wxT("<p align=center><img src=\"eutron.gif\" /></p>");
|
strBody += wxT("<p align=center><img src=\"eutron.gif\" /></p>");
|
||||||
strBody += wxT("<p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>Campo</i></b>. Premere il pulsante \"Next\".</p>");
|
strBody += wxT("<p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>Campo</i></b>. Premere il pulsante \"Next\".</p>");
|
||||||
break;
|
break;
|
||||||
//case 3: e' il caso del server di chiavi;la DongleTest() per ora non lo fa
|
case 3:
|
||||||
//break;
|
strBody += wxT("<p>E' stato rilevata una chiave remota condivisa in rete con il servizio di gestione autorizzazioni:</p>");
|
||||||
|
strBody += wxT("<p align=center><img src=\"passerona.gif\" /></p>");
|
||||||
|
strBody += wxT("<p>Si puo' procedere con l'installazione /aggiornamento del software <b><i>Campo</i></b>. Premere il pulsante \"Next\".</p>");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
strBody += wxT("<p><b>Non e' stata rilevata alcuna chiave hardware installata !</b></p>");
|
strBody += wxT("<p><b>Non e' stata rilevata alcuna chiave hardware installata sul computer!</b></p>");
|
||||||
strBody += wxT("<p>Per procedere all'installazione dei driver della chiave hardware collegata al computer premere il bottone corrispondente alla tipologia della chiave stessa.</p>");
|
strBody += wxT("<p>Per procedere all'installazione della chiave hardware, <u>collegarla al computer e premere il bottone corrispondente</u> alla tipologia della chiave stessa per installarne i driver.</p>");
|
||||||
strBody += wxT("<p>Se si desidera proseguire nell'installazione del software senza installare la chiave hardware cliccare su \"Next\".</p>");
|
strBody += wxT("<p>Se si utilizza una chiave remota collegata ad un altro computer e condivisa in rete attraverso il servizio gestione di autorizzazioni ");
|
||||||
strBody += wxT("<p>Quest'ultima procedura e' consigliata solo in caso di installazione tipo <b>Client</b> di rete senza chiave propria, ma che utilizza un server di autorizzazioni gia' installato e funzionante in rete.</p>");
|
strBody += wxT("<u>indicare il nome del computer (o l'indirizzo IP) cui e' collegata la chiave e su cui e' <b>installato e funzionante</b> il gestore di autorizzazioni</u>. ");
|
||||||
|
|
||||||
//procedura per la costruzione dei bottoni e delle immagini per l'installazione dei driver di chiave
|
//procedura per la costruzione dei bottoni e delle immagini per l'installazione dei driver di chiave
|
||||||
//"griglia" contenitrice degli oggetti
|
//"griglia" contenitrice degli oggetti
|
||||||
wxBoxSizer* butt_box = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
GetSizer()->Add(butt_box, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
//griglia per sistemare i campi
|
||||||
//Hardlock img e button
|
wxGridBagSizer* gbsButtSizer = new wxGridBagSizer(VGAP, HGAP);
|
||||||
|
GetSizer()->Add(gbsButtSizer);
|
||||||
|
|
||||||
|
//prima riga della griglia
|
||||||
|
//Hardlock label
|
||||||
|
AddLabel(gbsButtSizer, "Installa chiave locale di tipo Hardlock", 0, 0);
|
||||||
|
//Hardlock image
|
||||||
wxBitmap bmp_HL("hardlock.gif", wxBITMAP_TYPE_GIF);
|
wxBitmap bmp_HL("hardlock.gif", wxBITMAP_TYPE_GIF);
|
||||||
wxStaticBitmap* s_bmp_HL = new wxStaticBitmap(this, wxID_ANY, bmp_HL);
|
wxStaticBitmap* s_bmp_HL = new wxStaticBitmap(this, wxID_ANY, bmp_HL);
|
||||||
butt_box->Add(s_bmp_HL, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 8);
|
gbsButtSizer->Add(s_bmp_HL, wxGBPosition(0, 1));
|
||||||
_butt_HL = new wxButton(this, 401, "Hardlock", wxDefaultPosition, wxSize(100, 50));
|
//bottone Hardlock
|
||||||
butt_box->Add(_butt_HL, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 8);
|
wxButton* bHlButton = new wxButton(this, 401, wxT("Hardlock"), wxDefaultPosition, wxSize(64, -1));
|
||||||
//spaziatore centrale
|
gbsButtSizer->Add(bHlButton, wxGBPosition(0, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
|
||||||
butt_box->AddSpacer(24);
|
|
||||||
//Eutron img e button
|
//seconda riga della griglia
|
||||||
_butt_EU = new wxButton(this, 402, "Eutron", wxDefaultPosition, wxSize(100, 50));
|
//Eutron label
|
||||||
butt_box->Add(_butt_EU, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 8);
|
AddLabel(gbsButtSizer, "Installa chiave locale di tipo Eutron", 1, 0);
|
||||||
|
//Eutron image
|
||||||
wxBitmap bmp_EU("eutron.gif", wxBITMAP_TYPE_GIF);
|
wxBitmap bmp_EU("eutron.gif", wxBITMAP_TYPE_GIF);
|
||||||
wxStaticBitmap* s_bmp_EU = new wxStaticBitmap(this, wxID_ANY, bmp_EU);
|
wxStaticBitmap* s_bmp_EU = new wxStaticBitmap(this, wxID_ANY, bmp_EU);
|
||||||
butt_box->Add(s_bmp_EU, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 8);
|
gbsButtSizer->Add(s_bmp_EU, wxGBPosition(1, 1));
|
||||||
|
//bottone Eutron
|
||||||
|
wxButton* bEuButton = new wxButton(this, 402, wxT("Eutron"), wxDefaultPosition, wxSize(64, -1));
|
||||||
|
gbsButtSizer->Add(bEuButton, wxGBPosition(1, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
|
//terza riga della griglia
|
||||||
|
//Server label
|
||||||
|
AddLabel(gbsButtSizer, "Nome o indirizzo IP del server di autorizzazioni", 2, 0);
|
||||||
|
//Server image
|
||||||
|
/* wxBitmap bmp_Srv("passerona.gif", wxBITMAP_TYPE_GIF);
|
||||||
|
wxStaticBitmap* s_bmp_Srv = new wxStaticBitmap(this, wxID_ANY, bmp_Srv);
|
||||||
|
gbsButtSizer->Add(s_bmp_Srv, wxGBPosition(2, 1));*/
|
||||||
|
//nome Server
|
||||||
|
wxTextCtrl* tcSrvName = new wxTextCtrl(this, 403, "", wxDefaultPosition, wxSize(320,-1));
|
||||||
|
gbsButtSizer->Add(tcSrvName, wxGBPosition(2, 2));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user