friendlier download display

This commit is contained in:
Downforce Agent 2024-07-13 17:37:35 -05:00
parent 317eeedb29
commit c5be641a20
2 changed files with 28 additions and 8 deletions

View File

@ -143,11 +143,24 @@ public class Bert implements ActionListener {
public void run() { public void run() {
for (Main.ArcTarget type : arcs) { for (Main.ArcTarget type : arcs) {
String key = ""; String key = "";
String arcname = "";
switch (type) { switch (type) {
case BASE -> key = Main.ArcKey.BASE.toString(); case BASE :
case LATEST -> key = Main.ArcKey.LATEST.toString(); key = Main.ArcKey.BASE.toString();
case ADDON_HD -> key = Main.ArcKey.ADDON_HD.toString(); arcname = "Base game";
case ADDON_HD_FURY -> key = Main.ArcKey.ADDON_HD_FURY.toString(); break;
case LATEST :
key = Main.ArcKey.LATEST.toString();
arcname = "Updates";
break;
case ADDON_HD :
key = Main.ArcKey.ADDON_HD.toString();
arcname = "HD Add-On Pack";
break;
case ADDON_HD_FURY :
key = Main.ArcKey.ADDON_HD_FURY.toString();
arcname = "Fury Add-On Pack";
break;
} }
if (key.isEmpty()) { if (key.isEmpty()) {
System.out.println("Internal Error: Bert got dementia. Get a programmer!"); System.out.println("Internal Error: Bert got dementia. Get a programmer!");
@ -156,7 +169,9 @@ public class Bert implements ActionListener {
} }
// download file // download file
boolean downloader = new Fozzie().DownloadFile(type.toString(), Main.inpath, "asset.pkg"); Fozzie downloaderHandler = new Fozzie();
boolean downloader = downloaderHandler.DownloadFile(type.toString(), Main.inpath, "asset.pkg", arcname);
if (!downloader) { if (!downloader) {
// cleanup // cleanup
new File(Main.inpath + "asset.pkg").delete(); new File(Main.inpath + "asset.pkg").delete();
@ -170,9 +185,9 @@ public class Bert implements ActionListener {
} }
// dump contents // dump contents
System.out.println("Extracting asset.pkg"); System.out.println("Extracting " + arcname);
Fozzie popup = new Fozzie(); Fozzie popup = new Fozzie();
popup.displayTextOnly("Extracting PKG...", "Extracting"); popup.displayTextOnly("Extracting" + arcname + "...", "Extracting");
Process p; Process p;
try { try {
if (!Main.windows) { if (!Main.windows) {

View File

@ -27,6 +27,7 @@ import java.net.*;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.Optional;
public class Fozzie { public class Fozzie {
BufferedImage windowIcon; BufferedImage windowIcon;
@ -42,6 +43,10 @@ public class Fozzie {
public boolean backgroundDone = false; public boolean backgroundDone = false;
boolean DownloadFile(String url, String odir, String oname) { boolean DownloadFile(String url, String odir, String oname) {
return DownloadFile(url, odir, oname, oname);
}
boolean DownloadFile(String url, String odir, String oname, String dname) {
frame.add(frameContainer); frame.add(frameContainer);
frame.setSize(300, 100); frame.setSize(300, 100);
frame.setTitle("Download in Progress"); frame.setTitle("Download in Progress");
@ -58,7 +63,7 @@ public class Fozzie {
} }
frame.setVisible(true); frame.setVisible(true);
label.setText("Downloading \"" + oname + "\""); label.setText("Downloading \"" + dname + "\"");
try { try {
URL fileURL = new URL(url); URL fileURL = new URL(url);