Files
Il2CppInspectorRedux/Il2CppInspector.GUI/MainWindow.xaml
2020-02-09 04:11:16 +01:00

163 lines
12 KiB
XML

<Window x:Class="Il2CppInspectorGUI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif"
mc:Ignorable="d"
Title="Il2CppInspector" Height="500" Width="900" Background="White">
<Window.Resources>
<!-- Our favourite colours -->
<SolidColorBrush x:Key="MicrosoftBlue" Color="#00A2ED"/>
<SolidColorBrush x:Key="WindowsBlue" Color="#357EC7"/>
<!-- Light box button -->
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
<SolidColorBrush x:Key="Button.Static.Border" Color="Gray"/>
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
<Style x:Key="LightBoxButton" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
<Setter Property="Foreground" Value="{StaticResource MicrosoftBlue}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="FontSize" Value="28"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<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>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Image list -->
<DataTemplate x:Key="ImageListTemplate">
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{2}-bit {1} ({0})">
<Binding Path="Package.BinaryImage.Format"></Binding>
<Binding Path="Package.BinaryImage.Arch"></Binding>
<Binding Path="Package.BinaryImage.Bits"></Binding>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</Window.Resources>
<!-- Window content -->
<Grid>
<!-- Main content -->
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height ="100*" />
<RowDefinition Height ="40" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition Width="15"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<DockPanel DockPanel.Dock="Left">
<Label DockPanel.Dock="Top" Foreground="{StaticResource WindowsBlue}" FontSize="18">Select image</Label>
<ListBox DockPanel.Dock="Top" Name="lstImages" ItemTemplate="{StaticResource ImageListTemplate}" Height="80"/>
<Label DockPanel.Dock="Top" Foreground="{StaticResource WindowsBlue}" FontSize="18">Image information</Label>
<Grid DockPanel.Dock="Top" Name="gridImageDetails" DataContext="{Binding ElementName=lstImages, Path=SelectedItem.Package}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70*"></ColumnDefinition>
<ColumnDefinition Width="30*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="IL2CPP Metadata version"></Label>
<Label Grid.Row="0" Grid.Column="1" Content="{Binding Path=Version}"></Label>
<Label Grid.Row="1" Grid.Column="0" Content="Container format"></Label>
<Label Grid.Row="1" Grid.Column="1" Content="{Binding Path=BinaryImage.Format}"></Label>
<Label Grid.Row="2" Grid.Column="0" Content="Container endianness"></Label>
<Label Grid.Row="2" Grid.Column="1" Content="{Binding Path=BinaryImage.Endianness}"></Label>
<Label Grid.Row="3" Grid.Column="0" Content="Architecture"></Label>
<Label Grid.Row="3" Grid.Column="1" Content="{Binding Path=BinaryImage.Arch}"></Label>
<Label Grid.Row="4" Grid.Column="0" Content="Architecture word size"></Label>
<Label Grid.Row="4" Grid.Column="1" Content="{Binding Path=BinaryImage.Bits}" ContentStringFormat="{}{0}-bit"></Label>
<Label Grid.Row="5" Grid.Column="0" Content="Code image-to-VA positive offset"></Label>
<Label Grid.Row="5" Grid.Column="1" Content="{Binding Path=BinaryImage.GlobalOffset}" ContentStringFormat="0x{0:x8}"></Label>
<Label Grid.Row="6" Grid.Column="0" Content="MetadataRegistration address"></Label>
<Label Grid.Row="6" Grid.Column="1" Content="{Binding Path=Binary.MetadataRegistrationPointer}" ContentStringFormat="0x{0:x8}"></Label>
<Label Grid.Row="7" Grid.Column="0" Content="CodeRegistration address"></Label>
<Label Grid.Row="7" Grid.Column="1" Content="{Binding Path=Binary.CodeRegistrationPointer}" ContentStringFormat="0x{0:x8}"></Label>
<Label Grid.Row="8" Grid.Column="0" Content="Il2CppCodeRegistration function"></Label>
<Label Grid.Row="8" Grid.Column="1" Content="{Binding Path=Binary.RegistrationFunctionPointer}" ContentStringFormat="0x{0:x8}"></Label>
</Grid>
</DockPanel>
<Separator Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Margin="5">
<Separator.LayoutTransform>
<RotateTransform Angle="90"></RotateTransform>
</Separator.LayoutTransform>
</Separator>
<Label Grid.Row="0" Grid.Column="2" Grid.RowSpan="3" Foreground="{StaticResource WindowsBlue}" FontSize="24"
HorizontalAlignment="Center" VerticalAlignment="Center">Select an image on the left</Label>
</Grid>
<!-- Light boxes -->
<Rectangle Name="rectModalLightBoxBackground" Fill="Black" Opacity="0.4"></Rectangle>
<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" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Bottom" Style="{StaticResource LightBoxButton}" FontSize="18" Width="120" Click="BtnBack_OnClick" Visibility="Hidden">&lt;&lt; Back</Button>
<!-- Busy indicator -->
<Border Name="areaBusyIndicator" Width="400" 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" />
</StackPanel>
</Border>
</Grid>
</Window>