public void run() {
primeriMessageLabel.setText("Conectando");
}
});
Communicate communicate = new Communicate(sslComunicationSocket);
communicate.addPropertyChangeListener(getMySelf());
communicate.receiveAndSend("200, Thank you bastard");
if(ServerAdress.getServerAdress().equals(GDSystem.getServerIp())){
communicate.receiveAndSend("210, Update me fucker");
}else{
communicate.receiveAndSend("208, Update me fucker");
}
updateComposite.getDisplay().syncExec(new Runnable() {
public void run() {
primeriMessageLabel.setText("Procurando por atualiza��es...");
}
});
// ArrayList<FileDescriptorMD5> listOfFilefromServer = null;
// communicate.send("315, Me mande a lista dos arquivos do server");
// if (communicate.receive().equals("316")){
// String path = communicate.receive();
// listOfFilefromServer = (ArrayList<FileDescriptorMD5>) communicate.receiveObject();
// communicate.send("317, Lista recebida");
// }else if ( communicate.receive().equals(("318"))){
// communicate.sendObject(new ListFilestoDownloadThroughCompareofMD5().getListofFilesThatHasDifferentMD5tobeDownloaded(listOfFilefromServer));
// while (communicate.receive().equals("319")) {
// final FileDescriptorMD5 fileDescriptorMD5 = (FileDescriptorMD5) communicate.receiveObject();
//
// updateComposite.getDisplay().syncExec(new Runnable() {
// public void run() {
// primeriMessageLabel.setText("Recebendo: " + fileDescriptorMD5.getName());
// primeriMessageLabel.setText("");
//
// fileBar.setMaximum(Integer.parseInt(String.valueOf(fileDescriptorMD5.getSize())));
// fileBar.setSelection(0);
// }
// });
//
// communicate.send("320, Envie o proximo");
//
// if (communicate.receiveFile(fileDescriptorMD5)) {
// communicate.send("321, Arquivo recebido com sucesso");
//
// updateComposite.getDisplay().syncExec(new Runnable() {
// public void run() {
// primeriMessageLabel.setText("Arquivo recebido com sucesso");
// }
// });
// } else {
// communicate.send("322, Problema ao Receber o arquivo");
//
// updateComposite.getDisplay().syncExec(new Runnable() {
// public void run() {
// primeriMessageLabel.setText("Problema na recep��o do arquivo");
// }
// });
// }
// }
// }
String receive = communicate.receive();
if (receive.equals("300")) {
if (communicate.sendAndReceive(Constants.BUILD_ID + ", Versao").equals("302")) {
updateComposite.getDisplay().syncExec(new Runnable() {
public void run() {
primeriMessageLabel.setText("Progresso Geral:");
}
});
communicate.send("305, Me mande os arquivos");
if(ServerAdress.getServerAdress().equals(GDSystem.getServerIp()) || communicate.receive().equals("311")) {
if(!ServerAdress.getServerAdress().equals(GDSystem.getServerIp()))
communicate.sendObject(new Autentication((String) gd.get("username"), (String) gd.get("password"), (String) gd.get("serialnumber")));
if(ServerAdress.getServerAdress().equals(GDSystem.getServerIp()) || communicate.receive().equals("312")) {
while (communicate.receive().equals("303")) {
final FileDescriptor fileDescriptor = (FileDescriptor) communicate.receiveObject();
updateComposite.getDisplay().syncExec(new Runnable() {
public void run() {
secondMessageLabel.setText("Recebendo: " + fileDescriptor.getName());
downloadStatus.setText("");
fileBar.setMaximum(Integer.parseInt(String.valueOf(fileDescriptor.getSize())));
fileBar.setSelection(0);
}
});
communicate.send("309");
if (communicate.receiveFile(fileDescriptor)) {
communicate.send("307");
updateComposite.getDisplay().syncExec(new Runnable() {
public void run() {
secondMessageLabel.setText("Arquivo recebido com sucesso");
}
});
} else {
communicate.send("308");
updateComposite.getDisplay().syncExec(new Runnable() {
public void run() {
secondMessageLabel.setText("Problema na recep��o do arquivo");
}