GUI: Load binary file and back buttons
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="border" Background="White" BorderThickness="2" CornerRadius="2" BorderBrush="{TemplateBinding BorderBrush}" Margin="100" SnapsToDevicePixels="true">
|
||||
<Border x:Name="border" Background="White" BorderThickness="2" CornerRadius="2" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="true">
|
||||
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
@@ -90,6 +90,8 @@
|
||||
|
||||
<!-- Light boxes -->
|
||||
<Rectangle Name="rectModalLightBoxBackground" Fill="Black" Opacity="0.4"></Rectangle>
|
||||
<Button Name="btnSelectMetadataFile" Style="{StaticResource LightBoxButton}" Click="BtnSelectMetadataFile_OnClick">Select an IL2CPP metadata file</Button>
|
||||
<Button Name="btnSelectMetadataFile" Style="{StaticResource LightBoxButton}" Margin="100" Click="BtnSelectMetadataFile_OnClick">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>
|
||||
<Button Name="btnBack" VerticalAlignment="Bottom" DockPanel.Dock="Bottom" Style="{StaticResource LightBoxButton}" Margin="100,0,550,20" FontSize="18" Click="BtnBack_OnClick" Visibility="Hidden"><< Back</Button>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -46,12 +46,54 @@ namespace Il2CppInspectorGUI
|
||||
if (await app.LoadMetadataAsync(openFileDialog.FileName)) {
|
||||
// Metadata loaded successfully
|
||||
lblMetadataVersion.DataContext = app.CurrentMetadata;
|
||||
btnSelectBinaryFile.Visibility = Visibility.Visible;
|
||||
btnBack.Visibility = Visibility.Visible;
|
||||
}
|
||||
else {
|
||||
MessageBox.Show(this, app.LastException.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
btnSelectMetadataFile.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
else {
|
||||
btnSelectMetadataFile.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select binary file
|
||||
/// </summary>
|
||||
private async void BtnSelectBinaryFile_OnClick(object sender, RoutedEventArgs e) {
|
||||
var app = (App) Application.Current;
|
||||
|
||||
var openFileDialog = new OpenFileDialog {
|
||||
Filter = "Binary executable file (*.exe;*.dll;*.so)|*.exe;*.dll;*.so|All files (*.*)|*.*",
|
||||
CheckFileExists = true
|
||||
};
|
||||
|
||||
btnSelectBinaryFile.Visibility = Visibility.Hidden;
|
||||
btnBack.IsEnabled = false;
|
||||
|
||||
if (openFileDialog.ShowDialog() == true) {
|
||||
// Load the binary file
|
||||
}
|
||||
else {
|
||||
btnSelectBinaryFile.Visibility = Visibility.Visible;
|
||||
btnBack.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset binary and metadata files and start again
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void BtnBack_OnClick(object sender, RoutedEventArgs e) {
|
||||
var app = (App) Application.Current;
|
||||
|
||||
lblMetadataVersion.DataContext = null;
|
||||
btnSelectBinaryFile.Visibility = Visibility.Hidden;
|
||||
btnBack.Visibility = Visibility.Hidden;
|
||||
btnSelectMetadataFile.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user