2019-04-15 11:45:15 +02:00
|
|
|
package de.mas.wiiu.jnus.jnustool;
|
2016-02-02 19:38:53 +01:00
|
|
|
|
2016-02-01 20:54:01 +01:00
|
|
|
import java.util.concurrent.Callable;
|
|
|
|
|
2016-10-23 05:36:33 +02:00
|
|
|
public class FEntryDownloader implements Callable<Integer>{
|
|
|
|
FEntry f;
|
2016-02-06 18:25:08 +01:00
|
|
|
Progress progress = null;
|
2016-10-23 05:36:33 +02:00
|
|
|
|
2016-02-01 20:54:01 +01:00
|
|
|
public void setTitle(FEntry f){
|
|
|
|
this.f = f;
|
|
|
|
}
|
2016-10-23 05:36:33 +02:00
|
|
|
|
2016-02-06 18:25:08 +01:00
|
|
|
public FEntryDownloader(FEntry f,Progress fatherProgress){
|
2016-02-01 20:54:01 +01:00
|
|
|
setTitle(f);
|
2016-02-06 18:25:08 +01:00
|
|
|
createProgressListener(fatherProgress);
|
2016-10-23 05:36:33 +02:00
|
|
|
}
|
2016-02-01 20:54:01 +01:00
|
|
|
|
2016-02-06 18:25:08 +01:00
|
|
|
private void createProgressListener(Progress fatherProgress) {
|
|
|
|
if(fatherProgress != null){
|
|
|
|
progress = new Progress();
|
2016-03-02 19:48:04 +01:00
|
|
|
fatherProgress.add(progress);
|
2016-10-23 05:36:33 +02:00
|
|
|
progress.addTotal(f.getFileLength());
|
2016-02-06 18:25:08 +01:00
|
|
|
}
|
|
|
|
}
|
2016-10-23 05:36:33 +02:00
|
|
|
|
2016-02-02 19:38:53 +01:00
|
|
|
@Override
|
|
|
|
public Integer call() throws Exception {
|
2016-10-23 05:36:33 +02:00
|
|
|
try{
|
|
|
|
f.downloadAndDecrypt(progress);
|
|
|
|
}catch(Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
throw e;
|
|
|
|
}
|
2016-02-02 19:38:53 +01:00
|
|
|
return null;
|
|
|
|
}
|
2016-02-01 20:54:01 +01:00
|
|
|
|
|
|
|
}
|