|
@@ -5,22 +5,21 @@
|
|
|
|
|
|
// Inhalt der PatchServer Klasse aus PatchServer.h
|
|
|
// Konstruktor
|
|
|
-PatchServer::PatchServer( InitDatei *zIni )
|
|
|
+PatchServer::PatchServer( InitDatei* zIni )
|
|
|
: Thread()
|
|
|
{
|
|
|
Network::Start( 100 );
|
|
|
std::cout << "PS: Verbindung mit Datenbank wird hergestellt...\n";
|
|
|
db = new PSDatenbank( zIni );
|
|
|
- klientAnzahl = 0;
|
|
|
klients = new RCArray< PSKlient >();
|
|
|
empfangen = 0;
|
|
|
gesendet = 0;
|
|
|
fehler = new Text();
|
|
|
- ini = dynamic_cast<InitDatei *>( zIni->getThis() );
|
|
|
+ ini = dynamic_cast<InitDatei*>(zIni->getThis());
|
|
|
id = *zIni->zWert( "ServerId" );
|
|
|
- Text *dgInitPfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* dgInitPfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
dgInitPfad->append( "/datei_gruppe.ini" );
|
|
|
- InitDatei *dgInit = new InitDatei( dgInitPfad );
|
|
|
+ InitDatei* dgInit = new InitDatei( dgInitPfad );
|
|
|
dgInit->laden();
|
|
|
for( int i = 0; i < dgInit->getWertAnzahl(); i++ )
|
|
|
db->setDateiGruppe( id, TextZuInt( dgInit->zName( i )->getText(), 10 ), (int)TextZuInt( dgInit->zWert( i )->getText(), 10 ) );
|
|
@@ -70,18 +69,18 @@ void PatchServer::runn()
|
|
|
{
|
|
|
while( !end && aServer->isConnected() )
|
|
|
{
|
|
|
- SSLSKlient *klient;
|
|
|
+ SSLSKlient* klient;
|
|
|
klient = aServer->getKlient();
|
|
|
if( end && klient )
|
|
|
{
|
|
|
klient->trenne();
|
|
|
- klient = (SSLSKlient *)klient->release();
|
|
|
+ klient = (SSLSKlient*)klient->release();
|
|
|
Sleep( 1000 );
|
|
|
return;
|
|
|
}
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
- PSAKlient *clHandle = new PSAKlient( klient, dynamic_cast<PatchServer *>( getThis() ), dynamic_cast<InitDatei *>( ini->getThis() ) );
|
|
|
+ PSAKlient* clHandle = new PSAKlient( klient, dynamic_cast<PatchServer*>(getThis()), dynamic_cast<InitDatei*>(ini->getThis()) );
|
|
|
clHandle->start();
|
|
|
}
|
|
|
}
|
|
@@ -90,15 +89,14 @@ void PatchServer::thread()
|
|
|
{
|
|
|
while( server->isConnected() )
|
|
|
{
|
|
|
- SKlient *klient;
|
|
|
+ SKlient* klient;
|
|
|
klient = server->getKlient();
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
|
- PSKlient *clHandle = new PSKlient( klient, dynamic_cast<PatchServer *>( getThis() ), dynamic_cast<InitDatei *>( ini->getThis() ) );
|
|
|
+ PSKlient* clHandle = new PSKlient( klient, dynamic_cast<PatchServer*>(getThis()), dynamic_cast<InitDatei*>(ini->getThis()) );
|
|
|
EnterCriticalSection( &cs );
|
|
|
- klients->set( clHandle, klientAnzahl );
|
|
|
- klientAnzahl++;
|
|
|
+ klients->add( clHandle );
|
|
|
LeaveCriticalSection( &cs );
|
|
|
clHandle->start();
|
|
|
}
|
|
@@ -112,15 +110,14 @@ void PatchServer::close()
|
|
|
warteAufThread( 1000 );
|
|
|
#endif
|
|
|
EnterCriticalSection( &cs );
|
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
|
klients->z( i )->absturz();
|
|
|
- klients = ( RCArray<PSKlient>* ) klients->release();
|
|
|
- klientAnzahl = 0;
|
|
|
+ klients = (RCArray<PSKlient>*) klients->release();
|
|
|
LeaveCriticalSection( &cs );
|
|
|
ende();
|
|
|
run = 0;
|
|
|
end = 1;
|
|
|
- Klient *klient = new Klient();
|
|
|
+ Klient* klient = new Klient();
|
|
|
klient->verbinde( aServer->getPort(), "127.0.0.1" );
|
|
|
Sleep( 500 );
|
|
|
aServer->trenne();
|
|
@@ -218,13 +215,12 @@ bool PatchServer::absturzKlient( int klientId )
|
|
|
{
|
|
|
bool gefunden = 0;
|
|
|
EnterCriticalSection( &cs );
|
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
|
{
|
|
|
if( klients->z( i )->getKlientNummer() == klientId )
|
|
|
{
|
|
|
klients->z( i )->absturz();
|
|
|
klients->remove( i );
|
|
|
- klientAnzahl--;
|
|
|
gefunden = 1;
|
|
|
break;
|
|
|
}
|
|
@@ -233,16 +229,15 @@ bool PatchServer::absturzKlient( int klientId )
|
|
|
return gefunden;
|
|
|
}
|
|
|
|
|
|
-bool PatchServer::removeKlient( PSKlient *zKlient )
|
|
|
+bool PatchServer::removeKlient( PSKlient* zKlient )
|
|
|
{
|
|
|
bool gefunden = 0;
|
|
|
EnterCriticalSection( &cs );
|
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
|
{
|
|
|
if( klients->z( i ) == zKlient )
|
|
|
{
|
|
|
klients->remove( i );
|
|
|
- klientAnzahl--;
|
|
|
gefunden = 1;
|
|
|
break;
|
|
|
}
|
|
@@ -280,19 +275,19 @@ bool PatchServer::beginnUpdate( int gruppe )
|
|
|
}
|
|
|
if( !db->setDateiGruppe( id, gruppe, true ) )
|
|
|
return 0;
|
|
|
- Text *gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
+ Text* gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
if( !gruppeN )
|
|
|
return 0;
|
|
|
Result systemT = db->getSystemListe();
|
|
|
for( int i = 0; i < systemT.zeilenAnzahl; i++ )
|
|
|
{
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( systemT.values[ i * 2 + 1 ].getText() );
|
|
|
pfad->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pfad->getText() );
|
|
|
+ InitDatei* vIni = new InitDatei( pfad->getText() );
|
|
|
vIni->laden();
|
|
|
pfad->remove( pfad->getLength() - 11, pfad->getLength() );
|
|
|
Result dateiT = db->getDeletedFiles( TextZuInt( systemT.values[ i * 2 ].getText(), 10 ), gruppe );
|
|
@@ -300,7 +295,7 @@ bool PatchServer::beginnUpdate( int gruppe )
|
|
|
{
|
|
|
if( vIni->wertExistiert( dateiT.values[ j ].getText() ) )
|
|
|
{
|
|
|
- Text *pf = new Text( pfad->getText() );
|
|
|
+ Text* pf = new Text( pfad->getText() );
|
|
|
pf->append( dateiT.values[ j ].getText() );
|
|
|
DateiRemove( pf );
|
|
|
vIni->removeWert( dateiT.values[ j ].getText() );
|
|
@@ -319,13 +314,13 @@ bool PatchServer::beginnUpdate( int gruppe )
|
|
|
|
|
|
void PatchServer::endUpdate( int gruppe )
|
|
|
{
|
|
|
- Text *dgInitPfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* dgInitPfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
dgInitPfad->append( "/datei_gruppe.ini" );
|
|
|
- InitDatei *dgInit = new InitDatei( dgInitPfad );
|
|
|
+ InitDatei* dgInit = new InitDatei( dgInitPfad );
|
|
|
dgInit->laden();
|
|
|
- Text *gT = new Text();
|
|
|
+ Text* gT = new Text();
|
|
|
gT->append( gruppe );
|
|
|
- Text *vT = new Text();
|
|
|
+ Text* vT = new Text();
|
|
|
vT->append( db->getDateiGruppeVersion( gruppe ) );
|
|
|
if( !dgInit->wertExistiert( gT->getText() ) )
|
|
|
dgInit->addWert( gT->getText(), vT->getText() );
|
|
@@ -367,19 +362,19 @@ bool PatchServer::istAn() const
|
|
|
return db->serverIstNichtPausiert( id );
|
|
|
}
|
|
|
|
|
|
-Server *PatchServer::zServer() const
|
|
|
+Server* PatchServer::zServer() const
|
|
|
{
|
|
|
return server;
|
|
|
}
|
|
|
|
|
|
-PSDatenbank *PatchServer::zDB() const
|
|
|
+PSDatenbank* PatchServer::zDB() const
|
|
|
{
|
|
|
return db;
|
|
|
}
|
|
|
|
|
|
bool PatchServer::hatClients() const
|
|
|
{
|
|
|
- return klientAnzahl > 0;
|
|
|
+ return klients->hat( 0 );
|
|
|
}
|
|
|
|
|
|
int PatchServer::getId() const
|
|
@@ -387,7 +382,7 @@ int PatchServer::getId() const
|
|
|
return id;
|
|
|
}
|
|
|
|
|
|
-char *PatchServer::getLetzterFehler() const
|
|
|
+char* PatchServer::getLetzterFehler() const
|
|
|
{
|
|
|
return fehler->getText();
|
|
|
}
|
|
@@ -399,16 +394,16 @@ bool PatchServer::proveVersion( int gruppe ) const
|
|
|
{
|
|
|
int system = TextZuInt( systemT.values[ i * 2 ].getText(), 10 );
|
|
|
Result dateiT = db->getDateiListeOhneOrdner( system, gruppe );
|
|
|
- Text *gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
+ Text* gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
if( !gruppeN )
|
|
|
continue;
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( systemT.values[ i * 2 + 1 ].getText() );
|
|
|
pfad->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pfad );
|
|
|
+ InitDatei* vIni = new InitDatei( pfad );
|
|
|
vIni->laden();
|
|
|
int dAnz = vIni->getWertAnzahl();
|
|
|
if( dAnz != dateiT.zeilenAnzahl ) // nicht aktuell
|
|
@@ -465,16 +460,16 @@ bool PatchServer::proveVersion() const
|
|
|
{
|
|
|
int system = TextZuInt( systemT.values[ i * 2 ].getText(), 10 );
|
|
|
Result dateiT = db->getDateiListeOhneOrdner( system, gruppe );
|
|
|
- Text *gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
+ Text* gruppeN = db->getDateiGruppeName( gruppe );
|
|
|
if( !gruppeN )
|
|
|
continue;
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( systemT.values[ i * 2 + 1 ].getText() );
|
|
|
pfad->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pfad );
|
|
|
+ InitDatei* vIni = new InitDatei( pfad );
|
|
|
vIni->laden();
|
|
|
int dAnz = vIni->getWertAnzahl();
|
|
|
if( dAnz != dateiT.zeilenAnzahl ) // nicht aktuell
|
|
@@ -540,7 +535,7 @@ bool PatchServer::proveVersion() const
|
|
|
|
|
|
// Inhalt der PSAKlient Klasse aus PatchServer.h
|
|
|
// Konstruktor
|
|
|
-PSAKlient::PSAKlient( SSLSKlient *klient, PatchServer *ps, InitDatei *ini )
|
|
|
+PSAKlient::PSAKlient( SSLSKlient* klient, PatchServer* ps, InitDatei* ini )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
@@ -584,14 +579,14 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned char len = 0;
|
|
|
- klient->getNachricht( (char *)&len, 1 );
|
|
|
- char *n = new char[ len + 1 ];
|
|
|
+ klient->getNachricht( (char*)&len, 1 );
|
|
|
+ char* n = new char[ len + 1 ];
|
|
|
n[ (int)len ] = 0;
|
|
|
if( len )
|
|
|
klient->getNachricht( n, len );
|
|
|
unsigned char pLen = 0;
|
|
|
- klient->getNachricht( (char *)&pLen, 1 );
|
|
|
- char *p = new char[ pLen + 1 ];
|
|
|
+ klient->getNachricht( (char*)&pLen, 1 );
|
|
|
+ char* p = new char[ pLen + 1 ];
|
|
|
p[ (int)pLen ] = 0;
|
|
|
if( pLen )
|
|
|
klient->getNachricht( p, pLen );
|
|
@@ -628,7 +623,7 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
if( !ps->serverStarten() )
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( ps->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -651,7 +646,7 @@ void PSAKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( ps->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -675,7 +670,7 @@ void PSAKlient::thread()
|
|
|
ok = 1;
|
|
|
else
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( ps->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -762,7 +757,7 @@ void PSAKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( ps->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -784,14 +779,14 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int maxC = 0;
|
|
|
- klient->getNachricht( (char *)&maxC, 4 );
|
|
|
+ klient->getNachricht( (char*)&maxC, 4 );
|
|
|
if( ps->zDB()->adminHatRecht( adminId, Admin_Recht::PSMCChange ) )
|
|
|
{
|
|
|
if( ps->setMaxKlients( maxC ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( ps->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -814,16 +809,16 @@ void PSAKlient::thread()
|
|
|
for( int i = 0; i < systemT.zeilenAnzahl; i++ )
|
|
|
{
|
|
|
int len = systemT.values[ i * 2 + 1 ].getLength();
|
|
|
- klient->sende( (char *)&len, 4 );
|
|
|
+ klient->sende( (char*)&len, 4 );
|
|
|
klient->sende( systemT.values[ i * 2 + 1 ].getText(), len );
|
|
|
Result dateiT = ps->zDB()->getDateiListeOhneOrdner( TextZuInt( systemT.values[ i * 2 ].getText(), 10 ), updateGruppe );
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( systemT.values[ i * 2 + 1 ].getText() );
|
|
|
pfad->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pfad );
|
|
|
+ InitDatei* vIni = new InitDatei( pfad );
|
|
|
vIni->laden();
|
|
|
for( int j = 0; j < dateiT.zeilenAnzahl; j++ )
|
|
|
{
|
|
@@ -835,7 +830,7 @@ void PSAKlient::thread()
|
|
|
if( veraltet )
|
|
|
{
|
|
|
int len = dateiT.values[ j * 2 ].getLength();
|
|
|
- klient->sende( (char *)&len, 4 );
|
|
|
+ klient->sende( (char*)&len, 4 );
|
|
|
klient->sende( dateiT.values[ j * 2 ].getText(), len );
|
|
|
}
|
|
|
}
|
|
@@ -862,7 +857,7 @@ void PSAKlient::thread()
|
|
|
ps->endUpdate( updateGruppe );
|
|
|
updateGruppe = 0;
|
|
|
if( gruppeN )
|
|
|
- gruppeN = (Text *)gruppeN->release();
|
|
|
+ gruppeN = (Text*)gruppeN->release();
|
|
|
std::cout << "PS: Update erfolgreich abgeschlossen.\n";
|
|
|
klient->sende( "\1", 1 );
|
|
|
}
|
|
@@ -879,7 +874,7 @@ void PSAKlient::thread()
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
int dg = 0;
|
|
|
- klient->getNachricht( (char *)&dg, 4 );
|
|
|
+ klient->getNachricht( (char*)&dg, 4 );
|
|
|
gruppeN = ps->zDB()->getDateiGruppeName( dg );
|
|
|
if( !gruppeN )
|
|
|
{
|
|
@@ -919,13 +914,13 @@ void PSAKlient::thread()
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
int system = 0;
|
|
|
- klient->getNachricht( (char *)&system, 4 );
|
|
|
+ klient->getNachricht( (char*)&system, 4 );
|
|
|
int version = 0;
|
|
|
- klient->getNachricht( (char *)&version, 4 );
|
|
|
- Text *sName = ps->zDB()->getSystemName( system );
|
|
|
+ klient->getNachricht( (char*)&version, 4 );
|
|
|
+ Text* sName = ps->zDB()->getSystemName( system );
|
|
|
unsigned short len = 0;
|
|
|
- klient->getNachricht( (char *)&len, 2 );
|
|
|
- char *pfad = new char[ len + 1 ];
|
|
|
+ klient->getNachricht( (char*)&len, 2 );
|
|
|
+ char* pfad = new char[ len + 1 ];
|
|
|
pfad[ len ] = 0;
|
|
|
if( len )
|
|
|
klient->getNachricht( pfad, len );
|
|
@@ -937,36 +932,36 @@ void PSAKlient::thread()
|
|
|
sName->release();
|
|
|
break;
|
|
|
}
|
|
|
- Text *pf = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* pf = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pf->append( "/" );
|
|
|
pf->append( gruppeN->getText() );
|
|
|
pf->append( "/" );
|
|
|
pf->append( sName->getText() );
|
|
|
sName->release();
|
|
|
pf->append( "/version.ini" );
|
|
|
- InitDatei *vIni = new InitDatei( pf->getText() );
|
|
|
+ InitDatei* vIni = new InitDatei( pf->getText() );
|
|
|
vIni->laden();
|
|
|
pf->remove( pf->getLength() - 11, pf->getLength() );
|
|
|
pf->append( pfad );
|
|
|
- Datei *d = new Datei();
|
|
|
+ Datei* d = new Datei();
|
|
|
d->setDatei( pf );
|
|
|
d->erstellen();
|
|
|
if( d->open( Datei::Style::schreiben ) )
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
- klient->getNachricht( (char *)&len, 2 );
|
|
|
+ klient->getNachricht( (char*)&len, 2 );
|
|
|
while( len )
|
|
|
{
|
|
|
- char *buff = new char[ len ];
|
|
|
+ char* buff = new char[ len ];
|
|
|
klient->getNachricht( buff, len );
|
|
|
d->schreibe( buff, len );
|
|
|
delete[] buff;
|
|
|
- klient->getNachricht( (char *)&len, 2 );
|
|
|
+ klient->getNachricht( (char*)&len, 2 );
|
|
|
ps->addEmpfangen( klient->getDownloadBytes( 1 ) );
|
|
|
ps->addGesendet( klient->getUploadBytes( 1 ) );
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
- Text *vT = new Text();
|
|
|
+ Text* vT = new Text();
|
|
|
vT->append( version );
|
|
|
if( !vIni->wertExistiert( pfad ) )
|
|
|
vIni->addWert( pfad, vT->getText() );
|
|
@@ -990,7 +985,7 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int klientId = 0;
|
|
|
- klient->getNachricht( (char *)&klientId, 4 );
|
|
|
+ klient->getNachricht( (char*)&klientId, 4 );
|
|
|
if( klientId && ps->absturzKlient( klientId ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
@@ -1006,26 +1001,26 @@ void PSAKlient::thread()
|
|
|
errorZuKlient( "Du hast kein Recht diese Operation durchzuführen." );
|
|
|
else
|
|
|
{
|
|
|
- Array< FileGroupInfo * > list;
|
|
|
+ Array< FileGroupInfo* > list;
|
|
|
if( ps->zDB()->getFileGroupInfoList( ps->getId(), &list ) )
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int anz = list.getEintragAnzahl();
|
|
|
- klient->sende( (char *)&anz, 4 );
|
|
|
+ klient->sende( (char*)&anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
- FileGroupInfo *info = list.get( i );
|
|
|
- klient->sende( (char *)&info->id, 4 );
|
|
|
+ FileGroupInfo* info = list.get( i );
|
|
|
+ klient->sende( (char*)&info->id, 4 );
|
|
|
unsigned char len = (unsigned char)info->name.getLength();
|
|
|
- klient->sende( (char *)&len, 1 );
|
|
|
+ klient->sende( (char*)&len, 1 );
|
|
|
klient->sende( info->name, len );
|
|
|
len = (unsigned char)info->status.getLength();
|
|
|
- klient->sende( (char *)&len, 1 );
|
|
|
+ klient->sende( (char*)&len, 1 );
|
|
|
klient->sende( info->status, len );
|
|
|
unsigned short l = (unsigned short)info->pfad.getLength();
|
|
|
- klient->sende( (char *)&l, 2 );
|
|
|
+ klient->sende( (char*)&l, 2 );
|
|
|
klient->sende( info->pfad, l );
|
|
|
- klient->sende( (char *)&info->version, 4 );
|
|
|
+ klient->sende( (char*)&info->version, 4 );
|
|
|
delete info;
|
|
|
}
|
|
|
}
|
|
@@ -1045,13 +1040,13 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
Result res = ps->zDB()->getSystemListe();
|
|
|
- klient->sende( (char *)&res.zeilenAnzahl, 4 );
|
|
|
+ klient->sende( (char*)&res.zeilenAnzahl, 4 );
|
|
|
for( int i = 0; i < res.zeilenAnzahl; i++ )
|
|
|
{
|
|
|
int id = res.values[ i * 2 ];
|
|
|
- klient->sende( (char *)&id, 4 );
|
|
|
+ klient->sende( (char*)&id, 4 );
|
|
|
unsigned char len = (unsigned char)res.values[ i * 2 + 1 ].getLength();
|
|
|
- klient->sende( (char *)&len, 1 );
|
|
|
+ klient->sende( (char*)&len, 1 );
|
|
|
klient->sende( res.values[ i * 2 + 1 ], len );
|
|
|
}
|
|
|
res.destroy();
|
|
@@ -1069,21 +1064,21 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int system, group;
|
|
|
- klient->getNachricht( (char *)&system, 4 );
|
|
|
- klient->getNachricht( (char *)&group, 4 );
|
|
|
+ klient->getNachricht( (char*)&system, 4 );
|
|
|
+ klient->getNachricht( (char*)&group, 4 );
|
|
|
Result res = ps->zDB()->getDateiListeSMP( system, group );
|
|
|
- klient->sende( (char *)&res.zeilenAnzahl, 4 );
|
|
|
+ klient->sende( (char*)&res.zeilenAnzahl, 4 );
|
|
|
for( int i = 0; i < res.zeilenAnzahl; i++ )
|
|
|
{
|
|
|
int id = res.values[ i * 4 ];
|
|
|
- klient->sende( (char *)&id, 4 );
|
|
|
+ klient->sende( (char*)&id, 4 );
|
|
|
unsigned short len = (unsigned short)res.values[ i * 4 + 1 ].getLength();
|
|
|
- klient->sende( (char *)&len, 2 );
|
|
|
+ klient->sende( (char*)&len, 2 );
|
|
|
klient->sende( res.values[ i * 4 + 1 ], len );
|
|
|
int version = res.values[ i * 4 + 2 ];
|
|
|
- klient->sende( (char *)&version, 4 );
|
|
|
+ klient->sende( (char*)&version, 4 );
|
|
|
unsigned char l = (unsigned char)res.values[ i * 4 + 3 ].getLength();
|
|
|
- klient->sende( (char *)&l, 1 );
|
|
|
+ klient->sende( (char*)&l, 1 );
|
|
|
klient->sende( res.values[ i * 4 + 3 ], l );
|
|
|
}
|
|
|
res.destroy();
|
|
@@ -1102,15 +1097,15 @@ void PSAKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int group, system;
|
|
|
unsigned short len;
|
|
|
- klient->getNachricht( (char *)&len, 2 );
|
|
|
- char *path = new char[ len + 1 ];
|
|
|
+ klient->getNachricht( (char*)&len, 2 );
|
|
|
+ char* path = new char[ len + 1 ];
|
|
|
klient->getNachricht( path, len );
|
|
|
path[ len ] = 0;
|
|
|
- klient->getNachricht( (char *)&group, 4 );
|
|
|
- klient->getNachricht( (char *)&system, 4 );
|
|
|
+ klient->getNachricht( (char*)&group, 4 );
|
|
|
+ klient->getNachricht( (char*)&system, 4 );
|
|
|
int version = ps->zDB()->getDateiVersion( path, system, group );
|
|
|
delete[] path;
|
|
|
- klient->sende( (char *)&version, 4 );
|
|
|
+ klient->sende( (char*)&version, 4 );
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -1125,15 +1120,15 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned short len;
|
|
|
- klient->getNachricht( (char *)&len, 2 );
|
|
|
- char *path = new char[ len + 1 ];
|
|
|
+ klient->getNachricht( (char*)&len, 2 );
|
|
|
+ char* path = new char[ len + 1 ];
|
|
|
klient->getNachricht( path, len );
|
|
|
path[ len ] = 0;
|
|
|
char status = 0; // 0: delete, 1: update, 2: new
|
|
|
klient->getNachricht( &status, 1 );
|
|
|
unsigned char l;
|
|
|
- klient->getNachricht( (char *)&l, 1 );
|
|
|
- char *time = 0;
|
|
|
+ klient->getNachricht( (char*)&l, 1 );
|
|
|
+ char* time = 0;
|
|
|
if( l > 0 )
|
|
|
{
|
|
|
time = new char[ l + 1 ];
|
|
@@ -1141,8 +1136,8 @@ void PSAKlient::thread()
|
|
|
time[ l ] = 0;
|
|
|
}
|
|
|
int system, gruppe;
|
|
|
- klient->getNachricht( (char *)&system, 4 );
|
|
|
- klient->getNachricht( (char *)&gruppe, 4 );
|
|
|
+ klient->getNachricht( (char*)&system, 4 );
|
|
|
+ klient->getNachricht( (char*)&gruppe, 4 );
|
|
|
if( ps->zDB()->updateDatei( path, status, time, system, gruppe ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
@@ -1161,7 +1156,7 @@ void PSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int gruppe;
|
|
|
- klient->getNachricht( (char *)&gruppe, 4 );
|
|
|
+ klient->getNachricht( (char*)&gruppe, 4 );
|
|
|
if( ps->zDB()->dateiGruppeUpdate( gruppe ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
@@ -1186,7 +1181,7 @@ void PSAKlient::thread()
|
|
|
delete this;
|
|
|
}
|
|
|
|
|
|
-void PSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
+void PSAKlient::errorZuKlient( const char* nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
{
|
|
|
klient->sende( "\3", 1 );
|
|
|
char len = (char)textLength( nachricht );
|
|
@@ -1197,13 +1192,13 @@ void PSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehl
|
|
|
|
|
|
// Inhalt der PSKlient aus PatchServer.h
|
|
|
// Konstruktor
|
|
|
-PSKlient::PSKlient( SKlient *klient, PatchServer *ps, InitDatei *ini )
|
|
|
+PSKlient::PSKlient( SKlient* klient, PatchServer* ps, InitDatei* ini )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
|
unsigned char key[ 20 ] = { 102, 139, 140, 143, 52, 52, 194, 167, 97, 106, 23, 72, 170, 121, 213, 178, 28, 28, 124, 185 };
|
|
|
- klient->setSendeKey( (char *)key, 20 );
|
|
|
- klient->setEmpfangKey( (char *)key, 20 );
|
|
|
+ klient->setSendeKey( (char*)key, 20 );
|
|
|
+ klient->setEmpfangKey( (char*)key, 20 );
|
|
|
klientNummer = 0;
|
|
|
system = 0;
|
|
|
this->ps = ps;
|
|
@@ -1233,7 +1228,7 @@ void PSKlient::thread()
|
|
|
while( 1 )
|
|
|
{
|
|
|
char c = 0;
|
|
|
- if( ( !encrypted && !klient->getNachricht( &c, 1 ) ) || ( encrypted && !klient->getNachrichtEncrypted( &c, 1 ) ) )
|
|
|
+ if( (!encrypted && !klient->getNachricht( &c, 1 )) || (encrypted && !klient->getNachrichtEncrypted( &c, 1 )) )
|
|
|
break;
|
|
|
else
|
|
|
{
|
|
@@ -1246,13 +1241,13 @@ void PSKlient::thread()
|
|
|
case 1: // Klient identifikation
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- klient->getNachrichtEncrypted( (char *)&klientNummer, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char *)&system, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&klientNummer, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&system, 1 );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- klient->getNachricht( (char *)&klientNummer, 4 );
|
|
|
- klient->getNachricht( (char *)&system, 1 );
|
|
|
+ klient->getNachricht( (char*)&klientNummer, 4 );
|
|
|
+ klient->getNachricht( (char*)&system, 1 );
|
|
|
}
|
|
|
if( !ps->zDB()->proveKlient( klientNummer, ps->getId() ) )
|
|
|
{
|
|
@@ -1263,7 +1258,7 @@ void PSKlient::thread()
|
|
|
{
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- Text *key = ps->zDB()->getKlientKey( klientNummer );
|
|
|
+ Text* key = ps->zDB()->getKlientKey( klientNummer );
|
|
|
if( !key )
|
|
|
errorZuKlient( "Es konnte kein Key ermittelt werden." );
|
|
|
else
|
|
@@ -1294,7 +1289,7 @@ void PSKlient::thread()
|
|
|
int klientId = 0;
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- klient->getNachrichtEncrypted( (char *)&klientId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&klientId, 4 );
|
|
|
if( klientId && ps->absturzKlient( klientId ) )
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
else
|
|
@@ -1302,7 +1297,7 @@ void PSKlient::thread()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- klient->getNachricht( (char *)&klientId, 4 );
|
|
|
+ klient->getNachricht( (char*)&klientId, 4 );
|
|
|
if( klientId && ps->absturzKlient( klientId ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
@@ -1346,7 +1341,7 @@ void PSKlient::thread()
|
|
|
char byte = 0;
|
|
|
// ********neu beginn*********
|
|
|
klient->sende( "\2", 1 );
|
|
|
- Text *pfad = new Text( "start.exe" );
|
|
|
+ Text* pfad = new Text( "start.exe" );
|
|
|
byte = (char)pfad->getLength();
|
|
|
klient->sende( &byte, 1 );
|
|
|
klient->sende( pfad->getText(), byte );
|
|
@@ -1419,25 +1414,25 @@ void PSKlient::thread()
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned char byte = 0;
|
|
|
- klient->getNachricht( (char *)&byte, 1 );
|
|
|
- Text *pfad = new Text( "" );
|
|
|
+ klient->getNachricht( (char*)&byte, 1 );
|
|
|
+ Text* pfad = new Text( "" );
|
|
|
pfad->fillText( ' ', byte );
|
|
|
klient->getNachricht( pfad->getText(), byte );
|
|
|
__int64 pos = 0;
|
|
|
- klient->getNachricht( (char *)&pos, 8 );
|
|
|
+ klient->getNachricht( (char*)&pos, 8 );
|
|
|
if( system )
|
|
|
pfad->insert( 0, "../versions/x64/live/" );
|
|
|
else
|
|
|
pfad->insert( 0, "../versions/x32/live/" );
|
|
|
pfad->ersetzen( "ü", "ue" );
|
|
|
- Datei *datei = new Datei();
|
|
|
+ Datei* datei = new Datei();
|
|
|
datei->setDatei( pfad );
|
|
|
datei->open( Datei::Style::lesen );
|
|
|
if( pos )
|
|
|
datei->setLPosition( pos, 0 );
|
|
|
__int64 length = datei->getSize();
|
|
|
length -= pos;
|
|
|
- char *bytes = new char[ 2048 ];
|
|
|
+ char* bytes = new char[ 2048 ];
|
|
|
unsigned short byteLen = 0;
|
|
|
while( 1 )
|
|
|
{
|
|
@@ -1449,14 +1444,14 @@ void PSKlient::thread()
|
|
|
byteLen = 2048;
|
|
|
if( length < 2048 )
|
|
|
byteLen = (unsigned short)length;
|
|
|
- klient->sende( (char *)&byteLen, 2 );
|
|
|
+ klient->sende( (char*)&byteLen, 2 );
|
|
|
datei->lese( bytes, byteLen );
|
|
|
klient->sende( bytes, byteLen );
|
|
|
length -= byteLen;
|
|
|
char ret = 0;
|
|
|
if( byteLen != 2048 )
|
|
|
break;
|
|
|
- klient->getNachricht( (char *)&ret, 1 );
|
|
|
+ klient->getNachricht( (char*)&ret, 1 );
|
|
|
ps->addEmpfangen( klient->getDownloadBytes( 1 ) );
|
|
|
ps->addGesendet( klient->getUploadBytes( 1 ) );
|
|
|
if( ret == 1 )
|
|
@@ -1466,7 +1461,7 @@ void PSKlient::thread()
|
|
|
if( ret == 2 )
|
|
|
{
|
|
|
pos = 0;
|
|
|
- klient->getNachricht( (char *)&pos, 8 );
|
|
|
+ klient->getNachricht( (char*)&pos, 8 );
|
|
|
if( pos > length )
|
|
|
pos = length;
|
|
|
datei->setLPosition( pos, 0 );
|
|
@@ -1489,7 +1484,7 @@ void PSKlient::thread()
|
|
|
}
|
|
|
klient->sende( "\1", 1 );
|
|
|
int version = 30;
|
|
|
- klient->sende( (char *)&version, 4 );
|
|
|
+ klient->sende( (char*)&version, 4 );
|
|
|
}
|
|
|
break;
|
|
|
case 8: // Frage nach Dateigröße ****Altes Update System
|
|
@@ -1503,7 +1498,7 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
char byte = 0;
|
|
|
klient->getNachricht( &byte, 1 );
|
|
|
- Text *pfad = new Text( "" );
|
|
|
+ Text* pfad = new Text( "" );
|
|
|
pfad->fillText( ' ', byte );
|
|
|
klient->getNachricht( pfad->getText(), byte );
|
|
|
if( system )
|
|
@@ -1511,11 +1506,11 @@ void PSKlient::thread()
|
|
|
else
|
|
|
pfad->insert( 0, "../versions/x32/live/" );
|
|
|
pfad->ersetzen( "ü", "ue" );
|
|
|
- Datei *datei = new Datei();
|
|
|
+ Datei* datei = new Datei();
|
|
|
datei->setDatei( pfad );
|
|
|
__int64 size = datei->getSize();
|
|
|
datei->release();
|
|
|
- klient->sende( (char *)&size, 8 );
|
|
|
+ klient->sende( (char*)&size, 8 );
|
|
|
}
|
|
|
break;
|
|
|
case 9: // Frage nach Dateiliste ****Neues Update System
|
|
@@ -1532,9 +1527,9 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int updateGruppe = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char *)&updateGruppe, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&updateGruppe, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char *)&updateGruppe, 4 );
|
|
|
+ klient->getNachricht( (char*)&updateGruppe, 4 );
|
|
|
Result dateien = ps->zDB()->getDateiListeOhneOrdner( system, updateGruppe );
|
|
|
if( !dateien.zeilenAnzahl )
|
|
|
{
|
|
@@ -1554,17 +1549,17 @@ void PSKlient::thread()
|
|
|
break;
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- klient->sendeEncrypted( (char *)&len, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
klient->sendeEncrypted( dateien.values[ i * 2 ].getText(), len );
|
|
|
int version = TextZuInt( dateien.values[ i * 2 + 1 ].getText(), 10 );
|
|
|
- klient->sendeEncrypted( (char *)&version, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&version, 4 );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- klient->sende( (char *)&len, 4 );
|
|
|
+ klient->sende( (char*)&len, 4 );
|
|
|
klient->sende( dateien.values[ i * 2 ].getText(), len );
|
|
|
int version = TextZuInt( dateien.values[ i * 2 + 1 ].getText(), 10 );
|
|
|
- klient->sende( (char *)&version, 4 );
|
|
|
+ klient->sende( (char*)&version, 4 );
|
|
|
}
|
|
|
}
|
|
|
if( encrypted )
|
|
@@ -1578,12 +1573,12 @@ void PSKlient::thread()
|
|
|
break;
|
|
|
if( encrypted )
|
|
|
{
|
|
|
- klient->sendeEncrypted( (char *)&len, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
klient->sendeEncrypted( deleted.values[ i ].getText(), len );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- klient->sende( (char *)&len, 4 );
|
|
|
+ klient->sende( (char*)&len, 4 );
|
|
|
klient->sende( deleted.values[ i ].getText(), len );
|
|
|
}
|
|
|
}
|
|
@@ -1609,14 +1604,14 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int updateGruppe = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char *)&updateGruppe, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&updateGruppe, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char *)&updateGruppe, 4 );
|
|
|
+ klient->getNachricht( (char*)&updateGruppe, 4 );
|
|
|
if( !ps->zDB()->supportedDateiGruppe( ps->getId(), updateGruppe ) )
|
|
|
{
|
|
|
int s = ps->zDB()->getDateiGruppePatchServer( klientNummer, updateGruppe );
|
|
|
int port = 0;
|
|
|
- Text *ip = new Text();
|
|
|
+ Text* ip = new Text();
|
|
|
bool ok = ps->zDB()->getPatchServerPortIp( s, &port, ip );
|
|
|
if( !s || !ok )
|
|
|
errorZuKlient( "Es ist momentan nicht möglich diese Datei herunterzuladen." );
|
|
@@ -1625,34 +1620,34 @@ void PSKlient::thread()
|
|
|
if( encrypted )
|
|
|
{
|
|
|
klient->sendeEncrypted( "\2", 1 );
|
|
|
- klient->sendeEncrypted( (char *)&port, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&port, 4 );
|
|
|
int len = ip->getLength();
|
|
|
- klient->sendeEncrypted( (char *)&len, 4 );
|
|
|
- klient->sendeEncrypted( (char *)ip->getText(), len );
|
|
|
+ klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)ip->getText(), len );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
klient->sende( "\2", 1 );
|
|
|
- klient->sende( (char *)&port, 4 );
|
|
|
+ klient->sende( (char*)&port, 4 );
|
|
|
int len = ip->getLength();
|
|
|
- klient->sende( (char *)&len, 4 );
|
|
|
- klient->sende( (char *)ip->getText(), len );
|
|
|
+ klient->sende( (char*)&len, 4 );
|
|
|
+ klient->sende( (char*)ip->getText(), len );
|
|
|
}
|
|
|
}
|
|
|
ip->release();
|
|
|
break;
|
|
|
}
|
|
|
- Text *gruppeN = ps->zDB()->getDateiGruppeName( updateGruppe );
|
|
|
+ Text* gruppeN = ps->zDB()->getDateiGruppeName( updateGruppe );
|
|
|
if( !gruppeN )
|
|
|
{
|
|
|
errorZuKlient( "Dein System wird nicht unterstützt." );
|
|
|
break;
|
|
|
}
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN );
|
|
|
pfad->append( "/" );
|
|
|
- Text *tmp = ps->zDB()->getSystemName( system );
|
|
|
+ Text* tmp = ps->zDB()->getSystemName( system );
|
|
|
if( !tmp )
|
|
|
{
|
|
|
errorZuKlient( "Dein System wird nicht unterstützt." );
|
|
@@ -1667,10 +1662,10 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int len = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char *)&len, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&len, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char *)&len, 4 );
|
|
|
- char *pf = new char[ len + 1 ];
|
|
|
+ klient->getNachricht( (char*)&len, 4 );
|
|
|
+ char* pf = new char[ len + 1 ];
|
|
|
pf[ len ] = 0;
|
|
|
if( encrypted )
|
|
|
klient->getNachrichtEncrypted( pf, len );
|
|
@@ -1678,14 +1673,14 @@ void PSKlient::thread()
|
|
|
klient->getNachricht( pf, len );
|
|
|
pfad->append( pf );
|
|
|
delete[] pf;
|
|
|
- Datei *datei = new Datei();
|
|
|
+ Datei* datei = new Datei();
|
|
|
datei->setDatei( pfad );
|
|
|
__int64 size = datei->getSize();
|
|
|
datei->release();
|
|
|
if( encrypted )
|
|
|
- klient->sendeEncrypted( (char *)&size, 8 );
|
|
|
+ klient->sendeEncrypted( (char*)&size, 8 );
|
|
|
else
|
|
|
- klient->sende( (char *)&size, 8 );
|
|
|
+ klient->sende( (char*)&size, 8 );
|
|
|
}
|
|
|
break;
|
|
|
case 11: // Frage nach Datei ****Neues Update System
|
|
@@ -1702,14 +1697,14 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int updateGruppe = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char *)&updateGruppe, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&updateGruppe, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char *)&updateGruppe, 4 );
|
|
|
+ klient->getNachricht( (char*)&updateGruppe, 4 );
|
|
|
if( !ps->zDB()->supportedDateiGruppe( ps->getId(), updateGruppe ) )
|
|
|
{
|
|
|
int s = ps->zDB()->getDateiGruppePatchServer( klientNummer, updateGruppe );
|
|
|
int port = 0;
|
|
|
- Text *ip = new Text();
|
|
|
+ Text* ip = new Text();
|
|
|
bool ok = ps->zDB()->getPatchServerPortIp( s, &port, ip );
|
|
|
if( !s || !ok )
|
|
|
errorZuKlient( "Es ist momentan nicht möglich diese Datei herunterzuladen." );
|
|
@@ -1718,34 +1713,34 @@ void PSKlient::thread()
|
|
|
if( encrypted )
|
|
|
{
|
|
|
klient->sendeEncrypted( "\2", 1 );
|
|
|
- klient->sendeEncrypted( (char *)&port, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&port, 4 );
|
|
|
int len = ip->getLength();
|
|
|
- klient->sendeEncrypted( (char *)&len, 4 );
|
|
|
- klient->sendeEncrypted( (char *)ip->getText(), len );
|
|
|
+ klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)ip->getText(), len );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
klient->sende( "\2", 1 );
|
|
|
- klient->sende( (char *)&port, 4 );
|
|
|
+ klient->sende( (char*)&port, 4 );
|
|
|
int len = ip->getLength();
|
|
|
- klient->sende( (char *)&len, 4 );
|
|
|
- klient->sende( (char *)ip->getText(), len );
|
|
|
+ klient->sende( (char*)&len, 4 );
|
|
|
+ klient->sende( (char*)ip->getText(), len );
|
|
|
}
|
|
|
}
|
|
|
ip->release();
|
|
|
break;
|
|
|
}
|
|
|
- Text *gruppeN = ps->zDB()->getDateiGruppeName( updateGruppe );
|
|
|
+ Text* gruppeN = ps->zDB()->getDateiGruppeName( updateGruppe );
|
|
|
if( !gruppeN )
|
|
|
{
|
|
|
errorZuKlient( "Dein System wird nicht unterstützt." );
|
|
|
break;
|
|
|
}
|
|
|
- Text *pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( ini->zWert( "SystemPfad" )->getText() );
|
|
|
pfad->append( "/" );
|
|
|
pfad->append( gruppeN );
|
|
|
pfad->append( "/" );
|
|
|
- Text *tmp = ps->zDB()->getSystemName( system );
|
|
|
+ Text* tmp = ps->zDB()->getSystemName( system );
|
|
|
if( !tmp )
|
|
|
{
|
|
|
errorZuKlient( "Dein System wird nicht unterstützt." );
|
|
@@ -1760,10 +1755,10 @@ void PSKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
int len = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char *)&len, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&len, 4 );
|
|
|
else
|
|
|
- klient->getNachricht( (char *)&len, 4 );
|
|
|
- char *pf = new char[ len + 1 ];
|
|
|
+ klient->getNachricht( (char*)&len, 4 );
|
|
|
+ char* pf = new char[ len + 1 ];
|
|
|
pf[ len ] = 0;
|
|
|
if( encrypted )
|
|
|
klient->getNachrichtEncrypted( pf, len );
|
|
@@ -1773,17 +1768,17 @@ void PSKlient::thread()
|
|
|
delete[] pf;
|
|
|
__int64 pos = 0;
|
|
|
if( encrypted )
|
|
|
- klient->getNachrichtEncrypted( (char *)&pos, 8 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&pos, 8 );
|
|
|
else
|
|
|
- klient->getNachricht( (char *)&pos, 8 );
|
|
|
- Datei *datei = new Datei();
|
|
|
+ klient->getNachricht( (char*)&pos, 8 );
|
|
|
+ Datei* datei = new Datei();
|
|
|
datei->setDatei( pfad );
|
|
|
datei->open( Datei::Style::lesen );
|
|
|
if( pos )
|
|
|
datei->setLPosition( pos, 0 );
|
|
|
__int64 length = datei->getSize();
|
|
|
length -= pos;
|
|
|
- char *bytes = new char[ 2048 ];
|
|
|
+ char* bytes = new char[ 2048 ];
|
|
|
unsigned short byteLen = 0;
|
|
|
while( 1 )
|
|
|
{
|
|
@@ -1795,7 +1790,7 @@ void PSKlient::thread()
|
|
|
byteLen = 2048;
|
|
|
if( length < 2048 )
|
|
|
byteLen = (unsigned short)length;
|
|
|
- if( !klient->sende( (char *)&byteLen, 2 ) )
|
|
|
+ if( !klient->sende( (char*)&byteLen, 2 ) )
|
|
|
break;
|
|
|
datei->lese( bytes, byteLen );
|
|
|
if( !klient->sende( bytes, byteLen ) )
|
|
@@ -1834,24 +1829,24 @@ void PSKlient::thread()
|
|
|
if( encrypted )
|
|
|
{
|
|
|
int id = TextZuInt( dgl.values[ i * 3 ].getText(), 10 );
|
|
|
- klient->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&id, 4 );
|
|
|
int len = dgl.values[ i * 3 + 1 ].getLength();
|
|
|
- klient->sendeEncrypted( (char *)&len, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&len, 4 );
|
|
|
if( len )
|
|
|
klient->sendeEncrypted( dgl.values[ i * 3 + 1 ].getText(), len );
|
|
|
int vs = TextZuInt( dgl.values[ i * 3 + 2 ].getText(), 10 );
|
|
|
- klient->sendeEncrypted( (char *)&vs, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&vs, 4 );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
int id = TextZuInt( dgl.values[ i * 3 ].getText(), 10 );
|
|
|
- klient->sende( (char *)&id, 4 );
|
|
|
+ klient->sende( (char*)&id, 4 );
|
|
|
int len = dgl.values[ i * 3 + 1 ].getLength();
|
|
|
- klient->sende( (char *)&len, 4 );
|
|
|
+ klient->sende( (char*)&len, 4 );
|
|
|
if( len )
|
|
|
klient->sende( dgl.values[ i * 3 + 1 ].getText(), len );
|
|
|
int vs = TextZuInt( dgl.values[ i * 3 + 2 ].getText(), 10 );
|
|
|
- klient->sende( (char *)&vs, 4 );
|
|
|
+ klient->sende( (char*)&vs, 4 );
|
|
|
}
|
|
|
}
|
|
|
if( encrypted )
|
|
@@ -1884,7 +1879,7 @@ void PSKlient::thread()
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
-bool PSKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
+bool PSKlient::errorZuKlient( const char* nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
{
|
|
|
if( encrypted )
|
|
|
{
|