From c5be641a20cea70d623fbed6e464e160119f6eba Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Sat, 13 Jul 2024 17:37:35 -0500 Subject: [PATCH] friendlier download display --- firestar/src/main/java/Bert.java | 29 ++++++++++++++++++++++------- firestar/src/main/java/Fozzie.java | 7 ++++++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/firestar/src/main/java/Bert.java b/firestar/src/main/java/Bert.java index ec5c203..cbca71b 100644 --- a/firestar/src/main/java/Bert.java +++ b/firestar/src/main/java/Bert.java @@ -143,11 +143,24 @@ public class Bert implements ActionListener { public void run() { for (Main.ArcTarget type : arcs) { String key = ""; + String arcname = ""; switch (type) { - case BASE -> key = Main.ArcKey.BASE.toString(); - case LATEST -> key = Main.ArcKey.LATEST.toString(); - case ADDON_HD -> key = Main.ArcKey.ADDON_HD.toString(); - case ADDON_HD_FURY -> key = Main.ArcKey.ADDON_HD_FURY.toString(); + case BASE : + key = Main.ArcKey.BASE.toString(); + arcname = "Base game"; + 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()) { System.out.println("Internal Error: Bert got dementia. Get a programmer!"); @@ -156,7 +169,9 @@ public class Bert implements ActionListener { } // 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) { // cleanup new File(Main.inpath + "asset.pkg").delete(); @@ -170,9 +185,9 @@ public class Bert implements ActionListener { } // dump contents - System.out.println("Extracting asset.pkg"); + System.out.println("Extracting " + arcname); Fozzie popup = new Fozzie(); - popup.displayTextOnly("Extracting PKG...", "Extracting"); + popup.displayTextOnly("Extracting" + arcname + "...", "Extracting"); Process p; try { if (!Main.windows) { diff --git a/firestar/src/main/java/Fozzie.java b/firestar/src/main/java/Fozzie.java index 33793f2..3239e4c 100644 --- a/firestar/src/main/java/Fozzie.java +++ b/firestar/src/main/java/Fozzie.java @@ -27,6 +27,7 @@ import java.net.*; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; +import java.util.Optional; public class Fozzie { BufferedImage windowIcon; @@ -42,6 +43,10 @@ public class Fozzie { public boolean backgroundDone = false; 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.setSize(300, 100); frame.setTitle("Download in Progress"); @@ -58,7 +63,7 @@ public class Fozzie { } frame.setVisible(true); - label.setText("Downloading \"" + oname + "\""); + label.setText("Downloading \"" + dname + "\""); try { URL fileURL = new URL(url);