GUI: Export asynchronously
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
xmlns:local="clr-namespace:Il2CppInspectorGUI"
|
||||
xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif"
|
||||
mc:Ignorable="d"
|
||||
Title="Il2CppInspector" Height="630" Width="990" Background="White">
|
||||
Title="Il2CppInspector" Height="630" Width="990" Background="White"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<!-- Our favourite colours -->
|
||||
<SolidColorBrush x:Key="MicrosoftBlue" Color="#00A2ED"/>
|
||||
@@ -352,8 +353,27 @@
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Background dimmer -->
|
||||
<Rectangle Name="rectModalLightBoxBackground" Fill="Black" Opacity="0.4">
|
||||
<Rectangle.Style>
|
||||
<Style>
|
||||
<Setter Property="Rectangle.Visibility" Value="Hidden"></Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=btnSelectMetadataFile, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="Rectangle.Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ElementName=btnSelectBinaryFile, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="Rectangle.Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ElementName=areaBusyIndicator, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="Rectangle.Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Rectangle.Style>
|
||||
</Rectangle>
|
||||
|
||||
<!-- Light boxes -->
|
||||
<Rectangle Name="rectModalLightBoxBackground" Fill="Black" Opacity="0.4" Visibility="Visible"></Rectangle>
|
||||
<Button Name="btnSelectMetadataFile" Style="{StaticResource LightBoxButton}" Margin="100" Click="BtnSelectMetadataFile_OnClick" Visibility="Visible">Select an IL2CPP metadata file</Button>
|
||||
<Button Name="btnSelectBinaryFile" Style="{StaticResource LightBoxButton}" Margin="100" Click="BtnSelectBinaryFile_OnClick" Visibility="Hidden">Select an IL2CPP binary file</Button>
|
||||
|
||||
@@ -375,7 +395,7 @@
|
||||
</Button>
|
||||
|
||||
<!-- Busy indicator -->
|
||||
<Border Name="areaBusyIndicator" Width="400" BorderThickness="1" CornerRadius="2" BorderBrush="Gray" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" SnapsToDevicePixels="True" Visibility="Hidden">
|
||||
<Border Name="areaBusyIndicator" Width="500" BorderThickness="1" CornerRadius="2" BorderBrush="Gray" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" SnapsToDevicePixels="True" Visibility="Hidden">
|
||||
<StackPanel Margin="60,40,60,40">
|
||||
<TextBlock Name="txtBusyStatus" Foreground="{StaticResource WindowsBlue}" FontSize="24" HorizontalAlignment="Center">Getting things ready...</TextBlock>
|
||||
<Image gif:AnimationBehavior.SourceUri="Resources/pizza.gif" Width="100" Margin="0,20,0,0" RenderOptions.BitmapScalingMode="Fant" />
|
||||
|
||||
@@ -109,7 +109,6 @@ namespace Il2CppInspectorGUI
|
||||
if (await app.LoadBinaryAsync(openFileDialog.FileName)) {
|
||||
// Binary loaded successfully
|
||||
areaBusyIndicator.Visibility = Visibility.Hidden;
|
||||
rectModalLightBoxBackground.Visibility = Visibility.Hidden;
|
||||
|
||||
lstImages.ItemsSource = app.Il2CppModels;
|
||||
lstImages.SelectedIndex = 0;
|
||||
@@ -126,7 +125,6 @@ namespace Il2CppInspectorGUI
|
||||
/// Reset binary and metadata files and start again
|
||||
/// </summary>
|
||||
private void BtnBack_OnClick(object sender, RoutedEventArgs e) {
|
||||
rectModalLightBoxBackground.Visibility = Visibility.Visible;
|
||||
lstImages.ItemsSource = null;
|
||||
btnSelectBinaryFile.Visibility = Visibility.Hidden;
|
||||
btnSelectMetadataFile.Visibility = Visibility.Visible;
|
||||
@@ -238,8 +236,7 @@ namespace Il2CppInspectorGUI
|
||||
/// <summary>
|
||||
/// Perform export
|
||||
/// </summary>
|
||||
private void BtnExport_OnClick(object sender, RoutedEventArgs e) {
|
||||
var app = (App) Application.Current;
|
||||
private async void BtnExport_OnClick(object sender, RoutedEventArgs e) {
|
||||
var model = (Il2CppModel) lstImages.SelectedItem;
|
||||
|
||||
var unityPath = txtUnityPath.Text;
|
||||
@@ -298,11 +295,15 @@ namespace Il2CppInspectorGUI
|
||||
if (!needsFolder && saveFileDialog.ShowDialog() == false)
|
||||
return;
|
||||
|
||||
|
||||
txtBusyStatus.Text = createSolution ? "Creating Visual Studio solution..." : "Exporting C# type definitions...";
|
||||
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||
|
||||
var outPath = needsFolder ? saveFolderDialog.SelectedPath : saveFileDialog.FileName;
|
||||
|
||||
await Task.Run(() => {
|
||||
if (createSolution)
|
||||
writer.WriteSolution(outPath, unityPath, unityAssembliesPath);
|
||||
|
||||
else
|
||||
switch (layout, sortOrder) {
|
||||
case ("single", "index"):
|
||||
@@ -334,6 +335,7 @@ namespace Il2CppInspectorGUI
|
||||
writer.WriteFilesByClassTree(outPath, separateAssemblyAttributesFiles);
|
||||
break;
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
// IDA Python script
|
||||
@@ -350,10 +352,17 @@ namespace Il2CppInspectorGUI
|
||||
|
||||
var outFile = scriptSaveFileDialog.FileName;
|
||||
|
||||
txtBusyStatus.Text = "Generating IDAPython script...";
|
||||
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||
|
||||
await Task.Run(() => {
|
||||
var idaWriter = new IDAPythonScript(model);
|
||||
idaWriter.WriteScriptToFile(outFile);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
areaBusyIndicator.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private IEnumerable<string> constructExcludedNamespaces(IEnumerable<CheckboxNode> nodes) {
|
||||
|
||||
Reference in New Issue
Block a user