Skip to content

Commit

Permalink
rescan disc if settings were changed before the dump was started
Browse files Browse the repository at this point in the history
  • Loading branch information
13xforever committed Jan 22, 2024
1 parent 40d2112 commit 74daab8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Ps3DiscDumper/Dumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Ps3DiscDumper;

public class Dumper: IDisposable
{
public const string Version = "4.0.9";
public const string Version = "4.1.0";

static Dumper() => Log.Info("PS3 Disc Dumper v" + Version);

Expand Down
22 changes: 22 additions & 0 deletions UI.Avalonia/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.Linq;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Ps3DiscDumper;
Expand All @@ -12,6 +13,7 @@ public partial class MainWindowViewModel : ObservableObject, IDisposable
{
private readonly SettingsViewModel settingsPage = new();
private readonly MainViewModel mainPage;
private Settings oldSettings;

public MainWindowViewModel() => CurrentPage = mainPage = new(settingsPage);

Expand All @@ -25,16 +27,36 @@ public partial class MainWindowViewModel : ObservableObject, IDisposable
[ObservableProperty] private string formattedUpdateInfoBody = "";
[ObservableProperty] private string formattedUpdateInfoUrl = $"{SettingsViewModel.ProjectUrl}/releases/latest";
[ObservableProperty] private string formattedUpdateInfoVersion = "";


[RelayCommand]
private void ToggleSettingsPage()
{
if (CurrentPage is MainViewModel)
{
oldSettings = SettingsProvider.Settings;
CurrentPage = settingsPage;
}
else
{
SettingsProvider.Save();
CurrentPage = mainPage;
if (!mainPage.DumperIsReady)
return;

var newSettings = SettingsProvider.Settings;
if (newSettings.DumpNameTemplate != oldSettings.DumpNameTemplate
|| newSettings.OutputDir != oldSettings.OutputDir
|| newSettings.IrdDir != oldSettings.IrdDir
|| newSettings.CopyBdmv != oldSettings.CopyBdmv
|| newSettings.CopyPs3Update != oldSettings.CopyPs3Update)
{
Dispatcher.UIThread.Post(() =>
{
mainPage.ResetViewModelCommand.Execute(null);
mainPage.ScanDiscsCommand.Execute(null);
}, DispatcherPriority.Background);
}
}
}

Expand Down

0 comments on commit 74daab8

Please sign in to comment.