Migrate GUI to CommunityToolkit.Mvvm.

This commit is contained in:
2025-08-20 21:19:43 +01:00
parent f5414ff23d
commit 13ea0d299b
41 changed files with 1519 additions and 3388 deletions

View File

@@ -23,6 +23,7 @@
<PackageReference Include="Avalonia.Diagnostics"/> <PackageReference Include="Avalonia.Diagnostics"/>
<PackageReference Include="Avalonia.Themes.Fluent"/> <PackageReference Include="Avalonia.Themes.Fluent"/>
<PackageReference Include="Claunia.Encoding"/> <PackageReference Include="Claunia.Encoding"/>
<PackageReference Include="CommunityToolkit.Mvvm"/>
<PackageReference Include="Humanizer.Core"/> <PackageReference Include="Humanizer.Core"/>
<PackageReference Include="JetBrains.Annotations"/> <PackageReference Include="JetBrains.Annotations"/>
<PackageReference Include="MessageBox.Avalonia"/> <PackageReference Include="MessageBox.Avalonia"/>
@@ -32,7 +33,6 @@
<PackageReference Include="System.Text.Encoding.CodePages"/> <PackageReference Include="System.Text.Encoding.CodePages"/>
<PackageReference Include="Avalonia"/> <PackageReference Include="Avalonia"/>
<PackageReference Include="Avalonia.Desktop"/> <PackageReference Include="Avalonia.Desktop"/>
<PackageReference Include="Avalonia.ReactiveUI"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Aaru.Core\Aaru.Core.csproj"/> <ProjectReference Include="..\Aaru.Core\Aaru.Core.csproj"/>

View File

@@ -91,7 +91,7 @@ public sealed class App : Application
}) })
return; return;
mainWindowViewModel.ExecuteAboutCommand(); mainWindowViewModel.About();
} }
void OnQuitClicked(object sender, EventArgs args) void OnQuitClicked(object sender, EventArgs args)
@@ -105,7 +105,7 @@ public sealed class App : Application
}) })
return; return;
mainWindowViewModel.ExecuteExitCommand(); mainWindowViewModel.Exit();
} }
void OnPreferencesClicked(object sender, EventArgs args) void OnPreferencesClicked(object sender, EventArgs args)
@@ -119,6 +119,6 @@ public sealed class App : Application
}) })
return; return;
mainWindowViewModel.ExecuteSettingsCommand(); mainWindowViewModel.SettingsAsync();
} }
} }

View File

@@ -29,8 +29,6 @@
using System; using System;
using System.Text; using System.Text;
using Avalonia; using Avalonia;
using Avalonia.Dialogs;
using Avalonia.ReactiveUI;
using Sentry; using Sentry;
namespace Aaru.Gui; namespace Aaru.Gui;
@@ -78,6 +76,5 @@ public static class Main
} }
// Avalonia configuration, don't remove; also used by visual designer. // Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp() => public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>().UsePlatformDetect();
AppBuilder.Configure<App>().UsePlatformDetect().UseReactiveUI().UseManagedSystemDialogs();
} }

View File

@@ -34,22 +34,24 @@ using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Gui.Models; using Aaru.Gui.Models;
using Aaru.Gui.Views.Dialogs; using Aaru.Gui.Views.Dialogs;
using Aaru.Localization; using Aaru.Localization;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Dialogs; namespace Aaru.Gui.ViewModels.Dialogs;
public sealed class AboutViewModel : ViewModelBase public sealed partial class AboutViewModel : ViewModelBase
{ {
readonly About _view; readonly About _view;
string _versionText; [ObservableProperty]
string _versionText;
public AboutViewModel(About view) public AboutViewModel(About view)
{ {
@@ -59,13 +61,13 @@ public sealed class AboutViewModel : ViewModelBase
(Attribute.GetCustomAttribute(typeof(App).Assembly, typeof(AssemblyInformationalVersionAttribute)) as (Attribute.GetCustomAttribute(typeof(App).Assembly, typeof(AssemblyInformationalVersionAttribute)) as
AssemblyInformationalVersionAttribute)?.InformationalVersion; AssemblyInformationalVersionAttribute)?.InformationalVersion;
WebsiteCommand = ReactiveCommand.Create(ExecuteWebsiteCommand); WebsiteCommand = new RelayCommand(OpenWebsite);
LicenseCommand = ReactiveCommand.Create(ExecuteLicenseCommand); LicenseCommand = new AsyncRelayCommand(LicenseAsync);
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
Assemblies = []; Assemblies = [];
Task.Run(() => _ = Task.Run(() =>
{ {
foreach(Assembly assembly in AppDomain.CurrentDomain.GetAssemblies().OrderBy(a => a.FullName)) foreach(Assembly assembly in AppDomain.CurrentDomain.GetAssemblies().OrderBy(a => a.FullName))
{ {
@@ -125,18 +127,12 @@ public sealed class AboutViewModel : ViewModelBase
[NotNull] [NotNull]
public string Authors => UI.Text_Authors; public string Authors => UI.Text_Authors;
public ReactiveCommand<Unit, Unit> WebsiteCommand { get; } public ICommand WebsiteCommand { get; }
public ReactiveCommand<Unit, Unit> LicenseCommand { get; } public ICommand LicenseCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ObservableCollection<AssemblyModel> Assemblies { get; } public ObservableCollection<AssemblyModel> Assemblies { get; }
public string VersionText static void OpenWebsite()
{
get => _versionText;
set => this.RaiseAndSetIfChanged(ref _versionText, value);
}
static void ExecuteWebsiteCommand()
{ {
var process = new Process var process = new Process
{ {
@@ -163,12 +159,13 @@ public sealed class AboutViewModel : ViewModelBase
process.Start(); process.Start();
} }
void ExecuteLicenseCommand() Task LicenseAsync()
{ {
var dialog = new LicenseDialog(); var dialog = new LicenseDialog();
dialog.DataContext = new LicenseViewModel(dialog); dialog.DataContext = new LicenseViewModel(dialog);
dialog.ShowDialog(_view);
return dialog.ShowDialog(_view);
} }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
} }

View File

@@ -34,17 +34,17 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Reactive;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.CommonTypes.Interop; using Aaru.CommonTypes.Interop;
using Aaru.Localization; using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using MsBox.Avalonia; using MsBox.Avalonia;
using MsBox.Avalonia.Enums; using MsBox.Avalonia.Enums;
using ReactiveUI;
using Console = Aaru.Gui.Views.Dialogs.Console; using Console = Aaru.Gui.Views.Dialogs.Console;
using PlatformID = Aaru.CommonTypes.Interop.PlatformID; using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
using Version = Aaru.CommonTypes.Interop.Version; using Version = Aaru.CommonTypes.Interop.Version;
@@ -59,15 +59,15 @@ public sealed class ConsoleViewModel : ViewModelBase
public ConsoleViewModel(Console view) public ConsoleViewModel(Console view)
{ {
_view = view; _view = view;
SaveCommand = ReactiveCommand.Create(ExecuteSaveCommand); SaveCommand = new AsyncRelayCommand(SaveAsync);
ClearCommand = ReactiveCommand.Create(ExecuteClearCommand); ClearCommand = new RelayCommand(Clear);
} }
[NotNull] [NotNull]
public string Title => UI.Title_Console; public string Title => UI.Title_Console;
public ReactiveCommand<Unit, Unit> ClearCommand { get; } public ICommand ClearCommand { get; }
public ReactiveCommand<Unit, Task> SaveCommand { get; } public ICommand SaveCommand { get; }
public ObservableCollection<LogEntry> Entries => ConsoleHandler.Entries; public ObservableCollection<LogEntry> Entries => ConsoleHandler.Entries;
[NotNull] [NotNull]
@@ -90,11 +90,11 @@ public sealed class ConsoleViewModel : ViewModelBase
set set
{ {
ConsoleHandler.Debug = value; ConsoleHandler.Debug = value;
this.RaiseAndSetIfChanged(ref _debugChecked, value); SetProperty(ref _debugChecked, value);
} }
} }
async Task ExecuteSaveCommand() async Task SaveAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -165,11 +165,11 @@ public sealed class ConsoleViewModel : ViewModelBase
Icon.Error) Icon.Error)
.ShowWindowDialogAsync(_view); .ShowWindowDialogAsync(_view);
AaruLogging.Exception(exception, UI AaruLogging.Exception(exception,
.Exception_0_trying_to_save_logfile_details_has_been_sent_to_console, UI.Exception_0_trying_to_save_logfile_details_has_been_sent_to_console,
exception.Message); exception.Message);
} }
} }
static void ExecuteClearCommand() => ConsoleHandler.Entries.Clear(); static void Clear() => ConsoleHandler.Entries.Clear();
} }

View File

@@ -32,14 +32,14 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Gui.Models; using Aaru.Gui.Models;
using Aaru.Gui.Views.Dialogs; using Aaru.Gui.Views.Dialogs;
using Aaru.Localization; using Aaru.Localization;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Dialogs; namespace Aaru.Gui.ViewModels.Dialogs;
@@ -51,9 +51,9 @@ public sealed class EncodingsViewModel : ViewModelBase
{ {
_view = view; _view = view;
Encodings = []; Encodings = [];
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
Task.Run(() => _ = Task.Run(() =>
{ {
var encodings = Encoding.GetEncodings() var encodings = Encoding.GetEncodings()
.Select(info => new EncodingModel .Select(info => new EncodingModel
@@ -83,8 +83,8 @@ public sealed class EncodingsViewModel : ViewModelBase
public string CodeLabel => UI.Title_Code_for_encoding; public string CodeLabel => UI.Title_Code_for_encoding;
public string NameLabel => UI.Title_Name; public string NameLabel => UI.Title_Name;
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ObservableCollection<EncodingModel> Encodings { get; } public ObservableCollection<EncodingModel> Encodings { get; }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
} }

View File

@@ -31,12 +31,12 @@
// ****************************************************************************/ // ****************************************************************************/
using System.IO; using System.IO;
using System.Reactive;
using System.Reflection; using System.Reflection;
using System.Windows.Input;
using Aaru.Gui.Views.Dialogs; using Aaru.Gui.Views.Dialogs;
using Aaru.Localization; using Aaru.Localization;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Dialogs; namespace Aaru.Gui.ViewModels.Dialogs;
@@ -48,7 +48,7 @@ public sealed class LicenseViewModel : ViewModelBase
public LicenseViewModel(LicenseDialog view) public LicenseViewModel(LicenseDialog view)
{ {
_view = view; _view = view;
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
// TODO: Localize // TODO: Localize
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Aaru.Gui.LICENSE"); using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Aaru.Gui.LICENSE");
@@ -66,8 +66,8 @@ public sealed class LicenseViewModel : ViewModelBase
[NotNull] [NotNull]
public string CloseLabel => UI.ButtonLabel_Close; public string CloseLabel => UI.ButtonLabel_Close;
public string LicenseText { get; } public string LicenseText { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
} }

View File

@@ -31,15 +31,15 @@
// ****************************************************************************/ // ****************************************************************************/
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Reactive;
using System.Reflection; using System.Reflection;
using System.Windows.Input;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.Gui.Models; using Aaru.Gui.Models;
using Aaru.Gui.Views.Dialogs; using Aaru.Gui.Views.Dialogs;
using Aaru.Localization; using Aaru.Localization;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Dialogs; namespace Aaru.Gui.ViewModels.Dialogs;
@@ -58,7 +58,7 @@ public sealed class PluginsViewModel : ViewModelBase
WritableImages = []; WritableImages = [];
FloppyImages = []; FloppyImages = [];
WritableFloppyImages = []; WritableFloppyImages = [];
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
// TODO: Takes too much time // TODO: Takes too much time
foreach(IFilter filter in PluginRegister.Singleton.Filters.Values) foreach(IFilter filter in PluginRegister.Singleton.Filters.Values)
@@ -201,7 +201,7 @@ public sealed class PluginsViewModel : ViewModelBase
public string VersionLabel => UI.Title_Version; public string VersionLabel => UI.Title_Version;
public string AuthorLabel => UI.Title_Author; public string AuthorLabel => UI.Title_Author;
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ObservableCollection<PluginModel> Filters { get; } public ObservableCollection<PluginModel> Filters { get; }
public ObservableCollection<PluginModel> PartitionSchemes { get; } public ObservableCollection<PluginModel> PartitionSchemes { get; }
public ObservableCollection<PluginModel> Filesystems { get; } public ObservableCollection<PluginModel> Filesystems { get; }
@@ -211,5 +211,5 @@ public sealed class PluginsViewModel : ViewModelBase
public ObservableCollection<PluginModel> FloppyImages { get; } public ObservableCollection<PluginModel> FloppyImages { get; }
public ObservableCollection<PluginModel> WritableFloppyImages { get; } public ObservableCollection<PluginModel> WritableFloppyImages { get; }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
} }

View File

@@ -30,33 +30,49 @@
// Copyright © 2011-2025 Natalia Portillo // Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/ // ****************************************************************************/
using System.Reactive; using System.Windows.Input;
using Aaru.Gui.Views.Dialogs; using Aaru.Gui.Views.Dialogs;
using Aaru.Localization; using Aaru.Localization;
using Aaru.Settings; using Aaru.Settings;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Dialogs; namespace Aaru.Gui.ViewModels.Dialogs;
public sealed class SettingsViewModel : ViewModelBase public sealed partial class SettingsViewModel : ViewModelBase
{ {
readonly SettingsDialog _view; readonly SettingsDialog _view;
bool _commandStatsChecked; [ObservableProperty]
bool _deviceStatsChecked; bool _commandStatsChecked;
bool _filesystemStatsChecked; [ObservableProperty]
bool _filterStatsChecked; bool _deviceStatsChecked;
bool _gdprVisible; [ObservableProperty]
bool _mediaImageStatsChecked; bool _filesystemStatsChecked;
bool _mediaScanStatsChecked; [ObservableProperty]
bool _mediaStatsChecked; bool _filterStatsChecked;
bool _partitionStatsChecked; [ObservableProperty]
bool _saveReportsGloballyChecked; bool _gdprVisible;
bool _saveStatsChecked; [ObservableProperty]
bool _shareReportsChecked; bool _mediaImageStatsChecked;
bool _shareStatsChecked; [ObservableProperty]
int _tabControlSelectedIndex; bool _mediaScanStatsChecked;
bool _verifyStatsChecked; [ObservableProperty]
bool _mediaStatsChecked;
[ObservableProperty]
bool _partitionStatsChecked;
[ObservableProperty]
bool _saveReportsGloballyChecked;
[ObservableProperty]
bool _saveStatsChecked;
[ObservableProperty]
bool _shareReportsChecked;
[ObservableProperty]
bool _shareStatsChecked;
[ObservableProperty]
int _tabControlSelectedIndex;
[ObservableProperty]
bool _verifyStatsChecked;
public SettingsViewModel(SettingsDialog view, bool gdprChange) public SettingsViewModel(SettingsDialog view, bool gdprChange)
{ {
@@ -82,8 +98,8 @@ public sealed class SettingsViewModel : ViewModelBase
else else
SaveStatsChecked = false; SaveStatsChecked = false;
CancelCommand = ReactiveCommand.Create(ExecuteCancelCommand); CancelCommand = new RelayCommand(Cancel);
SaveCommand = ReactiveCommand.Create(ExecuteSaveCommand); SaveCommand = new RelayCommand(Save);
if(!_gdprVisible) _tabControlSelectedIndex = 1; if(!_gdprVisible) _tabControlSelectedIndex = 1;
} }
@@ -164,100 +180,10 @@ public sealed class SettingsViewModel : ViewModelBase
[NotNull] [NotNull]
public string VerifyStatsText => UI.Gather_statistics_about_media_image_verifications_Q; public string VerifyStatsText => UI.Gather_statistics_about_media_image_verifications_Q;
public ReactiveCommand<Unit, Unit> CancelCommand { get; } public ICommand CancelCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCommand { get; } public ICommand SaveCommand { get; }
public bool GdprVisible void Save()
{
get => _gdprVisible;
set => this.RaiseAndSetIfChanged(ref _gdprVisible, value);
}
public bool SaveReportsGloballyChecked
{
get => _saveReportsGloballyChecked;
set => this.RaiseAndSetIfChanged(ref _saveReportsGloballyChecked, value);
}
public bool ShareReportsChecked
{
get => _shareReportsChecked;
set => this.RaiseAndSetIfChanged(ref _shareReportsChecked, value);
}
public bool SaveStatsChecked
{
get => _saveStatsChecked;
set => this.RaiseAndSetIfChanged(ref _saveStatsChecked, value);
}
public bool ShareStatsChecked
{
get => _shareStatsChecked;
set => this.RaiseAndSetIfChanged(ref _shareStatsChecked, value);
}
public bool CommandStatsChecked
{
get => _commandStatsChecked;
set => this.RaiseAndSetIfChanged(ref _commandStatsChecked, value);
}
public bool DeviceStatsChecked
{
get => _deviceStatsChecked;
set => this.RaiseAndSetIfChanged(ref _deviceStatsChecked, value);
}
public bool FilesystemStatsChecked
{
get => _filesystemStatsChecked;
set => this.RaiseAndSetIfChanged(ref _filesystemStatsChecked, value);
}
public bool FilterStatsChecked
{
get => _filterStatsChecked;
set => this.RaiseAndSetIfChanged(ref _filterStatsChecked, value);
}
public bool MediaImageStatsChecked
{
get => _mediaImageStatsChecked;
set => this.RaiseAndSetIfChanged(ref _mediaImageStatsChecked, value);
}
public bool MediaScanStatsChecked
{
get => _mediaScanStatsChecked;
set => this.RaiseAndSetIfChanged(ref _mediaScanStatsChecked, value);
}
public bool PartitionStatsChecked
{
get => _partitionStatsChecked;
set => this.RaiseAndSetIfChanged(ref _partitionStatsChecked, value);
}
public bool MediaStatsChecked
{
get => _mediaStatsChecked;
set => this.RaiseAndSetIfChanged(ref _mediaStatsChecked, value);
}
public bool VerifyStatsChecked
{
get => _verifyStatsChecked;
set => this.RaiseAndSetIfChanged(ref _verifyStatsChecked, value);
}
public int TabControlSelectedIndex
{
get => _tabControlSelectedIndex;
set => this.RaiseAndSetIfChanged(ref _tabControlSelectedIndex, value);
}
void ExecuteSaveCommand()
{ {
Settings.Settings.Current.SaveReportsGlobally = SaveReportsGloballyChecked; Settings.Settings.Current.SaveReportsGlobally = SaveReportsGloballyChecked;
Settings.Settings.Current.ShareReports = ShareReportsChecked; Settings.Settings.Current.ShareReports = ShareReportsChecked;
@@ -286,5 +212,5 @@ public sealed class SettingsViewModel : ViewModelBase
_view.Close(); _view.Close();
} }
void ExecuteCancelCommand() => _view.Close(); void Cancel() => _view.Close();
} }

View File

@@ -32,14 +32,14 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Reactive; using System.Windows.Input;
using Aaru.Database; using Aaru.Database;
using Aaru.Database.Models; using Aaru.Database.Models;
using Aaru.Gui.Models; using Aaru.Gui.Models;
using Aaru.Gui.Views.Dialogs; using Aaru.Gui.Views.Dialogs;
using Aaru.Localization; using Aaru.Localization;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
using NameCountModel = Aaru.Gui.Models.NameCountModel; using NameCountModel = Aaru.Gui.Models.NameCountModel;
namespace Aaru.Gui.ViewModels.Dialogs; namespace Aaru.Gui.ViewModels.Dialogs;
@@ -96,7 +96,7 @@ public sealed class StatisticsViewModel : ViewModelBase
Filesystems = []; Filesystems = [];
Devices = []; Devices = [];
Medias = []; Medias = [];
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
using var ctx = AaruContext.Create(Settings.Settings.LocalDbPath); using var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
if(ctx.Commands.Any()) if(ctx.Commands.Any())
@@ -481,235 +481,235 @@ public sealed class StatisticsViewModel : ViewModelBase
public string FsInfoText public string FsInfoText
{ {
get => _fsinfoText; get => _fsinfoText;
set => this.RaiseAndSetIfChanged(ref _fsinfoText, value); set => SetProperty(ref _fsinfoText, value);
} }
public bool FsInfoVisible public bool FsInfoVisible
{ {
get => _fsinfoVisible; get => _fsinfoVisible;
set => this.RaiseAndSetIfChanged(ref _fsinfoVisible, value); set => SetProperty(ref _fsinfoVisible, value);
} }
public string ChecksumText public string ChecksumText
{ {
get => _checksumText; get => _checksumText;
set => this.RaiseAndSetIfChanged(ref _checksumText, value); set => SetProperty(ref _checksumText, value);
} }
public bool ChecksumVisible public bool ChecksumVisible
{ {
get => _checksumVisible; get => _checksumVisible;
set => this.RaiseAndSetIfChanged(ref _checksumVisible, value); set => SetProperty(ref _checksumVisible, value);
} }
public string CompareText public string CompareText
{ {
get => _compareText; get => _compareText;
set => this.RaiseAndSetIfChanged(ref _compareText, value); set => SetProperty(ref _compareText, value);
} }
public bool CompareVisible public bool CompareVisible
{ {
get => _compareVisible; get => _compareVisible;
set => this.RaiseAndSetIfChanged(ref _compareVisible, value); set => SetProperty(ref _compareVisible, value);
} }
public string ConvertImageText public string ConvertImageText
{ {
get => _convertImageText; get => _convertImageText;
set => this.RaiseAndSetIfChanged(ref _convertImageText, value); set => SetProperty(ref _convertImageText, value);
} }
public bool ConvertImageVisible public bool ConvertImageVisible
{ {
get => _convertImageVisible; get => _convertImageVisible;
set => this.RaiseAndSetIfChanged(ref _convertImageVisible, value); set => SetProperty(ref _convertImageVisible, value);
} }
public string CreateSidecarText public string CreateSidecarText
{ {
get => _createSidecarText; get => _createSidecarText;
set => this.RaiseAndSetIfChanged(ref _createSidecarText, value); set => SetProperty(ref _createSidecarText, value);
} }
public bool CreateSidecarVisible public bool CreateSidecarVisible
{ {
get => _createSidecarVisible; get => _createSidecarVisible;
set => this.RaiseAndSetIfChanged(ref _createSidecarVisible, value); set => SetProperty(ref _createSidecarVisible, value);
} }
public string DecodeText public string DecodeText
{ {
get => _decodeText; get => _decodeText;
set => this.RaiseAndSetIfChanged(ref _decodeText, value); set => SetProperty(ref _decodeText, value);
} }
public bool DecodeVisible public bool DecodeVisible
{ {
get => _decodeVisible; get => _decodeVisible;
set => this.RaiseAndSetIfChanged(ref _decodeVisible, value); set => SetProperty(ref _decodeVisible, value);
} }
public string DeviceInfoText public string DeviceInfoText
{ {
get => _deviceInfoText; get => _deviceInfoText;
set => this.RaiseAndSetIfChanged(ref _deviceInfoText, value); set => SetProperty(ref _deviceInfoText, value);
} }
public bool DeviceInfoVisible public bool DeviceInfoVisible
{ {
get => _deviceInfoVisible; get => _deviceInfoVisible;
set => this.RaiseAndSetIfChanged(ref _deviceInfoVisible, value); set => SetProperty(ref _deviceInfoVisible, value);
} }
public string DeviceReportText public string DeviceReportText
{ {
get => _deviceReportText; get => _deviceReportText;
set => this.RaiseAndSetIfChanged(ref _deviceReportText, value); set => SetProperty(ref _deviceReportText, value);
} }
public bool DeviceReportVisible public bool DeviceReportVisible
{ {
get => _deviceReportVisible; get => _deviceReportVisible;
set => this.RaiseAndSetIfChanged(ref _deviceReportVisible, value); set => SetProperty(ref _deviceReportVisible, value);
} }
public string DumpMediaText public string DumpMediaText
{ {
get => _dumpMediaText; get => _dumpMediaText;
set => this.RaiseAndSetIfChanged(ref _dumpMediaText, value); set => SetProperty(ref _dumpMediaText, value);
} }
public bool DumpMediaVisible public bool DumpMediaVisible
{ {
get => _dumpMediaVisible; get => _dumpMediaVisible;
set => this.RaiseAndSetIfChanged(ref _dumpMediaVisible, value); set => SetProperty(ref _dumpMediaVisible, value);
} }
public string EntropyText public string EntropyText
{ {
get => _entropyText; get => _entropyText;
set => this.RaiseAndSetIfChanged(ref _entropyText, value); set => SetProperty(ref _entropyText, value);
} }
public bool EntropyVisible public bool EntropyVisible
{ {
get => _entropyVisible; get => _entropyVisible;
set => this.RaiseAndSetIfChanged(ref _entropyVisible, value); set => SetProperty(ref _entropyVisible, value);
} }
public string FormatsCommandText public string FormatsCommandText
{ {
get => _formatsText; get => _formatsText;
set => this.RaiseAndSetIfChanged(ref _formatsText, value); set => SetProperty(ref _formatsText, value);
} }
public bool FormatsCommandVisible public bool FormatsCommandVisible
{ {
get => _formatsCommandVisible; get => _formatsCommandVisible;
set => this.RaiseAndSetIfChanged(ref _formatsCommandVisible, value); set => SetProperty(ref _formatsCommandVisible, value);
} }
public string ImageInfoText public string ImageInfoText
{ {
get => _imageInfoText; get => _imageInfoText;
set => this.RaiseAndSetIfChanged(ref _imageInfoText, value); set => SetProperty(ref _imageInfoText, value);
} }
public bool ImageInfoVisible public bool ImageInfoVisible
{ {
get => _imageInfoVisible; get => _imageInfoVisible;
set => this.RaiseAndSetIfChanged(ref _imageInfoVisible, value); set => SetProperty(ref _imageInfoVisible, value);
} }
public string MediaInfoText public string MediaInfoText
{ {
get => _mediaInfoText; get => _mediaInfoText;
set => this.RaiseAndSetIfChanged(ref _mediaInfoText, value); set => SetProperty(ref _mediaInfoText, value);
} }
public bool MediaInfoVisible public bool MediaInfoVisible
{ {
get => _mediaInfoVisible; get => _mediaInfoVisible;
set => this.RaiseAndSetIfChanged(ref _mediaInfoVisible, value); set => SetProperty(ref _mediaInfoVisible, value);
} }
public string MediaScanText public string MediaScanText
{ {
get => _mediaScanText; get => _mediaScanText;
set => this.RaiseAndSetIfChanged(ref _mediaScanText, value); set => SetProperty(ref _mediaScanText, value);
} }
public bool MediaScanVisible public bool MediaScanVisible
{ {
get => _mediaScanVisible; get => _mediaScanVisible;
set => this.RaiseAndSetIfChanged(ref _mediaScanVisible, value); set => SetProperty(ref _mediaScanVisible, value);
} }
public string PrintHexText public string PrintHexText
{ {
get => _printHexText; get => _printHexText;
set => this.RaiseAndSetIfChanged(ref _printHexText, value); set => SetProperty(ref _printHexText, value);
} }
public bool PrintHexVisible public bool PrintHexVisible
{ {
get => _printHexVisible; get => _printHexVisible;
set => this.RaiseAndSetIfChanged(ref _printHexVisible, value); set => SetProperty(ref _printHexVisible, value);
} }
public string VerifyText public string VerifyText
{ {
get => _verifyText; get => _verifyText;
set => this.RaiseAndSetIfChanged(ref _verifyText, value); set => SetProperty(ref _verifyText, value);
} }
public bool VerifyVisible public bool VerifyVisible
{ {
get => _verifyVisible; get => _verifyVisible;
set => this.RaiseAndSetIfChanged(ref _verifyVisible, value); set => SetProperty(ref _verifyVisible, value);
} }
public bool CommandsVisible public bool CommandsVisible
{ {
get => _commandsVisible; get => _commandsVisible;
set => this.RaiseAndSetIfChanged(ref _commandsVisible, value); set => SetProperty(ref _commandsVisible, value);
} }
public bool FiltersVisible public bool FiltersVisible
{ {
get => _filtersVisible; get => _filtersVisible;
set => this.RaiseAndSetIfChanged(ref _filtersVisible, value); set => SetProperty(ref _filtersVisible, value);
} }
public bool PartitionsVisible public bool PartitionsVisible
{ {
get => _partitionsVisible; get => _partitionsVisible;
set => this.RaiseAndSetIfChanged(ref _partitionsVisible, value); set => SetProperty(ref _partitionsVisible, value);
} }
public bool FormatsVisible public bool FormatsVisible
{ {
get => _formatsVisible; get => _formatsVisible;
set => this.RaiseAndSetIfChanged(ref _formatsVisible, value); set => SetProperty(ref _formatsVisible, value);
} }
public bool FilesystemsVisible public bool FilesystemsVisible
{ {
get => _filesystemsVisible; get => _filesystemsVisible;
set => this.RaiseAndSetIfChanged(ref _filesystemsVisible, value); set => SetProperty(ref _filesystemsVisible, value);
} }
public bool DevicesVisible public bool DevicesVisible
{ {
get => _devicesVisible; get => _devicesVisible;
set => this.RaiseAndSetIfChanged(ref _devicesVisible, value); set => SetProperty(ref _devicesVisible, value);
} }
public bool MediasVisible public bool MediasVisible
{ {
get => _mediasVisible; get => _mediasVisible;
set => this.RaiseAndSetIfChanged(ref _mediasVisible, value); set => SetProperty(ref _mediasVisible, value);
} }
[NotNull] [NotNull]
@@ -772,7 +772,7 @@ public sealed class StatisticsViewModel : ViewModelBase
[NotNull] [NotNull]
public string CloseLabel => UI.ButtonLabel_Close; public string CloseLabel => UI.ButtonLabel_Close;
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ObservableCollection<NameCountModel> Filters { get; } public ObservableCollection<NameCountModel> Filters { get; }
public ObservableCollection<NameCountModel> Formats { get; } public ObservableCollection<NameCountModel> Formats { get; }
public ObservableCollection<NameCountModel> Partitions { get; } public ObservableCollection<NameCountModel> Partitions { get; }
@@ -780,5 +780,5 @@ public sealed class StatisticsViewModel : ViewModelBase
public ObservableCollection<DeviceStatsModel> Devices { get; } public ObservableCollection<DeviceStatsModel> Devices { get; }
public ObservableCollection<MediaStatsModel> Medias { get; } public ObservableCollection<MediaStatsModel> Medias { get; }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
} }

View File

@@ -33,8 +33,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Decoders.SCSI.SSC; using Aaru.Decoders.SCSI.SSC;
using Aaru.Devices; using Aaru.Devices;
using Aaru.Gui.ViewModels.Tabs; using Aaru.Gui.ViewModels.Tabs;
@@ -42,110 +42,200 @@ using Aaru.Gui.Views.Tabs;
using Aaru.Localization; using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Humanizer; using Humanizer;
using Humanizer.Localisation; using Humanizer.Localisation;
using ReactiveUI;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo; using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
namespace Aaru.Gui.ViewModels.Panels; namespace Aaru.Gui.ViewModels.Panels;
public sealed class DeviceInfoViewModel : ViewModelBase public sealed partial class DeviceInfoViewModel : ViewModelBase
{ {
readonly DeviceInfo _devInfo; readonly DeviceInfo _devInfo;
readonly Window _view; readonly Window _view;
AtaInfo _ataInfo; [ObservableProperty]
string _blockLimits; AtaInfo _ataInfo;
string _blockSizeGranularity; [ObservableProperty]
string _cid; string _blockLimits;
string _csd; [ObservableProperty]
string _densities; string _blockSizeGranularity;
string _deviceType; [ObservableProperty]
string _extendedCsd; string _cid;
string _firewireGuid; [ObservableProperty]
string _firewireManufacturer; string _csd;
string _firewireModel; [ObservableProperty]
string _firewireModelId; string _densities;
string _firewireVendorId; [ObservableProperty]
bool _firewireVisible; string _deviceType;
bool _kreon; [ObservableProperty]
bool _kreonChallengeResponse; string _extendedCsd;
bool _kreonChallengeResponse360; [ObservableProperty]
bool _kreonDecryptSs; string _firewireGuid;
bool _kreonDecryptSs360; [ObservableProperty]
bool _kreonErrorSkipping; string _firewireManufacturer;
bool _kreonLock; [ObservableProperty]
bool _kreonWxripperUnlock; string _firewireModel;
bool _kreonWxripperUnlock360; [ObservableProperty]
bool _kreonXtremeUnlock; string _firewireModelId;
bool _kreonXtremeUnlock360; [ObservableProperty]
string _manufacturer; string _firewireVendorId;
string _maxBlockSize; [ObservableProperty]
string _mediumDensity; bool _firewireVisible;
string _mediumTypes; [ObservableProperty]
string _minBlockSize; bool _kreon;
string _model; [ObservableProperty]
string _ocr; bool _kreonChallengeResponse;
PcmciaInfo _pcmciaInfo; [ObservableProperty]
bool _plextorBitSetting; bool _kreonChallengeResponse360;
bool _plextorBitSettingDl; [ObservableProperty]
string _plextorCdReadTime; bool _kreonDecryptSs;
string _plextorCdWriteTime; [ObservableProperty]
string _plextorDiscs; bool _kreonDecryptSs360;
string _plextorDvd; [ObservableProperty]
bool _plextorDvdPlusWriteTest; bool _kreonErrorSkipping;
string _plextorDvdReadTime; [ObservableProperty]
bool _plextorDvdTimesVisible; bool _kreonLock;
string _plextorDvdWriteTime; [ObservableProperty]
bool _plextorEepromVisible; bool _kreonWxripperUnlock;
bool _plextorGigaRec; [ObservableProperty]
bool _plextorHidesRecordables; bool _kreonWxripperUnlock360;
bool _plextorHidesSessions; [ObservableProperty]
bool _plextorHiding; bool _kreonXtremeUnlock;
bool _plextorPoweRec; [ObservableProperty]
bool _plextorPoweRecEnabled; bool _kreonXtremeUnlock360;
string _plextorPoweRecLast; [ObservableProperty]
bool _plextorPoweRecLastVisible; string _manufacturer;
string _plextorPoweRecMax; [ObservableProperty]
bool _plextorPoweRecMaxVisible; string _maxBlockSize;
string _plextorPoweRecRecommended; [ObservableProperty]
bool _plextorPoweRecRecommendedVisible; string _mediumDensity;
string _plextorPoweRecSelected; [ObservableProperty]
bool _plextorPoweRecSelectedVisible; string _mediumTypes;
bool _plextorSecuRec; [ObservableProperty]
bool _plextorSilentMode; string _minBlockSize;
string _plextorSilentModeAccessTime; [ObservableProperty]
string _plextorSilentModeCdReadSpeedLimit; string _model;
string _plextorSilentModeCdWriteSpeedLimit; [ObservableProperty]
string _plextorSilentModeDvdReadSpeedLimit; string _ocr;
bool _plextorSilentModeDvdReadSpeedLimitVisible; [ObservableProperty]
bool _plextorSilentModeEnabled; PcmciaInfo _pcmciaInfo;
bool _plextorSpeedEnabled; [ObservableProperty]
bool _plextorSpeedRead; bool _plextorBitSetting;
bool _plextorVariRec; [ObservableProperty]
bool _plextorVariRecDvd; bool _plextorBitSettingDl;
bool _plextorVisible; [ObservableProperty]
bool _removable; string _plextorCdReadTime;
string _revision; [ObservableProperty]
bool _saveUsbDescriptorsEnabled; string _plextorCdWriteTime;
string _scr; [ObservableProperty]
ScsiInfo _scsiInfo; string _plextorDiscs;
string _scsiType; [ObservableProperty]
string _sdMm; string _plextorDvd;
SdMmcInfo _sdMmcInfo; [ObservableProperty]
string _secureDigital; bool _plextorDvdPlusWriteTest;
string _serial; [ObservableProperty]
bool _ssc; string _plextorDvdReadTime;
string _usbConnected; [ObservableProperty]
string _usbManufacturer; bool _plextorDvdTimesVisible;
string _usbProduct; [ObservableProperty]
string _usbProductId; string _plextorDvdWriteTime;
string _usbSerial; [ObservableProperty]
string _usbVendorId; bool _plextorEepromVisible;
bool _usbVisible; [ObservableProperty]
bool _plextorGigaRec;
[ObservableProperty]
bool _plextorHidesRecordables;
[ObservableProperty]
bool _plextorHidesSessions;
[ObservableProperty]
bool _plextorHiding;
[ObservableProperty]
bool _plextorPoweRec;
[ObservableProperty]
bool _plextorPoweRecEnabled;
[ObservableProperty]
string _plextorPoweRecLast;
[ObservableProperty]
bool _plextorPoweRecLastVisible;
[ObservableProperty]
string _plextorPoweRecMax;
[ObservableProperty]
bool _plextorPoweRecMaxVisible;
[ObservableProperty]
string _plextorPoweRecRecommended;
[ObservableProperty]
bool _plextorPoweRecRecommendedVisible;
[ObservableProperty]
string _plextorPoweRecSelected;
[ObservableProperty]
bool _plextorPoweRecSelectedVisible;
[ObservableProperty]
bool _plextorSecuRec;
[ObservableProperty]
bool _plextorSilentMode;
[ObservableProperty]
string _plextorSilentModeAccessTime;
[ObservableProperty]
string _plextorSilentModeCdReadSpeedLimit;
[ObservableProperty]
string _plextorSilentModeCdWriteSpeedLimit;
[ObservableProperty]
string _plextorSilentModeDvdReadSpeedLimit;
[ObservableProperty]
bool _plextorSilentModeDvdReadSpeedLimitVisible;
[ObservableProperty]
bool _plextorSilentModeEnabled;
[ObservableProperty]
bool _plextorSpeedEnabled;
[ObservableProperty]
bool _plextorSpeedRead;
[ObservableProperty]
bool _plextorVariRec;
[ObservableProperty]
bool _plextorVariRecDvd;
[ObservableProperty]
bool _plextorVisible;
[ObservableProperty]
bool _removable;
[ObservableProperty]
string _revision;
[ObservableProperty]
bool _saveUsbDescriptorsEnabled;
[ObservableProperty]
string _scr;
[ObservableProperty]
ScsiInfo _scsiInfo;
[ObservableProperty]
string _scsiType;
[ObservableProperty]
string _sdMm;
[ObservableProperty]
SdMmcInfo _sdMmcInfo;
[ObservableProperty]
string _secureDigital;
[ObservableProperty]
string _serial;
[ObservableProperty]
bool _ssc;
[ObservableProperty]
string _usbConnected;
[ObservableProperty]
string _usbManufacturer;
[ObservableProperty]
string _usbProduct;
[ObservableProperty]
string _usbProductId;
[ObservableProperty]
string _usbSerial;
[ObservableProperty]
string _usbVendorId;
[ObservableProperty]
bool _usbVisible;
public DeviceInfoViewModel(DeviceInfo devInfo, Window view) public DeviceInfoViewModel(DeviceInfo devInfo, Window view)
{ {
SaveUsbDescriptorsCommand = ReactiveCommand.Create(ExecuteSaveUsbDescriptorsCommand); SaveUsbDescriptorsCommand = new AsyncRelayCommand(SaveUsbDescriptorsAsync);
_view = view; _view = view;
_devInfo = devInfo; _devInfo = devInfo;
@@ -412,541 +502,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase
}; };
} }
public ReactiveCommand<Unit, Task> SaveUsbDescriptorsCommand { get; } public ICommand SaveUsbDescriptorsCommand { get; }
public string DeviceType
{
get => _deviceType;
set => this.RaiseAndSetIfChanged(ref _deviceType, value);
}
public string Manufacturer
{
get => _manufacturer;
set => this.RaiseAndSetIfChanged(ref _manufacturer, value);
}
public string Model
{
get => _model;
set => this.RaiseAndSetIfChanged(ref _model, value);
}
public string Revision
{
get => _revision;
set => this.RaiseAndSetIfChanged(ref _revision, value);
}
public string Serial
{
get => _serial;
set => this.RaiseAndSetIfChanged(ref _serial, value);
}
public string ScsiType
{
get => _scsiType;
set => this.RaiseAndSetIfChanged(ref _scsiType, value);
}
public bool Removable
{
get => _removable;
set => this.RaiseAndSetIfChanged(ref _removable, value);
}
public string UsbConnected
{
get => _usbConnected;
set => this.RaiseAndSetIfChanged(ref _usbConnected, value);
}
public bool UsbVisible
{
get => _usbVisible;
set => this.RaiseAndSetIfChanged(ref _usbVisible, value);
}
public string UsbVendorId
{
get => _usbVendorId;
set => this.RaiseAndSetIfChanged(ref _usbVendorId, value);
}
public string UsbProductId
{
get => _usbProductId;
set => this.RaiseAndSetIfChanged(ref _usbProductId, value);
}
public string UsbManufacturer
{
get => _usbManufacturer;
set => this.RaiseAndSetIfChanged(ref _usbManufacturer, value);
}
public string UsbProduct
{
get => _usbProduct;
set => this.RaiseAndSetIfChanged(ref _usbProduct, value);
}
public string UsbSerial
{
get => _usbSerial;
set => this.RaiseAndSetIfChanged(ref _usbSerial, value);
}
public bool SaveUsbDescriptorsEnabled
{
get => _saveUsbDescriptorsEnabled;
set => this.RaiseAndSetIfChanged(ref _saveUsbDescriptorsEnabled, value);
}
public bool FirewireVisible
{
get => _firewireVisible;
set => this.RaiseAndSetIfChanged(ref _firewireVisible, value);
}
public string FirewireVendorId
{
get => _firewireVendorId;
set => this.RaiseAndSetIfChanged(ref _firewireVendorId, value);
}
public string FirewireModelId
{
get => _firewireModelId;
set => this.RaiseAndSetIfChanged(ref _firewireModelId, value);
}
public string FirewireManufacturer
{
get => _firewireManufacturer;
set => this.RaiseAndSetIfChanged(ref _firewireManufacturer, value);
}
public string FirewireModel
{
get => _firewireModel;
set => this.RaiseAndSetIfChanged(ref _firewireModel, value);
}
public string FirewireGuid
{
get => _firewireGuid;
set => this.RaiseAndSetIfChanged(ref _firewireGuid, value);
}
public bool PlextorVisible
{
get => _plextorVisible;
set => this.RaiseAndSetIfChanged(ref _plextorVisible, value);
}
public bool PlextorEepromVisible
{
get => _plextorEepromVisible;
set => this.RaiseAndSetIfChanged(ref _plextorEepromVisible, value);
}
public string PlextorDiscs
{
get => _plextorDiscs;
set => this.RaiseAndSetIfChanged(ref _plextorDiscs, value);
}
public string PlextorCdReadTime
{
get => _plextorCdReadTime;
set => this.RaiseAndSetIfChanged(ref _plextorCdReadTime, value);
}
public string PlextorCdWriteTime
{
get => _plextorCdWriteTime;
set => this.RaiseAndSetIfChanged(ref _plextorCdWriteTime, value);
}
public bool PlextorDvdTimesVisible
{
get => _plextorDvdTimesVisible;
set => this.RaiseAndSetIfChanged(ref _plextorDvdTimesVisible, value);
}
public string PlextorDvdReadTime
{
get => _plextorDvdReadTime;
set => this.RaiseAndSetIfChanged(ref _plextorDvdReadTime, value);
}
public string PlextorDvdWriteTime
{
get => _plextorDvdWriteTime;
set => this.RaiseAndSetIfChanged(ref _plextorDvdWriteTime, value);
}
public bool PlextorPoweRec
{
get => _plextorPoweRec;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRec, value);
}
public bool PlextorPoweRecEnabled
{
get => _plextorPoweRecEnabled;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecEnabled, value);
}
public bool PlextorPoweRecRecommendedVisible
{
get => _plextorPoweRecRecommendedVisible;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecRecommendedVisible, value);
}
public string PlextorPoweRecRecommended
{
get => _plextorPoweRecRecommended;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecRecommended, value);
}
public bool PlextorPoweRecSelectedVisible
{
get => _plextorPoweRecSelectedVisible;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecSelectedVisible, value);
}
public string PlextorPoweRecSelected
{
get => _plextorPoweRecSelected;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecSelected, value);
}
public bool PlextorPoweRecMaxVisible
{
get => _plextorPoweRecMaxVisible;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecMaxVisible, value);
}
public string PlextorPoweRecMax
{
get => _plextorPoweRecMax;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecMax, value);
}
public bool PlextorPoweRecLastVisible
{
get => _plextorPoweRecLastVisible;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecLastVisible, value);
}
public string PlextorPoweRecLast
{
get => _plextorPoweRecLast;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecLast, value);
}
public bool PlextorSilentMode
{
get => _plextorSilentMode;
set => this.RaiseAndSetIfChanged(ref _plextorSilentMode, value);
}
public bool PlextorSilentModeEnabled
{
get => _plextorSilentModeEnabled;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeEnabled, value);
}
public string PlextorSilentModeAccessTime
{
get => _plextorSilentModeAccessTime;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeAccessTime, value);
}
public string PlextorSilentModeCdReadSpeedLimit
{
get => _plextorSilentModeCdReadSpeedLimit;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeCdReadSpeedLimit, value);
}
public string PlextorSilentModeCdWriteSpeedLimit
{
get => _plextorSilentModeCdWriteSpeedLimit;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeCdWriteSpeedLimit, value);
}
public bool PlextorSilentModeDvdReadSpeedLimitVisible
{
get => _plextorSilentModeDvdReadSpeedLimitVisible;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeDvdReadSpeedLimitVisible, value);
}
public string PlextorSilentModeDvdReadSpeedLimit
{
get => _plextorSilentModeDvdReadSpeedLimit;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeDvdReadSpeedLimit, value);
}
public bool PlextorGigaRec
{
get => _plextorGigaRec;
set => this.RaiseAndSetIfChanged(ref _plextorGigaRec, value);
}
public bool PlextorSecuRec
{
get => _plextorSecuRec;
set => this.RaiseAndSetIfChanged(ref _plextorSecuRec, value);
}
public bool PlextorSpeedRead
{
get => _plextorSpeedRead;
set => this.RaiseAndSetIfChanged(ref _plextorSpeedRead, value);
}
public bool PlextorSpeedEnabled
{
get => _plextorSpeedEnabled;
set => this.RaiseAndSetIfChanged(ref _plextorSpeedEnabled, value);
}
public bool PlextorHiding
{
get => _plextorHiding;
set => this.RaiseAndSetIfChanged(ref _plextorHiding, value);
}
public bool PlextorHidesRecordables
{
get => _plextorHidesRecordables;
set => this.RaiseAndSetIfChanged(ref _plextorHidesRecordables, value);
}
public bool PlextorHidesSessions
{
get => _plextorHidesSessions;
set => this.RaiseAndSetIfChanged(ref _plextorHidesSessions, value);
}
public bool PlextorVariRec
{
get => _plextorVariRec;
set => this.RaiseAndSetIfChanged(ref _plextorVariRec, value);
}
public string PlextorDvd
{
get => _plextorDvd;
set => this.RaiseAndSetIfChanged(ref _plextorDvd, value);
}
public bool PlextorVariRecDvd
{
get => _plextorVariRecDvd;
set => this.RaiseAndSetIfChanged(ref _plextorVariRecDvd, value);
}
public bool PlextorBitSetting
{
get => _plextorBitSetting;
set => this.RaiseAndSetIfChanged(ref _plextorBitSetting, value);
}
public bool PlextorBitSettingDl
{
get => _plextorBitSettingDl;
set => this.RaiseAndSetIfChanged(ref _plextorBitSettingDl, value);
}
public bool PlextorDvdPlusWriteTest
{
get => _plextorDvdPlusWriteTest;
set => this.RaiseAndSetIfChanged(ref _plextorDvdPlusWriteTest, value);
}
public bool Kreon
{
get => _kreon;
set => this.RaiseAndSetIfChanged(ref _kreon, value);
}
public bool KreonChallengeResponse
{
get => _kreonChallengeResponse;
set => this.RaiseAndSetIfChanged(ref _kreonChallengeResponse, value);
}
public bool KreonDecryptSs
{
get => _kreonDecryptSs;
set => this.RaiseAndSetIfChanged(ref _kreonDecryptSs, value);
}
public bool KreonXtremeUnlock
{
get => _kreonXtremeUnlock;
set => this.RaiseAndSetIfChanged(ref _kreonXtremeUnlock, value);
}
public bool KreonWxripperUnlock
{
get => _kreonWxripperUnlock;
set => this.RaiseAndSetIfChanged(ref _kreonWxripperUnlock, value);
}
public bool KreonChallengeResponse360
{
get => _kreonChallengeResponse360;
set => this.RaiseAndSetIfChanged(ref _kreonChallengeResponse360, value);
}
public bool KreonDecryptSs360
{
get => _kreonDecryptSs360;
set => this.RaiseAndSetIfChanged(ref _kreonDecryptSs360, value);
}
public bool KreonXtremeUnlock360
{
get => _kreonXtremeUnlock360;
set => this.RaiseAndSetIfChanged(ref _kreonXtremeUnlock360, value);
}
public bool KreonWxripperUnlock360
{
get => _kreonWxripperUnlock360;
set => this.RaiseAndSetIfChanged(ref _kreonWxripperUnlock360, value);
}
public bool KreonLock
{
get => _kreonLock;
set => this.RaiseAndSetIfChanged(ref _kreonLock, value);
}
public bool KreonErrorSkipping
{
get => _kreonErrorSkipping;
set => this.RaiseAndSetIfChanged(ref _kreonErrorSkipping, value);
}
public bool Ssc
{
get => _ssc;
set => this.RaiseAndSetIfChanged(ref _ssc, value);
}
public string BlockLimits
{
get => _blockLimits;
set => this.RaiseAndSetIfChanged(ref _blockLimits, value);
}
public string MinBlockSize
{
get => _minBlockSize;
set => this.RaiseAndSetIfChanged(ref _minBlockSize, value);
}
public string MaxBlockSize
{
get => _maxBlockSize;
set => this.RaiseAndSetIfChanged(ref _maxBlockSize, value);
}
public string BlockSizeGranularity
{
get => _blockSizeGranularity;
set => this.RaiseAndSetIfChanged(ref _blockSizeGranularity, value);
}
public string Densities
{
get => _densities;
set => this.RaiseAndSetIfChanged(ref _densities, value);
}
public string MediumTypes
{
get => _mediumTypes;
set => this.RaiseAndSetIfChanged(ref _mediumTypes, value);
}
public string MediumDensity
{
get => _mediumDensity;
set => this.RaiseAndSetIfChanged(ref _mediumDensity, value);
}
public string SecureDigital
{
get => _secureDigital;
set => this.RaiseAndSetIfChanged(ref _secureDigital, value);
}
public string SdMm
{
get => _sdMm;
set => this.RaiseAndSetIfChanged(ref _sdMm, value);
}
public string Cid
{
get => _cid;
set => this.RaiseAndSetIfChanged(ref _cid, value);
}
public string Csd
{
get => _csd;
set => this.RaiseAndSetIfChanged(ref _csd, value);
}
public string Ocr
{
get => _ocr;
set => this.RaiseAndSetIfChanged(ref _ocr, value);
}
public string ExtendedCsd
{
get => _extendedCsd;
set => this.RaiseAndSetIfChanged(ref _extendedCsd, value);
}
public string Scr
{
get => _scr;
set => this.RaiseAndSetIfChanged(ref _scr, value);
}
public PcmciaInfo PcmciaInfo
{
get => _pcmciaInfo;
set => this.RaiseAndSetIfChanged(ref _pcmciaInfo, value);
}
public ScsiInfo ScsiInfo
{
get => _scsiInfo;
set => this.RaiseAndSetIfChanged(ref _scsiInfo, value);
}
public AtaInfo AtaInfo
{
get => _ataInfo;
set => this.RaiseAndSetIfChanged(ref _ataInfo, value);
}
public SdMmcInfo SdMmcInfo
{
get => _sdMmcInfo;
set => this.RaiseAndSetIfChanged(ref _sdMmcInfo, value);
}
public string DeviceInformationLabel => UI.Title_Device_information; public string DeviceInformationLabel => UI.Title_Device_information;
public string GeneralLabel => UI.Title_General; public string GeneralLabel => UI.Title_General;
@@ -1018,7 +574,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase
public string SCSILabel => UI.Title_SCSI; public string SCSILabel => UI.Title_SCSI;
public string Sd_MMCLabel => UI.Title_SD_MMC; public string Sd_MMCLabel => UI.Title_SD_MMC;
async Task ExecuteSaveUsbDescriptorsCommand() async Task SaveUsbDescriptorsAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {

View File

@@ -33,8 +33,8 @@
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Text; using System.Text;
using System.Windows.Input;
using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
@@ -53,9 +53,9 @@ using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using Avalonia.Platform; using Avalonia.Platform;
using CommunityToolkit.Mvvm.Input;
using Humanizer; using Humanizer;
using Humanizer.Bytes; using Humanizer.Bytes;
using ReactiveUI;
using Sentry; using Sentry;
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
using Session = Aaru.CommonTypes.Structs.Session; using Session = Aaru.CommonTypes.Structs.Session;
@@ -87,13 +87,13 @@ public sealed class ImageInfoViewModel : ViewModelBase
Sessions = []; Sessions = [];
Tracks = []; Tracks = [];
DumpHardwareList = []; DumpHardwareList = [];
EntropyCommand = ReactiveCommand.Create(ExecuteEntropyCommand); EntropyCommand = new RelayCommand(Entropy);
VerifyCommand = ReactiveCommand.Create(ExecuteVerifyCommand); VerifyCommand = new RelayCommand(Verify);
ChecksumCommand = ReactiveCommand.Create(ExecuteChecksumCommand); ChecksumCommand = new RelayCommand(Checksum);
ConvertCommand = ReactiveCommand.Create(ExecuteConvertCommand); ConvertCommand = new RelayCommand(Convert);
CreateSidecarCommand = ReactiveCommand.Create(ExecuteCreateSidecarCommand); CreateSidecarCommand = new RelayCommand(CreateSidecar);
ViewSectorsCommand = ReactiveCommand.Create(ExecuteViewSectorsCommand); ViewSectorsCommand = new RelayCommand(ViewSectors);
DecodeMediaTagCommand = ReactiveCommand.Create(ExecuteDecodeMediaTagCommand); DecodeMediaTagCommand = new RelayCommand(DecodeMediaTag);
var genericHddIcon = var genericHddIcon =
new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-harddisk.png"))); new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-harddisk.png")));
@@ -780,13 +780,13 @@ public sealed class ImageInfoViewModel : ViewModelBase
public ObservableCollection<Session> Sessions { get; } public ObservableCollection<Session> Sessions { get; }
public ObservableCollection<Track> Tracks { get; } public ObservableCollection<Track> Tracks { get; }
public ObservableCollection<DumpHardwareModel> DumpHardwareList { get; } public ObservableCollection<DumpHardwareModel> DumpHardwareList { get; }
public ReactiveCommand<Unit, Unit> EntropyCommand { get; } public ICommand EntropyCommand { get; }
public ReactiveCommand<Unit, Unit> VerifyCommand { get; } public ICommand VerifyCommand { get; }
public ReactiveCommand<Unit, Unit> ChecksumCommand { get; } public ICommand ChecksumCommand { get; }
public ReactiveCommand<Unit, Unit> ConvertCommand { get; } public ICommand ConvertCommand { get; }
public ReactiveCommand<Unit, Unit> CreateSidecarCommand { get; } public ICommand CreateSidecarCommand { get; }
public ReactiveCommand<Unit, Unit> ViewSectorsCommand { get; } public ICommand ViewSectorsCommand { get; }
public ReactiveCommand<Unit, Unit> DecodeMediaTagCommand { get; } public ICommand DecodeMediaTagCommand { get; }
public bool DriveInformationVisible => DriveManufacturerText != null || public bool DriveInformationVisible => DriveManufacturerText != null ||
DriveModelText != null || DriveModelText != null ||
@@ -848,7 +848,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
public string ViewSectorsLabel => UI.ButtonLabel_View_sectors; public string ViewSectorsLabel => UI.ButtonLabel_View_sectors;
public string DecodeMediaTagLabel => UI.ButtonLabel_Decode_media_tags; public string DecodeMediaTagLabel => UI.ButtonLabel_Decode_media_tags;
void ExecuteEntropyCommand() void Entropy()
{ {
if(_imageEntropy != null) if(_imageEntropy != null)
{ {
@@ -865,7 +865,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
_imageEntropy.Show(); _imageEntropy.Show();
} }
void ExecuteVerifyCommand() void Verify()
{ {
if(_imageVerify != null) if(_imageVerify != null)
{ {
@@ -882,7 +882,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
_imageVerify.Show(); _imageVerify.Show();
} }
void ExecuteChecksumCommand() void Checksum()
{ {
if(_imageChecksum != null) if(_imageChecksum != null)
{ {
@@ -899,7 +899,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
_imageChecksum.Show(); _imageChecksum.Show();
} }
void ExecuteConvertCommand() void Convert()
{ {
if(_imageConvert != null) if(_imageConvert != null)
{ {
@@ -916,7 +916,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
_imageConvert.Show(); _imageConvert.Show();
} }
void ExecuteCreateSidecarCommand() void CreateSidecar()
{ {
if(_imageSidecar != null) if(_imageSidecar != null)
{ {
@@ -936,7 +936,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
_imageSidecar.Show(); _imageSidecar.Show();
} }
void ExecuteViewSectorsCommand() void ViewSectors()
{ {
if(_viewSector != null) if(_viewSector != null)
{ {
@@ -955,7 +955,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
_viewSector.Show(); _viewSector.Show();
} }
void ExecuteDecodeMediaTagCommand() void DecodeMediaTag()
{ {
if(_decodeMediaTags != null) if(_decodeMediaTags != null)
{ {

View File

@@ -33,9 +33,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Gui.ViewModels.Tabs; using Aaru.Gui.ViewModels.Tabs;
using Aaru.Gui.ViewModels.Windows; using Aaru.Gui.ViewModels.Windows;
using Aaru.Gui.Views.Tabs; using Aaru.Gui.Views.Tabs;
@@ -45,55 +45,78 @@ using Avalonia.Controls;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using Avalonia.Platform; using Avalonia.Platform;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Humanizer.Bytes; using Humanizer.Bytes;
using MsBox.Avalonia; using MsBox.Avalonia;
using MsBox.Avalonia.Enums; using MsBox.Avalonia.Enums;
using ReactiveUI;
using ScsiInfo = Aaru.Core.Media.Info.ScsiInfo; using ScsiInfo = Aaru.Core.Media.Info.ScsiInfo;
namespace Aaru.Gui.ViewModels.Panels; namespace Aaru.Gui.ViewModels.Panels;
public sealed class MediaInfoViewModel : ViewModelBase public sealed partial class MediaInfoViewModel : ViewModelBase
{ {
readonly string _devicePath; readonly string _devicePath;
readonly ScsiInfo _scsiInfo; readonly ScsiInfo _scsiInfo;
readonly Window _view; readonly Window _view;
BlurayInfo _blurayInfo; [ObservableProperty]
CompactDiscInfo _compactDiscInfo; BlurayInfo _blurayInfo;
string _densitySupport; [ObservableProperty]
DvdInfo _dvdInfo; CompactDiscInfo _compactDiscInfo;
DvdWritableInfo _dvdWritableInfo; [ObservableProperty]
string _generalVisible; string _densitySupport;
Bitmap _mediaLogo; [ObservableProperty]
string _mediaSerial; DvdInfo _dvdInfo;
string _mediaSize; [ObservableProperty]
string _mediaType; DvdWritableInfo _dvdWritableInfo;
string _mediumSupport; [ObservableProperty]
bool _mmcVisible; string _generalVisible;
bool _saveDensitySupportVisible; [ObservableProperty]
bool _saveGetConfigurationVisible; Bitmap _mediaLogo;
bool _saveMediumSupportVisible; [ObservableProperty]
bool _saveReadCapacity16Visible; string _mediaSerial;
bool _saveReadCapacityVisible; [ObservableProperty]
bool _saveReadMediaSerialVisible; string _mediaSize;
bool _saveRecognizedFormatLayersVisible; [ObservableProperty]
bool _saveWriteProtectionStatusVisible; string _mediaType;
bool _sscVisible; [ObservableProperty]
XboxInfo _xboxInfo; string _mediumSupport;
[ObservableProperty]
bool _mmcVisible;
[ObservableProperty]
bool _saveDensitySupportVisible;
[ObservableProperty]
bool _saveGetConfigurationVisible;
[ObservableProperty]
bool _saveMediumSupportVisible;
[ObservableProperty]
bool _saveReadCapacity16Visible;
[ObservableProperty]
bool _saveReadCapacityVisible;
[ObservableProperty]
bool _saveReadMediaSerialVisible;
[ObservableProperty]
bool _saveRecognizedFormatLayersVisible;
[ObservableProperty]
bool _saveWriteProtectionStatusVisible;
[ObservableProperty]
bool _sscVisible;
[ObservableProperty]
XboxInfo _xboxInfo;
public MediaInfoViewModel(ScsiInfo scsiInfo, string devicePath, Window view) public MediaInfoViewModel(ScsiInfo scsiInfo, string devicePath, Window view)
{ {
_view = view; _view = view;
SaveReadMediaSerialCommand = ReactiveCommand.Create(ExecuteSaveReadMediaSerialCommand); SaveReadMediaSerialCommand = new AsyncRelayCommand(SaveReadMediaSerial);
SaveReadCapacityCommand = ReactiveCommand.Create(ExecuteSaveReadCapacityCommand); SaveReadCapacityCommand = new AsyncRelayCommand(SaveReadCapacity);
SaveReadCapacity16Command = ReactiveCommand.Create(ExecuteSaveReadCapacity16Command); SaveReadCapacity16Command = new AsyncRelayCommand(SaveReadCapacity16);
SaveGetConfigurationCommand = ReactiveCommand.Create(ExecuteSaveGetConfigurationCommand); SaveGetConfigurationCommand = new AsyncRelayCommand(SaveGetConfiguration);
SaveRecognizedFormatLayersCommand = ReactiveCommand.Create(ExecuteSaveRecognizedFormatLayersCommand); SaveRecognizedFormatLayersCommand = new AsyncRelayCommand(SaveRecognizedFormatLayers);
SaveWriteProtectionStatusCommand = ReactiveCommand.Create(ExecuteSaveWriteProtectionStatusCommand); SaveWriteProtectionStatusCommand = new AsyncRelayCommand(SaveWriteProtectionStatus);
SaveDensitySupportCommand = ReactiveCommand.Create(ExecuteSaveDensitySupportCommand); SaveDensitySupportCommand = new AsyncRelayCommand(SaveDensitySupport);
SaveMediumSupportCommand = ReactiveCommand.Create(ExecuteSaveMediumSupportCommand); SaveMediumSupportCommand = new AsyncRelayCommand(SaveMediumSupport);
DumpCommand = ReactiveCommand.Create(ExecuteDumpCommand); DumpCommand = new AsyncRelayCommand(DumpAsync);
ScanCommand = ReactiveCommand.Create(ExecuteScanCommand); ScanCommand = new AsyncRelayCommand(ScanAsync);
_devicePath = devicePath; _devicePath = devicePath;
_scsiInfo = scsiInfo; _scsiInfo = scsiInfo;
@@ -115,7 +138,7 @@ public sealed class MediaInfoViewModel : ViewModelBase
{ {
var sbSerial = new StringBuilder(); var sbSerial = new StringBuilder();
for(var i = 4; i < scsiInfo.MediaSerialNumber.Length; i++) for(int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++)
sbSerial.Append($"{scsiInfo.MediaSerialNumber[i]:X2}"); sbSerial.Append($"{scsiInfo.MediaSerialNumber[i]:X2}");
MediaSerial = sbSerial.ToString(); MediaSerial = sbSerial.ToString();
@@ -221,148 +244,16 @@ public sealed class MediaInfoViewModel : ViewModelBase
}; };
} }
public ReactiveCommand<Unit, Task> SaveReadMediaSerialCommand { get; } public ICommand SaveReadMediaSerialCommand { get; }
public ReactiveCommand<Unit, Task> SaveReadCapacityCommand { get; } public ICommand SaveReadCapacityCommand { get; }
public ReactiveCommand<Unit, Task> SaveReadCapacity16Command { get; } public ICommand SaveReadCapacity16Command { get; }
public ReactiveCommand<Unit, Task> SaveGetConfigurationCommand { get; } public ICommand SaveGetConfigurationCommand { get; }
public ReactiveCommand<Unit, Task> SaveRecognizedFormatLayersCommand { get; } public ICommand SaveRecognizedFormatLayersCommand { get; }
public ReactiveCommand<Unit, Task> SaveWriteProtectionStatusCommand { get; } public ICommand SaveWriteProtectionStatusCommand { get; }
public ReactiveCommand<Unit, Task> SaveDensitySupportCommand { get; } public ICommand SaveDensitySupportCommand { get; }
public ReactiveCommand<Unit, Task> SaveMediumSupportCommand { get; } public ICommand SaveMediumSupportCommand { get; }
public ReactiveCommand<Unit, Task> DumpCommand { get; } public ICommand DumpCommand { get; }
public ReactiveCommand<Unit, Task> ScanCommand { get; } public ICommand ScanCommand { get; }
public Bitmap MediaLogo
{
get => _mediaLogo;
set => this.RaiseAndSetIfChanged(ref _mediaLogo, value);
}
public string GeneralVisible
{
get => _generalVisible;
set => this.RaiseAndSetIfChanged(ref _generalVisible, value);
}
public string MediaType
{
get => _mediaType;
set => this.RaiseAndSetIfChanged(ref _mediaType, value);
}
public string MediaSize
{
get => _mediaSize;
set => this.RaiseAndSetIfChanged(ref _mediaSize, value);
}
public string MediaSerial
{
get => _mediaSerial;
set => this.RaiseAndSetIfChanged(ref _mediaSerial, value);
}
public bool SaveReadMediaSerialVisible
{
get => _saveReadMediaSerialVisible;
set => this.RaiseAndSetIfChanged(ref _saveReadMediaSerialVisible, value);
}
public bool SaveReadCapacityVisible
{
get => _saveReadCapacityVisible;
set => this.RaiseAndSetIfChanged(ref _saveReadCapacityVisible, value);
}
public bool SaveReadCapacity16Visible
{
get => _saveReadCapacity16Visible;
set => this.RaiseAndSetIfChanged(ref _saveReadCapacity16Visible, value);
}
public bool MmcVisible
{
get => _mmcVisible;
set => this.RaiseAndSetIfChanged(ref _mmcVisible, value);
}
public bool SaveGetConfigurationVisible
{
get => _saveGetConfigurationVisible;
set => this.RaiseAndSetIfChanged(ref _saveGetConfigurationVisible, value);
}
public bool SaveRecognizedFormatLayersVisible
{
get => _saveRecognizedFormatLayersVisible;
set => this.RaiseAndSetIfChanged(ref _saveRecognizedFormatLayersVisible, value);
}
public bool SaveWriteProtectionStatusVisible
{
get => _saveWriteProtectionStatusVisible;
set => this.RaiseAndSetIfChanged(ref _saveWriteProtectionStatusVisible, value);
}
public bool SscVisible
{
get => _sscVisible;
set => this.RaiseAndSetIfChanged(ref _sscVisible, value);
}
public string DensitySupport
{
get => _densitySupport;
set => this.RaiseAndSetIfChanged(ref _densitySupport, value);
}
public string MediumSupport
{
get => _mediumSupport;
set => this.RaiseAndSetIfChanged(ref _mediumSupport, value);
}
public bool SaveDensitySupportVisible
{
get => _saveDensitySupportVisible;
set => this.RaiseAndSetIfChanged(ref _saveDensitySupportVisible, value);
}
public bool SaveMediumSupportVisible
{
get => _saveMediumSupportVisible;
set => this.RaiseAndSetIfChanged(ref _saveMediumSupportVisible, value);
}
public CompactDiscInfo CompactDiscInfo
{
get => _compactDiscInfo;
set => this.RaiseAndSetIfChanged(ref _compactDiscInfo, value);
}
public DvdInfo DvdInfo
{
get => _dvdInfo;
set => this.RaiseAndSetIfChanged(ref _dvdInfo, value);
}
public DvdWritableInfo DvdWritableInfo
{
get => _dvdWritableInfo;
set => this.RaiseAndSetIfChanged(ref _dvdWritableInfo, value);
}
public XboxInfo XboxInfo
{
get => _xboxInfo;
set => this.RaiseAndSetIfChanged(ref _xboxInfo, value);
}
public BlurayInfo BlurayInfo
{
get => _blurayInfo;
set => this.RaiseAndSetIfChanged(ref _blurayInfo, value);
}
public string MediaInformationLabel => UI.Title_Media_information; public string MediaInformationLabel => UI.Title_Media_information;
public string GeneralLabel => UI.Title_General; public string GeneralLabel => UI.Title_General;
@@ -388,7 +279,7 @@ public sealed class MediaInfoViewModel : ViewModelBase
public string DumpLabel => UI.ButtonLabel_Dump_media_to_image; public string DumpLabel => UI.ButtonLabel_Dump_media_to_image;
public string ScanLabel => UI.ButtonLabel_Scan_media_surface; public string ScanLabel => UI.ButtonLabel_Scan_media_surface;
async Task SaveElement(byte[] data) async Task SaveElementAsync(byte[] data)
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -406,23 +297,23 @@ public sealed class MediaInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveReadMediaSerialCommand() => await SaveElement(_scsiInfo.MediaSerialNumber); Task SaveReadMediaSerial() => SaveElementAsync(_scsiInfo.MediaSerialNumber);
async Task ExecuteSaveReadCapacityCommand() => await SaveElement(_scsiInfo.ReadCapacity); Task SaveReadCapacity() => SaveElementAsync(_scsiInfo.ReadCapacity);
async Task ExecuteSaveReadCapacity16Command() => await SaveElement(_scsiInfo.ReadCapacity16); Task SaveReadCapacity16() => SaveElementAsync(_scsiInfo.ReadCapacity16);
async Task ExecuteSaveGetConfigurationCommand() => await SaveElement(_scsiInfo.MmcConfiguration); Task SaveGetConfiguration() => SaveElementAsync(_scsiInfo.MmcConfiguration);
async Task ExecuteSaveRecognizedFormatLayersCommand() => await SaveElement(_scsiInfo.RecognizedFormatLayers); Task SaveRecognizedFormatLayers() => SaveElementAsync(_scsiInfo.RecognizedFormatLayers);
async Task ExecuteSaveWriteProtectionStatusCommand() => await SaveElement(_scsiInfo.WriteProtectionStatus); Task SaveWriteProtectionStatus() => SaveElementAsync(_scsiInfo.WriteProtectionStatus);
async Task ExecuteSaveDensitySupportCommand() => await SaveElement(_scsiInfo.DensitySupport); Task SaveDensitySupport() => SaveElementAsync(_scsiInfo.DensitySupport);
async Task ExecuteSaveMediumSupportCommand() => await SaveElement(_scsiInfo.MediaTypeSupport); Task SaveMediumSupport() => SaveElementAsync(_scsiInfo.MediaTypeSupport);
async Task ExecuteDumpCommand() async Task DumpAsync()
{ {
switch(_scsiInfo.MediaType) switch(_scsiInfo.MediaType)
{ {
@@ -456,7 +347,7 @@ public sealed class MediaInfoViewModel : ViewModelBase
mediaDumpWindow.Show(); mediaDumpWindow.Show();
} }
async Task ExecuteScanCommand() async Task ScanAsync()
{ {
switch(_scsiInfo.MediaType) switch(_scsiInfo.MediaType)
{ {

View File

@@ -35,8 +35,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Interop; using Aaru.CommonTypes.Interop;
@@ -47,10 +47,10 @@ using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using MsBox.Avalonia; using MsBox.Avalonia;
using MsBox.Avalonia.Enums; using MsBox.Avalonia.Enums;
using ReactiveUI;
using Sentry; using Sentry;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
@@ -65,7 +65,7 @@ public sealed class SubdirectoryViewModel
{ {
Entries = []; Entries = [];
SelectedEntries = []; SelectedEntries = [];
ExtractFilesCommand = ReactiveCommand.Create(ExecuteExtractFilesCommand); ExtractFilesCommand = new AsyncRelayCommand(ExtractFiles);
_model = model; _model = model;
_view = view; _view = view;
@@ -73,13 +73,13 @@ public sealed class SubdirectoryViewModel
if(errno != ErrorNumber.NoError) if(errno != ErrorNumber.NoError)
{ {
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, _ = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
string.Format(UI.Error_0_trying_to_read_1_of_chosen_filesystem, string.Format(UI.Error_0_trying_to_read_1_of_chosen_filesystem,
errno, errno,
model.Path), model.Path),
ButtonEnum.Ok, ButtonEnum.Ok,
Icon.Error) Icon.Error)
.ShowWindowDialogAsync(view); .ShowWindowDialogAsync(view);
return; return;
} }
@@ -121,7 +121,7 @@ public sealed class SubdirectoryViewModel
public ObservableCollection<FileModel> Entries { get; } public ObservableCollection<FileModel> Entries { get; }
public List<FileModel> SelectedEntries { get; } public List<FileModel> SelectedEntries { get; }
public ReactiveCommand<Unit, Task> ExtractFilesCommand { get; } public ICommand ExtractFilesCommand { get; }
public string ExtractFilesLabel => UI.ButtonLabel_Extract_to; public string ExtractFilesLabel => UI.ButtonLabel_Extract_to;
public string NameLabel => UI.Title_Name; public string NameLabel => UI.Title_Name;
@@ -138,7 +138,7 @@ public sealed class SubdirectoryViewModel
public string LinksLabel => UI.Title_Links; public string LinksLabel => UI.Title_Links;
public string ModeLabel => UI.Title_Mode; public string ModeLabel => UI.Title_Mode;
async Task ExecuteExtractFilesCommand() async Task ExtractFiles()
{ {
if(SelectedEntries.Count == 0) return; if(SelectedEntries.Count == 0) return;

View File

@@ -32,14 +32,14 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Decoders.ATA; using Aaru.Decoders.ATA;
using Aaru.Localization; using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Tabs; namespace Aaru.Gui.ViewModels.Tabs;
@@ -52,8 +52,8 @@ public sealed class AtaInfoViewModel : ViewModelBase
public AtaInfoViewModel([CanBeNull] byte[] ataIdentify, byte[] atapiIdentify, AtaErrorRegistersChs? ataMcptError, public AtaInfoViewModel([CanBeNull] byte[] ataIdentify, byte[] atapiIdentify, AtaErrorRegistersChs? ataMcptError,
Window view) Window view)
{ {
SaveAtaBinaryCommand = ReactiveCommand.Create(ExecuteSaveAtaBinaryCommand); SaveAtaBinaryCommand = new AsyncRelayCommand(SaveAtaBinaryAsync);
SaveAtaTextCommand = ReactiveCommand.Create(ExecuteSaveAtaTextCommand); SaveAtaTextCommand = new AsyncRelayCommand(SaveAtaTextAsync);
_ata = ataIdentify; _ata = ataIdentify;
_atapi = atapiIdentify; _atapi = atapiIdentify;
@@ -82,7 +82,8 @@ public sealed class AtaInfoViewModel : ViewModelBase
AtaMcptWriteProtectionChecked = (ataMcptError.Value.DeviceHead & 0x08) == 0x08; AtaMcptWriteProtectionChecked = (ataMcptError.Value.DeviceHead & 0x08) == 0x08;
var specificData = (ushort)(ataMcptError.Value.CylinderHigh * 0x100 + ataMcptError.Value.CylinderLow); ushort specificData =
(ushort)(ataMcptError.Value.CylinderHigh * 0x100 + ataMcptError.Value.CylinderLow);
AtaMcptSpecificDataText = string.Format(Localization.Core.Card_specific_data_0, specificData); AtaMcptSpecificDataText = string.Format(Localization.Core.Card_specific_data_0, specificData);
} }
@@ -96,14 +97,14 @@ public sealed class AtaInfoViewModel : ViewModelBase
} }
} }
public string AtaIdentifyText { get; } public string AtaIdentifyText { get; }
public string AtaMcptText { get; } public string AtaMcptText { get; }
public string AtaMcptSpecificDataText { get; } public string AtaMcptSpecificDataText { get; }
public bool AtaMcptChecked { get; } public bool AtaMcptChecked { get; }
public bool AtaMcptWriteProtectionChecked { get; } public bool AtaMcptWriteProtectionChecked { get; }
public bool AtaMcptVisible { get; } public bool AtaMcptVisible { get; }
public ReactiveCommand<Unit, Task> SaveAtaBinaryCommand { get; } public ICommand SaveAtaBinaryCommand { get; }
public ReactiveCommand<Unit, Task> SaveAtaTextCommand { get; } public ICommand SaveAtaTextCommand { get; }
public string AtaOrAtapiText { get; } public string AtaOrAtapiText { get; }
@@ -112,7 +113,7 @@ public sealed class AtaInfoViewModel : ViewModelBase
public string SaveAtaBinaryLabel => UI.ButtonLabel_Save_binary_to_file; public string SaveAtaBinaryLabel => UI.ButtonLabel_Save_binary_to_file;
public string SaveAtaTextLabel => UI.ButtonLabel_Save_text_to_file; public string SaveAtaTextLabel => UI.ButtonLabel_Save_text_to_file;
async Task ExecuteSaveAtaBinaryCommand() async Task SaveAtaBinaryAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -133,7 +134,7 @@ public sealed class AtaInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveAtaTextCommand() async Task SaveAtaTextAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {

View File

@@ -32,15 +32,15 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Decoders.Bluray; using Aaru.Decoders.Bluray;
using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.SCSI.MMC;
using Aaru.Localization; using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Tabs; namespace Aaru.Gui.ViewModels.Tabs;
@@ -73,17 +73,17 @@ public sealed class BlurayInfoViewModel
_trackResources = blurayTrackResources; _trackResources = blurayTrackResources;
_rawDfl = blurayRawDfl; _rawDfl = blurayRawDfl;
_pac = blurayPac; _pac = blurayPac;
SaveBlurayDiscInformationCommand = ReactiveCommand.Create(ExecuteSaveBlurayDiscInformationCommand); SaveBlurayDiscInformationCommand = new AsyncRelayCommand(SaveBlurayDiscInformationAsync);
SaveBlurayBurstCuttingAreaCommand = ReactiveCommand.Create(ExecuteSaveBlurayBurstCuttingAreaCommand); SaveBlurayBurstCuttingAreaCommand = new AsyncRelayCommand(SaveBlurayBurstCuttingAreaAsync);
SaveBlurayDdsCommand = ReactiveCommand.Create(ExecuteSaveBlurayDdsCommand); SaveBlurayDdsCommand = new AsyncRelayCommand(SaveBlurayDdsAsync);
SaveBlurayCartridgeStatusCommand = ReactiveCommand.Create(ExecuteSaveBlurayCartridgeStatusCommand); SaveBlurayCartridgeStatusCommand = new AsyncRelayCommand(SaveBlurayCartridgeStatusAsync);
SaveBluraySpareAreaInformationCommand = ReactiveCommand.Create(ExecuteSaveBluraySpareAreaInformationCommand); SaveBluraySpareAreaInformationCommand = new AsyncRelayCommand(SaveBluraySpareAreaInformationAsync);
SaveBlurayPowResourcesCommand = ReactiveCommand.Create(ExecuteSaveBlurayPowResourcesCommand); SaveBlurayPowResourcesCommand = new AsyncRelayCommand(SaveBlurayPowResourcesAsync);
SaveBlurayTrackResourcesCommand = ReactiveCommand.Create(ExecuteSaveBlurayTrackResourcesCommand); SaveBlurayTrackResourcesCommand = new AsyncRelayCommand(SaveBlurayTrackResourcesAsync);
SaveBlurayRawDflCommand = ReactiveCommand.Create(ExecuteSaveBlurayRawDflCommand); SaveBlurayRawDflCommand = new AsyncRelayCommand(SaveBlurayRawDflAsync);
SaveBlurayPacCommand = ReactiveCommand.Create(ExecuteSaveBlurayPacCommand); SaveBlurayPacCommand = new AsyncRelayCommand(SaveBlurayPacAsync);
if(blurayDiscInformation != null) if(blurayDiscInformation != null)
{ {
@@ -131,31 +131,31 @@ public sealed class BlurayInfoViewModel
SaveBlurayPacVisible = blurayPac != null; SaveBlurayPacVisible = blurayPac != null;
} }
public string BlurayDiscInformationText { get; } public string BlurayDiscInformationText { get; }
public string BlurayBurstCuttingAreaText { get; } public string BlurayBurstCuttingAreaText { get; }
public string BlurayDdsText { get; } public string BlurayDdsText { get; }
public string BlurayCartridgeStatusText { get; } public string BlurayCartridgeStatusText { get; }
public string BluraySpareAreaInformationText { get; } public string BluraySpareAreaInformationText { get; }
public string BlurayPowResourcesText { get; } public string BlurayPowResourcesText { get; }
public string BlurayTrackResourcesText { get; } public string BlurayTrackResourcesText { get; }
public ReactiveCommand<Unit, Task> SaveBlurayDiscInformationCommand { get; } public ICommand SaveBlurayDiscInformationCommand { get; }
public ReactiveCommand<Unit, Task> SaveBlurayBurstCuttingAreaCommand { get; } public ICommand SaveBlurayBurstCuttingAreaCommand { get; }
public ReactiveCommand<Unit, Task> SaveBlurayDdsCommand { get; } public ICommand SaveBlurayDdsCommand { get; }
public ReactiveCommand<Unit, Task> SaveBlurayCartridgeStatusCommand { get; } public ICommand SaveBlurayCartridgeStatusCommand { get; }
public ReactiveCommand<Unit, Task> SaveBluraySpareAreaInformationCommand { get; } public ICommand SaveBluraySpareAreaInformationCommand { get; }
public ReactiveCommand<Unit, Task> SaveBlurayPowResourcesCommand { get; } public ICommand SaveBlurayPowResourcesCommand { get; }
public ReactiveCommand<Unit, Task> SaveBlurayTrackResourcesCommand { get; } public ICommand SaveBlurayTrackResourcesCommand { get; }
public ReactiveCommand<Unit, Task> SaveBlurayRawDflCommand { get; } public ICommand SaveBlurayRawDflCommand { get; }
public ReactiveCommand<Unit, Task> SaveBlurayPacCommand { get; } public ICommand SaveBlurayPacCommand { get; }
public bool SaveBlurayDiscInformationVisible { get; } public bool SaveBlurayDiscInformationVisible { get; }
public bool SaveBlurayBurstCuttingAreaVisible { get; } public bool SaveBlurayBurstCuttingAreaVisible { get; }
public bool SaveBlurayDdsVisible { get; } public bool SaveBlurayDdsVisible { get; }
public bool SaveBlurayCartridgeStatusVisible { get; } public bool SaveBlurayCartridgeStatusVisible { get; }
public bool SaveBluraySpareAreaInformationVisible { get; } public bool SaveBluraySpareAreaInformationVisible { get; }
public bool SaveBlurayPowResourcesVisible { get; } public bool SaveBlurayPowResourcesVisible { get; }
public bool SaveBlurayTrackResourcesVisible { get; } public bool SaveBlurayTrackResourcesVisible { get; }
public bool SaveBlurayRawDflVisible { get; } public bool SaveBlurayRawDflVisible { get; }
public bool SaveBlurayPacVisible { get; } public bool SaveBlurayPacVisible { get; }
public string DiscInformationLabel => UI.Disc_information; public string DiscInformationLabel => UI.Disc_information;
public string BurstCuttingAreaLabel => UI.Burst_Cutting_Area; public string BurstCuttingAreaLabel => UI.Burst_Cutting_Area;
@@ -174,7 +174,7 @@ public sealed class BlurayInfoViewModel
public string SaveBlurayRawDflLabel => UI.ButtonLabel_Save_raw_DFL; public string SaveBlurayRawDflLabel => UI.ButtonLabel_Save_raw_DFL;
public string SaveBlurayPacLabel => UI.ButtonLabel_Save_PAC; public string SaveBlurayPacLabel => UI.ButtonLabel_Save_PAC;
async Task SaveElement(byte[] data) async Task SaveElementAsync(byte[] data)
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -192,21 +192,21 @@ public sealed class BlurayInfoViewModel
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveBlurayDiscInformationCommand() => await SaveElement(_discInformation); Task SaveBlurayDiscInformationAsync() => SaveElementAsync(_discInformation);
async Task ExecuteSaveBlurayBurstCuttingAreaCommand() => await SaveElement(_burstCuttingArea); Task SaveBlurayBurstCuttingAreaAsync() => SaveElementAsync(_burstCuttingArea);
async Task ExecuteSaveBlurayDdsCommand() => await SaveElement(_dds); Task SaveBlurayDdsAsync() => SaveElementAsync(_dds);
async Task ExecuteSaveBlurayCartridgeStatusCommand() => await SaveElement(_cartridgeStatus); Task SaveBlurayCartridgeStatusAsync() => SaveElementAsync(_cartridgeStatus);
async Task ExecuteSaveBluraySpareAreaInformationCommand() => await SaveElement(_spareAreaInformation); Task SaveBluraySpareAreaInformationAsync() => SaveElementAsync(_spareAreaInformation);
async Task ExecuteSaveBlurayPowResourcesCommand() => await SaveElement(_powResources); Task SaveBlurayPowResourcesAsync() => SaveElementAsync(_powResources);
async Task ExecuteSaveBlurayTrackResourcesCommand() => await SaveElement(_trackResources); Task SaveBlurayTrackResourcesAsync() => SaveElementAsync(_trackResources);
async Task ExecuteSaveBlurayRawDflCommand() => await SaveElement(_rawDfl); Task SaveBlurayRawDflAsync() => SaveElementAsync(_rawDfl);
async Task ExecuteSaveBlurayPacCommand() => await SaveElement(_pac); Task SaveBlurayPacAsync() => SaveElementAsync(_pac);
} }

View File

@@ -33,15 +33,15 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Decoders.CD; using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.SCSI.MMC;
using Aaru.Gui.Models; using Aaru.Gui.Models;
using Aaru.Localization; using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using ReactiveUI; using CommunityToolkit.Mvvm.Input;
namespace Aaru.Gui.ViewModels.Tabs; namespace Aaru.Gui.ViewModels.Tabs;
@@ -72,13 +72,13 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
_cdTextLeadInData = cdTextLeadIn; _cdTextLeadInData = cdTextLeadIn;
_view = view; _view = view;
IsrcList = []; IsrcList = [];
SaveCdInformationCommand = ReactiveCommand.Create(ExecuteSaveCdInformationCommand); SaveCdInformationCommand = new AsyncRelayCommand(SaveCdInformationAsync);
SaveCdTocCommand = ReactiveCommand.Create(ExecuteSaveCdTocCommand); SaveCdTocCommand = new AsyncRelayCommand(SaveCdTocAsync);
SaveCdFullTocCommand = ReactiveCommand.Create(ExecuteSaveCdFullTocCommand); SaveCdFullTocCommand = new AsyncRelayCommand(SaveCdFullTocAsync);
SaveCdSessionCommand = ReactiveCommand.Create(ExecuteSaveCdSessionCommand); SaveCdSessionCommand = new AsyncRelayCommand(SaveCdSessionAsync);
SaveCdTextCommand = ReactiveCommand.Create(ExecuteSaveCdTextCommand); SaveCdTextCommand = new AsyncRelayCommand(SaveCdTextAsync);
SaveCdAtipCommand = ReactiveCommand.Create(ExecuteSaveCdAtipCommand); SaveCdAtipCommand = new AsyncRelayCommand(SaveCdAtipAsync);
SaveCdPmaCommand = ReactiveCommand.Create(ExecuteSaveCdPmaCommand); SaveCdPmaCommand = new AsyncRelayCommand(SaveCdPmaAsync);
if(decodedCompactDiscInformation.HasValue) if(decodedCompactDiscInformation.HasValue)
CdInformationText = DiscInformation.Prettify000b(decodedCompactDiscInformation); CdInformationText = DiscInformation.Prettify000b(decodedCompactDiscInformation);
@@ -120,13 +120,13 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
public bool MiscellaneousVisible { get; } public bool MiscellaneousVisible { get; }
public string McnText { get; } public string McnText { get; }
public bool CdPmaVisible { get; } public bool CdPmaVisible { get; }
public ReactiveCommand<Unit, Task> SaveCdInformationCommand { get; } public ICommand SaveCdInformationCommand { get; }
public ReactiveCommand<Unit, Task> SaveCdTocCommand { get; } public ICommand SaveCdTocCommand { get; }
public ReactiveCommand<Unit, Task> SaveCdFullTocCommand { get; } public ICommand SaveCdFullTocCommand { get; }
public ReactiveCommand<Unit, Task> SaveCdSessionCommand { get; } public ICommand SaveCdSessionCommand { get; }
public ReactiveCommand<Unit, Task> SaveCdTextCommand { get; } public ICommand SaveCdTextCommand { get; }
public ReactiveCommand<Unit, Task> SaveCdAtipCommand { get; } public ICommand SaveCdAtipCommand { get; }
public ReactiveCommand<Unit, Task> SaveCdPmaCommand { get; } public ICommand SaveCdPmaCommand { get; }
public ObservableCollection<IsrcModel> IsrcList { get; } public ObservableCollection<IsrcModel> IsrcList { get; }
public string CdInformationLabel => UI.Title_Information; public string CdInformationLabel => UI.Title_Information;
@@ -148,7 +148,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
public string ISRCLabel => UI.Title_ISRC; public string ISRCLabel => UI.Title_ISRC;
public string SaveCdPmaLabel => UI.ButtonLabel_Save_READ_PMA_response; public string SaveCdPmaLabel => UI.ButtonLabel_Save_READ_PMA_response;
async Task ExecuteSaveCdInformationCommand() async Task SaveCdInformationAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -166,7 +166,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveCdTocCommand() async Task SaveCdTocAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -184,7 +184,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveCdFullTocCommand() async Task SaveCdFullTocAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -202,7 +202,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveCdSessionCommand() async Task SaveCdSessionAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -220,7 +220,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveCdTextCommand() async Task SaveCdTextAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -238,7 +238,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveCdAtipCommand() async Task SaveCdAtipAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -256,7 +256,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveCdPmaCommand() async Task SaveCdPmaAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {

View File

@@ -32,14 +32,14 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Decoders.DVD; using Aaru.Decoders.DVD;
using Aaru.Localization; using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Tabs; namespace Aaru.Gui.ViewModels.Tabs;
@@ -64,12 +64,12 @@ public sealed class DvdInfoViewModel
_dvdBca = bca; _dvdBca = bca;
_dvdAacs = aacs; _dvdAacs = aacs;
_view = view; _view = view;
SaveDvdPfiCommand = ReactiveCommand.Create(ExecuteSaveDvdPfiCommand); SaveDvdPfiCommand = new AsyncRelayCommand(SaveDvdPfiAsync);
SaveDvdDmiCommand = ReactiveCommand.Create(ExecuteSaveDvdDmiCommand); SaveDvdDmiCommand = new AsyncRelayCommand(SaveDvdDmiAsync);
SaveDvdCmiCommand = ReactiveCommand.Create(ExecuteSaveDvdCmiCommand); SaveDvdCmiCommand = new AsyncRelayCommand(SaveDvdCmiAsync);
SaveHdDvdCmiCommand = ReactiveCommand.Create(ExecuteSaveHdDvdCmiCommand); SaveHdDvdCmiCommand = new AsyncRelayCommand(SaveHdDvdCmiAsync);
SaveDvdBcaCommand = ReactiveCommand.Create(ExecuteSaveDvdBcaCommand); SaveDvdBcaCommand = new AsyncRelayCommand(SaveDvdBcaAsync);
SaveDvdAacsCommand = ReactiveCommand.Create(ExecuteSaveDvdAacsCommand); SaveDvdAacsCommand = new AsyncRelayCommand(SaveDvdAacsAsync);
/* TODO: Pass back /* TODO: Pass back
switch(mediaType) switch(mediaType)
@@ -102,20 +102,20 @@ public sealed class DvdInfoViewModel
SaveDvdAacsVisible = aacs != null; SaveDvdAacsVisible = aacs != null;
} }
public ReactiveCommand<Unit, Task> SaveDvdPfiCommand { get; } public ICommand SaveDvdPfiCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdDmiCommand { get; } public ICommand SaveDvdDmiCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdCmiCommand { get; } public ICommand SaveDvdCmiCommand { get; }
public ReactiveCommand<Unit, Task> SaveHdDvdCmiCommand { get; } public ICommand SaveHdDvdCmiCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdBcaCommand { get; } public ICommand SaveDvdBcaCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdAacsCommand { get; } public ICommand SaveDvdAacsCommand { get; }
public string DvdPfiText { get; } public string DvdPfiText { get; }
public string DvdCmiText { get; } public string DvdCmiText { get; }
public bool SaveDvdPfiVisible { get; } public bool SaveDvdPfiVisible { get; }
public bool SaveDvdDmiVisible { get; } public bool SaveDvdDmiVisible { get; }
public bool SaveDvdCmiVisible { get; } public bool SaveDvdCmiVisible { get; }
public bool SaveHdDvdCmiVisible { get; } public bool SaveHdDvdCmiVisible { get; }
public bool SaveDvdBcaVisible { get; } public bool SaveDvdBcaVisible { get; }
public bool SaveDvdAacsVisible { get; } public bool SaveDvdAacsVisible { get; }
public string SaveDvdPfiLabel => UI.ButtonLabel_Save_Physical_Format_Information; public string SaveDvdPfiLabel => UI.ButtonLabel_Save_Physical_Format_Information;
public string SaveDvdDmiLabel => UI.ButtonLabel_Save_Disc_Manufacturer_Information; public string SaveDvdDmiLabel => UI.ButtonLabel_Save_Disc_Manufacturer_Information;
@@ -124,7 +124,7 @@ public sealed class DvdInfoViewModel
public string SaveDvdBcaLabel => UI.ButtonLabel_Save_Burst_Cutting_Area; public string SaveDvdBcaLabel => UI.ButtonLabel_Save_Burst_Cutting_Area;
public string SaveDvdAacsLabel => UI.ButtonLabel_Save_AACS_Information; public string SaveDvdAacsLabel => UI.ButtonLabel_Save_AACS_Information;
async Task SaveElement(byte[] data) async Task SaveElementAsync(byte[] data)
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -142,15 +142,15 @@ public sealed class DvdInfoViewModel
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveDvdPfiCommand() => await SaveElement(_dvdPfi); Task SaveDvdPfiAsync() => SaveElementAsync(_dvdPfi);
async Task ExecuteSaveDvdDmiCommand() => await SaveElement(_dvdDmi); Task SaveDvdDmiAsync() => SaveElementAsync(_dvdDmi);
async Task ExecuteSaveDvdCmiCommand() => await SaveElement(_dvdCmi); Task SaveDvdCmiAsync() => SaveElementAsync(_dvdCmi);
async Task ExecuteSaveHdDvdCmiCommand() => await SaveElement(_hddvdCopyrightInformation); Task SaveHdDvdCmiAsync() => SaveElementAsync(_hddvdCopyrightInformation);
async Task ExecuteSaveDvdBcaCommand() => await SaveElement(_dvdBca); Task SaveDvdBcaAsync() => SaveElementAsync(_dvdBca);
async Task ExecuteSaveDvdAacsCommand() => await SaveElement(_dvdAacs); Task SaveDvdAacsAsync() => SaveElementAsync(_dvdAacs);
} }

View File

@@ -32,13 +32,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Decoders.DVD; using Aaru.Decoders.DVD;
using Aaru.Localization; using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using ReactiveUI; using CommunityToolkit.Mvvm.Input;
namespace Aaru.Gui.ViewModels.Tabs; namespace Aaru.Gui.ViewModels.Tabs;
@@ -69,27 +69,26 @@ public sealed class DvdWritableInfoViewModel
byte[] adip, byte[] dcb, Window view) byte[] adip, byte[] dcb, Window view)
{ {
_view = view; _view = view;
SaveDvdRamDdsCommand = ReactiveCommand.Create(ExecuteSaveDvdRamDdsCommand); SaveDvdRamDdsCommand = new AsyncRelayCommand(SaveDvdRamDdsAsync);
SaveDvdRamCartridgeStatusCommand = ReactiveCommand.Create(ExecuteSaveDvdRamCartridgeStatusCommand); SaveDvdRamCartridgeStatusCommand = new AsyncRelayCommand(SaveDvdRamCartridgeStatusAsync);
SaveDvdRamSpareAreaInformationCommand = ReactiveCommand.Create(ExecuteSaveDvdRamSpareAreaInformationCommand); SaveDvdRamSpareAreaInformationCommand = new AsyncRelayCommand(SaveDvdRamSpareAreaInformationAsync);
SaveLastBorderOutRmdCommand = ReactiveCommand.Create(ExecuteSaveLastBorderOutRmdCommand); SaveLastBorderOutRmdCommand = new AsyncRelayCommand(SaveLastBorderOutRmdAsync);
SaveDvdPreRecordedInfoCommand = ReactiveCommand.Create(ExecuteSaveDvdPreRecordedInfoCommand); SaveDvdPreRecordedInfoCommand = new AsyncRelayCommand(SaveDvdPreRecordedInfoAsync);
SaveDvdrMediaIdentifierCommand = ReactiveCommand.Create(ExecuteSaveDvdrMediaIdentifierCommand); SaveDvdrMediaIdentifierCommand = new AsyncRelayCommand(SaveDvdrMediaIdentifierAsync);
SaveDvdrPhysicalInformationCommand = ReactiveCommand.Create(ExecuteSaveDvdrPhysicalInformationCommand); SaveDvdrPhysicalInformationCommand = new AsyncRelayCommand(SaveDvdrPhysicalInformationAsync);
SaveHddvdrMediumStatusCommand = ReactiveCommand.Create(ExecuteSaveHddvdrMediumStatusCommand); SaveHddvdrMediumStatusCommand = new AsyncRelayCommand(SaveHddvdrMediumStatusAsync);
SaveHddvdrLastRmdCommand = ReactiveCommand.Create(ExecuteSaveHddvdrLastRmdCommand); SaveHddvdrLastRmdCommand = new AsyncRelayCommand(SaveHddvdrLastRmdAsync);
SaveDvdrLayerCapacityCommand = ReactiveCommand.Create(ExecuteSaveDvdrLayerCapacityCommand); SaveDvdrLayerCapacityCommand = new AsyncRelayCommand(SaveDvdrLayerCapacityAsync);
SaveDvdrDlMiddleZoneStartCommand = ReactiveCommand.Create(ExecuteSaveDvdrDlMiddleZoneStartCommand); SaveDvdrDlMiddleZoneStartCommand = new AsyncRelayCommand(SaveDvdrDlMiddleZoneStartAsync);
SaveDvdrDlJumpIntervalSizeCommand = ReactiveCommand.Create(ExecuteSaveDvdrDlJumpIntervalSizeCommand); SaveDvdrDlJumpIntervalSizeCommand = new AsyncRelayCommand(SaveDvdrDlJumpIntervalSizeAsync);
SaveDvdrDlManualLayerJumpStartLbaCommand = SaveDvdrDlManualLayerJumpStartLbaCommand = new AsyncRelayCommand(SaveDvdrDlManualLayerJumpStartLbaAsync);
ReactiveCommand.Create(ExecuteSaveDvdrDlManualLayerJumpStartLbaCommand);
SaveDvdrDlRemapAnchorPointCommand = ReactiveCommand.Create(ExecuteSaveDvdrDlRemapAnchorPointCommand); SaveDvdrDlRemapAnchorPointCommand = new AsyncRelayCommand(SaveDvdrDlRemapAnchorPointAsync);
SaveDvdPlusAdipCommand = ReactiveCommand.Create(ExecuteSaveDvdPlusAdipCommand); SaveDvdPlusAdipCommand = new AsyncRelayCommand(SaveDvdPlusAdipAsync);
SaveDvdPlusDcbCommand = ReactiveCommand.Create(ExecuteSaveDvdPlusDcbCommand); SaveDvdPlusDcbCommand = new AsyncRelayCommand(SaveDvdPlusDcbAsync);
_dvdRamDds = dds; _dvdRamDds = dds;
_dvdRamCartridgeStatus = cartridgeStatus; _dvdRamCartridgeStatus = cartridgeStatus;
@@ -194,41 +193,41 @@ public sealed class DvdWritableInfoViewModel
SaveDvdPlusDcbVisible = dcb != null; SaveDvdPlusDcbVisible = dcb != null;
} }
public string DvdRamDdsText { get; } public string DvdRamDdsText { get; }
public string DvdRamCartridgeStatusText { get; } public string DvdRamCartridgeStatusText { get; }
public string DvdRamSpareAreaInformationText { get; } public string DvdRamSpareAreaInformationText { get; }
public bool SaveDvdRamDdsVisible { get; } public bool SaveDvdRamDdsVisible { get; }
public bool SaveDvdRamCartridgeStatusVisible { get; } public bool SaveDvdRamCartridgeStatusVisible { get; }
public bool SaveDvdRamSpareAreaInformationVisible { get; } public bool SaveDvdRamSpareAreaInformationVisible { get; }
public bool SaveLastBorderOutRmdVisible { get; } public bool SaveLastBorderOutRmdVisible { get; }
public bool SaveDvdPreRecordedInfoVisible { get; } public bool SaveDvdPreRecordedInfoVisible { get; }
public bool SaveDvdrMediaIdentifierVisible { get; } public bool SaveDvdrMediaIdentifierVisible { get; }
public bool SaveDvdrPhysicalInformationVisible { get; } public bool SaveDvdrPhysicalInformationVisible { get; }
public bool SaveHddvdrMediumStatusVisible { get; } public bool SaveHddvdrMediumStatusVisible { get; }
public bool SaveHddvdrLastRmdVisible { get; } public bool SaveHddvdrLastRmdVisible { get; }
public bool SaveDvdrLayerCapacityVisible { get; } public bool SaveDvdrLayerCapacityVisible { get; }
public bool SaveDvdrDlMiddleZoneStartVisible { get; } public bool SaveDvdrDlMiddleZoneStartVisible { get; }
public bool SaveDvdrDlJumpIntervalSizeVisible { get; } public bool SaveDvdrDlJumpIntervalSizeVisible { get; }
public bool SaveDvdrDlManualLayerJumpStartLbaVisible { get; } public bool SaveDvdrDlManualLayerJumpStartLbaVisible { get; }
public bool SaveDvdrDlRemapAnchorPointVisible { get; } public bool SaveDvdrDlRemapAnchorPointVisible { get; }
public bool SaveDvdPlusAdipVisible { get; } public bool SaveDvdPlusAdipVisible { get; }
public bool SaveDvdPlusDcbVisible { get; } public bool SaveDvdPlusDcbVisible { get; }
public ReactiveCommand<Unit, Task> SaveDvdRamDdsCommand { get; } public ICommand SaveDvdRamDdsCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdRamCartridgeStatusCommand { get; } public ICommand SaveDvdRamCartridgeStatusCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdRamSpareAreaInformationCommand { get; } public ICommand SaveDvdRamSpareAreaInformationCommand { get; }
public ReactiveCommand<Unit, Task> SaveLastBorderOutRmdCommand { get; } public ICommand SaveLastBorderOutRmdCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdPreRecordedInfoCommand { get; } public ICommand SaveDvdPreRecordedInfoCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdrMediaIdentifierCommand { get; } public ICommand SaveDvdrMediaIdentifierCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdrPhysicalInformationCommand { get; } public ICommand SaveDvdrPhysicalInformationCommand { get; }
public ReactiveCommand<Unit, Task> SaveHddvdrMediumStatusCommand { get; } public ICommand SaveHddvdrMediumStatusCommand { get; }
public ReactiveCommand<Unit, Task> SaveHddvdrLastRmdCommand { get; } public ICommand SaveHddvdrLastRmdCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdrLayerCapacityCommand { get; } public ICommand SaveDvdrLayerCapacityCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdrDlMiddleZoneStartCommand { get; } public ICommand SaveDvdrDlMiddleZoneStartCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdrDlJumpIntervalSizeCommand { get; } public ICommand SaveDvdrDlJumpIntervalSizeCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdrDlManualLayerJumpStartLbaCommand { get; } public ICommand SaveDvdrDlManualLayerJumpStartLbaCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdrDlRemapAnchorPointCommand { get; } public ICommand SaveDvdrDlRemapAnchorPointCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdPlusAdipCommand { get; } public ICommand SaveDvdPlusAdipCommand { get; }
public ReactiveCommand<Unit, Task> SaveDvdPlusDcbCommand { get; } public ICommand SaveDvdPlusDcbCommand { get; }
public string DvdRamDdsLabel => UI.Disc_Definition_Structure; public string DvdRamDdsLabel => UI.Disc_Definition_Structure;
public string DvdRamCartridgeStatusLabel => UI.Cartridge_Status; public string DvdRamCartridgeStatusLabel => UI.Cartridge_Status;
@@ -250,7 +249,7 @@ public sealed class DvdWritableInfoViewModel
public string SaveDvdPlusAdipLabel => UI.ButtonLabel_Save_ADIP; public string SaveDvdPlusAdipLabel => UI.ButtonLabel_Save_ADIP;
public string SaveDvdPlusDcbLabel => UI.ButtonLabel_Save_Disc_Control_Blocks; public string SaveDvdPlusDcbLabel => UI.ButtonLabel_Save_Disc_Control_Blocks;
async Task SaveElement(byte[] data) async Task SaveElementAsync(byte[] data)
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -268,35 +267,35 @@ public sealed class DvdWritableInfoViewModel
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveDvdRamDdsCommand() => await SaveElement(_dvdRamDds); Task SaveDvdRamDdsAsync() => SaveElementAsync(_dvdRamDds);
async Task ExecuteSaveDvdRamCartridgeStatusCommand() => await SaveElement(_dvdRamCartridgeStatus); Task SaveDvdRamCartridgeStatusAsync() => SaveElementAsync(_dvdRamCartridgeStatus);
async Task ExecuteSaveDvdRamSpareAreaInformationCommand() => await SaveElement(_dvdRamSpareArea); Task SaveDvdRamSpareAreaInformationAsync() => SaveElementAsync(_dvdRamSpareArea);
async Task ExecuteSaveLastBorderOutRmdCommand() => await SaveElement(_dvdLastBorderOutRmd); Task SaveLastBorderOutRmdAsync() => SaveElementAsync(_dvdLastBorderOutRmd);
async Task ExecuteSaveDvdPreRecordedInfoCommand() => await SaveElement(_dvdPreRecordedInfo); Task SaveDvdPreRecordedInfoAsync() => SaveElementAsync(_dvdPreRecordedInfo);
async Task ExecuteSaveDvdrMediaIdentifierCommand() => await SaveElement(_dvdrMediaIdentifier); Task SaveDvdrMediaIdentifierAsync() => SaveElementAsync(_dvdrMediaIdentifier);
async Task ExecuteSaveDvdrPhysicalInformationCommand() => await SaveElement(_dvdrPhysicalInformation); Task SaveDvdrPhysicalInformationAsync() => SaveElementAsync(_dvdrPhysicalInformation);
async Task ExecuteSaveHddvdrMediumStatusCommand() => await SaveElement(_hddvdrMediumStatus); Task SaveHddvdrMediumStatusAsync() => SaveElementAsync(_hddvdrMediumStatus);
async Task ExecuteSaveHddvdrLastRmdCommand() => await SaveElement(_hddvdrLastRmd); Task SaveHddvdrLastRmdAsync() => SaveElementAsync(_hddvdrLastRmd);
async Task ExecuteSaveDvdrLayerCapacityCommand() => await SaveElement(_dvdrLayerCapacity); Task SaveDvdrLayerCapacityAsync() => SaveElementAsync(_dvdrLayerCapacity);
async Task ExecuteSaveDvdrDlMiddleZoneStartCommand() => await SaveElement(_dvdrDlMiddleZoneStart); Task SaveDvdrDlMiddleZoneStartAsync() => SaveElementAsync(_dvdrDlMiddleZoneStart);
async Task ExecuteSaveDvdrDlJumpIntervalSizeCommand() => await SaveElement(_dvdrDlJumpIntervalSize); Task SaveDvdrDlJumpIntervalSizeAsync() => SaveElementAsync(_dvdrDlJumpIntervalSize);
async Task ExecuteSaveDvdrDlManualLayerJumpStartLbaCommand() => await SaveElement(_dvdrDlManualLayerJumpStartLba); Task SaveDvdrDlManualLayerJumpStartLbaAsync() => SaveElementAsync(_dvdrDlManualLayerJumpStartLba);
async Task ExecuteSaveDvdrDlRemapAnchorPointCommand() => await SaveElement(_dvdrDlRemapAnchorPoint); Task SaveDvdrDlRemapAnchorPointAsync() => SaveElementAsync(_dvdrDlRemapAnchorPoint);
async Task ExecuteSaveDvdPlusAdipCommand() => await SaveElement(_dvdPlusAdip); Task SaveDvdPlusAdipAsync() => SaveElementAsync(_dvdPlusAdip);
async Task ExecuteSaveDvdPlusDcbCommand() => await SaveElement(_dvdPlusDcb); Task SaveDvdPlusDcbAsync() => SaveElementAsync(_dvdPlusDcb);
} }

View File

@@ -33,27 +33,29 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Decoders.PCMCIA; using Aaru.Decoders.PCMCIA;
using Aaru.Gui.Models; using Aaru.Gui.Models;
using Aaru.Localization; using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
using Tuple = Aaru.Decoders.PCMCIA.Tuple; using Tuple = Aaru.Decoders.PCMCIA.Tuple;
namespace Aaru.Gui.ViewModels.Tabs; namespace Aaru.Gui.ViewModels.Tabs;
public class PcmciaInfoViewModel : ViewModelBase public sealed partial class PcmciaInfoViewModel : ViewModelBase
{ {
const string MODULE_NAME = "PCMCIA Information ViewModel"; const string MODULE_NAME = "PCMCIA Information ViewModel";
readonly byte[] _cis; readonly byte[] _cis;
readonly Window _view; readonly Window _view;
string _pcmciaCisText; [ObservableProperty]
PcmciaCisModel _selectedCis; string _pcmciaCisText;
PcmciaCisModel _selectedCis;
internal PcmciaInfoViewModel([CanBeNull] byte[] pcmciaCis, Window view) internal PcmciaInfoViewModel([CanBeNull] byte[] pcmciaCis, Window view)
{ {
@@ -61,7 +63,7 @@ public class PcmciaInfoViewModel : ViewModelBase
_cis = pcmciaCis; _cis = pcmciaCis;
CisList = []; CisList = [];
SavePcmciaCisCommand = ReactiveCommand.Create(ExecuteSavePcmciaCisCommand); SavePcmciaCisCommand = new AsyncRelayCommand(SavePcmciaCisAsync);
_view = view; _view = view;
@@ -156,12 +158,6 @@ public class PcmciaInfoViewModel : ViewModelBase
public ObservableCollection<PcmciaCisModel> CisList { get; } public ObservableCollection<PcmciaCisModel> CisList { get; }
public string PcmciaCisText
{
get => _pcmciaCisText;
set => this.RaiseAndSetIfChanged(ref _pcmciaCisText, value);
}
public PcmciaCisModel SelectedCis public PcmciaCisModel SelectedCis
{ {
get => _selectedCis; get => _selectedCis;
@@ -170,13 +166,13 @@ public class PcmciaInfoViewModel : ViewModelBase
if(_selectedCis == value) return; if(_selectedCis == value) return;
PcmciaCisText = value?.Description; PcmciaCisText = value?.Description;
this.RaiseAndSetIfChanged(ref _selectedCis, value); SetProperty(ref _selectedCis, value);
} }
} }
public ReactiveCommand<Unit, Task> SavePcmciaCisCommand { get; } public ICommand SavePcmciaCisCommand { get; }
async Task ExecuteSavePcmciaCisCommand() async Task SavePcmciaCisAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {

View File

@@ -34,8 +34,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI;
using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.SCSI.MMC;
@@ -45,24 +45,28 @@ using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using ReactiveUI; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
namespace Aaru.Gui.ViewModels.Tabs; namespace Aaru.Gui.ViewModels.Tabs;
public sealed class ScsiInfoViewModel : ViewModelBase public sealed partial class ScsiInfoViewModel : ViewModelBase
{ {
const string MODULE_NAME = "SCSI Information ViewModel"; const string MODULE_NAME = "SCSI Information ViewModel";
readonly byte[] _configuration; readonly byte[] _configuration;
readonly byte[] _scsiModeSense10; readonly byte[] _scsiModeSense10;
readonly byte[] _scsiModeSense6; readonly byte[] _scsiModeSense6;
readonly Window _view; readonly Window _view;
string _evpdPageText; [ObservableProperty]
string _mmcFeatureText; string _evpdPageText;
string _scsiModeSensePageText; [ObservableProperty]
object _selectedEvpdPage; string _mmcFeatureText;
object _selectedMmcFeature; [ObservableProperty]
object _selectedModeSensePage; string _modeSensePageText;
object _selectedEvpdPage;
object _selectedMmcFeature;
object _selectedModeSensePage;
public ScsiInfoViewModel(byte[] scsiInquiryData, Inquiry? scsiInquiry, Dictionary<byte, byte[]> scsiEvpdPages, public ScsiInfoViewModel(byte[] scsiInquiryData, Inquiry? scsiInquiry, Dictionary<byte, byte[]> scsiEvpdPages,
Modes.DecodedMode? scsiMode, PeripheralDeviceTypes scsiType, byte[] scsiModeSense6, Modes.DecodedMode? scsiMode, PeripheralDeviceTypes scsiType, byte[] scsiModeSense6,
@@ -76,12 +80,12 @@ public sealed class ScsiInfoViewModel : ViewModelBase
ModeSensePages = []; ModeSensePages = [];
EvpdPages = []; EvpdPages = [];
MmcFeatures = []; MmcFeatures = [];
SaveInquiryBinaryCommand = ReactiveCommand.Create(ExecuteSaveInquiryBinaryCommand); SaveInquiryBinaryCommand = new AsyncRelayCommand(SaveInquiryBinaryAsync);
SaveInquiryTextCommand = ReactiveCommand.Create(ExecuteSaveInquiryTextCommand); SaveInquiryTextCommand = new AsyncRelayCommand(SaveInquiryTextAsync);
SaveModeSense6Command = ReactiveCommand.Create(ExecuteSaveModeSense6Command); SaveModeSense6Command = new AsyncRelayCommand(SaveModeSense6Async);
SaveModeSense10Command = ReactiveCommand.Create(ExecuteSaveModeSense10Command); SaveModeSense10Command = new AsyncRelayCommand(SaveModeSense10Async);
SaveEvpdPageCommand = ReactiveCommand.Create(ExecuteSaveEvpdPageCommand); SaveEvpdPageCommand = new AsyncRelayCommand(SaveEvpdPageAsync);
SaveMmcFeaturesCommand = ReactiveCommand.Create(ExecuteSaveMmcFeaturesCommand); SaveMmcFeaturesCommand = new AsyncRelayCommand(SaveMmcFeaturesAsync);
if(InquiryData == null || !scsiInquiry.HasValue) return; if(InquiryData == null || !scsiInquiry.HasValue) return;
@@ -606,9 +610,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
evpdPageTitle = string.Format(UI.Page_0_h, page.Key); evpdPageTitle = string.Format(UI.Page_0_h, page.Key);
evpdDecodedPage = UI.Undecoded; evpdDecodedPage = UI.Undecoded;
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Core.Found_undecoded_SCSI_VPD_page_0, page.Key);
Localization.Core.Found_undecoded_SCSI_VPD_page_0,
page.Key);
break; break;
} }
@@ -629,9 +631,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
AaruLogging.Debug(MODULE_NAME, Localization.Core.GET_CONFIGURATION_length_is_0, ftr.DataLength); AaruLogging.Debug(MODULE_NAME, Localization.Core.GET_CONFIGURATION_length_is_0, ftr.DataLength);
AaruLogging.Debug(MODULE_NAME, AaruLogging.Debug(MODULE_NAME, Localization.Core.GET_CONFIGURATION_current_profile_is_0, ftr.CurrentProfile);
Localization.Core.GET_CONFIGURATION_current_profile_is_0,
ftr.CurrentProfile);
if(ftr.Descriptors != null) if(ftr.Descriptors != null)
{ {
@@ -711,10 +711,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
} }
} }
else else
{ AaruLogging.Debug(MODULE_NAME, Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors);
AaruLogging.Debug(MODULE_NAME,
Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors);
}
} }
public byte[] InquiryData { get; } public byte[] InquiryData { get; }
@@ -722,12 +719,12 @@ public sealed class ScsiInfoViewModel : ViewModelBase
public ObservableCollection<ScsiPageModel> ModeSensePages { get; } public ObservableCollection<ScsiPageModel> ModeSensePages { get; }
public ObservableCollection<ScsiPageModel> EvpdPages { get; } public ObservableCollection<ScsiPageModel> EvpdPages { get; }
public ObservableCollection<ScsiPageModel> MmcFeatures { get; } public ObservableCollection<ScsiPageModel> MmcFeatures { get; }
public ReactiveCommand<Unit, Task> SaveInquiryBinaryCommand { get; } public ICommand SaveInquiryBinaryCommand { get; }
public ReactiveCommand<Unit, Task> SaveInquiryTextCommand { get; } public ICommand SaveInquiryTextCommand { get; }
public ReactiveCommand<Unit, Task> SaveModeSense6Command { get; } public ICommand SaveModeSense6Command { get; }
public ReactiveCommand<Unit, Task> SaveModeSense10Command { get; } public ICommand SaveModeSense10Command { get; }
public ReactiveCommand<Unit, Task> SaveEvpdPageCommand { get; } public ICommand SaveEvpdPageCommand { get; }
public ReactiveCommand<Unit, Task> SaveMmcFeaturesCommand { get; } public ICommand SaveMmcFeaturesCommand { get; }
public object SelectedModeSensePage public object SelectedModeSensePage
{ {
@@ -738,16 +735,10 @@ public sealed class ScsiInfoViewModel : ViewModelBase
if(value is ScsiPageModel pageModel) ModeSensePageText = pageModel.Description; if(value is ScsiPageModel pageModel) ModeSensePageText = pageModel.Description;
this.RaiseAndSetIfChanged(ref _selectedModeSensePage, value); SetProperty(ref _selectedModeSensePage, value);
} }
} }
public string ModeSensePageText
{
get => _scsiModeSensePageText;
set => this.RaiseAndSetIfChanged(ref _scsiModeSensePageText, value);
}
public object SelectedEvpdPage public object SelectedEvpdPage
{ {
get => _selectedEvpdPage; get => _selectedEvpdPage;
@@ -757,16 +748,10 @@ public sealed class ScsiInfoViewModel : ViewModelBase
if(value is ScsiPageModel pageModel) EvpdPageText = pageModel.Description; if(value is ScsiPageModel pageModel) EvpdPageText = pageModel.Description;
this.RaiseAndSetIfChanged(ref _selectedEvpdPage, value); SetProperty(ref _selectedEvpdPage, value);
} }
} }
public string EvpdPageText
{
get => _evpdPageText;
set => this.RaiseAndSetIfChanged(ref _evpdPageText, value);
}
public object SelectedMmcFeature public object SelectedMmcFeature
{ {
get => _selectedMmcFeature; get => _selectedMmcFeature;
@@ -776,16 +761,10 @@ public sealed class ScsiInfoViewModel : ViewModelBase
if(value is ScsiPageModel pageModel) MmcFeatureText = pageModel.Description; if(value is ScsiPageModel pageModel) MmcFeatureText = pageModel.Description;
this.RaiseAndSetIfChanged(ref _selectedMmcFeature, value); SetProperty(ref _selectedMmcFeature, value);
} }
} }
public string MmcFeatureText
{
get => _mmcFeatureText;
set => this.RaiseAndSetIfChanged(ref _mmcFeatureText, value);
}
public string InquiryLabel => UI.Title_INQUIRY; public string InquiryLabel => UI.Title_INQUIRY;
public string ScsiInquiryLabel => UI.Title_SCSI_INQUIRY; public string ScsiInquiryLabel => UI.Title_SCSI_INQUIRY;
public string SaveInquiryBinaryLabel => UI.ButtonLabel_Save_binary_to_file; public string SaveInquiryBinaryLabel => UI.ButtonLabel_Save_binary_to_file;
@@ -800,7 +779,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
public string FeatureLabel => UI.Title_Feature; public string FeatureLabel => UI.Title_Feature;
public string SaveMmcFeaturesLabel => UI.ButtonLabel_Save_MMC_GET_CONFIGURATION_response_to_file; public string SaveMmcFeaturesLabel => UI.ButtonLabel_Save_MMC_GET_CONFIGURATION_response_to_file;
async Task ExecuteSaveInquiryBinaryCommand() async Task SaveInquiryBinaryAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -818,7 +797,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveInquiryTextCommand() async Task SaveInquiryTextAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -836,7 +815,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveModeSense6Command() async Task SaveModeSense6Async()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -854,7 +833,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveModeSense10Command() async Task SaveModeSense10Async()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -872,7 +851,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveEvpdPageCommand() async Task SaveEvpdPageAsync()
{ {
if(SelectedEvpdPage is not ScsiPageModel pageModel) return; if(SelectedEvpdPage is not ScsiPageModel pageModel) return;
@@ -892,7 +871,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async Task ExecuteSaveMmcFeaturesCommand() async Task SaveMmcFeaturesAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {

View File

@@ -32,15 +32,15 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.Core.Media.Info; using Aaru.Core.Media.Info;
using Aaru.Decoders.Xbox; using Aaru.Decoders.Xbox;
using Aaru.Localization; using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Tabs; namespace Aaru.Gui.ViewModels.Tabs;
@@ -54,7 +54,7 @@ public sealed class XboxInfoViewModel
{ {
_xboxSecuritySector = securitySector; _xboxSecuritySector = securitySector;
_view = view; _view = view;
SaveXboxSsCommand = ReactiveCommand.Create(ExecuteSaveXboxSsCommand); SaveXboxSsCommand = new AsyncRelayCommand(SaveXboxSsAsync);
if(xgdInfo != null) if(xgdInfo != null)
{ {
@@ -79,17 +79,17 @@ public sealed class XboxInfoViewModel
SaveXboxSsVisible = securitySector != null; SaveXboxSsVisible = securitySector != null;
} }
public ReactiveCommand<Unit, Task> SaveXboxSsCommand { get; } public ICommand SaveXboxSsCommand { get; }
public bool XboxInformationVisible { get; } public bool XboxInformationVisible { get; }
public bool SaveXboxSsVisible { get; } public bool SaveXboxSsVisible { get; }
public string XboxL0VideoText { get; } public string XboxL0VideoText { get; }
public string XboxL1VideoText { get; } public string XboxL1VideoText { get; }
public string XboxMiddleZoneText { get; } public string XboxMiddleZoneText { get; }
public string XboxGameSizeText { get; } public string XboxGameSizeText { get; }
public string XboxTotalSizeText { get; } public string XboxTotalSizeText { get; }
public string XboxRealBreakText { get; } public string XboxRealBreakText { get; }
public string XboxDmiText { get; } public string XboxDmiText { get; }
public string XboxSsText { get; } public string XboxSsText { get; }
public string XboxL0VideoLabel => Localization.Core.Video_layer_zero_size; public string XboxL0VideoLabel => Localization.Core.Video_layer_zero_size;
public string XboxL1VideoLabel => Localization.Core.Video_layer_one_size; public string XboxL1VideoLabel => Localization.Core.Video_layer_one_size;
@@ -101,7 +101,7 @@ public sealed class XboxInfoViewModel
public string XboxSsLabel => UI.Title_Security_Sector; public string XboxSsLabel => UI.Title_Security_Sector;
public string SaveXboxSsLabel => UI.ButtonLabel_Save_Xbox_Security_Sector; public string SaveXboxSsLabel => UI.ButtonLabel_Save_Xbox_Security_Sector;
async Task SaveElement(byte[] data) async Task SaveElementAsync(byte[] data)
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
@@ -119,5 +119,5 @@ public sealed class XboxInfoViewModel
saveFs.Close(); saveFs.Close();
} }
public async Task ExecuteSaveXboxSsCommand() => await SaveElement(_xboxSecuritySector); Task SaveXboxSsAsync() => SaveElementAsync(_xboxSecuritySector);
} }

View File

@@ -30,8 +30,8 @@
// Copyright © 2011-2025 Natalia Portillo // Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/ // ****************************************************************************/
using ReactiveUI; using CommunityToolkit.Mvvm.ComponentModel;
namespace Aaru.Gui.ViewModels; namespace Aaru.Gui.ViewModels;
public class ViewModelBase : ReactiveObject; public class ViewModelBase : ObservableObject;

View File

@@ -46,8 +46,8 @@ using Aaru.Decoders.Xbox;
using Aaru.Gui.Models; using Aaru.Gui.Models;
using Aaru.Helpers; using Aaru.Helpers;
using Aaru.Localization; using Aaru.Localization;
using CommunityToolkit.Mvvm.ComponentModel;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
using BCA = Aaru.Decoders.Bluray.BCA; using BCA = Aaru.Decoders.Bluray.BCA;
using Cartridge = Aaru.Decoders.DVD.Cartridge; using Cartridge = Aaru.Decoders.DVD.Cartridge;
using DDS = Aaru.Decoders.DVD.DDS; using DDS = Aaru.Decoders.DVD.DDS;
@@ -57,14 +57,17 @@ using Spare = Aaru.Decoders.DVD.Spare;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class DecodeMediaTagsViewModel : ViewModelBase public sealed partial class DecodeMediaTagsViewModel : ViewModelBase
{ {
const int HEX_COLUMNS = 32; const int HEX_COLUMNS = 32;
readonly MediaType _mediaType; readonly MediaType _mediaType;
string _decodedText; [ObservableProperty]
bool _decodedVisible; string _decodedText;
string _hexViewText; [ObservableProperty]
MediaTagModel _selectedTag; bool _decodedVisible;
[ObservableProperty]
string _hexViewText;
MediaTagModel _selectedTag;
public DecodeMediaTagsViewModel([NotNull] IMediaImage inputFormat) public DecodeMediaTagsViewModel([NotNull] IMediaImage inputFormat)
{ {
@@ -95,7 +98,7 @@ public sealed class DecodeMediaTagsViewModel : ViewModelBase
get => _selectedTag; get => _selectedTag;
set set
{ {
this.RaiseAndSetIfChanged(ref _selectedTag, value); SetProperty(ref _selectedTag, value);
if(value is null) return; if(value is null) return;
@@ -233,24 +236,6 @@ public sealed class DecodeMediaTagsViewModel : ViewModelBase
} }
} }
public string HexViewText
{
get => _hexViewText;
set => this.RaiseAndSetIfChanged(ref _hexViewText, value);
}
public bool DecodedVisible
{
get => _decodedVisible;
set => this.RaiseAndSetIfChanged(ref _decodedVisible, value);
}
public string DecodedText
{
get => _decodedText;
set => this.RaiseAndSetIfChanged(ref _decodedText, value);
}
public string TagLabel => UI.Title_Tag; public string TagLabel => UI.Title_Tag;
public string HexViewLabel => UI.Title_HexView; public string HexViewLabel => UI.Title_HexView;
public string DecodedLabel => UI.Title_Decoded; public string DecodedLabel => UI.Title_Decoded;

View File

@@ -33,8 +33,8 @@
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Reactive;
using System.Threading; using System.Threading;
using System.Windows.Input;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs;
@@ -44,54 +44,91 @@ using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Threading; using Avalonia.Threading;
using ReactiveUI; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Sentry; using Sentry;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class ImageChecksumViewModel : ViewModelBase public sealed partial class ImageChecksumViewModel : ViewModelBase
{ {
// How many sectors to read at once // How many sectors to read at once
const uint SECTORS_TO_READ = 256; const uint SECTORS_TO_READ = 256;
const string MODULE_NAME = "Image Checksum ViewModel"; const string MODULE_NAME = "Image Checksum ViewModel";
readonly IMediaImage _inputFormat; readonly IMediaImage _inputFormat;
readonly Window _view; readonly Window _view;
bool _adler32Checked; [ObservableProperty]
bool _cancel; bool _adler32Checked;
bool _checksumMediaChecked; [ObservableProperty]
bool _checksumTracksChecked; bool _cancel;
bool _checksumTracksVisible; [ObservableProperty]
bool _closeCommandEnabled; bool _checksumMediaChecked;
bool _closeCommandVisible; [ObservableProperty]
bool _crc16Checked; bool _checksumTracksChecked;
bool _crc32Checked; [ObservableProperty]
bool _crc64Checked; bool _checksumTracksVisible;
bool _fletcher16Checked; [ObservableProperty]
bool _fletcher32Checked; bool _closeCommandEnabled;
bool _md5Checked; [ObservableProperty]
bool _mediaChecksumsVisible; bool _closeCommandVisible;
bool _optionsEnabled; [ObservableProperty]
bool _progress1Visible; bool _crc16Checked;
double _progress2Max; [ObservableProperty]
string _progress2Text; bool _crc32Checked;
double _progress2Value; [ObservableProperty]
bool _progress2Visible; bool _crc64Checked;
double _progressMax; [ObservableProperty]
string _progressText; bool _fletcher16Checked;
double _progressValue; [ObservableProperty]
bool _progressVisible; bool _fletcher32Checked;
bool _resultsVisible; [ObservableProperty]
bool _sha1Checked; bool _md5Checked;
bool _sha256Checked; [ObservableProperty]
bool _sha384Checked; bool _mediaChecksumsVisible;
bool _sha512Checked; [ObservableProperty]
bool _spamsumChecked; bool _optionsEnabled;
bool _startCommandEnabled; [ObservableProperty]
bool _startCommandVisible; bool _progress1Visible;
bool _stopCommandEnabled; [ObservableProperty]
bool _stopCommandVisible; double _progress2Max;
string _title; [ObservableProperty]
bool _trackChecksumsVisible; string _progress2Text;
[ObservableProperty]
double _progress2Value;
[ObservableProperty]
bool _progress2Visible;
[ObservableProperty]
double _progressMax;
[ObservableProperty]
string _progressText;
[ObservableProperty]
double _progressValue;
[ObservableProperty]
bool _progressVisible;
[ObservableProperty]
bool _resultsVisible;
[ObservableProperty]
bool _sha1Checked;
[ObservableProperty]
bool _sha256Checked;
[ObservableProperty]
bool _sha384Checked;
[ObservableProperty]
bool _sha512Checked;
[ObservableProperty]
bool _spamsumChecked;
[ObservableProperty]
bool _startCommandEnabled;
[ObservableProperty]
bool _startCommandVisible;
[ObservableProperty]
bool _stopCommandEnabled;
[ObservableProperty]
bool _stopCommandVisible;
[ObservableProperty]
string _title;
[ObservableProperty]
bool _trackChecksumsVisible;
public ImageChecksumViewModel(IMediaImage inputFormat, Window view) public ImageChecksumViewModel(IMediaImage inputFormat, Window view)
{ {
@@ -110,9 +147,9 @@ public sealed class ImageChecksumViewModel : ViewModelBase
SpamsumChecked = true; SpamsumChecked = true;
TrackChecksums = []; TrackChecksums = [];
MediaChecksums = []; MediaChecksums = [];
StartCommand = ReactiveCommand.Create(ExecuteStartCommand); StartCommand = new RelayCommand(Start);
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
StopCommand = ReactiveCommand.Create(ExecuteStopCommand); StopCommand = new RelayCommand(Stop);
StopCommandVisible = false; StopCommandVisible = false;
StartCommandVisible = true; StartCommandVisible = true;
CloseCommandVisible = true; CloseCommandVisible = true;
@@ -154,223 +191,13 @@ public sealed class ImageChecksumViewModel : ViewModelBase
public string CloseLabel => UI.ButtonLabel_Close; public string CloseLabel => UI.ButtonLabel_Close;
public string StopLabel => UI.ButtonLabel_Stop; public string StopLabel => UI.ButtonLabel_Stop;
public string Title
{
get => _title;
set => this.RaiseAndSetIfChanged(ref _title, value);
}
public bool OptionsEnabled
{
get => _optionsEnabled;
set => this.RaiseAndSetIfChanged(ref _optionsEnabled, value);
}
public bool ChecksumMediaChecked
{
get => _checksumMediaChecked;
set => this.RaiseAndSetIfChanged(ref _checksumMediaChecked, value);
}
public bool ChecksumTracksChecked
{
get => _checksumTracksChecked;
set => this.RaiseAndSetIfChanged(ref _checksumTracksChecked, value);
}
public bool Adler32Checked
{
get => _adler32Checked;
set => this.RaiseAndSetIfChanged(ref _adler32Checked, value);
}
public bool Crc16Checked
{
get => _crc16Checked;
set => this.RaiseAndSetIfChanged(ref _crc16Checked, value);
}
public bool Crc32Checked
{
get => _crc32Checked;
set => this.RaiseAndSetIfChanged(ref _crc32Checked, value);
}
public bool Crc64Checked
{
get => _crc64Checked;
set => this.RaiseAndSetIfChanged(ref _crc64Checked, value);
}
public bool Fletcher16Checked
{
get => _fletcher16Checked;
set => this.RaiseAndSetIfChanged(ref _fletcher16Checked, value);
}
public bool Fletcher32Checked
{
get => _fletcher32Checked;
set => this.RaiseAndSetIfChanged(ref _fletcher32Checked, value);
}
public bool Md5Checked
{
get => _md5Checked;
set => this.RaiseAndSetIfChanged(ref _md5Checked, value);
}
public bool Sha1Checked
{
get => _sha1Checked;
set => this.RaiseAndSetIfChanged(ref _sha1Checked, value);
}
public bool Sha256Checked
{
get => _sha256Checked;
set => this.RaiseAndSetIfChanged(ref _sha256Checked, value);
}
public bool Sha384Checked
{
get => _sha384Checked;
set => this.RaiseAndSetIfChanged(ref _sha384Checked, value);
}
public bool Sha512Checked
{
get => _sha512Checked;
set => this.RaiseAndSetIfChanged(ref _sha512Checked, value);
}
public bool SpamsumChecked
{
get => _spamsumChecked;
set => this.RaiseAndSetIfChanged(ref _spamsumChecked, value);
}
public bool ResultsVisible
{
get => _resultsVisible;
set => this.RaiseAndSetIfChanged(ref _resultsVisible, value);
}
public bool TrackChecksumsVisible
{
get => _trackChecksumsVisible;
set => this.RaiseAndSetIfChanged(ref _trackChecksumsVisible, value);
}
public bool MediaChecksumsVisible
{
get => _mediaChecksumsVisible;
set => this.RaiseAndSetIfChanged(ref _mediaChecksumsVisible, value);
}
public bool ProgressVisible
{
get => _progressVisible;
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
}
public bool Progress1Visible
{
get => _progress1Visible;
set => this.RaiseAndSetIfChanged(ref _progress1Visible, value);
}
public string ProgressText
{
get => _progressText;
set => this.RaiseAndSetIfChanged(ref _progressText, value);
}
public double ProgressMax
{
get => _progressMax;
set => this.RaiseAndSetIfChanged(ref _progressMax, value);
}
public double ProgressValue
{
get => _progressValue;
set => this.RaiseAndSetIfChanged(ref _progressValue, value);
}
public bool Progress2Visible
{
get => _progress2Visible;
set => this.RaiseAndSetIfChanged(ref _progress2Visible, value);
}
public string Progress2Text
{
get => _progress2Text;
set => this.RaiseAndSetIfChanged(ref _progress2Text, value);
}
public double Progress2Max
{
get => _progress2Max;
set => this.RaiseAndSetIfChanged(ref _progress2Max, value);
}
public double Progress2Value
{
get => _progress2Value;
set => this.RaiseAndSetIfChanged(ref _progress2Value, value);
}
public bool StartCommandEnabled
{
get => _startCommandEnabled;
set => this.RaiseAndSetIfChanged(ref _startCommandEnabled, value);
}
public bool StartCommandVisible
{
get => _startCommandVisible;
set => this.RaiseAndSetIfChanged(ref _startCommandVisible, value);
}
public bool CloseCommandEnabled
{
get => _closeCommandEnabled;
set => this.RaiseAndSetIfChanged(ref _closeCommandEnabled, value);
}
public bool CloseCommandVisible
{
get => _closeCommandVisible;
set => this.RaiseAndSetIfChanged(ref _closeCommandVisible, value);
}
public bool StopCommandEnabled
{
get => _stopCommandEnabled;
set => this.RaiseAndSetIfChanged(ref _stopCommandEnabled, value);
}
public bool StopCommandVisible
{
get => _stopCommandVisible;
set => this.RaiseAndSetIfChanged(ref _stopCommandVisible, value);
}
public bool ChecksumTracksVisible
{
get => _checksumTracksVisible;
set => this.RaiseAndSetIfChanged(ref _stopCommandVisible, value);
}
public ObservableCollection<ChecksumModel> TrackChecksums { get; } public ObservableCollection<ChecksumModel> TrackChecksums { get; }
public ObservableCollection<ChecksumModel> MediaChecksums { get; } public ObservableCollection<ChecksumModel> MediaChecksums { get; }
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ICommand StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ICommand StopCommand { get; }
void ExecuteStartCommand() void Start()
{ {
OptionsEnabled = false; OptionsEnabled = false;
CloseCommandVisible = false; CloseCommandVisible = false;
@@ -386,9 +213,9 @@ public sealed class ImageChecksumViewModel : ViewModelBase
}.Start(); }.Start();
} }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
internal void ExecuteStopCommand() internal void Stop()
{ {
_cancel = true; _cancel = true;
StopCommandEnabled = false; StopCommandEnabled = false;

View File

@@ -36,11 +36,11 @@ using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
@@ -55,9 +55,10 @@ using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using Avalonia.Threading; using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using MsBox.Avalonia; using MsBox.Avalonia;
using MsBox.Avalonia.Enums; using MsBox.Avalonia.Enums;
using ReactiveUI;
using Sentry; using Sentry;
using ImageInfo = Aaru.CommonTypes.Structs.ImageInfo; using ImageInfo = Aaru.CommonTypes.Structs.ImageInfo;
using Track = Aaru.CommonTypes.Structs.Track; using Track = Aaru.CommonTypes.Structs.Track;
@@ -66,70 +67,130 @@ using Version = Aaru.CommonTypes.Interop.Version;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
[SuppressMessage("ReSharper", "AsyncVoidLambda")] [SuppressMessage("ReSharper", "AsyncVoidLambda")]
public sealed class ImageConvertViewModel : ViewModelBase public sealed partial class ImageConvertViewModel : ViewModelBase
{ {
readonly IMediaImage _inputFormat; readonly IMediaImage _inputFormat;
readonly Window _view; readonly Window _view;
Metadata _aaruMetadata; [ObservableProperty]
bool _aaruMetadataFromImageVisible; Metadata _aaruMetadata;
bool _cancel; [ObservableProperty]
bool _closeVisible; bool _aaruMetadataFromImageVisible;
string _commentsText; [ObservableProperty]
bool _commentsVisible; bool _cancel;
string _creatorText; [ObservableProperty]
bool _creatorVisible; bool _closeVisible;
bool _destinationEnabled; [ObservableProperty]
string _destinationText; string _commentsText;
bool _destinationVisible; [ObservableProperty]
string _driveFirmwareRevisionText; bool _commentsVisible;
bool _driveFirmwareRevisionVisible; [ObservableProperty]
string _driveManufacturerText; string _creatorText;
bool _driveManufacturerVisible; [ObservableProperty]
string _driveModelText; bool _creatorVisible;
bool _driveModelVisible; [ObservableProperty]
string _driveSerialNumberText; bool _destinationEnabled;
bool _driveSerialNumberVisible; [ObservableProperty]
List<DumpHardware> _dumpHardware; string _destinationText;
bool _forceChecked; [ObservableProperty]
bool _formatReadOnly; bool _destinationVisible;
double _lastMediaSequenceValue; [ObservableProperty]
bool _lastMediaSequenceVisible; string _driveFirmwareRevisionText;
string _mediaBarcodeText; [ObservableProperty]
bool _mediaBarcodeVisible; bool _driveFirmwareRevisionVisible;
string _mediaManufacturerText; [ObservableProperty]
bool _mediaManufacturerVisible; string _driveManufacturerText;
string _mediaModelText; [ObservableProperty]
bool _mediaModelVisible; bool _driveManufacturerVisible;
string _mediaPartNumberText; [ObservableProperty]
bool _mediaPartNumberVisible; string _driveModelText;
double _mediaSequenceValue; [ObservableProperty]
bool _mediaSequenceVisible; bool _driveModelVisible;
string _mediaSerialNumberText; [ObservableProperty]
bool _mediaSerialNumberVisible; string _driveSerialNumberText;
string _mediaTitleText; [ObservableProperty]
bool _mediaTitleVisible; bool _driveSerialNumberVisible;
string _metadataJsonText; [ObservableProperty]
bool _optionsVisible; List<DumpHardware> _dumpHardware;
bool _progress1Visible; [ObservableProperty]
bool _progress2Indeterminate; bool _forceChecked;
double _progress2MaxValue; [ObservableProperty]
string _progress2Text; bool _formatReadOnly;
double _progress2Value; [ObservableProperty]
bool _progress2Visible; double _lastMediaSequenceValue;
bool _progressIndeterminate; [ObservableProperty]
double _progressMaxValue; bool _lastMediaSequenceVisible;
string _progressText; [ObservableProperty]
double _progressValue; string _mediaBarcodeText;
bool _progressVisible; [ObservableProperty]
bool _resumeFileFromImageVisible; bool _mediaBarcodeVisible;
string _resumeFileText; [ObservableProperty]
double _sectorsValue; string _mediaManufacturerText;
ImagePluginModel _selectedPlugin; [ObservableProperty]
string _sourceText; bool _mediaManufacturerVisible;
bool _startVisible; [ObservableProperty]
bool _stopEnabled; string _mediaModelText;
bool _stopVisible; [ObservableProperty]
string _title; bool _mediaModelVisible;
[ObservableProperty]
string _mediaPartNumberText;
[ObservableProperty]
bool _mediaPartNumberVisible;
[ObservableProperty]
double _mediaSequenceValue;
[ObservableProperty]
bool _mediaSequenceVisible;
[ObservableProperty]
string _mediaSerialNumberText;
[ObservableProperty]
bool _mediaSerialNumberVisible;
[ObservableProperty]
string _mediaTitleText;
[ObservableProperty]
bool _mediaTitleVisible;
[ObservableProperty]
string _metadataJsonText;
[ObservableProperty]
bool _optionsVisible;
[ObservableProperty]
bool _progress1Visible;
[ObservableProperty]
bool _progress2Indeterminate;
[ObservableProperty]
double _progress2MaxValue;
[ObservableProperty]
string _progress2Text;
[ObservableProperty]
double _progress2Value;
[ObservableProperty]
bool _progress2Visible;
[ObservableProperty]
bool _progressIndeterminate;
[ObservableProperty]
double _progressMaxValue;
[ObservableProperty]
string _progressText;
[ObservableProperty]
double _progressValue;
[ObservableProperty]
bool _progressVisible;
[ObservableProperty]
bool _resumeFileFromImageVisible;
[ObservableProperty]
string _resumeFileText;
[ObservableProperty]
double _sectorsValue;
[ObservableProperty]
ImagePluginModel _selectedPlugin;
[ObservableProperty]
string _sourceText;
[ObservableProperty]
bool _startVisible;
[ObservableProperty]
bool _stopEnabled;
[ObservableProperty]
bool _stopVisible;
[ObservableProperty]
string _title;
public ImageConvertViewModel([JetBrains.Annotations.NotNull] IMediaImage inputFormat, string imageSource, public ImageConvertViewModel([JetBrains.Annotations.NotNull] IMediaImage inputFormat, string imageSource,
Window view) Window view)
@@ -137,28 +198,28 @@ public sealed class ImageConvertViewModel : ViewModelBase
_view = view; _view = view;
_inputFormat = inputFormat; _inputFormat = inputFormat;
_cancel = false; _cancel = false;
DestinationCommand = ReactiveCommand.Create(ExecuteDestinationCommand); DestinationCommand = new AsyncRelayCommand(DestinationAsync);
CreatorCommand = ReactiveCommand.Create(ExecuteCreatorCommand); CreatorCommand = new RelayCommand(Creator);
MediaTitleCommand = ReactiveCommand.Create(ExecuteMediaTitleCommand); MediaTitleCommand = new RelayCommand(MediaTitle);
MediaManufacturerCommand = ReactiveCommand.Create(ExecuteMediaManufacturerCommand); MediaManufacturerCommand = new RelayCommand(MediaManufacturer);
MediaModelCommand = ReactiveCommand.Create(ExecuteMediaModelCommand); MediaModelCommand = new RelayCommand(MediaModel);
MediaSerialNumberCommand = ReactiveCommand.Create(ExecuteMediaSerialNumberCommand); MediaSerialNumberCommand = new RelayCommand(MediaSerialNumber);
MediaBarcodeCommand = ReactiveCommand.Create(ExecuteMediaBarcodeCommand); MediaBarcodeCommand = new RelayCommand(MediaBarcode);
MediaPartNumberCommand = ReactiveCommand.Create(ExecuteMediaPartNumberCommand); MediaPartNumberCommand = new RelayCommand(MediaPartNumber);
MediaSequenceCommand = ReactiveCommand.Create(ExecuteMediaSequenceCommand); MediaSequenceCommand = new RelayCommand(MediaSequence);
LastMediaSequenceCommand = ReactiveCommand.Create(ExecuteLastMediaSequenceCommand); LastMediaSequenceCommand = new RelayCommand(LastMediaSequence);
DriveManufacturerCommand = ReactiveCommand.Create(ExecuteDriveManufacturerCommand); DriveManufacturerCommand = new RelayCommand(DriveManufacturer);
DriveModelCommand = ReactiveCommand.Create(ExecuteDriveModelCommand); DriveModelCommand = new RelayCommand(DriveModel);
DriveSerialNumberCommand = ReactiveCommand.Create(ExecuteDriveSerialNumberCommand); DriveSerialNumberCommand = new RelayCommand(DriveSerialNumber);
DriveFirmwareRevisionCommand = ReactiveCommand.Create(ExecuteDriveFirmwareRevisionCommand); DriveFirmwareRevisionCommand = new RelayCommand(DriveFirmwareRevision);
CommentsCommand = ReactiveCommand.Create(ExecuteCommentsCommand); CommentsCommand = new RelayCommand(Comments);
AaruMetadataFromImageCommand = ReactiveCommand.Create(ExecuteAaruMetadataFromImageCommand); AaruMetadataFromImageCommand = new RelayCommand(AaruMetadataFromImage);
AaruMetadataCommand = ReactiveCommand.Create(ExecuteAaruMetadataCommand); AaruMetadataCommand = new AsyncRelayCommand(AaruMetadataAsync);
ResumeFileFromImageCommand = ReactiveCommand.Create(ExecuteResumeFileFromImageCommand); ResumeFileFromImageCommand = new RelayCommand(ResumeFileFromImage);
ResumeFileCommand = ReactiveCommand.Create(ExecuteResumeFileCommand); ResumeFileCommand = new AsyncRelayCommand(ResumeFileAsync);
StartCommand = ReactiveCommand.Create(ExecuteStartCommand); StartCommand = new AsyncRelayCommand(StartAsync);
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
StopCommand = ReactiveCommand.Create(ExecuteStopCommand); StopCommand = new RelayCommand(Stop);
SourceText = imageSource; SourceText = imageSource;
CreatorVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.Creator); CreatorVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.Creator);
MediaTitleVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.MediaTitle); MediaTitleVisible = !string.IsNullOrWhiteSpace(inputFormat.Info.MediaTitle);
@@ -200,401 +261,58 @@ public sealed class ImageConvertViewModel : ViewModelBase
ResumeFileText = _dumpHardware == null ? "" : UI._From_image_; ResumeFileText = _dumpHardware == null ? "" : UI._From_image_;
} }
public string SourceImageLabel => UI.Source_image; public string SourceImageLabel => UI.Source_image;
public string OutputFormatLabel => UI.Output_format; public string OutputFormatLabel => UI.Output_format;
public string ChooseLabel => UI.ButtonLabel_Choose; public string ChooseLabel => UI.ButtonLabel_Choose;
public string SectorsLabel => UI.How_many_sectors_to_convert_at_once; public string SectorsLabel => UI.How_many_sectors_to_convert_at_once;
public string ForceLabel => UI.Continue_conversion_even_if_data_lost; public string ForceLabel => UI.Continue_conversion_even_if_data_lost;
public string CreatorLabel => UI.Who_person_created_the_image; public string CreatorLabel => UI.Who_person_created_the_image;
public string GetFromSourceImageLabel => UI.ButtonLabel_Get_from_source_image; public string GetFromSourceImageLabel => UI.ButtonLabel_Get_from_source_image;
public string MetadataLabel => UI.Title_Metadata; public string MetadataLabel => UI.Title_Metadata;
public string MediaLabel => UI.Title_Media; public string MediaLabel => UI.Title_Media;
public string TitleLabel => UI.Title_Title; public string TitleLabel => UI.Title_Title;
public string ManufacturerLabel => UI.Title_Manufacturer; public string ManufacturerLabel => UI.Title_Manufacturer;
public string ModelLabel => UI.Title_Model; public string ModelLabel => UI.Title_Model;
public string SerialNumberLabel => UI.Title_Serial_number; public string SerialNumberLabel => UI.Title_Serial_number;
public string BarcodeLabel => UI.Title_Barcode; public string BarcodeLabel => UI.Title_Barcode;
public string PartNumberLabel => UI.Title_Part_number; public string PartNumberLabel => UI.Title_Part_number;
public string NumberInSequenceLabel => UI.Title_Number_in_sequence; public string NumberInSequenceLabel => UI.Title_Number_in_sequence;
public string LastMediaOfTheSequenceLabel => UI.Title_Last_media_of_the_sequence; public string LastMediaOfTheSequenceLabel => UI.Title_Last_media_of_the_sequence;
public string DriveLabel => UI.Title_Drive; public string DriveLabel => UI.Title_Drive;
public string FirmwareRevisionLabel => UI.Title_Firmware_revision; public string FirmwareRevisionLabel => UI.Title_Firmware_revision;
public string CommentsLabel => UI.Title_Comments; public string CommentsLabel => UI.Title_Comments;
public string AaruMetadataLabel => UI.Title_Existing_Aaru_Metadata_sidecar; public string AaruMetadataLabel => UI.Title_Existing_Aaru_Metadata_sidecar;
public string FromImageLabel => UI.Title_From_image; public string FromImageLabel => UI.Title_From_image;
public string ResumeFileLabel => UI.Title_Existing_resume_file; public string ResumeFileLabel => UI.Title_Existing_resume_file;
public string StartLabel => UI.ButtonLabel_Start; public string StartLabel => UI.ButtonLabel_Start;
public string CloseLabel => UI.ButtonLabel_Close; public string CloseLabel => UI.ButtonLabel_Close;
public string StopLabel => UI.ButtonLabel_Stop; public string StopLabel => UI.ButtonLabel_Stop;
public string Title
{
get => _title;
set => this.RaiseAndSetIfChanged(ref _title, value);
}
public string SourceText
{
get => _sourceText;
set => this.RaiseAndSetIfChanged(ref _sourceText, value);
}
public ObservableCollection<ImagePluginModel> PluginsList { get; } public ObservableCollection<ImagePluginModel> PluginsList { get; }
public ImagePluginModel SelectedPlugin public ICommand DestinationCommand { get; }
{ public ICommand CreatorCommand { get; }
get => _selectedPlugin; public ICommand MediaTitleCommand { get; }
set => this.RaiseAndSetIfChanged(ref _selectedPlugin, value); public ICommand MediaManufacturerCommand { get; }
} public ICommand MediaModelCommand { get; }
public ICommand MediaSerialNumberCommand { get; }
public ICommand MediaBarcodeCommand { get; }
public ICommand MediaPartNumberCommand { get; }
public ICommand MediaSequenceCommand { get; }
public ICommand LastMediaSequenceCommand { get; }
public ICommand DriveManufacturerCommand { get; }
public ICommand DriveModelCommand { get; }
public ICommand DriveSerialNumberCommand { get; }
public ICommand DriveFirmwareRevisionCommand { get; }
public ICommand CommentsCommand { get; }
public ICommand AaruMetadataFromImageCommand { get; }
public ICommand AaruMetadataCommand { get; }
public ICommand ResumeFileFromImageCommand { get; }
public ICommand ResumeFileCommand { get; }
public ICommand StartCommand { get; }
public ICommand CloseCommand { get; }
public ICommand StopCommand { get; }
public string DestinationText async Task StartAsync()
{
get => _destinationText;
set => this.RaiseAndSetIfChanged(ref _destinationText, value);
}
public bool OptionsVisible
{
get => _optionsVisible;
set => this.RaiseAndSetIfChanged(ref _optionsVisible, value);
}
public double SectorsValue
{
get => _sectorsValue;
set => this.RaiseAndSetIfChanged(ref _sectorsValue, value);
}
public bool ForceChecked
{
get => _forceChecked;
set => this.RaiseAndSetIfChanged(ref _forceChecked, value);
}
public string CreatorText
{
get => _creatorText;
set => this.RaiseAndSetIfChanged(ref _creatorText, value);
}
public string MediaTitleText
{
get => _mediaTitleText;
set => this.RaiseAndSetIfChanged(ref _mediaTitleText, value);
}
public string MediaManufacturerText
{
get => _mediaManufacturerText;
set => this.RaiseAndSetIfChanged(ref _mediaManufacturerText, value);
}
public string MediaModelText
{
get => _mediaModelText;
set => this.RaiseAndSetIfChanged(ref _mediaModelText, value);
}
public string MediaSerialNumberText
{
get => _mediaSerialNumberText;
set => this.RaiseAndSetIfChanged(ref _mediaSerialNumberText, value);
}
public string MediaBarcodeText
{
get => _mediaBarcodeText;
set => this.RaiseAndSetIfChanged(ref _mediaBarcodeText, value);
}
public string MediaPartNumberText
{
get => _mediaPartNumberText;
set => this.RaiseAndSetIfChanged(ref _mediaPartNumberText, value);
}
public double MediaSequenceValue
{
get => _mediaSequenceValue;
set => this.RaiseAndSetIfChanged(ref _mediaSequenceValue, value);
}
public double LastMediaSequenceValue
{
get => _lastMediaSequenceValue;
set => this.RaiseAndSetIfChanged(ref _lastMediaSequenceValue, value);
}
public string DriveManufacturerText
{
get => _driveManufacturerText;
set => this.RaiseAndSetIfChanged(ref _driveManufacturerText, value);
}
public string DriveModelText
{
get => _driveModelText;
set => this.RaiseAndSetIfChanged(ref _driveModelText, value);
}
public string DriveSerialNumberText
{
get => _driveSerialNumberText;
set => this.RaiseAndSetIfChanged(ref _driveSerialNumberText, value);
}
public string DriveFirmwareRevisionText
{
get => _driveFirmwareRevisionText;
set => this.RaiseAndSetIfChanged(ref _driveFirmwareRevisionText, value);
}
public string CommentsText
{
get => _commentsText;
set => this.RaiseAndSetIfChanged(ref _commentsText, value);
}
public string MetadataJsonText
{
get => _metadataJsonText;
set => this.RaiseAndSetIfChanged(ref _metadataJsonText, value);
}
public string ResumeFileText
{
get => _resumeFileText;
set => this.RaiseAndSetIfChanged(ref _resumeFileText, value);
}
public bool ProgressVisible
{
get => _progressVisible;
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
}
public bool Progress1Visible
{
get => _progress1Visible;
set => this.RaiseAndSetIfChanged(ref _progress1Visible, value);
}
public string ProgressText
{
get => _progressText;
set => this.RaiseAndSetIfChanged(ref _progressText, value);
}
public double ProgressValue
{
get => _progressValue;
set => this.RaiseAndSetIfChanged(ref _progressValue, value);
}
public double ProgressMaxValue
{
get => _progressMaxValue;
set => this.RaiseAndSetIfChanged(ref _progressMaxValue, value);
}
public bool ProgressIndeterminate
{
get => _progressIndeterminate;
set => this.RaiseAndSetIfChanged(ref _progressIndeterminate, value);
}
public bool Progress2Visible
{
get => _progress2Visible;
set => this.RaiseAndSetIfChanged(ref _progress2Visible, value);
}
public string Progress2Text
{
get => _progress2Text;
set => this.RaiseAndSetIfChanged(ref _progress2Text, value);
}
public double Progress2Value
{
get => _progress2Value;
set => this.RaiseAndSetIfChanged(ref _progress2Value, value);
}
public double Progress2MaxValue
{
get => _progress2MaxValue;
set => this.RaiseAndSetIfChanged(ref _progress2MaxValue, value);
}
public bool Progress2Indeterminate
{
get => _progress2Indeterminate;
set => this.RaiseAndSetIfChanged(ref _progress2Indeterminate, value);
}
public bool StartVisible
{
get => _startVisible;
set => this.RaiseAndSetIfChanged(ref _startVisible, value);
}
public bool CloseVisible
{
get => _closeVisible;
set => this.RaiseAndSetIfChanged(ref _closeVisible, value);
}
public bool StopVisible
{
get => _stopVisible;
set => this.RaiseAndSetIfChanged(ref _stopVisible, value);
}
public bool StopEnabled
{
get => _stopEnabled;
set => this.RaiseAndSetIfChanged(ref _stopEnabled, value);
}
public bool CreatorVisible
{
get => _creatorVisible;
set => this.RaiseAndSetIfChanged(ref _creatorVisible, value);
}
public bool MediaTitleVisible
{
get => _mediaTitleVisible;
set => this.RaiseAndSetIfChanged(ref _mediaTitleVisible, value);
}
public bool CommentsVisible
{
get => _commentsVisible;
set => this.RaiseAndSetIfChanged(ref _commentsVisible, value);
}
public bool MediaManufacturerVisible
{
get => _mediaManufacturerVisible;
set => this.RaiseAndSetIfChanged(ref _mediaManufacturerVisible, value);
}
public bool MediaModelVisible
{
get => _mediaModelVisible;
set => this.RaiseAndSetIfChanged(ref _mediaModelVisible, value);
}
public bool MediaSerialNumberVisible
{
get => _mediaSerialNumberVisible;
set => this.RaiseAndSetIfChanged(ref _mediaSerialNumberVisible, value);
}
public bool MediaBarcodeVisible
{
get => _mediaBarcodeVisible;
set => this.RaiseAndSetIfChanged(ref _mediaBarcodeVisible, value);
}
public bool MediaPartNumberVisible
{
get => _mediaPartNumberVisible;
set => this.RaiseAndSetIfChanged(ref _mediaPartNumberVisible, value);
}
public bool MediaSequenceVisible
{
get => _mediaSequenceVisible;
set => this.RaiseAndSetIfChanged(ref _mediaSequenceVisible, value);
}
public bool LastMediaSequenceVisible
{
get => _lastMediaSequenceVisible;
set => this.RaiseAndSetIfChanged(ref _lastMediaSequenceVisible, value);
}
public bool DriveManufacturerVisible
{
get => _driveManufacturerVisible;
set => this.RaiseAndSetIfChanged(ref _driveManufacturerVisible, value);
}
public bool DriveModelVisible
{
get => _driveModelVisible;
set => this.RaiseAndSetIfChanged(ref _driveModelVisible, value);
}
public bool DriveSerialNumberVisible
{
get => _driveSerialNumberVisible;
set => this.RaiseAndSetIfChanged(ref _driveSerialNumberVisible, value);
}
public bool DriveFirmwareRevisionVisible
{
get => _driveFirmwareRevisionVisible;
set => this.RaiseAndSetIfChanged(ref _driveFirmwareRevisionVisible, value);
}
public bool AaruMetadataFromImageVisible
{
get => _aaruMetadataFromImageVisible;
set => this.RaiseAndSetIfChanged(ref _aaruMetadataFromImageVisible, value);
}
public bool ResumeFileFromImageVisible
{
get => _resumeFileFromImageVisible;
set => this.RaiseAndSetIfChanged(ref _resumeFileFromImageVisible, value);
}
public bool DestinationEnabled
{
get => _destinationEnabled;
set => this.RaiseAndSetIfChanged(ref _destinationEnabled, value);
}
public ReactiveCommand<Unit, Task> DestinationCommand { get; }
public ReactiveCommand<Unit, Unit> CreatorCommand { get; }
public ReactiveCommand<Unit, Unit> MediaTitleCommand { get; }
public ReactiveCommand<Unit, Unit> MediaManufacturerCommand { get; }
public ReactiveCommand<Unit, Unit> MediaModelCommand { get; }
public ReactiveCommand<Unit, Unit> MediaSerialNumberCommand { get; }
public ReactiveCommand<Unit, Unit> MediaBarcodeCommand { get; }
public ReactiveCommand<Unit, Unit> MediaPartNumberCommand { get; }
public ReactiveCommand<Unit, Unit> MediaSequenceCommand { get; }
public ReactiveCommand<Unit, Unit> LastMediaSequenceCommand { get; }
public ReactiveCommand<Unit, Unit> DriveManufacturerCommand { get; }
public ReactiveCommand<Unit, Unit> DriveModelCommand { get; }
public ReactiveCommand<Unit, Unit> DriveSerialNumberCommand { get; }
public ReactiveCommand<Unit, Unit> DriveFirmwareRevisionCommand { get; }
public ReactiveCommand<Unit, Unit> CommentsCommand { get; }
public ReactiveCommand<Unit, Unit> AaruMetadataFromImageCommand { get; }
public ReactiveCommand<Unit, Task> AaruMetadataCommand { get; }
public ReactiveCommand<Unit, Unit> ResumeFileFromImageCommand { get; }
public ReactiveCommand<Unit, Task> ResumeFileCommand { get; }
public ReactiveCommand<Unit, Task> StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; }
public bool FormatReadOnly
{
get => _formatReadOnly;
set => this.RaiseAndSetIfChanged(ref _formatReadOnly, value);
}
public bool DestinationVisible
{
get => _destinationVisible;
set => this.RaiseAndSetIfChanged(ref _destinationVisible, value);
}
async Task ExecuteStartCommand()
{ {
if(SelectedPlugin is null) if(SelectedPlugin is null)
{ {
@@ -1894,9 +1612,9 @@ public sealed class ImageConvertViewModel : ViewModelBase
Statistics.AddCommand("convert-image"); Statistics.AddCommand("convert-image");
} }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
internal void ExecuteStopCommand() internal void Stop()
{ {
_cancel = true; _cancel = true;
StopEnabled = false; StopEnabled = false;
@@ -2036,7 +1754,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
grpOptions.Content = stkImageOptions; grpOptions.Content = stkImageOptions;
} }
*/ */
async Task ExecuteDestinationCommand() async Task DestinationAsync()
{ {
if(SelectedPlugin is null) return; if(SelectedPlugin is null) return;
@@ -2065,41 +1783,41 @@ public sealed class ImageConvertViewModel : ViewModelBase
DestinationText += SelectedPlugin.Plugin.KnownExtensions.First(); DestinationText += SelectedPlugin.Plugin.KnownExtensions.First();
} }
void ExecuteCreatorCommand() => CreatorText = _inputFormat.Info.Creator; void Creator() => CreatorText = _inputFormat.Info.Creator;
void ExecuteMediaTitleCommand() => MediaTitleText = _inputFormat.Info.MediaTitle; void MediaTitle() => MediaTitleText = _inputFormat.Info.MediaTitle;
void ExecuteCommentsCommand() => CommentsText = _inputFormat.Info.Comments; void Comments() => CommentsText = _inputFormat.Info.Comments;
void ExecuteMediaManufacturerCommand() => MediaManufacturerText = _inputFormat.Info.MediaManufacturer; void MediaManufacturer() => MediaManufacturerText = _inputFormat.Info.MediaManufacturer;
void ExecuteMediaModelCommand() => MediaModelText = _inputFormat.Info.MediaModel; void MediaModel() => MediaModelText = _inputFormat.Info.MediaModel;
void ExecuteMediaSerialNumberCommand() => MediaSerialNumberText = _inputFormat.Info.MediaSerialNumber; void MediaSerialNumber() => MediaSerialNumberText = _inputFormat.Info.MediaSerialNumber;
void ExecuteMediaBarcodeCommand() => MediaBarcodeText = _inputFormat.Info.MediaBarcode; void MediaBarcode() => MediaBarcodeText = _inputFormat.Info.MediaBarcode;
void ExecuteMediaPartNumberCommand() => MediaPartNumberText = _inputFormat.Info.MediaPartNumber; void MediaPartNumber() => MediaPartNumberText = _inputFormat.Info.MediaPartNumber;
void ExecuteMediaSequenceCommand() => MediaSequenceValue = _inputFormat.Info.MediaSequence; void MediaSequence() => MediaSequenceValue = _inputFormat.Info.MediaSequence;
void ExecuteLastMediaSequenceCommand() => LastMediaSequenceValue = _inputFormat.Info.LastMediaSequence; void LastMediaSequence() => LastMediaSequenceValue = _inputFormat.Info.LastMediaSequence;
void ExecuteDriveManufacturerCommand() => DriveManufacturerText = _inputFormat.Info.DriveManufacturer; void DriveManufacturer() => DriveManufacturerText = _inputFormat.Info.DriveManufacturer;
void ExecuteDriveModelCommand() => DriveModelText = _inputFormat.Info.DriveModel; void DriveModel() => DriveModelText = _inputFormat.Info.DriveModel;
void ExecuteDriveSerialNumberCommand() => DriveSerialNumberText = _inputFormat.Info.DriveSerialNumber; void DriveSerialNumber() => DriveSerialNumberText = _inputFormat.Info.DriveSerialNumber;
void ExecuteDriveFirmwareRevisionCommand() => DriveFirmwareRevisionText = _inputFormat.Info.DriveFirmwareRevision; void DriveFirmwareRevision() => DriveFirmwareRevisionText = _inputFormat.Info.DriveFirmwareRevision;
void ExecuteAaruMetadataFromImageCommand() void AaruMetadataFromImage()
{ {
MetadataJsonText = UI._From_image_; MetadataJsonText = UI._From_image_;
_aaruMetadata = _inputFormat.AaruMetadata; _aaruMetadata = _inputFormat.AaruMetadata;
} }
async Task ExecuteAaruMetadataCommand() async Task AaruMetadataAsync()
{ {
_aaruMetadata = null; _aaruMetadata = null;
MetadataJsonText = ""; MetadataJsonText = "";
@@ -2138,13 +1856,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
} }
} }
void ExecuteResumeFileFromImageCommand() void ResumeFileFromImage()
{ {
ResumeFileText = UI._From_image_; ResumeFileText = UI._From_image_;
_dumpHardware = _inputFormat.DumpHardware; _dumpHardware = _inputFormat.DumpHardware;
} }
async Task ExecuteResumeFileCommand() async Task ResumeFileAsync()
{ {
_dumpHardware = null; _dumpHardware = null;
ResumeFileText = ""; ResumeFileText = "";

View File

@@ -34,8 +34,8 @@ using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Globalization; using System.Globalization;
using System.Reactive;
using System.Threading; using System.Threading;
using System.Windows.Input;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.Core; using Aaru.Core;
using Aaru.Gui.Models; using Aaru.Gui.Models;
@@ -43,53 +43,84 @@ using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Threading; using Avalonia.Threading;
using ReactiveUI; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class ImageEntropyViewModel : ViewModelBase public sealed partial class ImageEntropyViewModel : ViewModelBase
{ {
readonly IMediaImage _inputFormat; readonly IMediaImage _inputFormat;
readonly Window _view; readonly Window _view;
bool _closeVisible; [ObservableProperty]
bool _duplicatedSectorsChecked; bool _closeVisible;
bool _duplicatedSectorsEnabled; [ObservableProperty]
EntropyResults _entropy; bool _duplicatedSectorsChecked;
string _mediaEntropyText; [ObservableProperty]
bool _mediaEntropyVisible; bool _duplicatedSectorsEnabled;
string _mediaUniqueSectorsText; [ObservableProperty]
bool _mediaUniqueSectorsVisible; EntropyResults _entropy;
bool _optionsVisible; [ObservableProperty]
bool _progress1Visible; string _mediaEntropyText;
bool _progress2Indeterminate; [ObservableProperty]
double _progress2Max; bool _mediaEntropyVisible;
string _progress2Text; [ObservableProperty]
double _progress2Value; string _mediaUniqueSectorsText;
bool _progress2Visible; [ObservableProperty]
bool _progressIndeterminate; bool _mediaUniqueSectorsVisible;
double _progressMax; [ObservableProperty]
string _progressText; bool _optionsVisible;
double _progressValue; [ObservableProperty]
bool _progressVisible; bool _progress1Visible;
bool _resultsVisible; [ObservableProperty]
bool _separatedTracksChecked; bool _progress2Indeterminate;
bool _separatedTracksEnabled; [ObservableProperty]
bool _separatedTracksVisible; double _progress2Max;
bool _startVisible; [ObservableProperty]
bool _stopVisible; string _progress2Text;
EntropyResults[] _tracksEntropy; [ObservableProperty]
bool _wholeDiscChecked; double _progress2Value;
bool _wholeDiscEnabled; [ObservableProperty]
bool _wholeDiscVisible; bool _progress2Visible;
[ObservableProperty]
bool _progressIndeterminate;
[ObservableProperty]
double _progressMax;
[ObservableProperty]
string _progressText;
[ObservableProperty]
double _progressValue;
[ObservableProperty]
bool _progressVisible;
[ObservableProperty]
bool _resultsVisible;
[ObservableProperty]
bool _separatedTracksChecked;
[ObservableProperty]
bool _separatedTracksEnabled;
[ObservableProperty]
bool _separatedTracksVisible;
[ObservableProperty]
bool _startVisible;
[ObservableProperty]
bool _stopVisible;
[ObservableProperty]
EntropyResults[] _tracksEntropy;
[ObservableProperty]
bool _wholeDiscChecked;
[ObservableProperty]
bool _wholeDiscEnabled;
[ObservableProperty]
bool _wholeDiscVisible;
public ImageEntropyViewModel(IMediaImage inputFormat, Window view) public ImageEntropyViewModel(IMediaImage inputFormat, Window view)
{ {
_inputFormat = inputFormat; _inputFormat = inputFormat;
_view = view; _view = view;
TrackEntropy = []; TrackEntropy = [];
StartCommand = ReactiveCommand.Create(ExecuteStartCommand); StartCommand = new RelayCommand(Start);
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
StopCommand = ReactiveCommand.Create(ExecuteStopCommand); StopCommand = new RelayCommand(Stop);
OptionsVisible = true; OptionsVisible = true;
DuplicatedSectorsChecked = true; DuplicatedSectorsChecked = true;
SeparatedTracksChecked = true; SeparatedTracksChecked = true;
@@ -121,183 +152,15 @@ public sealed class ImageEntropyViewModel : ViewModelBase
public string CloseLabel => UI.ButtonLabel_Close; public string CloseLabel => UI.ButtonLabel_Close;
public string StopLabel => UI.ButtonLabel_Stop; public string StopLabel => UI.ButtonLabel_Stop;
public bool SeparatedTracksVisible
{
get => _separatedTracksVisible;
set => this.RaiseAndSetIfChanged(ref _separatedTracksVisible, value);
}
public bool WholeDiscVisible
{
get => _wholeDiscVisible;
set => this.RaiseAndSetIfChanged(ref _wholeDiscVisible, value);
}
public bool SeparatedTracksChecked
{
get => _separatedTracksChecked;
set => this.RaiseAndSetIfChanged(ref _separatedTracksChecked, value);
}
public bool WholeDiscChecked
{
get => _wholeDiscChecked;
set => this.RaiseAndSetIfChanged(ref _wholeDiscChecked, value);
}
public bool DuplicatedSectorsEnabled
{
get => _duplicatedSectorsEnabled;
set => this.RaiseAndSetIfChanged(ref _duplicatedSectorsEnabled, value);
}
public bool SeparatedTracksEnabled
{
get => _separatedTracksEnabled;
set => this.RaiseAndSetIfChanged(ref _separatedTracksEnabled, value);
}
public bool WholeDiscEnabled
{
get => _wholeDiscEnabled;
set => this.RaiseAndSetIfChanged(ref _wholeDiscEnabled, value);
}
public bool CloseVisible
{
get => _closeVisible;
set => this.RaiseAndSetIfChanged(ref _closeVisible, value);
}
public bool StartVisible
{
get => _startVisible;
set => this.RaiseAndSetIfChanged(ref _startVisible, value);
}
public bool StopVisible
{
get => _stopVisible;
set => this.RaiseAndSetIfChanged(ref _stopVisible, value);
}
public bool ProgressVisible
{
get => _progressVisible;
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
}
public bool DuplicatedSectorsChecked
{
get => _duplicatedSectorsChecked;
set => this.RaiseAndSetIfChanged(ref _duplicatedSectorsChecked, value);
}
public bool OptionsVisible
{
get => _optionsVisible;
set => this.RaiseAndSetIfChanged(ref _optionsVisible, value);
}
public bool ResultsVisible
{
get => _resultsVisible;
set => this.RaiseAndSetIfChanged(ref _resultsVisible, value);
}
public string MediaEntropyText
{
get => _mediaEntropyText;
set => this.RaiseAndSetIfChanged(ref _mediaEntropyText, value);
}
public bool MediaEntropyVisible
{
get => _mediaEntropyVisible;
set => this.RaiseAndSetIfChanged(ref _mediaEntropyVisible, value);
}
public string MediaUniqueSectorsText
{
get => _mediaUniqueSectorsText;
set => this.RaiseAndSetIfChanged(ref _mediaUniqueSectorsText, value);
}
public bool MediaUniqueSectorsVisible
{
get => _mediaUniqueSectorsVisible;
set => this.RaiseAndSetIfChanged(ref _mediaUniqueSectorsVisible, value);
}
public bool Progress1Visible
{
get => _progress1Visible;
set => this.RaiseAndSetIfChanged(ref _progress1Visible, value);
}
public bool Progress2Visible
{
get => _progress2Visible;
set => this.RaiseAndSetIfChanged(ref _progress2Visible, value);
}
public string ProgressText
{
get => _progressText;
set => this.RaiseAndSetIfChanged(ref _progressText, value);
}
public bool ProgressIndeterminate
{
get => _progressIndeterminate;
set => this.RaiseAndSetIfChanged(ref _progressIndeterminate, value);
}
public double ProgressMax
{
get => _progressMax;
set => this.RaiseAndSetIfChanged(ref _progressMax, value);
}
public double ProgressValue
{
get => _progressValue;
set => this.RaiseAndSetIfChanged(ref _progressValue, value);
}
public string Progress2Text
{
get => _progress2Text;
set => this.RaiseAndSetIfChanged(ref _progress2Text, value);
}
public bool Progress2Indeterminate
{
get => _progress2Indeterminate;
set => this.RaiseAndSetIfChanged(ref _progress2Indeterminate, value);
}
public double Progress2Max
{
get => _progress2Max;
set => this.RaiseAndSetIfChanged(ref _progress2Max, value);
}
public double Progress2Value
{
get => _progress2Value;
set => this.RaiseAndSetIfChanged(ref _progress2Value, value);
}
[JetBrains.Annotations.NotNull] [JetBrains.Annotations.NotNull]
public string Title => UI.Title_Calculating_entropy; public string Title => UI.Title_Calculating_entropy;
public ObservableCollection<TrackEntropyModel> TrackEntropy { get; } public ObservableCollection<TrackEntropyModel> TrackEntropy { get; }
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ICommand StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ICommand StopCommand { get; }
void ExecuteStartCommand() void Start()
{ {
var entropyCalculator = new Entropy(false, _inputFormat); var entropyCalculator = new Entropy(false, _inputFormat);
entropyCalculator.InitProgressEvent += InitProgress; entropyCalculator.InitProgressEvent += InitProgress;
@@ -388,9 +251,9 @@ public sealed class ImageEntropyViewModel : ViewModelBase
MediaUniqueSectorsVisible = true; MediaUniqueSectorsVisible = true;
} }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
internal void ExecuteStopCommand() => throw new NotImplementedException(); internal void Stop() => throw new NotImplementedException();
void InitProgress() => Progress1Visible = true; void InitProgress() => Progress1Visible = true;

View File

@@ -34,11 +34,11 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using System.Reactive;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.Core; using Aaru.Core;
@@ -47,37 +47,58 @@ using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using Avalonia.Threading; using Avalonia.Threading;
using ReactiveUI; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class ImageSidecarViewModel : ViewModelBase public sealed partial class ImageSidecarViewModel : ViewModelBase
{ {
readonly Encoding _encoding; readonly Encoding _encoding;
readonly Guid _filterId; readonly Guid _filterId;
readonly string _imageSource; readonly string _imageSource;
readonly IMediaImage _inputFormat; readonly IMediaImage _inputFormat;
readonly Window _view; readonly Window _view;
bool _closeVisible; [ObservableProperty]
bool _destinationEnabled; bool _closeVisible;
string _destinationText; [ObservableProperty]
bool _progress1Visible; bool _destinationEnabled;
bool _progress2Indeterminate; [ObservableProperty]
double _progress2MaxValue; string _destinationText;
string _progress2Text; [ObservableProperty]
double _progress2Value; bool _progress1Visible;
bool _progress2Visible; [ObservableProperty]
bool _progressIndeterminate; bool _progress2Indeterminate;
double _progressMaxValue; [ObservableProperty]
string _progressText; double _progress2MaxValue;
double _progressValue; [ObservableProperty]
bool _progressVisible; string _progress2Text;
Sidecar _sidecarClass; [ObservableProperty]
bool _startVisible; double _progress2Value;
string _statusText; [ObservableProperty]
bool _statusVisible; bool _progress2Visible;
bool _stopEnabled; [ObservableProperty]
bool _stopVisible; bool _progressIndeterminate;
[ObservableProperty]
double _progressMaxValue;
[ObservableProperty]
string _progressText;
[ObservableProperty]
double _progressValue;
[ObservableProperty]
bool _progressVisible;
[ObservableProperty]
Sidecar _sidecarClass;
[ObservableProperty]
bool _startVisible;
[ObservableProperty]
string _statusText;
[ObservableProperty]
bool _statusVisible;
[ObservableProperty]
bool _stopEnabled;
[ObservableProperty]
bool _stopVisible;
public ImageSidecarViewModel(IMediaImage inputFormat, string imageSource, Guid filterId, Encoding encoding, public ImageSidecarViewModel(IMediaImage inputFormat, string imageSource, Guid filterId, Encoding encoding,
Window view) Window view)
@@ -94,10 +115,10 @@ public sealed class ImageSidecarViewModel : ViewModelBase
DestinationEnabled = true; DestinationEnabled = true;
StartVisible = true; StartVisible = true;
CloseVisible = true; CloseVisible = true;
DestinationCommand = ReactiveCommand.Create(ExecuteDestinationCommand); DestinationCommand = new AsyncRelayCommand(DestinationAsync);
StartCommand = ReactiveCommand.Create(ExecuteStartCommand); StartCommand = new RelayCommand(Start);
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
StopCommand = ReactiveCommand.Create(ExecuteStopCommand); StopCommand = new RelayCommand(Stop);
} }
public string DestinationFileLabel => UI.Title_Destination_file; public string DestinationFileLabel => UI.Title_Destination_file;
@@ -106,127 +127,13 @@ public sealed class ImageSidecarViewModel : ViewModelBase
public string CloseLabel => UI.ButtonLabel_Close; public string CloseLabel => UI.ButtonLabel_Close;
public string StopLabel => UI.ButtonLabel_Stop; public string StopLabel => UI.ButtonLabel_Stop;
public string Title { get; } public string Title { get; }
public ReactiveCommand<Unit, Task> DestinationCommand { get; } public ICommand DestinationCommand { get; }
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ICommand StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ICommand StopCommand { get; }
public bool ProgressIndeterminate void Start() => new Thread(DoWork).Start();
{
get => _progressIndeterminate;
set => this.RaiseAndSetIfChanged(ref _progressIndeterminate, value);
}
public bool ProgressVisible
{
get => _progressVisible;
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
}
public bool Progress1Visible
{
get => _progress1Visible;
set => this.RaiseAndSetIfChanged(ref _progress1Visible, value);
}
public bool Progress2Visible
{
get => _progress2Visible;
set => this.RaiseAndSetIfChanged(ref _progress2Visible, value);
}
public bool Progress2Indeterminate
{
get => _progress2Indeterminate;
set => this.RaiseAndSetIfChanged(ref _progress2Indeterminate, value);
}
public double ProgressMaxValue
{
get => _progressMaxValue;
set => this.RaiseAndSetIfChanged(ref _progressMaxValue, value);
}
public double Progress2MaxValue
{
get => _progress2MaxValue;
set => this.RaiseAndSetIfChanged(ref _progress2MaxValue, value);
}
public string ProgressText
{
get => _progressText;
set => this.RaiseAndSetIfChanged(ref _progressText, value);
}
public double ProgressValue
{
get => _progressValue;
set => this.RaiseAndSetIfChanged(ref _progressValue, value);
}
public double Progress2Value
{
get => _progress2Value;
set => this.RaiseAndSetIfChanged(ref _progress2Value, value);
}
public string Progress2Text
{
get => _progress2Text;
set => this.RaiseAndSetIfChanged(ref _progress2Text, value);
}
public string DestinationText
{
get => _destinationText;
set => this.RaiseAndSetIfChanged(ref _destinationText, value);
}
public bool DestinationEnabled
{
get => _destinationEnabled;
set => this.RaiseAndSetIfChanged(ref _destinationEnabled, value);
}
public string StatusText
{
get => _statusText;
set => this.RaiseAndSetIfChanged(ref _statusText, value);
}
public bool StatusVisible
{
get => _statusVisible;
set => this.RaiseAndSetIfChanged(ref _statusVisible, value);
}
public bool StartVisible
{
get => _startVisible;
set => this.RaiseAndSetIfChanged(ref _startVisible, value);
}
public bool CloseVisible
{
get => _closeVisible;
set => this.RaiseAndSetIfChanged(ref _closeVisible, value);
}
public bool StopEnabled
{
get => _stopEnabled;
set => this.RaiseAndSetIfChanged(ref _stopEnabled, value);
}
public bool StopVisible
{
get => _stopVisible;
set => this.RaiseAndSetIfChanged(ref _stopVisible, value);
}
void ExecuteStartCommand() => new Thread(DoWork).Start();
[SuppressMessage("ReSharper", "AsyncVoidMethod")] [SuppressMessage("ReSharper", "AsyncVoidMethod")]
async void DoWork() async void DoWork()
@@ -313,16 +220,16 @@ public sealed class ImageSidecarViewModel : ViewModelBase
[SuppressMessage("ReSharper", "AsyncVoidMethod")] [SuppressMessage("ReSharper", "AsyncVoidMethod")]
async void UpdateStatus(string text) => await Dispatcher.UIThread.InvokeAsync(() => { StatusText = text; }); async void UpdateStatus(string text) => await Dispatcher.UIThread.InvokeAsync(() => { StatusText = text; });
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
void ExecuteStopCommand() void Stop()
{ {
ProgressText = Localization.Core.Aborting; ProgressText = Localization.Core.Aborting;
StopEnabled = false; StopEnabled = false;
_sidecarClass.Abort(); _sidecarClass.Abort();
} }
async Task ExecuteDestinationCommand() async Task DestinationAsync()
{ {
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {

View File

@@ -35,8 +35,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Reactive;
using System.Threading; using System.Threading;
using System.Windows.Input;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs;
using Aaru.Core; using Aaru.Core;
@@ -45,61 +45,99 @@ using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Threading; using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Humanizer; using Humanizer;
using Humanizer.Localisation; using Humanizer.Localisation;
using ReactiveUI;
using Sentry; using Sentry;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class ImageVerifyViewModel : ViewModelBase public sealed partial class ImageVerifyViewModel : ViewModelBase
{ {
readonly IMediaImage _inputFormat; readonly IMediaImage _inputFormat;
readonly Window _view; readonly Window _view;
bool _cancel; [ObservableProperty]
bool _closeVisible; bool _cancel;
string _imageResultText; [ObservableProperty]
bool _imageResultVisible; bool _closeVisible;
bool _optionsVisible; [ObservableProperty]
bool _progress2Indeterminate; string _imageResultText;
double _progress2MaxValue; [ObservableProperty]
string _progress2Text; bool _imageResultVisible;
double _progress2Value; [ObservableProperty]
bool _progress2Visible; bool _optionsVisible;
bool _progressIndeterminate; [ObservableProperty]
double _progressMaxValue; bool _progress2Indeterminate;
string _progressText; [ObservableProperty]
double _progressValue; double _progress2MaxValue;
bool _progressVisible; [ObservableProperty]
bool _resultsVisible; string _progress2Text;
string _sectorErrorsText; [ObservableProperty]
bool _sectorErrorsVisible; double _progress2Value;
string _sectorsErrorsAllText; [ObservableProperty]
bool _sectorsErrorsAllVisible; bool _progress2Visible;
bool _sectorSummaryVisible; [ObservableProperty]
string _sectorsUnknownAllText; bool _progressIndeterminate;
bool _sectorsUnknownAllVisible; [ObservableProperty]
string _sectorsUnknownsText; double _progressMaxValue;
bool _sectorsUnknownsVisible; [ObservableProperty]
bool _startVisible; string _progressText;
bool _stopEnabled; [ObservableProperty]
bool _stopVisible; double _progressValue;
string _totalSectorErrorsText; [ObservableProperty]
string _totalSectorErrorsUnknownsText; bool _progressVisible;
string _totalSectorsText; [ObservableProperty]
string _totalSectorUnknownsText; bool _resultsVisible;
bool _verifyImageChecked; [ObservableProperty]
bool _verifyImageEnabled; string _sectorErrorsText;
bool _verifySectorsChecked; [ObservableProperty]
bool _verifySectorsEnabled; bool _sectorErrorsVisible;
bool _verifySectorsVisible; [ObservableProperty]
string _sectorsErrorsAllText;
[ObservableProperty]
bool _sectorsErrorsAllVisible;
[ObservableProperty]
bool _sectorSummaryVisible;
[ObservableProperty]
string _sectorsUnknownAllText;
[ObservableProperty]
bool _sectorsUnknownAllVisible;
[ObservableProperty]
string _sectorsUnknownsText;
[ObservableProperty]
bool _sectorsUnknownsVisible;
[ObservableProperty]
bool _startVisible;
[ObservableProperty]
bool _stopEnabled;
[ObservableProperty]
bool _stopVisible;
[ObservableProperty]
string _totalSectorErrorsText;
[ObservableProperty]
string _totalSectorErrorsUnknownsText;
[ObservableProperty]
string _totalSectorsText;
[ObservableProperty]
string _totalSectorUnknownsText;
[ObservableProperty]
bool _verifyImageChecked;
[ObservableProperty]
bool _verifyImageEnabled;
[ObservableProperty]
bool _verifySectorsChecked;
[ObservableProperty]
bool _verifySectorsEnabled;
[ObservableProperty]
bool _verifySectorsVisible;
public ImageVerifyViewModel(IMediaImage inputFormat, Window view) public ImageVerifyViewModel(IMediaImage inputFormat, Window view)
{ {
_view = view; _view = view;
StartCommand = ReactiveCommand.Create(ExecuteStartCommand); StartCommand = new RelayCommand(Start);
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
StopCommand = ReactiveCommand.Create(ExecuteStopCommand); StopCommand = new RelayCommand(Stop);
_inputFormat = inputFormat; _inputFormat = inputFormat;
_cancel = false; _cancel = false;
ErrorList = []; ErrorList = [];
@@ -120,227 +158,12 @@ public sealed class ImageVerifyViewModel : ViewModelBase
public ObservableCollection<LbaModel> ErrorList { get; } public ObservableCollection<LbaModel> ErrorList { get; }
public ObservableCollection<LbaModel> UnknownList { get; } public ObservableCollection<LbaModel> UnknownList { get; }
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ICommand StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ICommand StopCommand { get; }
public bool VerifyImageEnabled
{
get => _verifyImageEnabled;
set => this.RaiseAndSetIfChanged(ref _verifyImageEnabled, value);
}
public bool VerifySectorsEnabled void Start()
{
get => _verifySectorsEnabled;
set => this.RaiseAndSetIfChanged(ref _verifySectorsEnabled, value);
}
public bool VerifySectorsVisible
{
get => _verifySectorsVisible;
set => this.RaiseAndSetIfChanged(ref _verifySectorsVisible, value);
}
public double ProgressMaxValue
{
get => _progressMaxValue;
set => this.RaiseAndSetIfChanged(ref _progressMaxValue, value);
}
public bool VerifyImageChecked
{
get => _verifyImageChecked;
set => this.RaiseAndSetIfChanged(ref _verifyImageChecked, value);
}
public bool ProgressIndeterminate
{
get => _progressIndeterminate;
set => this.RaiseAndSetIfChanged(ref _progressIndeterminate, value);
}
public bool ImageResultVisible
{
get => _imageResultVisible;
set => this.RaiseAndSetIfChanged(ref _imageResultVisible, value);
}
public string ImageResultText
{
get => _imageResultText;
set => this.RaiseAndSetIfChanged(ref _imageResultText, value);
}
public bool VerifySectorsChecked
{
get => _verifySectorsChecked;
set => this.RaiseAndSetIfChanged(ref _verifySectorsChecked, value);
}
public bool Progress2Visible
{
get => _progress2Visible;
set => this.RaiseAndSetIfChanged(ref _progress2Visible, value);
}
public bool Progress2Indeterminate
{
get => _progress2Indeterminate;
set => this.RaiseAndSetIfChanged(ref _progress2Indeterminate, value);
}
public double Progress2MaxValue
{
get => _progress2MaxValue;
set => this.RaiseAndSetIfChanged(ref _progress2MaxValue, value);
}
public string ProgressText
{
get => _progressText;
set => this.RaiseAndSetIfChanged(ref _progressText, value);
}
public double ProgressValue
{
get => _progressValue;
set => this.RaiseAndSetIfChanged(ref _progressValue, value);
}
public double Progress2Value
{
get => _progress2Value;
set => this.RaiseAndSetIfChanged(ref _progress2Value, value);
}
public string Progress2Text
{
get => _progress2Text;
set => this.RaiseAndSetIfChanged(ref _progress2Text, value);
}
public bool SectorsErrorsAllVisible
{
get => _sectorsErrorsAllVisible;
set => this.RaiseAndSetIfChanged(ref _sectorsErrorsAllVisible, value);
}
public string SectorsErrorsAllText
{
get => _sectorsErrorsAllText;
set => this.RaiseAndSetIfChanged(ref _sectorsErrorsAllText, value);
}
public bool SectorsUnknownAllVisible
{
get => _sectorsUnknownAllVisible;
set => this.RaiseAndSetIfChanged(ref _sectorsUnknownAllVisible, value);
}
public string SectorsUnknownAllText
{
get => _sectorsUnknownAllText;
set => this.RaiseAndSetIfChanged(ref _sectorsUnknownAllText, value);
}
public string SectorErrorsText
{
get => _sectorErrorsText;
set => this.RaiseAndSetIfChanged(ref _sectorErrorsText, value);
}
public bool SectorErrorsVisible
{
get => _sectorErrorsVisible;
set => this.RaiseAndSetIfChanged(ref _sectorErrorsVisible, value);
}
public bool SectorsUnknownsVisible
{
get => _sectorsUnknownsVisible;
set => this.RaiseAndSetIfChanged(ref _sectorsUnknownsVisible, value);
}
public string SectorsUnknownsText
{
get => _sectorsUnknownsText;
set => this.RaiseAndSetIfChanged(ref _sectorsUnknownsText, value);
}
public bool SectorSummaryVisible
{
get => _sectorSummaryVisible;
set => this.RaiseAndSetIfChanged(ref _sectorSummaryVisible, value);
}
public string TotalSectorsText
{
get => _totalSectorsText;
set => this.RaiseAndSetIfChanged(ref _totalSectorsText, value);
}
public string TotalSectorErrorsText
{
get => _totalSectorErrorsText;
set => this.RaiseAndSetIfChanged(ref _totalSectorErrorsText, value);
}
public string TotalSectorUnknownsText
{
get => _totalSectorUnknownsText;
set => this.RaiseAndSetIfChanged(ref _totalSectorUnknownsText, value);
}
public string TotalSectorErrorsUnknownsText
{
get => _totalSectorErrorsUnknownsText;
set => this.RaiseAndSetIfChanged(ref _totalSectorErrorsUnknownsText, value);
}
public bool OptionsVisible
{
get => _optionsVisible;
set => this.RaiseAndSetIfChanged(ref _optionsVisible, value);
}
public bool ResultsVisible
{
get => _resultsVisible;
set => this.RaiseAndSetIfChanged(ref _resultsVisible, value);
}
public bool ProgressVisible
{
get => _progressVisible;
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
}
public bool StartVisible
{
get => _startVisible;
set => this.RaiseAndSetIfChanged(ref _startVisible, value);
}
public bool StopVisible
{
get => _stopVisible;
set => this.RaiseAndSetIfChanged(ref _stopVisible, value);
}
public bool CloseVisible
{
get => _closeVisible;
set => this.RaiseAndSetIfChanged(ref _closeVisible, value);
}
public bool StopEnabled
{
get => _stopEnabled;
set => this.RaiseAndSetIfChanged(ref _stopEnabled, value);
}
void ExecuteStartCommand()
{ {
VerifyImageEnabled = false; VerifyImageEnabled = false;
VerifySectorsEnabled = false; VerifySectorsEnabled = false;
@@ -687,9 +510,9 @@ public sealed class ImageVerifyViewModel : ViewModelBase
}); });
} }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
internal void ExecuteStopCommand() internal void Stop()
{ {
_cancel = true; _cancel = true;
StopEnabled = false; StopEnabled = false;

View File

@@ -35,8 +35,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
@@ -60,10 +60,10 @@ using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using Avalonia.Platform; using Avalonia.Platform;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using MsBox.Avalonia; using MsBox.Avalonia;
using MsBox.Avalonia.Enums; using MsBox.Avalonia.Enums;
using ReactiveUI;
using Spectre.Console; using Spectre.Console;
using Console = Aaru.Gui.Views.Dialogs.Console; using Console = Aaru.Gui.Views.Dialogs.Console;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo; using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
@@ -94,22 +94,22 @@ public sealed class MainWindowViewModel : ViewModelBase
public MainWindowViewModel(MainWindow view) public MainWindowViewModel(MainWindow view)
{ {
AboutCommand = ReactiveCommand.Create(ExecuteAboutCommand); AboutCommand = new RelayCommand(About);
EncodingsCommand = ReactiveCommand.Create(ExecuteEncodingsCommand); EncodingsCommand = new RelayCommand(Encodings);
PluginsCommand = ReactiveCommand.Create(ExecutePluginsCommand); PluginsCommand = new RelayCommand(Plugins);
StatisticsCommand = ReactiveCommand.Create(ExecuteStatisticsCommand); StatisticsCommand = new RelayCommand(Statistics);
ExitCommand = ReactiveCommand.Create(ExecuteExitCommand); ExitCommand = new RelayCommand(Exit);
SettingsCommand = ReactiveCommand.Create(ExecuteSettingsCommand); SettingsCommand = new AsyncRelayCommand(SettingsAsync);
ConsoleCommand = ReactiveCommand.Create(ExecuteConsoleCommand); ConsoleCommand = new RelayCommand(Console);
OpenCommand = ReactiveCommand.Create(ExecuteOpenCommand); OpenCommand = new AsyncRelayCommand(OpenAsync);
CalculateEntropyCommand = ReactiveCommand.Create(ExecuteCalculateEntropyCommand); CalculateEntropyCommand = new RelayCommand(CalculateEntropy);
VerifyImageCommand = ReactiveCommand.Create(ExecuteVerifyImageCommand); VerifyImageCommand = new RelayCommand(VerifyImage);
ChecksumImageCommand = ReactiveCommand.Create(ExecuteChecksumImageCommand); ChecksumImageCommand = new RelayCommand(ChecksumImage);
ConvertImageCommand = ReactiveCommand.Create(ExecuteConvertImageCommand); ConvertImageCommand = new RelayCommand(ConvertImage);
CreateSidecarCommand = ReactiveCommand.Create(ExecuteCreateSidecarCommand); CreateSidecarCommand = new RelayCommand(CreateSidecar);
ViewImageSectorsCommand = ReactiveCommand.Create(ExecuteViewImageSectorsCommand); ViewImageSectorsCommand = new RelayCommand(ViewImageSectors);
DecodeImageMediaTagsCommand = ReactiveCommand.Create(ExecuteDecodeImageMediaTagsCommand); DecodeImageMediaTagsCommand = new RelayCommand(DecodeImageMediaTags);
RefreshDevicesCommand = ReactiveCommand.Create(ExecuteRefreshDevicesCommand); RefreshDevicesCommand = new RelayCommand(RefreshDevices);
_view = view; _view = view;
TreeRoot = []; TreeRoot = [];
ContentPanel = Greeting; ContentPanel = Greeting;
@@ -190,7 +190,7 @@ public sealed class MainWindowViewModel : ViewModelBase
public bool DevicesSupported public bool DevicesSupported
{ {
get => _devicesSupported; get => _devicesSupported;
set => this.RaiseAndSetIfChanged(ref _devicesSupported, value); set => SetProperty(ref _devicesSupported, value);
} }
public bool NativeMenuSupported public bool NativeMenuSupported
@@ -208,27 +208,27 @@ public sealed class MainWindowViewModel : ViewModelBase
public string Greeting => UI.Welcome_to_Aaru; public string Greeting => UI.Welcome_to_Aaru;
public ObservableCollection<RootModel> TreeRoot { get; } public ObservableCollection<RootModel> TreeRoot { get; }
public ReactiveCommand<Unit, Unit> AboutCommand { get; } public ICommand AboutCommand { get; }
public ReactiveCommand<Unit, Unit> ConsoleCommand { get; } public ICommand ConsoleCommand { get; }
public ReactiveCommand<Unit, Unit> EncodingsCommand { get; } public ICommand EncodingsCommand { get; }
public ReactiveCommand<Unit, Unit> PluginsCommand { get; } public ICommand PluginsCommand { get; }
public ReactiveCommand<Unit, Unit> StatisticsCommand { get; } public ICommand StatisticsCommand { get; }
public ReactiveCommand<Unit, Unit> ExitCommand { get; } public ICommand ExitCommand { get; }
public ReactiveCommand<Unit, Task> SettingsCommand { get; } public ICommand SettingsCommand { get; }
public ReactiveCommand<Unit, Task> OpenCommand { get; } public ICommand OpenCommand { get; }
public ReactiveCommand<Unit, Unit> CalculateEntropyCommand { get; } public ICommand CalculateEntropyCommand { get; }
public ReactiveCommand<Unit, Unit> VerifyImageCommand { get; } public ICommand VerifyImageCommand { get; }
public ReactiveCommand<Unit, Unit> ChecksumImageCommand { get; } public ICommand ChecksumImageCommand { get; }
public ReactiveCommand<Unit, Unit> ConvertImageCommand { get; } public ICommand ConvertImageCommand { get; }
public ReactiveCommand<Unit, Unit> CreateSidecarCommand { get; } public ICommand CreateSidecarCommand { get; }
public ReactiveCommand<Unit, Unit> ViewImageSectorsCommand { get; } public ICommand ViewImageSectorsCommand { get; }
public ReactiveCommand<Unit, Unit> DecodeImageMediaTagsCommand { get; } public ICommand DecodeImageMediaTagsCommand { get; }
public ReactiveCommand<Unit, Unit> RefreshDevicesCommand { get; } public ICommand RefreshDevicesCommand { get; }
public object ContentPanel public object ContentPanel
{ {
get => _contentPanel; get => _contentPanel;
set => this.RaiseAndSetIfChanged(ref _contentPanel, value); set => SetProperty(ref _contentPanel, value);
} }
public object TreeViewSelectedItem public object TreeViewSelectedItem
@@ -238,7 +238,7 @@ public sealed class MainWindowViewModel : ViewModelBase
{ {
if(value == _treeViewSelectedItem) return; if(value == _treeViewSelectedItem) return;
this.RaiseAndSetIfChanged(ref _treeViewSelectedItem, value); SetProperty(ref _treeViewSelectedItem, value);
ContentPanel = null; ContentPanel = null;
@@ -285,11 +285,11 @@ public sealed class MainWindowViewModel : ViewModelBase
return; return;
case Devices.Remote.Device remoteDev: case Devices.Remote.Device remoteDev:
Statistics.AddRemote(remoteDev.RemoteApplication, Core.Statistics.AddRemote(remoteDev.RemoteApplication,
remoteDev.RemoteVersion, remoteDev.RemoteVersion,
remoteDev.RemoteOperatingSystem, remoteDev.RemoteOperatingSystem,
remoteDev.RemoteOperatingSystemVersion, remoteDev.RemoteOperatingSystemVersion,
remoteDev.RemoteArchitecture); remoteDev.RemoteArchitecture);
break; break;
} }
@@ -378,7 +378,7 @@ public sealed class MainWindowViewModel : ViewModelBase
} }
} }
void ExecuteCalculateEntropyCommand() void CalculateEntropy()
{ {
if(TreeViewSelectedItem is not ImageModel imageModel) return; if(TreeViewSelectedItem is not ImageModel imageModel) return;
@@ -390,7 +390,7 @@ public sealed class MainWindowViewModel : ViewModelBase
imageEntropyWindow.Show(); imageEntropyWindow.Show();
} }
void ExecuteVerifyImageCommand() void VerifyImage()
{ {
if(TreeViewSelectedItem is not ImageModel imageModel) return; if(TreeViewSelectedItem is not ImageModel imageModel) return;
@@ -402,7 +402,7 @@ public sealed class MainWindowViewModel : ViewModelBase
imageVerifyWindow.Show(); imageVerifyWindow.Show();
} }
void ExecuteChecksumImageCommand() void ChecksumImage()
{ {
if(TreeViewSelectedItem is not ImageModel imageModel) return; if(TreeViewSelectedItem is not ImageModel imageModel) return;
@@ -414,7 +414,7 @@ public sealed class MainWindowViewModel : ViewModelBase
imageChecksumWindow.Show(); imageChecksumWindow.Show();
} }
void ExecuteConvertImageCommand() void ConvertImage()
{ {
if(TreeViewSelectedItem is not ImageModel imageModel) return; if(TreeViewSelectedItem is not ImageModel imageModel) return;
@@ -428,7 +428,7 @@ public sealed class MainWindowViewModel : ViewModelBase
imageConvertWindow.Show(); imageConvertWindow.Show();
} }
void ExecuteCreateSidecarCommand() void CreateSidecar()
{ {
if(TreeViewSelectedItem is not ImageModel imageModel) return; if(TreeViewSelectedItem is not ImageModel imageModel) return;
@@ -445,7 +445,7 @@ public sealed class MainWindowViewModel : ViewModelBase
imageSidecarWindow.Show(); imageSidecarWindow.Show();
} }
void ExecuteViewImageSectorsCommand() void ViewImageSectors()
{ {
if(TreeViewSelectedItem is not ImageModel imageModel) return; if(TreeViewSelectedItem is not ImageModel imageModel) return;
@@ -455,7 +455,7 @@ public sealed class MainWindowViewModel : ViewModelBase
}.Show(); }.Show();
} }
void ExecuteDecodeImageMediaTagsCommand() void DecodeImageMediaTags()
{ {
if(TreeViewSelectedItem is not ImageModel imageModel) return; if(TreeViewSelectedItem is not ImageModel imageModel) return;
@@ -465,28 +465,28 @@ public sealed class MainWindowViewModel : ViewModelBase
}.Show(); }.Show();
} }
internal void ExecuteAboutCommand() internal void About()
{ {
var dialog = new About(); var dialog = new About();
dialog.DataContext = new AboutViewModel(dialog); dialog.DataContext = new AboutViewModel(dialog);
dialog.ShowDialog(_view); dialog.ShowDialog(_view);
} }
void ExecuteEncodingsCommand() void Encodings()
{ {
var dialog = new Encodings(); var dialog = new Encodings();
dialog.DataContext = new EncodingsViewModel(dialog); dialog.DataContext = new EncodingsViewModel(dialog);
dialog.ShowDialog(_view); dialog.ShowDialog(_view);
} }
void ExecutePluginsCommand() void Plugins()
{ {
var dialog = new PluginsDialog(); var dialog = new PluginsDialog();
dialog.DataContext = new PluginsViewModel(dialog); dialog.DataContext = new PluginsViewModel(dialog);
dialog.ShowDialog(_view); dialog.ShowDialog(_view);
} }
void ExecuteStatisticsCommand() void Statistics()
{ {
using var ctx = AaruContext.Create(Settings.Settings.LocalDbPath); using var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
@@ -509,17 +509,17 @@ public sealed class MainWindowViewModel : ViewModelBase
dialog.ShowDialog(_view); dialog.ShowDialog(_view);
} }
internal async Task ExecuteSettingsCommand() internal async Task SettingsAsync()
{ {
var dialog = new SettingsDialog(); var dialog = new SettingsDialog();
dialog.DataContext = new SettingsViewModel(dialog, false); dialog.DataContext = new SettingsViewModel(dialog, false);
await dialog.ShowDialog(_view); await dialog.ShowDialog(_view);
} }
internal void ExecuteExitCommand() => internal void Exit() =>
(Application.Current?.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown(); (Application.Current?.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown();
void ExecuteConsoleCommand() void Console()
{ {
if(_console is null) if(_console is null)
{ {
@@ -530,7 +530,7 @@ public sealed class MainWindowViewModel : ViewModelBase
_console.Show(); _console.Show();
} }
async Task ExecuteOpenCommand() async Task OpenAsync()
{ {
// TODO: Extensions // TODO: Extensions
IReadOnlyList<IStorageFile> result = await _view.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions IReadOnlyList<IStorageFile> result = await _view.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
@@ -698,10 +698,10 @@ public sealed class MainWindowViewModel : ViewModelBase
Plugin = rofs Plugin = rofs
}); });
Statistics.AddCommand("ls"); Core.Statistics.AddCommand("ls");
} }
Statistics.AddFilesystem(rofs?.Metadata.Type ?? fsMetadata.Type); Core.Statistics.AddFilesystem(rofs?.Metadata.Type ?? fsMetadata.Type);
partitionModel.FileSystems.Add(filesystemModel); partitionModel.FileSystems.Add(filesystemModel);
} }
} }
@@ -776,18 +776,18 @@ public sealed class MainWindowViewModel : ViewModelBase
Plugin = rofs Plugin = rofs
}); });
Statistics.AddCommand("ls"); Core.Statistics.AddCommand("ls");
} }
Statistics.AddFilesystem(rofs?.Metadata.Type ?? fsMetadata.Type); Core.Statistics.AddFilesystem(rofs?.Metadata.Type ?? fsMetadata.Type);
imageModel.PartitionSchemesOrFileSystems.Add(filesystemModel); imageModel.PartitionSchemesOrFileSystems.Add(filesystemModel);
} }
} }
} }
Statistics.AddMediaFormat(imageFormat.Format); Core.Statistics.AddMediaFormat(imageFormat.Format);
Statistics.AddMedia(imageFormat.Info.MediaType, false); Core.Statistics.AddMedia(imageFormat.Info.MediaType, false);
Statistics.AddFilter(inputFilter.Name); Core.Statistics.AddFilter(inputFilter.Name);
_imagesRoot.Images.Add(imageModel); _imagesRoot.Images.Add(imageModel);
} }
@@ -814,13 +814,11 @@ public sealed class MainWindowViewModel : ViewModelBase
AaruLogging.Exception(ex, UI.Error_reading_file_0, ex.Message); AaruLogging.Exception(ex, UI.Error_reading_file_0, ex.Message);
} }
Statistics.AddCommand("image-info"); Core.Statistics.AddCommand("image-info");
} }
internal void LoadComplete() => RefreshDevices(); internal void LoadComplete() => RefreshDevices();
void ExecuteRefreshDevicesCommand() => RefreshDevices();
void RefreshDevices() void RefreshDevices()
{ {
if(!DevicesSupported) return; if(!DevicesSupported) return;
@@ -855,11 +853,11 @@ public sealed class MainWindowViewModel : ViewModelBase
{ {
if(dev is Devices.Remote.Device remoteDev) if(dev is Devices.Remote.Device remoteDev)
{ {
Statistics.AddRemote(remoteDev.RemoteApplication, Core.Statistics.AddRemote(remoteDev.RemoteApplication,
remoteDev.RemoteVersion, remoteDev.RemoteVersion,
remoteDev.RemoteOperatingSystem, remoteDev.RemoteOperatingSystem,
remoteDev.RemoteOperatingSystemVersion, remoteDev.RemoteOperatingSystemVersion,
remoteDev.RemoteArchitecture); remoteDev.RemoteArchitecture);
} }
deviceModel.Icon = dev.Type switch deviceModel.Icon = dev.Type switch

View File

@@ -36,11 +36,11 @@ using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using System.Xml.Serialization; using System.Xml.Serialization;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.AaruMetadata;
@@ -58,11 +58,11 @@ using Aaru.Logging;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using Avalonia.Threading; using Avalonia.Threading;
using DynamicData; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using JetBrains.Annotations; using JetBrains.Annotations;
using MsBox.Avalonia; using MsBox.Avalonia;
using MsBox.Avalonia.Enums; using MsBox.Avalonia.Enums;
using ReactiveUI;
using Sentry; using Sentry;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo; using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
using Dump = Aaru.Core.Devices.Dumping.Dump; using Dump = Aaru.Core.Devices.Dumping.Dump;
@@ -71,50 +71,86 @@ using MediaType = Aaru.CommonTypes.MediaType;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class MediaDumpViewModel : ViewModelBase public sealed partial class MediaDumpViewModel : ViewModelBase
{ {
readonly string _devicePath; readonly string _devicePath;
readonly Window _view; readonly Window _view;
bool _closeVisible; [ObservableProperty]
string _destination; bool _closeVisible;
bool _destinationEnabled; [ObservableProperty]
Device _dev; string _destination;
Dump _dumper; [ObservableProperty]
string _encodingEnabled; bool _destinationEnabled;
bool _encodingVisible; [ObservableProperty]
bool _existingMetadata; Device _dev;
bool _force; [ObservableProperty]
string _formatReadOnly; Dump _dumper;
string _log; [ObservableProperty]
bool _optionsVisible; string _encodingEnabled;
string _outputPrefix; [ObservableProperty]
bool _persistent; bool _encodingVisible;
bool _progress1Visible; bool _existingMetadata;
bool _progress2Indeterminate; [ObservableProperty]
double _progress2MaxValue; bool _force;
string _progress2Text; [ObservableProperty]
double _progress2Value; string _formatReadOnly;
bool _progress2Visible; [ObservableProperty]
bool _progressIndeterminate; string _log;
double _progressMaxValue; [ObservableProperty]
string _progressText; bool _optionsVisible;
double _progressValue; [ObservableProperty]
bool _progressVisible; string _outputPrefix;
Resume _resume; [ObservableProperty]
double _retries; bool _persistent;
EncodingModel _selectedEncoding; [ObservableProperty]
bool _progress1Visible;
[ObservableProperty]
bool _progress2Indeterminate;
[ObservableProperty]
double _progress2MaxValue;
[ObservableProperty]
string _progress2Text;
[ObservableProperty]
double _progress2Value;
[ObservableProperty]
bool _progress2Visible;
[ObservableProperty]
bool _progressIndeterminate;
[ObservableProperty]
double _progressMaxValue;
[ObservableProperty]
string _progressText;
[ObservableProperty]
double _progressValue;
[ObservableProperty]
bool _progressVisible;
Resume _resume;
[ObservableProperty]
double _retries;
[ObservableProperty]
EncodingModel _selectedEncoding;
ImagePluginModel _selectedPlugin; ImagePluginModel _selectedPlugin;
Metadata _sidecar; [ObservableProperty]
double _skipped; Metadata _sidecar;
bool _startVisible; [ObservableProperty]
bool _stopEnabled; double _skipped;
bool _stopOnError; [ObservableProperty]
bool _stopVisible; bool _startVisible;
bool _track1Pregap; [ObservableProperty]
bool _track1PregapVisible; bool _stopEnabled;
bool _trim; [ObservableProperty]
bool _useResume; bool _stopOnError;
bool _useSidecar; [ObservableProperty]
bool _stopVisible;
[ObservableProperty]
bool _track1Pregap;
[ObservableProperty]
bool _track1PregapVisible;
[ObservableProperty]
bool _trim;
bool _useResume;
[ObservableProperty]
bool _useSidecar;
public MediaDumpViewModel(string devicePath, DeviceInfo deviceInfo, Window view, public MediaDumpViewModel(string devicePath, DeviceInfo deviceInfo, Window view,
[CanBeNull] ScsiInfo scsiInfo = null) [CanBeNull] ScsiInfo scsiInfo = null)
@@ -124,10 +160,10 @@ public sealed class MediaDumpViewModel : ViewModelBase
StartVisible = true; StartVisible = true;
CloseVisible = true; CloseVisible = true;
OptionsVisible = true; OptionsVisible = true;
StartCommand = ReactiveCommand.Create(ExecuteStartCommand); StartCommand = new RelayCommand(Start);
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
StopCommand = ReactiveCommand.Create(ExecuteStopCommand); StopCommand = new RelayCommand(Stop);
DestinationCommand = ReactiveCommand.Create(ExecuteDestinationCommand); DestinationCommand = new AsyncRelayCommand(DestinationAsync);
PluginsList = []; PluginsList = [];
Encodings = []; Encodings = [];
@@ -137,7 +173,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
Persistent = true; Persistent = true;
Resume = true; Resume = true;
Track1Pregap = false; Track1Pregap = false;
Sidecar = true; UseSidecar = true;
Trim = true; Trim = true;
ExistingMetadata = false; ExistingMetadata = false;
Retries = 5; Retries = 5;
@@ -186,19 +222,21 @@ public sealed class MediaDumpViewModel : ViewModelBase
} }
} }
Encodings.AddRange(Encoding.GetEncodings() foreach(EncodingModel model in Encoding.GetEncodings()
.Select(info => new EncodingModel .Select(info => new EncodingModel
{ {
Name = info.Name, Name = info.Name,
DisplayName = info.GetEncoding().EncodingName DisplayName = info.GetEncoding().EncodingName
})); })
.Concat(Claunia.Encoding.Encoding.GetEncodings()
Encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings() .Select(info => new EncodingModel
.Select(info => new EncodingModel {
{ Name = info.Name,
Name = info.Name, DisplayName = info.DisplayName
DisplayName = info.DisplayName }))
})); .AsParallel()
.OrderBy(m => m.DisplayName))
Encodings.Add(model);
Track1PregapVisible = mediaType switch Track1PregapVisible = mediaType switch
{ {
@@ -270,28 +308,22 @@ public sealed class MediaDumpViewModel : ViewModelBase
public string CloseLabel => UI.ButtonLabel_Close; public string CloseLabel => UI.ButtonLabel_Close;
public string StopLabel => UI.ButtonLabel_Stop; public string StopLabel => UI.ButtonLabel_Stop;
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ICommand StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ICommand StopCommand { get; }
public ReactiveCommand<Unit, Task> DestinationCommand { get; } public ICommand DestinationCommand { get; }
public ObservableCollection<ImagePluginModel> PluginsList { get; } public ObservableCollection<ImagePluginModel> PluginsList { get; }
public ObservableCollection<EncodingModel> Encodings { get; } public ObservableCollection<EncodingModel> Encodings { get; }
public string Title { get; } public string Title { get; }
public bool OptionsVisible
{
get => _optionsVisible;
set => this.RaiseAndSetIfChanged(ref _optionsVisible, value);
}
public ImagePluginModel SelectedPlugin public ImagePluginModel SelectedPlugin
{ {
get => _selectedPlugin; get => _selectedPlugin;
set set
{ {
this.RaiseAndSetIfChanged(ref _selectedPlugin, value); SetProperty(ref _selectedPlugin, value);
Destination = ""; Destination = "";
@@ -399,107 +431,27 @@ public sealed class MediaDumpViewModel : ViewModelBase
} }
} }
public string FormatReadOnly
{
get => _formatReadOnly;
set => this.RaiseAndSetIfChanged(ref _formatReadOnly, value);
}
public string Destination
{
get => _destination;
set => this.RaiseAndSetIfChanged(ref _destination, value);
}
public bool DestinationEnabled
{
get => _destinationEnabled;
set => this.RaiseAndSetIfChanged(ref _destinationEnabled, value);
}
public bool StopOnError
{
get => _stopOnError;
set => this.RaiseAndSetIfChanged(ref _stopOnError, value);
}
public bool Force
{
get => _force;
set => this.RaiseAndSetIfChanged(ref _force, value);
}
public double Retries
{
get => _retries;
set => this.RaiseAndSetIfChanged(ref _retries, value);
}
public bool Persistent
{
get => _persistent;
set => this.RaiseAndSetIfChanged(ref _persistent, value);
}
public bool Resume public bool Resume
{ {
get => _useResume; get => _useResume;
set set
{ {
this.RaiseAndSetIfChanged(ref _useResume, value); SetProperty(ref _useResume, value);
if(!value) return; if(!value) return;
if(_outputPrefix != null) CheckResumeFile().GetAwaiter().GetResult(); if(_outputPrefix != null) CheckResumeFileAsync().GetAwaiter().GetResult();
} }
} }
public bool Track1Pregap
{
get => _track1Pregap;
set => this.RaiseAndSetIfChanged(ref _track1Pregap, value);
}
public bool Track1PregapVisible
{
get => _track1PregapVisible;
set => this.RaiseAndSetIfChanged(ref _track1PregapVisible, value);
}
public double Skipped
{
get => _skipped;
set => this.RaiseAndSetIfChanged(ref _skipped, value);
}
public bool Sidecar
{
get => _useSidecar;
set
{
this.RaiseAndSetIfChanged(ref _useSidecar, value);
EncodingVisible = value;
}
}
public bool EncodingVisible
{
get => _encodingVisible;
set => this.RaiseAndSetIfChanged(ref _encodingVisible, value);
}
public bool Trim
{
get => _trim;
set => this.RaiseAndSetIfChanged(ref _trim, value);
}
public bool ExistingMetadata public bool ExistingMetadata
{ {
get => _existingMetadata; get => _existingMetadata;
set set
{ {
this.RaiseAndSetIfChanged(ref _existingMetadata, value); SetProperty(ref _existingMetadata, value);
if(!value) if(!value)
{ {
@@ -553,115 +505,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
} }
} }
public EncodingModel SelectedEncoding async Task DestinationAsync()
{
get => _selectedEncoding;
set => this.RaiseAndSetIfChanged(ref _selectedEncoding, value);
}
public string EncodingEnabled
{
get => _encodingEnabled;
set => this.RaiseAndSetIfChanged(ref _encodingEnabled, value);
}
public bool ProgressVisible
{
get => _progressVisible;
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
}
public string Log
{
get => _log;
set => this.RaiseAndSetIfChanged(ref _log, value);
}
public bool Progress1Visible
{
get => _progress1Visible;
set => this.RaiseAndSetIfChanged(ref _progress1Visible, value);
}
public string ProgressText
{
get => _progressText;
set => this.RaiseAndSetIfChanged(ref _progressText, value);
}
public double ProgressValue
{
get => _progressValue;
set => this.RaiseAndSetIfChanged(ref _progressValue, value);
}
public double ProgressMaxValue
{
get => _progressMaxValue;
set => this.RaiseAndSetIfChanged(ref _progressMaxValue, value);
}
public bool ProgressIndeterminate
{
get => _progressIndeterminate;
set => this.RaiseAndSetIfChanged(ref _progressIndeterminate, value);
}
public bool Progress2Visible
{
get => _progress2Visible;
set => this.RaiseAndSetIfChanged(ref _progress2Visible, value);
}
public string Progress2Text
{
get => _progress2Text;
set => this.RaiseAndSetIfChanged(ref _progress2Text, value);
}
public double Progress2Value
{
get => _progress2Value;
set => this.RaiseAndSetIfChanged(ref _progress2Value, value);
}
public double Progress2MaxValue
{
get => _progress2MaxValue;
set => this.RaiseAndSetIfChanged(ref _progress2MaxValue, value);
}
public bool Progress2Indeterminate
{
get => _progress2Indeterminate;
set => this.RaiseAndSetIfChanged(ref _progress2Indeterminate, value);
}
public bool StartVisible
{
get => _startVisible;
set => this.RaiseAndSetIfChanged(ref _startVisible, value);
}
public bool CloseVisible
{
get => _closeVisible;
set => this.RaiseAndSetIfChanged(ref _closeVisible, value);
}
public bool StopVisible
{
get => _stopVisible;
set => this.RaiseAndSetIfChanged(ref _stopVisible, value);
}
public bool StopEnabled
{
get => _stopEnabled;
set => this.RaiseAndSetIfChanged(ref _stopEnabled, value);
}
async Task ExecuteDestinationCommand()
{ {
if(SelectedPlugin is null) return; if(SelectedPlugin is null) return;
@@ -696,7 +540,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
Resume = true; Resume = true;
} }
async Task CheckResumeFile() async Task CheckResumeFileAsync()
{ {
_resume = null; _resume = null;
@@ -760,15 +604,15 @@ public sealed class MediaDumpViewModel : ViewModelBase
Resume = false; Resume = false;
} }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
internal void ExecuteStopCommand() internal void Stop()
{ {
StopEnabled = false; StopEnabled = false;
_dumper?.Abort(); _dumper?.Abort();
} }
void ExecuteStartCommand() void Start()
{ {
Log = ""; Log = "";
CloseVisible = false; CloseVisible = false;
@@ -929,10 +773,10 @@ public sealed class MediaDumpViewModel : ViewModelBase
_dev.Close(); _dev.Close();
await WorkFinished(); await WorkFinishedAsync();
} }
async Task WorkFinished() => await Dispatcher.UIThread.InvokeAsync(() => async Task WorkFinishedAsync() => await Dispatcher.UIThread.InvokeAsync(() =>
{ {
CloseVisible = true; CloseVisible = true;
StopVisible = false; StopVisible = false;
@@ -987,7 +831,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, $"{text}", ButtonEnum.Ok, Icon.Error) await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, $"{text}", ButtonEnum.Ok, Icon.Error)
.ShowWindowDialogAsync(_view); .ShowWindowDialogAsync(_view);
await WorkFinished(); await WorkFinishedAsync();
}); });
[SuppressMessage("ReSharper", "AsyncVoidMethod")] [SuppressMessage("ReSharper", "AsyncVoidMethod")]

View File

@@ -32,9 +32,9 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Reactive;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.Core; using Aaru.Core;
using Aaru.Core.Devices.Scanning; using Aaru.Core.Devices.Scanning;
@@ -43,69 +43,110 @@ using Aaru.Localization;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Threading; using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Humanizer; using Humanizer;
using Humanizer.Bytes; using Humanizer.Bytes;
using Humanizer.Localisation; using Humanizer.Localisation;
using MsBox.Avalonia; using MsBox.Avalonia;
using MsBox.Avalonia.Enums; using MsBox.Avalonia.Enums;
using ReactiveUI;
//using OxyPlot; //using OxyPlot;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class MediaScanViewModel : ViewModelBase public sealed partial class MediaScanViewModel : ViewModelBase
{ {
readonly Window _view; readonly Window _view;
string _a; [ObservableProperty]
string _avgSpeed; string _a;
Color _axesColor; [ObservableProperty]
string _b; string _avgSpeed;
ulong _blocks; [ObservableProperty]
ulong _blocksToRead; Color _axesColor;
string _c; [ObservableProperty]
bool _closeVisible; string _b;
string _d; [ObservableProperty]
string _devicePath; ulong _blocks;
string _e; [ObservableProperty]
string _f; ulong _blocksToRead;
Color _lineColor; [ObservableProperty]
ScanResults _localResults; string _c;
string _maxSpeed; [ObservableProperty]
double _maxX; bool _closeVisible;
double _maxY; [ObservableProperty]
string _minSpeed; string _d;
double _minX; [ObservableProperty]
double _minY; string _devicePath;
bool _progress1Visible; [ObservableProperty]
string _progress2Indeterminate; string _e;
string _progress2MaxValue; [ObservableProperty]
string _progress2Text; string _f;
string _progress2Value; [ObservableProperty]
string _progress2Visible; Color _lineColor;
bool _progressIndeterminate; [ObservableProperty]
double _progressMaxValue; ScanResults _localResults;
string _progressText; [ObservableProperty]
double _progressValue; string _maxSpeed;
bool _progressVisible; [ObservableProperty]
bool _resultsVisible; double _maxX;
MediaScan _scanner; [ObservableProperty]
bool _startVisible; double _maxY;
double _stepsX; [ObservableProperty]
double _stepsY; string _minSpeed;
string _stopEnabled; [ObservableProperty]
bool _stopVisible; double _minX;
string _totalTime; [ObservableProperty]
string _unreadableSectors; double _minY;
[ObservableProperty]
bool _progress1Visible;
[ObservableProperty]
string _progress2Indeterminate;
[ObservableProperty]
string _progress2MaxValue;
[ObservableProperty]
string _progress2Text;
[ObservableProperty]
string _progress2Value;
[ObservableProperty]
string _progress2Visible;
[ObservableProperty]
bool _progressIndeterminate;
[ObservableProperty]
double _progressMaxValue;
[ObservableProperty]
string _progressText;
[ObservableProperty]
double _progressValue;
[ObservableProperty]
bool _progressVisible;
[ObservableProperty]
bool _resultsVisible;
[ObservableProperty]
MediaScan _scanner;
[ObservableProperty]
bool _startVisible;
[ObservableProperty]
double _stepsX;
[ObservableProperty]
double _stepsY;
[ObservableProperty]
string _stopEnabled;
[ObservableProperty]
bool _stopVisible;
[ObservableProperty]
string _totalTime;
[ObservableProperty]
string _unreadableSectors;
public MediaScanViewModel(string devicePath, Window view) public MediaScanViewModel(string devicePath, Window view)
{ {
_devicePath = devicePath; _devicePath = devicePath;
_view = view; _view = view;
StopVisible = false; StopVisible = false;
StartCommand = ReactiveCommand.Create(ExecuteStartCommand); StartCommand = new RelayCommand(Start);
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); CloseCommand = new RelayCommand(Close);
StopCommand = ReactiveCommand.Create(ExecuteStopCommand); StopCommand = new RelayCommand(Stop);
StartVisible = true; StartVisible = true;
CloseVisible = true; CloseVisible = true;
BlockMapList = []; BlockMapList = [];
@@ -124,207 +165,21 @@ public sealed class MediaScanViewModel : ViewModelBase
public string CloseLabel => UI.ButtonLabel_Close; public string CloseLabel => UI.ButtonLabel_Close;
public string StopLabel => UI.ButtonLabel_Stop; public string StopLabel => UI.ButtonLabel_Stop;
public Color AxesColor
{
get => _axesColor;
set => this.RaiseAndSetIfChanged(ref _axesColor, value);
}
public Color LineColor
{
get => _lineColor;
set => this.RaiseAndSetIfChanged(ref _lineColor, value);
}
public ObservableCollection<(ulong block, double duration)> BlockMapList { get; } public ObservableCollection<(ulong block, double duration)> BlockMapList { get; }
// public ObservableCollection<DataPoint> ChartPoints { get; } // public ObservableCollection<DataPoint> ChartPoints { get; }
public ulong Blocks
{
get => _blocks;
set => this.RaiseAndSetIfChanged(ref _blocks, value);
}
public string A
{
get => _a;
set => this.RaiseAndSetIfChanged(ref _a, value);
}
public string B
{
get => _b;
set => this.RaiseAndSetIfChanged(ref _b, value);
}
public string C
{
get => _c;
set => this.RaiseAndSetIfChanged(ref _c, value);
}
public string D
{
get => _d;
set => this.RaiseAndSetIfChanged(ref _d, value);
}
public string E
{
get => _e;
set => this.RaiseAndSetIfChanged(ref _e, value);
}
public string F
{
get => _f;
set => this.RaiseAndSetIfChanged(ref _f, value);
}
public string UnreadableSectors
{
get => _unreadableSectors;
set => this.RaiseAndSetIfChanged(ref _unreadableSectors, value);
}
public string TotalTime
{
get => _totalTime;
set => this.RaiseAndSetIfChanged(ref _totalTime, value);
}
public string AvgSpeed
{
get => _avgSpeed;
set => this.RaiseAndSetIfChanged(ref _avgSpeed, value);
}
public string MaxSpeed
{
get => _maxSpeed;
set => this.RaiseAndSetIfChanged(ref _maxSpeed, value);
}
public string MinSpeed
{
get => _minSpeed;
set => this.RaiseAndSetIfChanged(ref _minSpeed, value);
}
public bool ProgressVisible
{
get => _progressVisible;
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
}
public bool Progress1Visible
{
get => _progress1Visible;
set => this.RaiseAndSetIfChanged(ref _progress1Visible, value);
}
public string ProgressText
{
get => _progressText;
set => this.RaiseAndSetIfChanged(ref _progressText, value);
}
public double ProgressMaxValue
{
get => _progressMaxValue;
set => this.RaiseAndSetIfChanged(ref _progressMaxValue, value);
}
public bool ProgressIndeterminate
{
get => _progressIndeterminate;
set => this.RaiseAndSetIfChanged(ref _progressIndeterminate, value);
}
public double ProgressValue
{
get => _progressValue;
set => this.RaiseAndSetIfChanged(ref _progressValue, value);
}
public bool StartVisible
{
get => _startVisible;
set => this.RaiseAndSetIfChanged(ref _startVisible, value);
}
public bool CloseVisible
{
get => _closeVisible;
set => this.RaiseAndSetIfChanged(ref _closeVisible, value);
}
public bool StopVisible
{
get => _stopVisible;
set => this.RaiseAndSetIfChanged(ref _stopVisible, value);
}
public string StopEnabled
{
get => _stopEnabled;
set => this.RaiseAndSetIfChanged(ref _stopEnabled, value);
}
public bool ResultsVisible
{
get => _resultsVisible;
set => this.RaiseAndSetIfChanged(ref _resultsVisible, value);
}
public double MaxY
{
get => _maxY;
set => this.RaiseAndSetIfChanged(ref _maxY, value);
}
public double MaxX
{
get => _maxX;
set => this.RaiseAndSetIfChanged(ref _maxX, value);
}
public double MinY
{
get => _minY;
set => this.RaiseAndSetIfChanged(ref _minY, value);
}
public double MinX
{
get => _minX;
set => this.RaiseAndSetIfChanged(ref _minX, value);
}
public double StepsY
{
get => _stepsY;
set => this.RaiseAndSetIfChanged(ref _stepsY, value);
}
public double StepsX
{
get => _stepsX;
set => this.RaiseAndSetIfChanged(ref _stepsX, value);
}
public string Title { get; } public string Title { get; }
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ICommand StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ICommand CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ICommand StopCommand { get; }
void ExecuteCloseCommand() => _view.Close(); void Close() => _view.Close();
internal void ExecuteStopCommand() => _scanner?.Abort(); internal void Stop() => _scanner?.Abort();
void ExecuteStartCommand() void Start()
{ {
StopVisible = true; StopVisible = true;
StartVisible = false; StartVisible = false;

View File

@@ -45,36 +45,21 @@ using Aaru.Localization;
using Aaru.Logging; using Aaru.Logging;
using Aaru.Settings; using Aaru.Settings;
using Avalonia.Threading; using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ReactiveUI;
using Sentry; using Sentry;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class SplashWindowViewModel(SplashWindow view) : ViewModelBase public sealed partial class SplashWindowViewModel(SplashWindow view) : ViewModelBase
{ {
[ObservableProperty]
double _currentProgress; double _currentProgress;
[ObservableProperty]
double _maxProgress; double _maxProgress;
[ObservableProperty]
string _message; string _message;
public string Message
{
get => _message;
set => this.RaiseAndSetIfChanged(ref _message, value);
}
public double MaxProgress
{
get => _maxProgress;
set => this.RaiseAndSetIfChanged(ref _maxProgress, value);
}
public double CurrentProgress
{
get => _currentProgress;
set => this.RaiseAndSetIfChanged(ref _currentProgress, value);
}
internal void OnOpened() internal void OnOpened()
{ {
Message = UI.Welcome_to_Aaru; Message = UI.Welcome_to_Aaru;

View File

@@ -34,21 +34,26 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers; using Aaru.Helpers;
using Aaru.Localization; using Aaru.Localization;
using CommunityToolkit.Mvvm.ComponentModel;
using JetBrains.Annotations; using JetBrains.Annotations;
using ReactiveUI;
namespace Aaru.Gui.ViewModels.Windows; namespace Aaru.Gui.ViewModels.Windows;
public sealed class ViewSectorViewModel : ViewModelBase public sealed partial class ViewSectorViewModel : ViewModelBase
{ {
const int HEX_COLUMNS = 32; const int HEX_COLUMNS = 32;
readonly IMediaImage _inputFormat; readonly IMediaImage _inputFormat;
bool _longSectorChecked; [ObservableProperty]
bool _longSectorVisible; bool _longSectorChecked;
string _printHexText; [ObservableProperty]
double _sectorNumber; bool _longSectorVisible;
string _title; [ObservableProperty]
string _totalSectorsText; string _printHexText;
double _sectorNumber;
[ObservableProperty]
string _title;
[ObservableProperty]
string _totalSectorsText;
public ViewSectorViewModel([NotNull] IMediaImage inputFormat) public ViewSectorViewModel([NotNull] IMediaImage inputFormat)
{ {
@@ -68,18 +73,13 @@ public sealed class ViewSectorViewModel : ViewModelBase
public string SectorLabel => UI.Title_Sector; public string SectorLabel => UI.Title_Sector;
public string LongSectorLabel => UI.Show_long_sector; public string LongSectorLabel => UI.Show_long_sector;
public string Title
{
get => _title;
set => this.RaiseAndSetIfChanged(ref _title, value);
}
public double SectorNumber public double SectorNumber
{ {
get => _sectorNumber; get => _sectorNumber;
set set
{ {
this.RaiseAndSetIfChanged(ref _sectorNumber, value); SetProperty(ref _sectorNumber, value);
ErrorNumber errno = LongSectorChecked ErrorNumber errno = LongSectorChecked
? _inputFormat.ReadSectorLong((ulong)SectorNumber, out byte[] sector) ? _inputFormat.ReadSectorLong((ulong)SectorNumber, out byte[] sector)
@@ -88,20 +88,4 @@ public sealed class ViewSectorViewModel : ViewModelBase
if(errno == ErrorNumber.NoError) PrintHexText = PrintHex.ByteArrayToHexArrayString(sector, HEX_COLUMNS); if(errno == ErrorNumber.NoError) PrintHexText = PrintHex.ByteArrayToHexArrayString(sector, HEX_COLUMNS);
} }
} }
public string TotalSectorsText { get; }
public bool LongSectorChecked
{
get => _longSectorChecked;
set => this.RaiseAndSetIfChanged(ref _longSectorChecked, value);
}
public bool LongSectorVisible { get; }
public string PrintHexText
{
get => _printHexText;
set => this.RaiseAndSetIfChanged(ref _printHexText, value);
}
} }

View File

@@ -51,7 +51,7 @@ public sealed class ImageChecksum : Window
protected override void OnClosing(WindowClosingEventArgs e) protected override void OnClosing(WindowClosingEventArgs e)
{ {
(DataContext as ImageChecksumViewModel)?.ExecuteStopCommand(); (DataContext as ImageChecksumViewModel)?.Stop();
base.OnClosing(e); base.OnClosing(e);
} }
} }

View File

@@ -51,7 +51,7 @@ public sealed class ImageConvert : Window
protected override void OnClosing(WindowClosingEventArgs e) protected override void OnClosing(WindowClosingEventArgs e)
{ {
(DataContext as ImageConvertViewModel)?.ExecuteStopCommand(); (DataContext as ImageConvertViewModel)?.Stop();
base.OnClosing(e); base.OnClosing(e);
} }
} }

View File

@@ -51,7 +51,7 @@ public sealed class ImageEntropy : Window
protected override void OnClosing(WindowClosingEventArgs e) protected override void OnClosing(WindowClosingEventArgs e)
{ {
(DataContext as ImageEntropyViewModel)?.ExecuteStopCommand(); (DataContext as ImageEntropyViewModel)?.Stop();
base.OnClosing(e); base.OnClosing(e);
} }
} }

View File

@@ -51,7 +51,7 @@ public sealed class ImageVerify : Window
protected override void OnClosing(WindowClosingEventArgs e) protected override void OnClosing(WindowClosingEventArgs e)
{ {
(DataContext as ImageVerifyViewModel)?.ExecuteStopCommand(); (DataContext as ImageVerifyViewModel)?.Stop();
base.OnClosing(e); base.OnClosing(e);
} }
} }

View File

@@ -51,7 +51,7 @@ public sealed class MediaDump : Window
protected override void OnClosing(WindowClosingEventArgs e) protected override void OnClosing(WindowClosingEventArgs e)
{ {
(DataContext as MediaDumpViewModel)?.ExecuteStopCommand(); (DataContext as MediaDumpViewModel)?.Stop();
base.OnClosing(e); base.OnClosing(e);
} }
} }

View File

@@ -51,7 +51,7 @@ public sealed class MediaScan : Window
protected override void OnClosing(WindowClosingEventArgs e) protected override void OnClosing(WindowClosingEventArgs e)
{ {
(DataContext as MediaScanViewModel)?.ExecuteStopCommand(); (DataContext as MediaScanViewModel)?.Stop();
base.OnClosing(e); base.OnClosing(e);
} }
} }

View File

@@ -6,11 +6,11 @@
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.4"/> <PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.4"/>
<PackageVersion Include="Avalonia.Desktop" Version="11.3.4"/> <PackageVersion Include="Avalonia.Desktop" Version="11.3.4"/>
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.4"/> <PackageVersion Include="Avalonia.Diagnostics" Version="11.3.4"/>
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.3.4"/>
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.3.4"/> <PackageVersion Include="Avalonia.Themes.Fluent" Version="11.3.4"/>
<PackageVersion Include="Avalonia" Version="11.3.4"/> <PackageVersion Include="Avalonia" Version="11.3.4"/>
<PackageVersion Include="Claunia.Encoding" Version="1.9.2"/> <PackageVersion Include="Claunia.Encoding" Version="1.9.2"/>
<PackageVersion Include="Claunia.RsrcFork" Version="1.2.0"/> <PackageVersion Include="Claunia.RsrcFork" Version="1.2.0"/>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
<PackageVersion Include="DotNetZip" Version="1.16.0"/> <PackageVersion Include="DotNetZip" Version="1.16.0"/>
<PackageVersion Include="ErrorProne.NET.CoreAnalyzers" Version="0.1.2"/> <PackageVersion Include="ErrorProne.NET.CoreAnalyzers" Version="0.1.2"/>
<PackageVersion Include="ErrorProne.NET.Structs" Version="0.1.2"/> <PackageVersion Include="ErrorProne.NET.Structs" Version="0.1.2"/>