Save decomp results even when there are errors

This commit is contained in:
Yoshi Askharoun
2021-11-16 23:20:20 -06:00
parent a97114fd50
commit a365dad3cb
+14 -12
View File
@@ -1,30 +1,19 @@
using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
using ICSharpCode.AvalonEdit.Rendering;
using Microsoft.Iris;
using Microsoft.Iris.Data;
using Microsoft.Iris.Markup;
using Microsoft.Iris.OS;
using Microsoft.Iris.Session;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ZuneUIXTools.ViewModels;
using Application = Microsoft.Iris.Application;
using Window = System.Windows.Window;
@@ -124,7 +113,7 @@ namespace ZuneUIXTools
{
TextBlock errBlock = new TextBlock
{
Text = $"Ln {err.Line}, Col {err.Column}: {err.Message}",
Text = $"{err.Context}, Ln {err.Line}, Col {err.Column}: {err.Message}",
Margin = new Thickness(0, 0, 0, 4)
};
@@ -273,6 +262,19 @@ namespace ZuneUIXTools
ErrorPanel.Children.Add(errBlock);
});
}
finally
{
// Even if there were errors, save the decomp results.
var results = InterpreterContext.DecompileResults;
if (results != null && results.Count > 0)
{
for (int i = 0; i < results.Count; i++)
{
var result = results[i];
File.WriteAllText(Path.ChangeExtension(compiledFile, $"{i}.decomp.uix"), result.InnerXml);
}
}
}
}
private void Build_Click(object sender, RoutedEventArgs e)