@@ -55,6 +55,7 @@ public class TTRUpdater extends JFrame {
55
55
public final Logger logger = LogManager .getLogger (this );
56
56
private final JProgressBar progressBar ;
57
57
private final JLabel updateStatus ;
58
+ private final JLabel fileProgress ;
58
59
59
60
/**
60
61
* Create the TTR updater window.
@@ -79,11 +80,14 @@ public TTRUpdater() {
79
80
80
81
updateStatus = new JLabel ("Checking files..." );
81
82
updateStatus .setAlignmentX (Component .CENTER_ALIGNMENT );
83
+ fileProgress = new JLabel ();
84
+ fileProgress .setAlignmentX (Component .CENTER_ALIGNMENT );
82
85
progressBar = new JProgressBar (0 , 0 );
83
86
progressBar .setAlignmentX (Component .CENTER_ALIGNMENT );
84
87
panel .add (Box .createRigidArea (new Dimension (0 , 30 )));
85
88
panel .add (updateStatus );
86
89
panel .add (progressBar );
90
+ panel .add (fileProgress );
87
91
88
92
progressBar .setBounds (150 , 100 , 100 , 30 );
89
93
updateStatus .setBounds (70 , 25 , 370 , 40 );
@@ -202,7 +206,9 @@ public void checkUpdates() {
202
206
203
207
// we store files we need to download in filesToDownload
204
208
// if there are files in that list, download them
209
+ int currentProgress = 0 ;
205
210
if (filesToDownload .size () > 0 ) {
211
+ fileProgress .setText (String .format ("Progress: %d / %d" , currentProgress , filesToDownload .size ()));
206
212
File tempFolder = new File ("temp" );
207
213
if (!tempFolder .exists () && !tempFolder .mkdirs ()) {
208
214
logger .error ("Unable to create temp folder!" );
@@ -260,6 +266,8 @@ public void checkUpdates() {
260
266
updateStatus .setText ("Finished extracting file " + fileToDownload );
261
267
long extractedTime = TimeUnit .MILLISECONDS .convert (System .nanoTime () - startTime , TimeUnit .NANOSECONDS );
262
268
logger .info ("Finished extracting file " + downloadName + ". Took " + extractedTime + "ms." );
269
+ currentProgress ++;
270
+ fileProgress .setText (String .format ("Progress: %d / %d" , currentProgress , filesToDownload .size ()));
263
271
}
264
272
// delete all files in the temp folder
265
273
File [] tempFolderFiles = tempFolder .listFiles ();
0 commit comments