diff --git a/BadBuilder.Formatter/NativeMethods.txt b/BadBuilder.Formatter/NativeMethods.txt index 7c42be3..bce018a 100644 --- a/BadBuilder.Formatter/NativeMethods.txt +++ b/BadBuilder.Formatter/NativeMethods.txt @@ -9,5 +9,4 @@ SetVolumeLabelW GUID DISK_GEOMETRY PARTITION_INFORMATION -PARTITION_INFORMATION_EX -SET_PARTITION_INFORMATION \ No newline at end of file +PARTITION_INFORMATION_EX \ No newline at end of file diff --git a/BadBuilder/ConsoleExperiences/DownloadExperience.cs b/BadBuilder/ConsoleExperiences/DownloadExperience.cs index aad3fe0..af96757 100644 --- a/BadBuilder/ConsoleExperiences/DownloadExperience.cs +++ b/BadBuilder/ConsoleExperiences/DownloadExperience.cs @@ -47,11 +47,11 @@ namespace BadBuilder itemsToDownload.Sort((a, b) => b.name.Length.CompareTo(a.name.Length)); + if (!Directory.Exists($"{DOWNLOAD_DIR}")) + Directory.CreateDirectory($"{DOWNLOAD_DIR}"); + if (itemsToDownload.Any()) { - if (!Directory.Exists($"{DOWNLOAD_DIR}")) - Directory.CreateDirectory($"{DOWNLOAD_DIR}"); - HttpClient downloadClient = new(); await AnsiConsole.Progress() @@ -90,7 +90,7 @@ namespace BadBuilder if (File.Exists(destinationPath)) continue; string existingPath = AnsiConsole.Prompt( - new TextPrompt($"Enter the path for the [bold]{selectedItem}[/] archive:") + new TextPrompt($"Enter the path to the [bold]{selectedItem}[/] archive:") .PromptStyle(LightOrangeStyle) .Validate(path => { @@ -100,11 +100,19 @@ namespace BadBuilder }) ).Trim().Trim('"'); - File.Copy(existingPath, destinationPath, overwrite: true); - AnsiConsole.MarkupLine($"[italic #76B900]Successfully copied [bold]{selectedItem}[/] to the working directory.[/]\n"); + Console.WriteLine(existingPath); + try + { + File.Copy(existingPath, destinationPath, overwrite: true); + AnsiConsole.MarkupLine($"[italic #76B900]Successfully copied [bold]{selectedItem}[/] to the working directory.[/]\n"); + } + catch (Exception ex) + { + AnsiConsole.MarkupLine($"[italic red]Failed to copy [bold]{selectedItem}[/] to the working directory. Exception: {ex.Message}[/]\n"); + } + } - return items.Select(item => new ArchiveItem(item.name, Path.Combine(DOWNLOAD_DIR, item.url.Split('/').Last()))).ToList(); } } diff --git a/BadBuilder/Program.cs b/BadBuilder/Program.cs index bc3614c..6744b51 100644 --- a/BadBuilder/Program.cs +++ b/BadBuilder/Program.cs @@ -173,7 +173,7 @@ namespace BadBuilder [#CCE388]██████╔╝██║ ██║██████╔╝██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║[/] [#CCE388]╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝[/] - [#76B900]──────────────────────────────────────────────────────────────────────v0.10a[/] + [#76B900]──────────────────────────────────────────────────────────────────────v0.20a[/] ───────────────────────Xbox 360 [#FF7200]BadUpdate[/] USB Builder─────────────────────── [#848589]Created by Pdawg[/] [#76B900]────────────────────────────────────────────────────────────────────────────[/] diff --git a/BadBuilder/Utilities/Constants.cs b/BadBuilder/Utilities/Constants.cs index 4ddd874..fe500ab 100644 --- a/BadBuilder/Utilities/Constants.cs +++ b/BadBuilder/Utilities/Constants.cs @@ -3,8 +3,8 @@ internal static class Constants { internal const string WORKING_DIR = "Work"; - internal const string DOWNLOAD_DIR = $@"{WORKING_DIR}\\Download"; - internal const string EXTRACTED_DIR = $@"{WORKING_DIR}\\Extract"; + internal const string DOWNLOAD_DIR = $@"{WORKING_DIR}\Download"; + internal const string EXTRACTED_DIR = $@"{WORKING_DIR}\Extract"; internal const string ContentFolder = "Content\\0000000000000000\\"; }