diff --git a/PS2_Manager/Core/Game.cs b/PS2_Manager/Core/Game.cs
index 69994c9..a7fdefe 100644
--- a/PS2_Manager/Core/Game.cs
+++ b/PS2_Manager/Core/Game.cs
@@ -71,30 +71,7 @@ public class Game
}
}
- public void GetChecksum()
- {
- string filePath = this.GamePath;
-
- BackgroundWorker md5Worker = new BackgroundWorker();
- BackgroundWorker sha1Worker = new BackgroundWorker();
-
- md5Worker.DoWork += (s, e) =>
- {
- string md5 = Checksum.GetMD5Hash(filePath);
- Console.WriteLine("MD5: " + md5);
- };
-
- sha1Worker.DoWork += (s, e) =>
- {
- string sha1 = Checksum.GetSHA1Hash(filePath);
- Console.WriteLine("SHA1: " + sha1);
- };
-
- md5Worker.RunWorkerAsync();
- sha1Worker.RunWorkerAsync();
-
- Console.WriteLine("Hashing started...");
- }
+
private string ParseFormattedFilename(string filename)
{
diff --git a/PS2_Manager/EditGame.axaml b/PS2_Manager/EditGame.axaml
index 5b79035..0337cb3 100644
--- a/PS2_Manager/EditGame.axaml
+++ b/PS2_Manager/EditGame.axaml
@@ -5,9 +5,24 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="PS2_Manager.EditGame">
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PS2_Manager/EditGame.axaml.cs b/PS2_Manager/EditGame.axaml.cs
index 20b332a..f41584f 100644
--- a/PS2_Manager/EditGame.axaml.cs
+++ b/PS2_Manager/EditGame.axaml.cs
@@ -1,8 +1,10 @@
using System;
+using System.ComponentModel;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
+using Avalonia.Threading;
using PS2_Manager.Core;
namespace PS2_Manager;
@@ -10,10 +12,29 @@ namespace PS2_Manager;
public partial class EditGame : UserControl
{
public Game game { get; set; }
+ public UpdateVar MD5Hash { get; set; } = new UpdateVar();
+ public UpdateVar SHA1Hash { get; set; } = new UpdateVar();
public EditGame(Game _game)
{
this.game = _game;
InitializeComponent();
+ DisplayNameBox.Text = this.game.Name;
+ MD5Hash.ValueChanged += () =>
+ {
+ Dispatcher.UIThread.Invoke(() =>
+ {
+ Console.WriteLine("MD5Hash.ValueChanged");
+ MD5TextBlock.Text = "MD5: " + MD5Hash.Value;
+ });
+ };
+ SHA1Hash.ValueChanged += () =>
+ {
+ Dispatcher.UIThread.Invoke(() =>
+ {
+ Console.WriteLine("SHA1Hash.ValueChanged");
+ SHATextBlock.Text = "SHA1: " + SHA1Hash.Value;
+ });
+ };
}
private void DisplayNameBox_OnTextChanged(object? sender, TextChangedEventArgs e)
@@ -22,8 +43,35 @@ public partial class EditGame : UserControl
MainWindow.RefreshGamesListTrigger.Invoke(null, EventArgs.Empty);
}
- private void Button_OnClick(object? sender, RoutedEventArgs e)
+ private void ChecksumButtonOnClick(object? sender, RoutedEventArgs e)
{
- this.game.GetChecksum();
+ this.GetChecksum();
+ }
+
+ public void GetChecksum()
+ {
+ string filePath = this.game.GamePath;
+
+ MD5TextBlock.Text = "MD5: Loading...";
+ SHATextBlock.Text = "SHA1: Loading...";
+ ChecksumArea.IsVisible = true;
+
+ BackgroundWorker md5Worker = new BackgroundWorker();
+ BackgroundWorker sha1Worker = new BackgroundWorker();
+
+ md5Worker.DoWork += (s, e) =>
+ {
+ this.MD5Hash.Value = Checksum.GetMD5Hash(filePath);
+ };
+
+ sha1Worker.DoWork += (s, e) =>
+ {
+ this.SHA1Hash.Value = Checksum.GetSHA1Hash(filePath);
+ };
+
+ md5Worker.RunWorkerAsync();
+ sha1Worker.RunWorkerAsync();
+
+ Console.WriteLine("Hashing started...");
}
}
\ No newline at end of file
diff --git a/PS2_Manager/MainWindow.axaml b/PS2_Manager/MainWindow.axaml
index 9540fd6..3c5a040 100644
--- a/PS2_Manager/MainWindow.axaml
+++ b/PS2_Manager/MainWindow.axaml
@@ -77,7 +77,7 @@
-
+