|
@@ -1,2909 +0,0 @@
|
|
|
-#include "../KSGKlient.h"
|
|
|
-#include "../KSGServer.h"
|
|
|
-#include <Datei.h>
|
|
|
-#include "../../Global/Variablen.h"
|
|
|
-#include <GSLDateiV.h>
|
|
|
-#include "../Keys.h"
|
|
|
-#include <Globals.h>
|
|
|
-
|
|
|
-typedef GSL::GSLDateiV *( *GetGSLDatei )( );
|
|
|
-
|
|
|
-class DownloadSound : public GSL::GSLSoundV
|
|
|
-{
|
|
|
-private:
|
|
|
- bool istM;
|
|
|
- int sample;
|
|
|
- __int64 län;
|
|
|
- Klient *k;
|
|
|
- FBalken *f;
|
|
|
- int ref;
|
|
|
-
|
|
|
-public:
|
|
|
- // Konstruktor
|
|
|
- DownloadSound( Klient *zK, FBalken *zF )
|
|
|
- {
|
|
|
- k = zK;
|
|
|
- f = zF;
|
|
|
- ref = 1;
|
|
|
- }
|
|
|
- // nicht constant
|
|
|
- // GSL
|
|
|
- void playSound() override
|
|
|
- {}
|
|
|
- void setPause( bool p ) override
|
|
|
- {}
|
|
|
- void stopSound() override
|
|
|
- {}
|
|
|
- void warteAufSound( int zeit ) override
|
|
|
- {}
|
|
|
- // Lautstärke: 0 - 0xFFFF
|
|
|
- void setVolume( unsigned int links, unsigned int rechts ) override
|
|
|
- {}
|
|
|
- // zum Speichern
|
|
|
- void open() override
|
|
|
- {
|
|
|
- char m = 0;
|
|
|
- k->getNachrichtEncrypted( &m, 1 );
|
|
|
- istM = ( m == 1 );
|
|
|
- sample = 0;
|
|
|
- k->getNachrichtEncrypted( (char*)&sample, 4 );
|
|
|
- län = 0;
|
|
|
- k->getNachrichtEncrypted( (char*)&län, 8 );
|
|
|
- f->setAktionAnzahl( län );
|
|
|
- }
|
|
|
- int getDaten( char *buffer, int län ) override
|
|
|
- {
|
|
|
- int l = län < this->län ? län : ( int )this->län;
|
|
|
- if( !l )
|
|
|
- return -1;
|
|
|
- k->getNachricht( buffer, l );
|
|
|
- this->län -= l;
|
|
|
- f->aktionPlus( l );
|
|
|
- return l;
|
|
|
- }
|
|
|
- void close() override
|
|
|
- {}
|
|
|
- bool istMono() const override
|
|
|
- {
|
|
|
- return istM;
|
|
|
- }
|
|
|
- int getSampleRate() const override
|
|
|
- {
|
|
|
- return sample;
|
|
|
- }
|
|
|
- __int64 getDatLength() const override
|
|
|
- {
|
|
|
- return län;
|
|
|
- }
|
|
|
- // Reference Counting
|
|
|
- GSL::GSLSoundV *getThis() override
|
|
|
- {
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
- }
|
|
|
- GSL::GSLSoundV *release() override
|
|
|
- {
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-// Inhalt der EditorKlient Klasse aus KSGKlient.h
|
|
|
-// Konstruktor
|
|
|
-EditorKlient::EditorKlient()
|
|
|
-{
|
|
|
- verbunden = 0;
|
|
|
- klient = 0;
|
|
|
- fehler = new Text( "" );
|
|
|
- klientId = getKlientId();
|
|
|
- ref = 1;
|
|
|
-}
|
|
|
-
|
|
|
-// Destruktor
|
|
|
-EditorKlient::~EditorKlient()
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( verbunden )
|
|
|
- trenne();
|
|
|
- fehler = fehler->release();
|
|
|
- cs.unlock();
|
|
|
-}
|
|
|
-
|
|
|
-// nicht constant
|
|
|
-bool EditorKlient::verbinde( unsigned short port, char *ip ) // verbindet ich mit dem Editor Server
|
|
|
-{
|
|
|
- if( klient && verbunden && klient->getServerPort() == port && Text( ip ).istGleich( klient->getServerIp() ) )
|
|
|
- return 1;
|
|
|
- if( klient || verbunden )
|
|
|
- trenne();
|
|
|
- klient = new Klient();
|
|
|
- Framework::logLine( ( ( Text( "Zugeteilter Editor Server:" ) += ip ) += ":" ) += port );
|
|
|
- Framework::logLine( "Verbinung mit Editor Server wird hergestellt..." );
|
|
|
- int keyLen = 0;
|
|
|
- char *key = 0;
|
|
|
- Keys::getServerKey( &key, keyLen, Keys::EDITOR, Keys::SENDEN );
|
|
|
- klient->setSendeKey( key, keyLen );
|
|
|
- delete[] key;
|
|
|
- Keys::getServerKey( &key, keyLen, Keys::EDITOR, Keys::EMPFANGEN );
|
|
|
- klient->setEmpfangKey( key, keyLen );
|
|
|
- delete[] key;
|
|
|
- if( !klient->verbinde( (unsigned short)port, ip ) )
|
|
|
- {
|
|
|
- Framework::logLine( "ERROR: Server nicht erreichbar." );
|
|
|
- klient = klient->release();
|
|
|
- fehler->setText( "Fehler beim verbinden mit dem Editor Server." );
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
- klient->sendeEncrypted( (char*)&klientId, 4 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char län = 0;
|
|
|
- klient->getNachrichtEncrypted( &län, 1 );
|
|
|
- char *nachricht = new char[ län + 1 ];
|
|
|
- nachricht[ län ] = 0;
|
|
|
- klient->getNachrichtEncrypted( nachricht, län );
|
|
|
- fehler->setText( nachricht );
|
|
|
- Framework::logLine( Text( "ERROR: " ) += nachricht );
|
|
|
- delete[]nachricht;
|
|
|
- trenne();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char *sl = 0;
|
|
|
- char slLän = getSchlüssel( &sl );
|
|
|
- klient->setSendeKey( sl, slLän );
|
|
|
- klient->setEmpfangKey( sl, slLän );
|
|
|
- delete[] sl;
|
|
|
- verbunden = 1;
|
|
|
- }
|
|
|
- Framework::logLine( "Erfolgreich mit Editor Server verbunden." );
|
|
|
- return 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::karteErstellen( Text *zName, int spielArt ) // Erstellt eine neue Karte
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\xA", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zName->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zName->getText(), l );
|
|
|
- klient->sendeEncrypted( (char*)&spielArt, 4 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ladeKarte( int id ) // lädt eine bestimmte Karte
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x6", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( (char*)&id, 4 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
-}
|
|
|
-
|
|
|
-int EditorKlient::getAbbildListe( RCArray< Text > *name, RCArray< Zeit > *datum )
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x5", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- char l = 0;
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *n = new char[ l + 1 ];
|
|
|
- n[ l ] = 0;
|
|
|
- klient->getNachrichtEncrypted( n, l );
|
|
|
- name->set( new Text( n ), i );
|
|
|
- delete[] n;
|
|
|
- Zeit *dat = new Zeit();
|
|
|
- int d = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&d, 4 );
|
|
|
- dat->setJahr( d );
|
|
|
- klient->getNachrichtEncrypted( (char*)&d, 4 );
|
|
|
- dat->setMonat( d );
|
|
|
- klient->getNachrichtEncrypted( (char*)&d, 4 );
|
|
|
- dat->setTag( d );
|
|
|
- klient->getNachrichtEncrypted( (char*)&d, 4 );
|
|
|
- dat->setStunde( d );
|
|
|
- klient->getNachrichtEncrypted( (char*)&d, 4 );
|
|
|
- dat->setMinute( d );
|
|
|
- klient->getNachrichtEncrypted( (char*)&d, 4 );
|
|
|
- dat->setSekunde( d );
|
|
|
- datum->set( dat, i );
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return anz;
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::abbildErstellen( char *name )
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x1", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( name );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( name, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::abbildLöschen( char *name )
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x2", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( name );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( name, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::abbildHerstellen( char *name )
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x3", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( name );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( name, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::veröffentlichen()
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x4", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::shopSeiteVeröffentlichen() // Veröffentlicht die Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x6", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ladeShopSeiteVorschau() // Läht die Vorschau der Shop Seite herrunter
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x8", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- Text pf = "data/tmp/ke/ssv";
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- char l = 0;
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *pfad = new char[ l + 1 ];
|
|
|
- pfad[ l ] = 0;
|
|
|
- klient->getNachrichtEncrypted( pfad, l );
|
|
|
- Text p = pf.getText();
|
|
|
- p += pfad;
|
|
|
- delete[] pfad;
|
|
|
- Datei d;
|
|
|
- d.setDatei( p );
|
|
|
- d.erstellen();
|
|
|
- d.open( Datei::Style::schreiben );
|
|
|
- __int64 größe = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&größe, 8 );
|
|
|
- char *buffer = new char[ 2048 ];
|
|
|
- while( größe > 0 )
|
|
|
- {
|
|
|
- int l = größe > 2048 ? 2048 : (int)größe;
|
|
|
- klient->getNachricht( buffer, l );
|
|
|
- d.schreibe( buffer, l );
|
|
|
- größe -= l;
|
|
|
- }
|
|
|
- delete[] buffer;
|
|
|
- d.close();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ssDateiErstellen( char *name, int typ ) // Erstellt eine neue Shop Seiten Datei (typ:0=Ordner,1=Bild,2=Text)
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x1", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char t = typ;
|
|
|
- klient->sendeEncrypted( &t, 1 );
|
|
|
- char l = (char)textLength( name );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( name, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ssOrdnerÖffnen( char *name ) // Öffnet einen Ordner der Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x2", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( name );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( name, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-Bild *EditorKlient::ssBildLaden( char *datei, char *bild ) // Läht das ein Bild der Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x3", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( datei );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( datei, l );
|
|
|
- l = (char)textLength( bild );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( bild, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- Bild *ret = new Bild();
|
|
|
- int br = 0;
|
|
|
- int hö = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&br, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&hö, 4 );
|
|
|
- ret->neuBild( br, hö, 0 );
|
|
|
- char *buffer = (char*)ret->getBuffer();
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; l = län > 2048 ? 2048 : (int)län )
|
|
|
- {
|
|
|
- klient->getNachricht( &( buffer[ i ] ), l );
|
|
|
- i += l;
|
|
|
- län -= l;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ssDateiLöschen( char *name ) // Löscht eine Datei der Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x4", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( name );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( name, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-Text *EditorKlient::ssTextLaden( char *datei ) // Läd eine KSGS Datei der Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xA", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( datei );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( datei, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int län = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&län, 4 );
|
|
|
- char *txt = new char[ län + 1 ];
|
|
|
- txt[ län ] = 0;
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : län; län > 0; i += l, län -= l, l = län > 2048 ? 2048 : län )
|
|
|
- klient->getNachricht( &( txt[ i ] ), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- Text *t = new Text( txt );
|
|
|
- delete[] txt;
|
|
|
- cs.unlock();
|
|
|
- return t;
|
|
|
- }
|
|
|
- delete[] txt;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ssTextSpeichern( char *datei, Text *zText ) // Spechert eine KSGS Datei der Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x5", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( datei );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( datei, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int län = zText->getLength();
|
|
|
- klient->sendeEncrypted( (char*)&län, 4 );
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : län; län > 0; i += l, län -= l, l = län > 2048 ? 2048 : län )
|
|
|
- klient->sende( &( zText->getText()[ i ] ), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ssBildLöschen( char *datei, char *bild ) // Löscht ein Bild der Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x6", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( datei );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( datei, l );
|
|
|
- l = (char)textLength( bild );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( bild, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ssBildSpeichern( char *datei, char *name, Bild *zBild ) // Speichert ein Bild einer ShopSeite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( datei );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( datei, l );
|
|
|
- l = (char)textLength( name );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( name, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int br = zBild->getBreite();
|
|
|
- int hö = zBild->getHeight();
|
|
|
- klient->sendeEncrypted( (char*)&br, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&hö, 4 );
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- char *buffer = (char*)zBild->getBuffer();
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; i += l, län -= l, l = län > 2048 ? 2048 : (int)län )
|
|
|
- klient->sende( &( buffer[ i ] ), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-int EditorKlient::ssGetDateiListe( RCArray< Text > *zList ) // Läd die Datei Liste der Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x8", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- char l = 0;
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *n = new char[ l + 1 ];
|
|
|
- n[ l ] = 0;
|
|
|
- klient->getNachrichtEncrypted( n, l );
|
|
|
- zList->add( new Text( n ) );
|
|
|
- delete[] n;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return anz;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return -1;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-int EditorKlient::ssGetBildListe( char *name, RCArray< Text > *zList ) // Läd die Bild Liste einer Bild Datei der Shop Seite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x9", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)textLength( name );
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( name, l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- l = 0;
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *n = new char[ l + 1 ];
|
|
|
- n[ l ] = 0;
|
|
|
- klient->getNachrichtEncrypted( n, l );
|
|
|
- zList->add( new Text( n ) );
|
|
|
- delete[] n;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return anz;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return -1;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::getShopDaten( int &es, int &tp, int &vp ) // Läht die Shop Daten
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x9", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->getNachrichtEncrypted( (char*)&es, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&tp, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&vp, 4 );
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::setShopDaten( int es, int tp, int vp ) // Setzt die Shop Daten
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xA", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( (char*)&es, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&tp, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&vp, 4 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-Text *EditorKlient::beschreibungLaden() // läht die Kartenbeschreibung
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x1", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int län = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&län, 4 );
|
|
|
- char *txt = new char[ län + 1 ];
|
|
|
- txt[ län ] = 0;
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : län; län > 0; i += l, län -= l, l = län > 2048 ? 2048 : län )
|
|
|
- klient->getNachricht( &( txt[ i ] ), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- Text *t = new Text( txt );
|
|
|
- delete[] txt;
|
|
|
- cs.unlock();
|
|
|
- return t;
|
|
|
- }
|
|
|
- delete[] txt;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-Bild *EditorKlient::titelbildLaden() // läht das Titelbild
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x2", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- Bild *ret = new Bild();
|
|
|
- int br = 0;
|
|
|
- int hö = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&br, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&hö, 4 );
|
|
|
- ret->neuBild( br, hö, 0 );
|
|
|
- char *buffer = (char*)ret->getBuffer();
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; l = län > 2048 ? 2048 : (int)län )
|
|
|
- {
|
|
|
- klient->getNachricht( &( buffer[ i ] ), l );
|
|
|
- i += l;
|
|
|
- län -= l;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-Bild *EditorKlient::minimapLaden() // läht das Minimapbild
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x3", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- Bild *ret = new Bild();
|
|
|
- int br = 0;
|
|
|
- int hö = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&br, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&hö, 4 );
|
|
|
- ret->neuBild( br, hö, 0 );
|
|
|
- char *buffer = (char*)ret->getBuffer();
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; l = län > 2048 ? 2048 : (int)län )
|
|
|
- {
|
|
|
- klient->getNachricht( &( buffer[ i ] ), l );
|
|
|
- i += l;
|
|
|
- län -= l;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-Bild *EditorKlient::ladebildLaden() // läht das Ladebild
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x4", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- Bild *ret = new Bild();
|
|
|
- int br = 0;
|
|
|
- int hö = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&br, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&hö, 4 );
|
|
|
- ret->neuBild( br, hö, 0 );
|
|
|
- char *buffer = (char*)ret->getBuffer();
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; l = län > 2048 ? 2048 : (int)län )
|
|
|
- {
|
|
|
- klient->getNachricht( &( buffer[ i ] ), l );
|
|
|
- i += l;
|
|
|
- län -= l;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::beschreibungSpeichern( Text *zText ) // speichert die Kartenbeschreibung
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x5", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int län = zText->getLength();
|
|
|
- klient->sendeEncrypted( (char*)&län, 4 );
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : län; län > 0; i += l, län -= l, l = län > 2048 ? 2048 : län )
|
|
|
- klient->sende( &( zText->getText()[ i ] ), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::titelbildSpeichern( Bild *zBild ) // speichert das Titelbild
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x6", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int br = zBild->getBreite();
|
|
|
- int hö = zBild->getHeight();
|
|
|
- klient->sendeEncrypted( (char*)&br, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&hö, 4 );
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- char *buffer = (char*)zBild->getBuffer();
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; i += l, län -= l, l = län > 2048 ? 2048 : (int)län )
|
|
|
- klient->sende( &( buffer[ i ] ), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::minimapSpeichern( Bild *zBild ) // speichert das Minimapbild
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int br = zBild->getBreite();
|
|
|
- int hö = zBild->getHeight();
|
|
|
- klient->sendeEncrypted( (char*)&br, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&hö, 4 );
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- char *buffer = (char*)zBild->getBuffer();
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; i += l, län -= l, l = län > 2048 ? 2048 : (int)län )
|
|
|
- klient->sende( &( buffer[ i ] ), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ladebildSpeichern( Bild *zBild ) // speichert das Ladebild
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x8", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int br = zBild->getBreite();
|
|
|
- int hö = zBild->getHeight();
|
|
|
- klient->sendeEncrypted( (char*)&br, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&hö, 4 );
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- char *buffer = (char*)zBild->getBuffer();
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; i += l, län -= l, l = län > 2048 ? 2048 : (int)län )
|
|
|
- klient->sende( &( buffer[ i ] ), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::ladeTeamDaten( SpielerTeamStruktur *sts ) // läht die Team Daten
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xC", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x1", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->getNachrichtEncrypted( (char*)&sts->spielerAnzahl, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&sts->teamAnzahl, 4 );
|
|
|
- for( int i = 0; i < sts->spielerAnzahl; i++ )
|
|
|
- {
|
|
|
- int f = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&f, 4 );
|
|
|
- sts->spielerFarbe->set( f, i );
|
|
|
- }
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- int f = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&f, 4 );
|
|
|
- sts->teamFarbe->set( f, i );
|
|
|
- }
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- char l = 0;
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *n = new char[ l + 1 ];
|
|
|
- n[ l ] = 0;
|
|
|
- klient->getNachrichtEncrypted( n, l );
|
|
|
- sts->teamName->set( new Text( n ), i );
|
|
|
- delete[] n;
|
|
|
- }
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- int g = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&g, 4 );
|
|
|
- sts->teamGröße->set( g, i );
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::speicherTeamDaten( SpielerTeamStruktur *sts ) // speichert die Team Daten
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xC", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x2", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( (char*)&sts->spielerAnzahl, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&sts->teamAnzahl, 4 );
|
|
|
- for( int i = 0; i < sts->spielerAnzahl; i++ )
|
|
|
- {
|
|
|
- int f = sts->spielerFarbe->get( i );
|
|
|
- klient->sendeEncrypted( (char*)&f, 4 );
|
|
|
- }
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- int f = sts->teamFarbe->get( i );
|
|
|
- klient->sendeEncrypted( (char*)&f, 4 );
|
|
|
- }
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- char l = (char)sts->teamName->z( i )->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( sts->teamName->z( i )->getText(), l );
|
|
|
- }
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- int g = sts->teamGröße->get( i );
|
|
|
- klient->sendeEncrypted( (char*)&g, 4 );
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deNeueDatei( char typ, Text *zName ) // DateienEditor: Erstellt neue Datei (typ: 0=ordner 1=bild 2=modell2d 3=sound
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x1", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( &typ, 1 );
|
|
|
- char l = (char)zName->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( zName->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deOrdnerÖffnen( Text *zName ) // DateienEditor: Öffnet Ordner
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x2", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char län = (char)zName->getLength();
|
|
|
- klient->sendeEncrypted( &län, 1 );
|
|
|
- if( län )
|
|
|
- klient->sendeEncrypted( zName->getText(), län );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-Bild *EditorKlient::deBildLaden( Text *zDatei, Text *zBild, FBalken *zF ) // DateienEditor: Bild laden
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- Bild *retB = 0;
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x3", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char län = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &län, 1 );
|
|
|
- if( län )
|
|
|
- klient->sendeEncrypted( zDatei->getText(), län );
|
|
|
- län = (char)zBild->getLength();
|
|
|
- klient->sendeEncrypted( &län, 1 );
|
|
|
- if( län )
|
|
|
- klient->sendeEncrypted( zBild->getText(), län );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int br = 0;
|
|
|
- int hö = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&br, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&hö, 4 );
|
|
|
- retB = new Bild();
|
|
|
- retB->neuBild( br, hö, 0 );
|
|
|
- char *buffer = (char*)retB->getBuffer();
|
|
|
- __int64 län = br * hö * 4;
|
|
|
- zF->setAktionAnzahl( län );
|
|
|
- for( int i = 0, l = län > 2048 ? 2048 : (int)län; län > 0; l = län > 2048 ? 2048 : (int)län )
|
|
|
- {
|
|
|
- klient->getNachricht( &( buffer[ i ] ), l );
|
|
|
- i += l;
|
|
|
- län -= l;
|
|
|
- zF->aktionPlus( l );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- if( !ret && retB )
|
|
|
- retB = retB->release();
|
|
|
- return retB;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deDateiLöschen( Text *zName ) // DateienEditor: Löscht Datei
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x4", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char län = (char)zName->getLength();
|
|
|
- klient->sendeEncrypted( &län, 1 );
|
|
|
- if( län )
|
|
|
- klient->sendeEncrypted( zName->getText(), län );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deBildLöschen( Text *zDatei, Text *zBild ) // DateienEditor: Löscht Bild aus Datei
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x5", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- l = (char)zBild->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- if( l )
|
|
|
- klient->sendeEncrypted( zBild->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deBildSpeichern( Text *zDatei, Text *zName, Bild *zBild, FBalken *zF ) // DateienEditor: Speichert Bild
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x6", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char län = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &län, 1 );
|
|
|
- if( län )
|
|
|
- klient->sendeEncrypted( zDatei->getText(), län );
|
|
|
- län = (char)zName->getLength();
|
|
|
- klient->sendeEncrypted( &län, 1 );
|
|
|
- if( län )
|
|
|
- klient->sendeEncrypted( zName->getText(), län );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int br = zBild->getBreite();
|
|
|
- int hö = zBild->getHeight();
|
|
|
- klient->sendeEncrypted( (char*)&br, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&hö, 4 );
|
|
|
- char *buffer = (char*)zBild->getBuffer();
|
|
|
- __int64 gr = br * hö * 4;
|
|
|
- zF->setAktionAnzahl( gr );
|
|
|
- for( int i = 0, l = gr > 2048 ? 2048 : (int)gr; gr > 0; i += l, gr -= l, l = gr > 2048 ? 2048 : (int)gr )
|
|
|
- {
|
|
|
- klient->sende( &( buffer[ i ] ), l );
|
|
|
- zF->aktionPlus( l );
|
|
|
- }
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-int EditorKlient::deGetDateiListe( RCArray< Text > *zNamen ) // DateienEditor: Datei Liste herunterladen
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- char l = 0;
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *n = new char[ l + 1 ];
|
|
|
- n[ l ] = 0;
|
|
|
- if( l )
|
|
|
- klient->getNachrichtEncrypted( n, l );
|
|
|
- zNamen->add( new Text( n ) );
|
|
|
- delete[] n;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return anz;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return -1;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-int EditorKlient::deGetBildListe( Text *zDatei, RCArray< Text > *zNamen ) // DateienEditor: Liste mit in der Datei gespeicherten Bildern
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x8", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *n = new char[ l + 1 ];
|
|
|
- n[ l ] = 0;
|
|
|
- if( l )
|
|
|
- klient->getNachrichtEncrypted( n, l );
|
|
|
- zNamen->add( new Text( n ) );
|
|
|
- delete[] n;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return anz;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-int EditorKlient::deGetModelListe( Text *zDatei, RCArray< Text > *zNamen ) // DateienEditor Liste mit in der Datei gespeicherten Modellen
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x9", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *n = new char[ l + 1 ];
|
|
|
- n[ l ] = 0;
|
|
|
- if( l )
|
|
|
- klient->getNachrichtEncrypted( n, l );
|
|
|
- zNamen->add( new Text( n ) );
|
|
|
- delete[] n;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return anz;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-int EditorKlient::deGetSoundListe( Text *zDatei, RCArray< Text > *zNamen ) // DateienEditor: Liste mit in der Datei gespeicherten Tönen
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xA", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- klient->getNachrichtEncrypted( &l, 1 );
|
|
|
- char *n = new char[ l + 1 ];
|
|
|
- n[ l ] = 0;
|
|
|
- if( l )
|
|
|
- klient->getNachrichtEncrypted( n, l );
|
|
|
- zNamen->add( new Text( n ) );
|
|
|
- delete[] n;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return anz;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deModelLöschen( Text *zDatei, Text *zModel ) // DateienEditor: Löscht Modell
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xB", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- l = (char)zModel->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zModel->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deSoundLöschen( Text *zDatei, Text *zSound ) // DateienEditor: Löscht Ton
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xC", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- l = (char)zSound->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zSound->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-Model2DData *EditorKlient::deModelLaden( Text *zDatei, Text *zModel, FBalken *zF ) // DateienEditor: läd ein Model herunter
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- l = (char)zModel->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zModel->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
- zF->setAktionAnzahl( anz );
|
|
|
- Array< Polygon2D > *pol = new Array< Polygon2D >();
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- Polygon2D p;
|
|
|
- p.schwerpunkt = new Vertex( 0, 0 );
|
|
|
- p.vertex = new Array< Vertex >();
|
|
|
- p.tKordinaten = new Array< Vertex >();
|
|
|
- klient->getNachrichtEncrypted( (char*)&p.transparent, 1 );
|
|
|
- char nLän = 0;
|
|
|
- klient->getNachrichtEncrypted( &nLän, 1 );
|
|
|
- char *txt = new char[ nLän + 1 ];
|
|
|
- if( nLän )
|
|
|
- klient->getNachrichtEncrypted( txt, nLän );
|
|
|
- txt[ nLän ] = 0;
|
|
|
- p.name = new Text( txt );
|
|
|
- delete[] txt;
|
|
|
- int anz2 = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&anz2, 4 );
|
|
|
- for( int j = 0; j < anz2; j++ )
|
|
|
- {
|
|
|
- Vertex v;
|
|
|
- klient->getNachrichtEncrypted( (char*)&v.x, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&v.y, 4 );
|
|
|
- *p.schwerpunkt += v * (float)( 1.0 / anz2 );
|
|
|
- Vertex t;
|
|
|
- klient->getNachrichtEncrypted( (char*)&t.x, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&t.y, 4 );
|
|
|
- p.vertex->add( v );
|
|
|
- p.tKordinaten->add( t );
|
|
|
- }
|
|
|
- pol->add( p );
|
|
|
- zF->aktionPlus();
|
|
|
- }
|
|
|
- Model2DData *data = new Model2DData();
|
|
|
- data->erstelleModell( pol );
|
|
|
- cs.unlock();
|
|
|
- return data;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-GSL::GSLSoundV *EditorKlient::deSoundLaden( Text *zDatei, Text *zSound, FBalken *zF ) // DateienEditor: läd Sound herunter
|
|
|
-{
|
|
|
- HMODULE gslDll = dllDateien->ladeDLL( "GSL.dll", "data/bin/GSL.dll" );
|
|
|
- if( !gslDll )
|
|
|
- {
|
|
|
- fehler->setText( "Die DLL Datei 'data/bin/GSL.dll' wurde nicht gefunden." );
|
|
|
- return 0;
|
|
|
- }
|
|
|
- GetGSLDatei getGSLDatei = (GetGSLDatei)GetProcAddress( gslDll, "getGSLDatei" );
|
|
|
- if( !getGSLDatei )
|
|
|
- {
|
|
|
- fehler->setText( "Der Einstiegspunkt 'getGSLDatei' wurde in der Datei 'data/bin/GSL.dll' nicht gefunden." );
|
|
|
- return 0;
|
|
|
- }
|
|
|
- DateiRemove( "data/tmp/editor/dateien/sounds/tmp.gsl" );
|
|
|
- DateiPfadErstellen( "data/tmp/editor/dateien/sounds/tmp.gsl" );
|
|
|
- GSL::GSLDateiV *gslDatei = getGSLDatei();
|
|
|
- gslDatei->setDatei( "data/tmp/editor/dateien/sounds/tmp.gsl" );
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- gslDatei->release();
|
|
|
- dllDateien->releaseDLL( "GSL.dll" );
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xE", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- l = (char)zSound->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zSound->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- DownloadSound dws( klient, zF );
|
|
|
- gslDatei->speicherSound( &dws, zSound->getText() );
|
|
|
- GSL::GSLSoundV *s = gslDatei->getSound( zSound->getText() );
|
|
|
- gslDatei->release();
|
|
|
- dllDateien->releaseDLL( "GSL.dll" );
|
|
|
- cs.unlock();
|
|
|
- return s;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- gslDatei->release();
|
|
|
- dllDateien->releaseDLL( "GSL.dll" );
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deModelSpeichern( Text *zDatei, Text *zModel, Model2DData *zData, FBalken *zF ) // DateienEditor: Speichert Modell
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xF", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- l = (char)zModel->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zModel->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int anz = zData->polygons ? zData->polygons->getEintragAnzahl() : 0;
|
|
|
- zF->setAktionAnzahl( anz );
|
|
|
- klient->sendeEncrypted( (char*)&anz, 4 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- Polygon2D pol = zData->polygons->get( i );
|
|
|
- klient->sendeEncrypted( (char*)&pol.transparent, 1 );
|
|
|
- char nLän = pol.name->getLength();
|
|
|
- klient->sendeEncrypted( &nLän, 1 );
|
|
|
- if( nLän )
|
|
|
- klient->sendeEncrypted( pol.name->getText(), nLän );
|
|
|
- int anz2 = pol.vertex->getEintragAnzahl();
|
|
|
- klient->sendeEncrypted( (char*)&anz2, 4 );
|
|
|
- for( int j = 0; j < anz2; j++ )
|
|
|
- {
|
|
|
- Vertex v = pol.vertex->get( j );
|
|
|
- Vertex p;
|
|
|
- if( pol.tKordinaten )
|
|
|
- p = pol.tKordinaten->hat( j ) ? pol.tKordinaten->get( j ) : Vertex( 0, 0 );
|
|
|
- klient->sendeEncrypted( (char*)&v.x, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&v.y, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&p.x, 4 );
|
|
|
- klient->sendeEncrypted( (char*)&p.y, 4 );
|
|
|
- }
|
|
|
- zF->aktionPlus();
|
|
|
- }
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::deSoundSpeichern( Text *zDatei, Text *zSound, GSL::GSLSoundV *zData, FBalken *zF ) // DateienEditor: Speichert Sound
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xD", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x10", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char l = (char)zDatei->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zDatei->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- l = (char)zSound->getLength();
|
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
- klient->sendeEncrypted( zSound->getText(), l );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- char channels = zData->istMono() ? 1 : 2;
|
|
|
- klient->sendeEncrypted( &channels, 1 );
|
|
|
- int sample = zData->getSampleRate();
|
|
|
- klient->sendeEncrypted( (char*)&sample, 4 );
|
|
|
- __int64 slän = zData->getDatLength();
|
|
|
- klient->sendeEncrypted( (char*)&slän, 8 );
|
|
|
- zF->setAktionAnzahl( slän );
|
|
|
- zData->open();
|
|
|
- char *buffer = new char[ 2048 ];
|
|
|
- while( slän > 0 )
|
|
|
- {
|
|
|
- int l = slän > 2048 ? 2048 : (int)slän;
|
|
|
- zData->getDaten( buffer, l );
|
|
|
- klient->sende( buffer, l );
|
|
|
- slän -= l;
|
|
|
- zF->aktionPlus( l );
|
|
|
- }
|
|
|
- delete[] buffer;
|
|
|
- zData->close();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-int EditorKlient::getVerkaufStatistik( Array< int > *verkauft, Array< int > *einkommen, Array< int > *gespielt ) // Gibt eine Verkaufsstatistik der letzten 30 Tage zurück
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\x10", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- int kaufAnz = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&kaufAnz, 4 );
|
|
|
- char anz = 0;
|
|
|
- klient->getNachrichtEncrypted( &anz, 1 );
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- int kupfer = 0;
|
|
|
- int kauf = 0;
|
|
|
- int games = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&kupfer, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&kauf, 4 );
|
|
|
- klient->getNachrichtEncrypted( (char*)&games, 4 );
|
|
|
- einkommen->add( kupfer );
|
|
|
- verkauft->add( kauf );
|
|
|
- gespielt->add( games );
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return kaufAnz;
|
|
|
- }
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::initEditor() // Initialisiert den Editor auf Serverseite
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !verbunden )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\x7", 1 );
|
|
|
- char ret = 0;
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- if( ret == 1 )
|
|
|
- {
|
|
|
- klient->sendeEncrypted( "\xE", 1 );
|
|
|
- klient->getNachrichtEncrypted( &ret, 1 );
|
|
|
- }
|
|
|
- if( ret == 3 )
|
|
|
- {
|
|
|
- char byte = 0;
|
|
|
- klient->getNachrichtEncrypted( &byte, 1 );
|
|
|
- char *f = new char[ byte + 1 ];
|
|
|
- f[ byte ] = 0;
|
|
|
- klient->getNachrichtEncrypted( f, byte );
|
|
|
- fehler->setText( f );
|
|
|
- delete[] f;
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- cs.unlock();
|
|
|
- return ret == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::keepAlive() // Erhält die Verbindung aufrecht
|
|
|
-{
|
|
|
- if( !cs.tryLock() )
|
|
|
- return 1;
|
|
|
- if( !verbunden || !klient )
|
|
|
- {
|
|
|
- cs.unlock();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- Framework::logLine( "Verbindungstest zum Editor Server..." );
|
|
|
- char res = 0;
|
|
|
- bool ok = klient->sendeEncrypted( "\x5", 1 );
|
|
|
- ok &= klient->getNachrichtEncrypted( &res, 1 );
|
|
|
- cs.unlock();
|
|
|
- if( res != 1 || !ok )
|
|
|
- {
|
|
|
- Framework::logLine( "Verbindungsabbruch." );
|
|
|
- trenne();
|
|
|
- fehler->setText( "Verbindung unterbrochen: 'Keep Alive' nicht erfolgreich." );
|
|
|
- }
|
|
|
- else
|
|
|
- Framework::logLine( "Verbindung besteht." );
|
|
|
- return res == 1;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorKlient::trenne() // trennt sich von dem Editor Server
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
- if( !klient || !verbunden )
|
|
|
- {
|
|
|
- if( klient )
|
|
|
- klient = klient->release();
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
- }
|
|
|
- Framework::logLine( "Verbindung zum Editor Server wird getrennt..." );
|
|
|
- char serverReturn;
|
|
|
- klient->sendeEncrypted( "\4", 1 );
|
|
|
- klient->getNachrichtEncrypted( &serverReturn, 1 );
|
|
|
- if( serverReturn == 3 )
|
|
|
- {
|
|
|
- char län = 0;
|
|
|
- klient->getNachrichtEncrypted( &län, 1 );
|
|
|
- char *nachricht = new char[ län + 1 ];
|
|
|
- nachricht[ län ] = 0;
|
|
|
- klient->getNachrichtEncrypted( nachricht, län );
|
|
|
- delete[]nachricht;
|
|
|
- }
|
|
|
- klient->sendeEncrypted( "\3", 1 );
|
|
|
- klient->getNachrichtEncrypted( &serverReturn, 1 );
|
|
|
- klient->trenne();
|
|
|
- klient = klient->release();
|
|
|
- verbunden = 0;
|
|
|
- cs.unlock();
|
|
|
- return 1;
|
|
|
-}
|
|
|
-
|
|
|
-void EditorKlient::lock()
|
|
|
-{
|
|
|
- cs.lock();
|
|
|
-}
|
|
|
-
|
|
|
-void EditorKlient::unlock()
|
|
|
-{
|
|
|
- cs.unlock();
|
|
|
-}
|
|
|
-
|
|
|
-Klient *EditorKlient::zKlient() // gibt den Klient zurück
|
|
|
-{
|
|
|
- if( cs.isLocked() && cs.zOwner() && cs.zOwner()->getThreadHandle() == GetCurrentThread() )
|
|
|
- return klient;
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-// constant
|
|
|
-bool EditorKlient::istVerbunden() const // prüft, ob mit Editor Server verbunden
|
|
|
-{
|
|
|
- return verbunden;
|
|
|
-}
|
|
|
-
|
|
|
-char *EditorKlient::getLetzterFehler() const // gibt den Letzten Fehlertext zuück
|
|
|
-{
|
|
|
- return fehler->getText();
|
|
|
-}
|
|
|
-
|
|
|
-// Reference Counting
|
|
|
-EditorKlientV *EditorKlient::getThis()
|
|
|
-{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
-}
|
|
|
-
|
|
|
-EditorKlientV *EditorKlient::release()
|
|
|
-{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
-}
|