added runtime patcher, added MemoryUtils, fixes

This commit is contained in:
kitbyte
2025-03-24 14:51:58 +02:00
parent 123307aed7
commit d3ff13a528
33 changed files with 1294 additions and 287 deletions
+20
View File
@@ -0,0 +1,20 @@
<UserControl x:Class="WeModPatcher.View.Controls.InfoItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WeModPatcher.View.Controls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Viewbox Width="20" Height="20" VerticalAlignment="Top">
<Path Fill="{Binding IconColor}" Data="{Binding IconData}"/>
</Viewbox>
<TextBlock Grid.Column="1" VerticalAlignment="Center" Margin="5 0 5 0" TextWrapping="Wrap"
FontSize="12" Text="{Binding Text}"/>
</Grid>
</UserControl>
@@ -0,0 +1,42 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace WeModPatcher.View.Controls
{
public partial class InfoItem : UserControl
{
public static readonly DependencyProperty IconDataProperty =
DependencyProperty.Register(nameof(IconData), typeof(Geometry), typeof(InfoItem));
public static readonly DependencyProperty IconColorProperty =
DependencyProperty.Register(nameof(IconColor), typeof(Brush), typeof(InfoItem));
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register(nameof(Text), typeof(string), typeof(InfoItem));
public Geometry IconData
{
get => (Geometry)GetValue(IconDataProperty);
set => SetValue(IconDataProperty, value);
}
public Brush IconColor
{
get => (Brush)GetValue(IconColorProperty);
set => SetValue(IconColorProperty, value);
}
public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
public InfoItem()
{
InitializeComponent();
this.DataContext = this;
}
}
}
+5 -3
View File
@@ -37,9 +37,11 @@
</Button.Style>
</Button>
<TextBlock x:Name="Title" Text="This is title" Foreground="{DynamicResource Foreground}"
HorizontalAlignment="Left" FontWeight="Bold" FontSize="16"
VerticalAlignment="Bottom"/>
<StackPanel Grid.Row="0" x:Name="TitleContainer" Orientation="Horizontal">
<TextBlock x:Name="Title" Text="This is title" Foreground="{DynamicResource Foreground}"
HorizontalAlignment="Left" FontWeight="Bold" FontSize="16"
VerticalAlignment="Bottom"/>
</StackPanel>
<ContentPresenter x:Name="Presenter" Margin="0 20 0 0"
Content="{Binding PopupContent}" Grid.Row="2"/>
@@ -65,6 +65,10 @@ namespace WeModPatcher.View.Controls
Visibility = Visibility.Collapsed;
Closed?.Invoke();
if (PopupContent is IDisposable disposable)
{
disposable.Dispose();
}
PopupContent = null;
Closed = null;
OpenedSemaphore.Release();