Fix copying bug

This commit is contained in:
Pdawg11239
2025-03-29 20:53:04 -04:00
parent ac42c67478
commit e27b272aa6
4 changed files with 19 additions and 12 deletions

View File

@@ -9,5 +9,4 @@ SetVolumeLabelW
GUID GUID
DISK_GEOMETRY DISK_GEOMETRY
PARTITION_INFORMATION PARTITION_INFORMATION
PARTITION_INFORMATION_EX PARTITION_INFORMATION_EX
SET_PARTITION_INFORMATION

View File

@@ -47,11 +47,11 @@ namespace BadBuilder
itemsToDownload.Sort((a, b) => b.name.Length.CompareTo(a.name.Length)); itemsToDownload.Sort((a, b) => b.name.Length.CompareTo(a.name.Length));
if (!Directory.Exists($"{DOWNLOAD_DIR}"))
Directory.CreateDirectory($"{DOWNLOAD_DIR}");
if (itemsToDownload.Any()) if (itemsToDownload.Any())
{ {
if (!Directory.Exists($"{DOWNLOAD_DIR}"))
Directory.CreateDirectory($"{DOWNLOAD_DIR}");
HttpClient downloadClient = new(); HttpClient downloadClient = new();
await AnsiConsole.Progress() await AnsiConsole.Progress()
@@ -90,7 +90,7 @@ namespace BadBuilder
if (File.Exists(destinationPath)) continue; if (File.Exists(destinationPath)) continue;
string existingPath = AnsiConsole.Prompt( string existingPath = AnsiConsole.Prompt(
new TextPrompt<string>($"Enter the path for the [bold]{selectedItem}[/] archive:") new TextPrompt<string>($"Enter the path to the [bold]{selectedItem}[/] archive:")
.PromptStyle(LightOrangeStyle) .PromptStyle(LightOrangeStyle)
.Validate(path => .Validate(path =>
{ {
@@ -100,11 +100,19 @@ namespace BadBuilder
}) })
).Trim().Trim('"'); ).Trim().Trim('"');
File.Copy(existingPath, destinationPath, overwrite: true); Console.WriteLine(existingPath);
AnsiConsole.MarkupLine($"[italic #76B900]Successfully copied [bold]{selectedItem}[/] to the working directory.[/]\n"); 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(); return items.Select(item => new ArchiveItem(item.name, Path.Combine(DOWNLOAD_DIR, item.url.Split('/').Last()))).ToList();
} }
} }

View File

@@ -173,7 +173,7 @@ namespace BadBuilder
[#CCE388] [/] [#CCE388] [/]
[#CCE388] [/] [#CCE388] [/]
[#76B900]v0.10a[/] [#76B900]v0.20a[/]
Xbox 360 [#FF7200]BadUpdate[/] USB Builder Xbox 360 [#FF7200]BadUpdate[/] USB Builder
[#848589]Created by Pdawg[/] [#848589]Created by Pdawg[/]
[#76B900][/] [#76B900][/]

View File

@@ -3,8 +3,8 @@
internal static class Constants internal static class Constants
{ {
internal const string WORKING_DIR = "Work"; internal const string WORKING_DIR = "Work";
internal const string DOWNLOAD_DIR = $@"{WORKING_DIR}\\Download"; internal const string DOWNLOAD_DIR = $@"{WORKING_DIR}\Download";
internal const string EXTRACTED_DIR = $@"{WORKING_DIR}\\Extract"; internal const string EXTRACTED_DIR = $@"{WORKING_DIR}\Extract";
internal const string ContentFolder = "Content\\0000000000000000\\"; internal const string ContentFolder = "Content\\0000000000000000\\";
} }