From c34aae8212c092c48812b3ff159232b049eb066f Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Wed, 29 Jan 2025 10:58:05 -0600 Subject: [PATCH] Show errors from loading shared data table when decompiling --- UIXC/Commands/DecompileCommand.cs | 16 ++++++++++++++-- UIXC/Program.cs | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/UIXC/Commands/DecompileCommand.cs b/UIXC/Commands/DecompileCommand.cs index f95a0e1..a4cfef6 100644 --- a/UIXC/Commands/DecompileCommand.cs +++ b/UIXC/Commands/DecompileCommand.cs @@ -46,7 +46,10 @@ public class DecompileCommand : CompilerCommandBase } } - BeginErrorReporting(new IrisSourceRepository(enumeratedInputs)); + var repoSources = enumeratedInputs.ToList(); + if (settings.DataTable is not null) + repoSources.Add(settings.DataTable); + BeginErrorReporting(new IrisSourceRepository(repoSources)); var loadAssembliesResult = LoadAssemblies(settings); if (loadAssembliesResult < 0) @@ -68,7 +71,10 @@ public class DecompileCommand : CompilerCommandBase { dataTableLoadResult = LoadIrisFile(settings.DataTable, settings); if (dataTableLoadResult.Status != LoadResultStatus.Success) - throw new Exception($"Failed to load data table from {dataTableLoadResult.ErrorContextUri}"); + { + AnsiConsole.MarkupLineInterpolated($"[red]Failed to load shared data table from {dataTableLoadResult.ErrorContextUri}[/]"); + goto done; + } } if (settings.Language == SourceLanguage.Asm) @@ -106,6 +112,12 @@ public class DecompileCommand : CompilerCommandBase AnsiConsole.MarkupLine($"[red]{settings.Language} is not currently a supported decompilation target.[/]"); } + done: + StopErrorReporting(); + Report?.Render(AnsiConsole.Console); + AnsiConsole.WriteLine(); + AnsiConsole.WriteLine(); + if (!success) { AnsiConsole.MarkupLine("[red]Decompilation failed.[/]"); diff --git a/UIXC/Program.cs b/UIXC/Program.cs index 7fb8dd3..e8f4aa4 100644 --- a/UIXC/Program.cs +++ b/UIXC/Program.cs @@ -17,7 +17,7 @@ internal class Program config.AddCommand("decompile") .WithAlias("d") - .WithDescription("Decompiles the given compiled UIX to a source langauge."); + .WithDescription("Decompiles the given compiled UIX to a source language."); #if DEBUG config.PropagateExceptions();