mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Aaru.Gui] Reformat and cleanup.
This commit is contained in:
@@ -90,30 +90,43 @@ public sealed class AboutViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string AboutLabel => UI.Label_About;
|
||||
|
||||
[NotNull]
|
||||
public string LibrariesLabel => UI.Label_Libraries;
|
||||
|
||||
[NotNull]
|
||||
public string AuthorsLabel => UI.Label_Authors;
|
||||
|
||||
[NotNull]
|
||||
public string Title => UI.Title_About_Aaru;
|
||||
|
||||
[NotNull]
|
||||
public string SoftwareName => "Aaru";
|
||||
|
||||
[NotNull]
|
||||
public string SuiteName => "Aaru Data Preservation Suite";
|
||||
|
||||
[NotNull]
|
||||
public string Copyright => "© 2011-2023 Natalia Portillo";
|
||||
|
||||
[NotNull]
|
||||
public string Website => "https://aaru.app";
|
||||
|
||||
[NotNull]
|
||||
public string License => UI.Label_License;
|
||||
|
||||
[NotNull]
|
||||
public string CloseLabel => UI.ButtonLabel_Close;
|
||||
|
||||
[NotNull]
|
||||
public string AssembliesLibraryText => UI.Title_Library;
|
||||
|
||||
[NotNull]
|
||||
public string AssembliesVersionText => UI.Title_Version;
|
||||
|
||||
[NotNull]
|
||||
public string Authors => UI.Text_Authors;
|
||||
|
||||
public ReactiveCommand<Unit, Unit> WebsiteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> LicenseCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
|
||||
@@ -64,13 +64,17 @@ public sealed class ConsoleViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string Title => UI.Title_Console;
|
||||
|
||||
public ReactiveCommand<Unit, Unit> ClearCommand { get; }
|
||||
public ReactiveCommand<Unit, Task> SaveCommand { get; }
|
||||
public ObservableCollection<LogEntry> Entries => ConsoleHandler.Entries;
|
||||
|
||||
[NotNull]
|
||||
public string DebugText => UI.Enable_debug_console;
|
||||
|
||||
[NotNull]
|
||||
public string SaveLabel => UI.ButtonLabel_Save;
|
||||
|
||||
[NotNull]
|
||||
public string ClearLabel => UI.ButtonLabel_Clear;
|
||||
|
||||
@@ -95,11 +99,8 @@ public sealed class ConsoleViewModel : ViewModelBase
|
||||
|
||||
dlgSave.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"log"
|
||||
}),
|
||||
Name = UI.Dialog_Log_files
|
||||
Extensions = new List<string>(new[] { "log" }),
|
||||
Name = UI.Dialog_Log_files
|
||||
});
|
||||
|
||||
string result = await dlgSave.ShowAsync(_view);
|
||||
@@ -132,7 +133,7 @@ public sealed class ConsoleViewModel : ViewModelBase
|
||||
logSw.WriteLine();
|
||||
|
||||
logSw.WriteLine(Localization.Core.Program_information);
|
||||
logSw.WriteLine("Aaru {0}", assemblyVersion?.InformationalVersion);
|
||||
logSw.WriteLine("Aaru {0}", assemblyVersion?.InformationalVersion);
|
||||
logSw.WriteLine(Localization.Core.Running_in_0_bit, Environment.Is64BitProcess ? 64 : 32);
|
||||
#if DEBUG
|
||||
logSw.WriteLine(Localization.Core.DEBUG_version);
|
||||
@@ -143,10 +144,12 @@ public sealed class ConsoleViewModel : ViewModelBase
|
||||
logSw.WriteLine(UI.Console_with_ornament);
|
||||
|
||||
foreach(LogEntry entry in ConsoleHandler.Entries)
|
||||
{
|
||||
if(entry.Type != UI.LogEntry_Type_Info)
|
||||
logSw.WriteLine("{0}: ({1}) {2}", entry.Timestamp, entry.Type.ToLower(), entry.Message);
|
||||
else
|
||||
logSw.WriteLine("{0}: {1}", entry.Timestamp, entry.Message);
|
||||
}
|
||||
|
||||
logSw.Close();
|
||||
logFs.Close();
|
||||
@@ -155,8 +158,10 @@ public sealed class ConsoleViewModel : ViewModelBase
|
||||
{
|
||||
await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Exception_0_trying_to_save_logfile_details_has_been_sent_to_console,
|
||||
exception.Message), ButtonEnum.Ok, Icon.Error).
|
||||
Format(
|
||||
UI.
|
||||
Exception_0_trying_to_save_logfile_details_has_been_sent_to_console,
|
||||
exception.Message), ButtonEnum.Ok, Icon.Error).
|
||||
ShowWindowDialogAsync(_view);
|
||||
|
||||
AaruConsole.ErrorWriteLine("Console", exception.Message);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
@@ -56,7 +55,7 @@ public sealed class EncodingsViewModel : ViewModelBase
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
List<EncodingModel> encodings = Encoding.GetEncodings().Select(info => new EncodingModel
|
||||
var encodings = Encoding.GetEncodings().Select(info => new EncodingModel
|
||||
{
|
||||
Name = info.Name,
|
||||
DisplayName = info.GetEncoding().EncodingName
|
||||
@@ -75,6 +74,7 @@ public sealed class EncodingsViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string Title => UI.Encodings;
|
||||
|
||||
[NotNull]
|
||||
public string CloseLabel => UI.ButtonLabel_Close;
|
||||
|
||||
|
||||
@@ -63,8 +63,10 @@ public sealed class LicenseViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string Title => UI.Title_Aaru_license;
|
||||
|
||||
[NotNull]
|
||||
public string CloseLabel => UI.ButtonLabel_Close;
|
||||
|
||||
public string LicenseText { get; }
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
|
||||
|
||||
@@ -177,24 +177,34 @@ public sealed class PluginsViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string Title => UI.Title_Plugins;
|
||||
|
||||
[NotNull]
|
||||
public string FiltersLabel => UI.Title_Filters;
|
||||
|
||||
[NotNull]
|
||||
public string PartitionsLabel => UI.Title_Partitions;
|
||||
|
||||
[NotNull]
|
||||
public string FilesystemsLabel => UI.Title_Filesystems;
|
||||
|
||||
[NotNull]
|
||||
public string IdentifyLabel => UI.Title_Identify_only;
|
||||
|
||||
[NotNull]
|
||||
public string ImagesLabel => UI.Title_Media_images;
|
||||
|
||||
[NotNull]
|
||||
public string FloppyImagesLabel => UI.Title_Floppy_images;
|
||||
|
||||
[NotNull]
|
||||
public string ReadableLabel => UI.Title_Readable;
|
||||
|
||||
[NotNull]
|
||||
public string WritableLabel => UI.Title_Writable;
|
||||
|
||||
[NotNull]
|
||||
public string CloseLabel => UI.ButtonLabel_Close;
|
||||
|
||||
public string NameLabel => UI.Title_Name;
|
||||
public string UUIDLabel => UI.Title_UUID;
|
||||
public string VersionLabel => UI.Title_Version;
|
||||
|
||||
@@ -92,16 +92,22 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
// TODO: Show Preferences in macOS
|
||||
[NotNull]
|
||||
public string Title => UI.Title_Settings;
|
||||
|
||||
[NotNull]
|
||||
public string GdprLabel => UI.Title_GDPR;
|
||||
|
||||
[NotNull]
|
||||
public string ReportsLabel => UI.Title_Reports;
|
||||
|
||||
[NotNull]
|
||||
public string StatisticsLabel => UI.Title_Statistics;
|
||||
|
||||
[NotNull]
|
||||
public string SaveLabel => UI.ButtonLabel_Save;
|
||||
|
||||
[NotNull]
|
||||
public string CancelLabel => UI.ButtonLabel_Cancel;
|
||||
|
||||
[NotNull]
|
||||
public string GdprText1 => UI.GDPR_Compliance;
|
||||
|
||||
@@ -110,6 +116,7 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string GdprText3 => UI.GDPR_Information_sharing;
|
||||
|
||||
[NotNull]
|
||||
public string ReportsGloballyText => UI.Configure_Device_Report_information_disclaimer;
|
||||
|
||||
@@ -121,29 +128,40 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string ShareReportsText => UI.Share_your_device_reports_with_us_Q;
|
||||
|
||||
[NotNull]
|
||||
public string StatisticsText => UI.Statistics_disclaimer;
|
||||
|
||||
[NotNull]
|
||||
public string SaveStatsText => UI.Save_stats_about_your_Aaru_usage_Q;
|
||||
|
||||
[NotNull]
|
||||
public string ShareStatsText => UI.Share_your_stats_anonymously_Q;
|
||||
|
||||
[NotNull]
|
||||
public string CommandStatsText => UI.Gather_statistics_about_command_usage_Q;
|
||||
|
||||
[NotNull]
|
||||
public string DeviceStatsText => UI.Gather_statistics_about_found_devices_Q;
|
||||
|
||||
[NotNull]
|
||||
public string FilesystemStatsText => UI.Gather_statistics_about_found_filesystems_Q;
|
||||
|
||||
[NotNull]
|
||||
public string FilterStatsText => UI.Gather_statistics_about_found_file_filters_Q;
|
||||
|
||||
[NotNull]
|
||||
public string MediaImageStatsText => UI.Gather_statistics_about_found_media_image_formats_Q;
|
||||
|
||||
[NotNull]
|
||||
public string MediaScanStatsText => UI.Gather_statistics_about_scanned_media_Q;
|
||||
|
||||
[NotNull]
|
||||
public string PartitionStatsText => UI.Gather_statistics_about_found_partitioning_schemes_Q;
|
||||
|
||||
[NotNull]
|
||||
public string MediaStatsText => UI.Gather_statistics_about_media_types_Q;
|
||||
|
||||
[NotNull]
|
||||
public string VerifyStatsText => UI.Gather_statistics_about_media_image_verifications_Q;
|
||||
|
||||
@@ -246,6 +264,7 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
Settings.Settings.Current.ShareReports = ShareReportsChecked;
|
||||
|
||||
if(SaveStatsChecked)
|
||||
{
|
||||
Settings.Settings.Current.Stats = new StatsSettings
|
||||
{
|
||||
ShareStats = ShareStatsChecked,
|
||||
@@ -259,6 +278,7 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
MediaStats = MediaStatsChecked,
|
||||
VerifyStats = VerifyStatsChecked
|
||||
};
|
||||
}
|
||||
else
|
||||
Settings.Settings.Current.Stats = null;
|
||||
|
||||
|
||||
@@ -118,12 +118,14 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(count > 0)
|
||||
{
|
||||
ctx.Commands.Add(new Command
|
||||
{
|
||||
Count = count,
|
||||
Name = "fs-info",
|
||||
Synchronized = true
|
||||
});
|
||||
}
|
||||
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
@@ -392,6 +394,7 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
foreach(DeviceStat ds in ctx.SeenDevices.OrderBy(n => n.Manufacturer).ThenBy(n => n.Manufacturer).
|
||||
ThenBy(n => n.Revision).ThenBy(n => n.Bus))
|
||||
{
|
||||
Devices.Add(new DeviceStatsModel
|
||||
{
|
||||
Model = ds.Model,
|
||||
@@ -399,6 +402,7 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
Revision = ds.Revision,
|
||||
Bus = ds.Bus
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(!ctx.Medias.Any())
|
||||
@@ -414,12 +418,14 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && c.Real);
|
||||
|
||||
if(count > 0)
|
||||
{
|
||||
Medias.Add(new MediaStatsModel
|
||||
{
|
||||
Name = media,
|
||||
Count = count,
|
||||
Type = UI.Media_found_type_real
|
||||
});
|
||||
}
|
||||
|
||||
count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real).Select(c => c.Count).
|
||||
FirstOrDefault();
|
||||
@@ -674,42 +680,61 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string CommandsLabel => UI.Title_Commands;
|
||||
|
||||
[NotNull]
|
||||
public string FilterLabel => UI.Title_Filter;
|
||||
|
||||
[NotNull]
|
||||
public string PartitionLabel => UI.Title_Partition;
|
||||
|
||||
[NotNull]
|
||||
public string PartitionsLabel => UI.Title_Partitions;
|
||||
|
||||
[NotNull]
|
||||
public string FiltersLabel => UI.Title_Filters;
|
||||
|
||||
[NotNull]
|
||||
public string FormatsLabel => UI.Title_Formats;
|
||||
|
||||
[NotNull]
|
||||
public string FormatLabel => UI.Title_Format;
|
||||
|
||||
[NotNull]
|
||||
public string FilesystemsLabel => UI.Title_Filesystems;
|
||||
|
||||
[NotNull]
|
||||
public string FilesystemLabel => UI.Title_Filesystem;
|
||||
|
||||
[NotNull]
|
||||
public string TimesFoundLabel => UI.Title_Times_used;
|
||||
|
||||
[NotNull]
|
||||
public string DevicesLabel => UI.Title_Devices;
|
||||
|
||||
[NotNull]
|
||||
public string DeviceLabel => UI.Title_Device;
|
||||
|
||||
[NotNull]
|
||||
public string ManufacturerLabel => UI.Title_Manufacturer;
|
||||
|
||||
[NotNull]
|
||||
public string RevisionLabel => UI.Title_Revision;
|
||||
|
||||
[NotNull]
|
||||
public string BusLabel => UI.Title_Bus;
|
||||
|
||||
[NotNull]
|
||||
public string MediasLabel => UI.Title_Medias;
|
||||
|
||||
[NotNull]
|
||||
public string MediaLabel => UI.Title_Media;
|
||||
|
||||
[NotNull]
|
||||
public string TypeLabel => Localization.Core.Title_Type_for_media;
|
||||
|
||||
[NotNull]
|
||||
public string Title => UI.Encodings;
|
||||
|
||||
[NotNull]
|
||||
public string CloseLabel => UI.ButtonLabel_Close;
|
||||
|
||||
|
||||
@@ -179,18 +179,22 @@ public sealed class DeviceInfoViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(devInfo.IsPcmcia)
|
||||
{
|
||||
PcmciaInfo = new PcmciaInfo
|
||||
{
|
||||
DataContext = new PcmciaInfoViewModel(devInfo.Cis, _view)
|
||||
};
|
||||
}
|
||||
|
||||
if(devInfo.AtaIdentify != null ||
|
||||
devInfo.AtapiIdentify != null)
|
||||
{
|
||||
AtaInfo = new AtaInfo
|
||||
{
|
||||
DataContext =
|
||||
new AtaInfoViewModel(devInfo.AtaIdentify, devInfo.AtapiIdentify, devInfo.AtaMcptError, _view)
|
||||
};
|
||||
}
|
||||
|
||||
if(devInfo.ScsiInquiryData != null)
|
||||
{
|
||||
@@ -208,7 +212,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase
|
||||
if(devInfo.PlextorFeatures.Eeprom != null)
|
||||
{
|
||||
PlextorEepromVisible = true;
|
||||
PlextorDiscs = $"{devInfo.PlextorFeatures.Discs}";
|
||||
PlextorDiscs = $"{devInfo.PlextorFeatures.Discs}";
|
||||
PlextorCdReadTime = devInfo.PlextorFeatures.CdReadTime.Seconds().Humanize(minUnit: TimeUnit.Second);
|
||||
|
||||
PlextorCdWriteTime =
|
||||
@@ -280,11 +284,13 @@ public sealed class DeviceInfoViewModel : ViewModelBase
|
||||
|
||||
PlextorSilentModeCdReadSpeedLimit =
|
||||
devInfo.PlextorFeatures.CdReadSpeedLimit > 0
|
||||
? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x" : UI.unlimited_as_in_speed;
|
||||
? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x"
|
||||
: UI.unlimited_as_in_speed;
|
||||
|
||||
PlextorSilentModeCdWriteSpeedLimit =
|
||||
devInfo.PlextorFeatures.CdWriteSpeedLimit > 0
|
||||
? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x" : UI.unlimited_as_in_speed;
|
||||
? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x"
|
||||
: UI.unlimited_as_in_speed;
|
||||
|
||||
if(devInfo.PlextorFeatures.IsDvd)
|
||||
{
|
||||
@@ -292,7 +298,8 @@ public sealed class DeviceInfoViewModel : ViewModelBase
|
||||
|
||||
PlextorSilentModeDvdReadSpeedLimit =
|
||||
devInfo.PlextorFeatures.DvdReadSpeedLimit > 0
|
||||
? $"{devInfo.PlextorFeatures.DvdReadSpeedLimit}x" : UI.unlimited_as_in_speed;
|
||||
? $"{devInfo.PlextorFeatures.DvdReadSpeedLimit}x"
|
||||
: UI.unlimited_as_in_speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,30 +356,37 @@ public sealed class DeviceInfoViewModel : ViewModelBase
|
||||
Ssc = true;
|
||||
|
||||
if(blockLimits.Value.minBlockLen == blockLimits.Value.maxBlockLen)
|
||||
{
|
||||
MinBlockSize = string.Format(Localization.Core.Device_block_size_is_fixed_at_0_bytes,
|
||||
blockLimits.Value.minBlockLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxBlockSize = blockLimits.Value.maxBlockLen > 0
|
||||
? string.Format(Localization.Core.Device_maximum_block_size_is_0_bytes,
|
||||
blockLimits.Value.maxBlockLen) : Localization.Core.
|
||||
Device_does_not_specify_a_maximum_block_size;
|
||||
blockLimits.Value.maxBlockLen)
|
||||
: Localization.Core.
|
||||
Device_does_not_specify_a_maximum_block_size;
|
||||
|
||||
MinBlockSize = string.Format(Localization.Core.Device_minimum_block_size_is_0_bytes,
|
||||
blockLimits.Value.minBlockLen);
|
||||
|
||||
if(blockLimits.Value.granularity > 0)
|
||||
{
|
||||
BlockSizeGranularity =
|
||||
string.Format(Localization.Core.Device_needs_a_block_size_granularity_of_pow_0_1_bytes,
|
||||
blockLimits.Value.granularity,
|
||||
Math.Pow(2, blockLimits.Value.granularity));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(devInfo.DensitySupport != null)
|
||||
{
|
||||
if(devInfo.DensitySupportHeader.HasValue)
|
||||
Densities = DensitySupport.PrettifyDensity(devInfo.DensitySupportHeader);
|
||||
}
|
||||
|
||||
if(devInfo.MediumDensitySupport != null)
|
||||
{
|
||||
@@ -1002,11 +1016,8 @@ public sealed class DeviceInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
@@ -41,8 +41,8 @@ public sealed class FileSystemViewModel
|
||||
public FileSystemViewModel([NotNull] FileSystem metadata, string information)
|
||||
{
|
||||
TypeText = string.Format(Localization.Core.Filesystem_type_0, metadata.Type);
|
||||
VolumeNameText = string.Format(Localization.Core.Volume_name_0, metadata.VolumeName);
|
||||
SerialNumberText = string.Format(Localization.Core.Volume_serial_0, metadata.VolumeSerial);
|
||||
VolumeNameText = string.Format(Localization.Core.Volume_name_0, metadata.VolumeName);
|
||||
SerialNumberText = string.Format(Localization.Core.Volume_serial_0, metadata.VolumeSerial);
|
||||
|
||||
ApplicationIdentifierText =
|
||||
string.Format(Localization.Core.Application_identifier_0, metadata.ApplicationIdentifier);
|
||||
@@ -57,10 +57,10 @@ public sealed class FileSystemViewModel
|
||||
|
||||
PublisherIdentifierText = string.Format(Localization.Core.Publisher_identifier_0, metadata.PublisherIdentifier);
|
||||
|
||||
CreationDateText = string.Format(Localization.Core.Volume_created_on_0, metadata.CreationDate);
|
||||
EffectiveDateText = string.Format(Localization.Core.Volume_effective_from_0, metadata.EffectiveDate);
|
||||
ModificationDateText = string.Format(Localization.Core.Volume_last_modified_on_0, metadata.ModificationDate);
|
||||
ExpirationDateText = string.Format(Localization.Core.Volume_expired_on_0, metadata.ExpirationDate);
|
||||
CreationDateText = string.Format(Localization.Core.Volume_created_on_0, metadata.CreationDate);
|
||||
EffectiveDateText = string.Format(Localization.Core.Volume_effective_from_0, metadata.EffectiveDate);
|
||||
ModificationDateText = string.Format(Localization.Core.Volume_last_modified_on_0, metadata.ModificationDate);
|
||||
ExpirationDateText = string.Format(Localization.Core.Volume_expired_on_0, metadata.ExpirationDate);
|
||||
BackupDateText = string.Format(Localization.Core.Volume_last_backed_up_on_0, metadata.BackupDate);
|
||||
|
||||
ClustersText = string.Format(Localization.Core.Volume_has_0_clusters_of_1_bytes_each_total_of_2_bytes,
|
||||
|
||||
@@ -50,7 +50,6 @@ using Aaru.Gui.Views.Tabs;
|
||||
using Aaru.Gui.Views.Windows;
|
||||
using Aaru.Helpers;
|
||||
using Aaru.Localization;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
@@ -78,9 +77,9 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
public ImageInfoViewModel(string imagePath, IFilter filter, IMediaImage imageFormat, Window view)
|
||||
|
||||
{
|
||||
_imagePath = imagePath;
|
||||
_filter = filter;
|
||||
_imageFormat = imageFormat;
|
||||
_imagePath = imagePath;
|
||||
_filter = filter;
|
||||
_imageFormat = imageFormat;
|
||||
MediaTagsList = new ObservableCollection<string>();
|
||||
SectorTagsList = new ObservableCollection<string>();
|
||||
Sessions = new ObservableCollection<Session>();
|
||||
@@ -113,13 +112,13 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
? genericOpticalIcon
|
||||
: genericFolderIcon;
|
||||
|
||||
ImagePathText = string.Format(UI.Path_0, imagePath);
|
||||
FilterText = string.Format(UI.Filter_0, filter.Name);
|
||||
ImagePathText = string.Format(UI.Path_0, imagePath);
|
||||
FilterText = string.Format(UI.Filter_0, filter.Name);
|
||||
ImageIdentifiedText = string.Format(UI.Image_format_identified_by_0_1, imageFormat.Name, imageFormat.Id);
|
||||
|
||||
ImageFormatText = !string.IsNullOrWhiteSpace(imageFormat.Info.Version)
|
||||
? string.Format(UI.Format_0_version_1, imageFormat.Format, imageFormat.Info.Version)
|
||||
: string.Format(UI.Format_0, imageFormat.Format);
|
||||
: string.Format(UI.Format_0, imageFormat.Format);
|
||||
|
||||
ImageSizeText = string.Format(Localization.Core.Image_without_headers_is_0_bytes_long,
|
||||
imageFormat.Info.ImageSize);
|
||||
@@ -136,10 +135,12 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
HasSessionsText = imageFormat.Info.HasSessions ? UI.Has_sessions : UI.Doesnt_have_sessions;
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application))
|
||||
{
|
||||
ApplicationText = !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion)
|
||||
? string.Format(Localization.Core.Was_created_with_0_version_1,
|
||||
imageFormat.Info.Application, imageFormat.Info.ApplicationVersion)
|
||||
: string.Format(Localization.Core.Was_created_with_0, imageFormat.Info.Application);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Creator))
|
||||
CreatorText = string.Format(Localization.Core.Created_by_0, imageFormat.Info.Creator);
|
||||
@@ -148,27 +149,35 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
CreationTimeText = string.Format(Localization.Core.Created_on_0, imageFormat.Info.CreationTime);
|
||||
|
||||
if(imageFormat.Info.LastModificationTime != DateTime.MinValue)
|
||||
{
|
||||
LastModificationTimeText =
|
||||
string.Format(Localization.Core.Last_modified_on_0, imageFormat.Info.LastModificationTime);
|
||||
}
|
||||
|
||||
if(imageFormat.Info.MediaSequence != 0 &&
|
||||
imageFormat.Info.LastMediaSequence != 0)
|
||||
{
|
||||
MediaSequenceText = string.Format(Localization.Core.Media_is_number_0_on_a_set_of_1_medias,
|
||||
imageFormat.Info.MediaSequence, imageFormat.Info.LastMediaSequence);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle))
|
||||
MediaTitleText = string.Format(UI.Media_title_0, imageFormat.Info.MediaTitle);
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer))
|
||||
{
|
||||
MediaManufacturerText =
|
||||
string.Format(Localization.Core.Media_manufacturer_0, imageFormat.Info.MediaManufacturer);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel))
|
||||
MediaModelText = string.Format(UI.Media_model_0, imageFormat.Info.MediaModel);
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber))
|
||||
{
|
||||
MediaSerialNumberText =
|
||||
string.Format(Localization.Core.Media_serial_number_0, imageFormat.Info.MediaSerialNumber);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode))
|
||||
MediaBarcodeText = string.Format(UI.Media_barcode_0, imageFormat.Info.MediaBarcode);
|
||||
@@ -183,8 +192,10 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
DriveModelText = string.Format(UI.Drive_model_0, imageFormat.Info.DriveModel);
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber))
|
||||
{
|
||||
DriveSerialNumberText =
|
||||
string.Format(Localization.Core.Drive_serial_number_0, imageFormat.Info.DriveSerialNumber);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision))
|
||||
DriveFirmwareRevisionText = string.Format(UI.Drive_firmware_info_0, imageFormat.Info.DriveFirmwareRevision);
|
||||
@@ -193,17 +204,23 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
imageFormat.Info is { Heads: > 0, SectorsPerTrack: > 0 } &&
|
||||
imageFormat.Info.MetadataMediaType != MetadataMediaType.OpticalDisc &&
|
||||
imageFormat is not ITapeImage { IsTape: true })
|
||||
{
|
||||
MediaGeometryText = string.Format(UI.Media_geometry_0_cylinders_1_heads_2_sectors_per_track,
|
||||
imageFormat.Info.Cylinders, imageFormat.Info.Heads,
|
||||
imageFormat.Info.SectorsPerTrack);
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags is { Count: > 0 })
|
||||
{
|
||||
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t))
|
||||
MediaTagsList.Add(tag.ToString());
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableSectorTags is { Count: > 0 })
|
||||
{
|
||||
foreach(SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t))
|
||||
SectorTagsList.Add(tag.ToString());
|
||||
}
|
||||
|
||||
PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess;
|
||||
byte[] scsiInquiryData = null;
|
||||
@@ -258,10 +275,12 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
errno = imageFormat.ReadMediaTag(MediaTagType.ATAPI_IDENTIFY, out atapiIdentify);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
AtaInfo = new AtaInfo
|
||||
{
|
||||
DataContext = new AtaInfoViewModel(ataIdentify, atapiIdentify, null, view)
|
||||
};
|
||||
}
|
||||
|
||||
byte[] toc = null;
|
||||
TOC.CDTOC? decodedToc = null;
|
||||
@@ -285,7 +304,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
|
||||
if(dataLen + 2 != toc.Length)
|
||||
{
|
||||
byte[] tmp = new byte[toc.Length + 2];
|
||||
var tmp = new byte[toc.Length + 2];
|
||||
Array.Copy(toc, 0, tmp, 2, toc.Length);
|
||||
tmp[0] = (byte)((toc.Length & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(toc.Length & 0xFF);
|
||||
@@ -307,7 +326,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
|
||||
if(dataLen + 2 != fullToc.Length)
|
||||
{
|
||||
byte[] tmp = new byte[fullToc.Length + 2];
|
||||
var tmp = new byte[fullToc.Length + 2];
|
||||
Array.Copy(fullToc, 0, tmp, 2, fullToc.Length);
|
||||
tmp[0] = (byte)((fullToc.Length & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(fullToc.Length & 0xFF);
|
||||
@@ -329,7 +348,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
|
||||
if(dataLen + 2 != pma.Length)
|
||||
{
|
||||
byte[] tmp = new byte[pma.Length + 2];
|
||||
var tmp = new byte[pma.Length + 2];
|
||||
Array.Copy(pma, 0, tmp, 2, pma.Length);
|
||||
tmp[0] = (byte)((pma.Length & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(pma.Length & 0xFF);
|
||||
@@ -348,7 +367,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
|
||||
if(dataLen + 4 != atip.Length)
|
||||
{
|
||||
byte[] tmp = new byte[atip.Length + 4];
|
||||
var tmp = new byte[atip.Length + 4];
|
||||
Array.Copy(atip, 0, tmp, 4, atip.Length);
|
||||
tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
|
||||
@@ -371,7 +390,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
|
||||
if(dataLen + 4 != cdtext.Length)
|
||||
{
|
||||
byte[] tmp = new byte[cdtext.Length + 4];
|
||||
var tmp = new byte[cdtext.Length + 4];
|
||||
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
|
||||
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
||||
@@ -562,10 +581,12 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
errno = imageFormat.ReadMediaTag(MediaTagType.PCMCIA_CIS, out pcmciaCis);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
PcmciaInfo = new PcmciaInfo
|
||||
{
|
||||
DataContext = new PcmciaInfoViewModel(pcmciaCis, view)
|
||||
};
|
||||
}
|
||||
|
||||
DeviceType deviceType = DeviceType.Unknown;
|
||||
byte[] cid = null;
|
||||
@@ -632,8 +653,10 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Sessions is { Count: > 0 })
|
||||
{
|
||||
foreach(Session session in opticalMediaImage.Sessions)
|
||||
Sessions.Add(session);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -643,8 +666,10 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Tracks is { Count: > 0 })
|
||||
{
|
||||
foreach(Track track in opticalMediaImage.Tracks)
|
||||
Tracks.Add(track);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -658,6 +683,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
foreach(DumpHardware dump in imageFormat.DumpHardware)
|
||||
{
|
||||
foreach(Extent extent in dump.Extents)
|
||||
{
|
||||
DumpHardwareList.Add(new DumpHardwareModel
|
||||
{
|
||||
Manufacturer = dump.Manufacturer,
|
||||
@@ -669,6 +695,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
Start = extent.Start,
|
||||
End = extent.End
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -720,9 +747,11 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
public ReactiveCommand<Unit, Unit> CreateSidecarCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ViewSectorsCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> DecodeMediaTagCommand { get; }
|
||||
|
||||
public bool DriveInformationVisible => DriveManufacturerText != null || DriveModelText != null ||
|
||||
DriveSerialNumberText != null || DriveFirmwareRevisionText != null ||
|
||||
MediaGeometryText != null;
|
||||
|
||||
public bool MediaInformationVisible => MediaSequenceText != null || MediaTitleText != null ||
|
||||
MediaManufacturerText != null || MediaModelText != null ||
|
||||
MediaSerialNumberText != null || MediaBarcodeText != null ||
|
||||
|
||||
@@ -93,8 +93,8 @@ public sealed class MediaInfoViewModel : ViewModelBase
|
||||
SaveMediumSupportCommand = ReactiveCommand.Create(ExecuteSaveMediumSupportCommand);
|
||||
DumpCommand = ReactiveCommand.Create(ExecuteDumpCommand);
|
||||
ScanCommand = ReactiveCommand.Create(ExecuteScanCommand);
|
||||
_devicePath = devicePath;
|
||||
_scsiInfo = scsiInfo;
|
||||
_devicePath = devicePath;
|
||||
_scsiInfo = scsiInfo;
|
||||
|
||||
var mediaResource = new Uri($"avares://Aaru.Gui/Assets/Logos/Media/{scsiInfo.MediaType}.png");
|
||||
|
||||
@@ -104,15 +104,17 @@ public sealed class MediaInfoViewModel : ViewModelBase
|
||||
|
||||
if(scsiInfo.Blocks != 0 &&
|
||||
scsiInfo.BlockSize != 0)
|
||||
{
|
||||
MediaSize = string.Format(Localization.Core.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2,
|
||||
scsiInfo.Blocks, scsiInfo.BlockSize,
|
||||
ByteSize.FromBytes(scsiInfo.Blocks * scsiInfo.BlockSize).ToString("0.000"));
|
||||
}
|
||||
|
||||
if(scsiInfo.MediaSerialNumber != null)
|
||||
{
|
||||
var sbSerial = new StringBuilder();
|
||||
|
||||
for(int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++)
|
||||
for(var i = 4; i < scsiInfo.MediaSerialNumber.Length; i++)
|
||||
sbSerial.AppendFormat("{0:X2}", scsiInfo.MediaSerialNumber[i]);
|
||||
|
||||
MediaSerial = sbSerial.ToString();
|
||||
@@ -360,11 +362,8 @@ public sealed class MediaInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -401,8 +400,8 @@ public sealed class MediaInfoViewModel : ViewModelBase
|
||||
case CommonTypes.MediaType.GDR or CommonTypes.MediaType.GDROM:
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
Localization.Core.GD_ROM_dump_support_is_not_yet_implemented,
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
Localization.Core.GD_ROM_dump_support_is_not_yet_implemented,
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
|
||||
return;
|
||||
case CommonTypes.MediaType.XGD or CommonTypes.MediaType.XGD2 or CommonTypes.MediaType.XGD3
|
||||
@@ -411,7 +410,7 @@ public sealed class MediaInfoViewModel : ViewModelBase
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
Localization.Core.
|
||||
Dumping_Xbox_Game_Discs_requires_a_drive_with_Kreon_firmware,
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -433,8 +432,8 @@ public sealed class MediaInfoViewModel : ViewModelBase
|
||||
case CommonTypes.MediaType.GDROM:
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
Localization.Core.GD_ROM_scan_support_is_not_yet_implemented,
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
Localization.Core.GD_ROM_scan_support_is_not_yet_implemented,
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
|
||||
return;
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ public sealed class PartitionViewModel
|
||||
{
|
||||
public PartitionViewModel(Partition partition)
|
||||
{
|
||||
NameText = string.Format(Localization.Core.Partition_name_0, partition.Name);
|
||||
TypeText = string.Format(Localization.Core.Partition_type_0, partition.Type);
|
||||
NameText = string.Format(Localization.Core.Partition_name_0, partition.Name);
|
||||
TypeText = string.Format(Localization.Core.Partition_type_0, partition.Type);
|
||||
StartText = string.Format(Localization.Core.Partition_start_sector_0_byte_1, partition.Start, partition.Offset);
|
||||
|
||||
LengthText = string.Format(Localization.Core.Partition_length_0_sectors_1_bytes, partition.Length,
|
||||
|
||||
@@ -161,6 +161,7 @@ public sealed class SubdirectoryViewModel
|
||||
ButtonResult mboxResult;
|
||||
|
||||
if(DetectOS.IsWindows)
|
||||
{
|
||||
if(filename.Contains('<') ||
|
||||
filename.Contains('>') ||
|
||||
filename.Contains(':') ||
|
||||
@@ -202,7 +203,8 @@ public sealed class SubdirectoryViewModel
|
||||
else
|
||||
chars = new char[filename.Length];
|
||||
|
||||
for(int ci = 0; ci < chars.Length; ci++)
|
||||
for(var ci = 0; ci < chars.Length; ci++)
|
||||
{
|
||||
switch(filename[ci])
|
||||
{
|
||||
case '<':
|
||||
@@ -253,6 +255,7 @@ public sealed class SubdirectoryViewModel
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(filename.StartsWith("CON", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
filename.StartsWith("PRN", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
@@ -269,34 +272,44 @@ public sealed class SubdirectoryViewModel
|
||||
|
||||
mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Unsupported_filename,
|
||||
string.
|
||||
Format(UI.Filename_0_not_supported_want_to_rename_to_1,
|
||||
Format(
|
||||
UI.
|
||||
Filename_0_not_supported_want_to_rename_to_1,
|
||||
filename, corrected),
|
||||
ButtonEnum.YesNoCancel, Icon.Warning).
|
||||
ShowWindowDialogAsync(_view);
|
||||
|
||||
switch(mboxResult)
|
||||
{
|
||||
case ButtonResult.Cancel: return;
|
||||
case ButtonResult.No: continue;
|
||||
case ButtonResult.Cancel:
|
||||
return;
|
||||
case ButtonResult.No:
|
||||
continue;
|
||||
default:
|
||||
filename = corrected;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string outputPath = Path.Combine(folder, filename);
|
||||
|
||||
if(File.Exists(outputPath))
|
||||
{
|
||||
mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Existing_file,
|
||||
string.Format(UI.File_named_0_exists_overwrite_Q, filename),
|
||||
ButtonEnum.YesNoCancel, Icon.Warning).ShowWindowDialogAsync(_view);
|
||||
string.Format(
|
||||
UI.File_named_0_exists_overwrite_Q,
|
||||
filename),
|
||||
ButtonEnum.YesNoCancel, Icon.Warning).
|
||||
ShowWindowDialogAsync(_view);
|
||||
|
||||
switch(mboxResult)
|
||||
{
|
||||
case ButtonResult.Cancel: return;
|
||||
case ButtonResult.No: continue;
|
||||
case ButtonResult.Cancel:
|
||||
return;
|
||||
case ButtonResult.No:
|
||||
continue;
|
||||
default:
|
||||
try
|
||||
{
|
||||
@@ -318,7 +331,7 @@ public sealed class SubdirectoryViewModel
|
||||
|
||||
try
|
||||
{
|
||||
byte[] outBuf = new byte[file.Stat.Length];
|
||||
var outBuf = new byte[file.Stat.Length];
|
||||
|
||||
ErrorNumber error = _model.Plugin.OpenFile(_model.Path + "/" + file.Name, out IFileNode fileNode);
|
||||
|
||||
@@ -331,8 +344,10 @@ public sealed class SubdirectoryViewModel
|
||||
if(error != ErrorNumber.NoError)
|
||||
{
|
||||
mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Error_reading_file,
|
||||
string.Format(UI.Error_0_reading_file_continue_Q, error), ButtonEnum.YesNo,
|
||||
Icon.Error).ShowWindowDialogAsync(_view);
|
||||
string.Format(
|
||||
UI.Error_0_reading_file_continue_Q,
|
||||
error), ButtonEnum.YesNo,
|
||||
Icon.Error).ShowWindowDialogAsync(_view);
|
||||
|
||||
if(mboxResult == ButtonResult.No)
|
||||
return;
|
||||
@@ -345,7 +360,7 @@ public sealed class SubdirectoryViewModel
|
||||
fs.Write(outBuf, 0, outBuf.Length);
|
||||
fs.Close();
|
||||
var fi = new FileInfo(outputPath);
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
try
|
||||
{
|
||||
if(file.Stat.CreationTimeUtc.HasValue)
|
||||
@@ -375,7 +390,7 @@ public sealed class SubdirectoryViewModel
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
}
|
||||
catch(IOException)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ public sealed class AtaInfoViewModel : ViewModelBase
|
||||
readonly Window _view;
|
||||
|
||||
public AtaInfoViewModel([CanBeNull] byte[] ataIdentify, byte[] atapiIdentify, AtaErrorRegistersChs? ataMcptError,
|
||||
Window view)
|
||||
Window view)
|
||||
{
|
||||
SaveAtaBinaryCommand = ReactiveCommand.Create(ExecuteSaveAtaBinaryCommand);
|
||||
SaveAtaTextCommand = ReactiveCommand.Create(ExecuteSaveAtaTextCommand);
|
||||
@@ -71,20 +71,20 @@ public sealed class AtaInfoViewModel : ViewModelBase
|
||||
if(ataMcptError.HasValue)
|
||||
{
|
||||
AtaMcptText = (ataMcptError.Value.DeviceHead & 0x7) switch
|
||||
{
|
||||
0 => Localization.Core.Device_reports_incorrect_media_card_type,
|
||||
1 => Localization.Core.Device_contains_SD_card,
|
||||
2 => Localization.Core.Device_contains_MMC,
|
||||
3 => Localization.Core.Device_contains_SDIO_card,
|
||||
4 => Localization.Core.Device_contains_SM_card,
|
||||
_ => string.Format(Localization.Core.Device_contains_unknown_media_card_type_0,
|
||||
ataMcptError.Value.DeviceHead & 0x07)
|
||||
};
|
||||
{
|
||||
0 => Localization.Core.Device_reports_incorrect_media_card_type,
|
||||
1 => Localization.Core.Device_contains_SD_card,
|
||||
2 => Localization.Core.Device_contains_MMC,
|
||||
3 => Localization.Core.Device_contains_SDIO_card,
|
||||
4 => Localization.Core.Device_contains_SM_card,
|
||||
_ => string.Format(Localization.Core.Device_contains_unknown_media_card_type_0,
|
||||
ataMcptError.Value.DeviceHead & 0x07)
|
||||
};
|
||||
|
||||
AtaMcptWriteProtectionChecked = (ataMcptError.Value.DeviceHead & 0x08) == 0x08;
|
||||
|
||||
ushort specificData =
|
||||
(ushort)((ataMcptError.Value.CylinderHigh * 0x100) + ataMcptError.Value.CylinderLow);
|
||||
var specificData =
|
||||
(ushort)(ataMcptError.Value.CylinderHigh * 0x100 + ataMcptError.Value.CylinderLow);
|
||||
|
||||
AtaMcptSpecificDataText = string.Format(Localization.Core.Card_specific_data_0, specificData);
|
||||
}
|
||||
@@ -120,11 +120,8 @@ public sealed class AtaInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -148,11 +145,8 @@ public sealed class AtaInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveText.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.txt"
|
||||
}),
|
||||
Name = UI.Dialog_Text_files
|
||||
Extensions = new List<string>(new[] { "*.txt" }),
|
||||
Name = UI.Dialog_Text_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveText.ShowAsync(_view);
|
||||
|
||||
@@ -56,11 +56,11 @@ public sealed class BlurayInfoViewModel
|
||||
readonly byte[] _trackResources;
|
||||
readonly Window _view;
|
||||
|
||||
public BlurayInfoViewModel([CanBeNull] byte[] blurayDiscInformation, [CanBeNull] byte[] blurayBurstCuttingArea,
|
||||
[CanBeNull] byte[] blurayDds, [CanBeNull] byte[] blurayCartridgeStatus,
|
||||
public BlurayInfoViewModel([CanBeNull] byte[] blurayDiscInformation, [CanBeNull] byte[] blurayBurstCuttingArea,
|
||||
[CanBeNull] byte[] blurayDds, [CanBeNull] byte[] blurayCartridgeStatus,
|
||||
[CanBeNull] byte[] bluraySpareAreaInformation, [CanBeNull] byte[] blurayPowResources,
|
||||
[CanBeNull] byte[] blurayTrackResources, [CanBeNull] byte[] blurayRawDfl,
|
||||
[CanBeNull] byte[] blurayPac, Window view)
|
||||
[CanBeNull] byte[] blurayTrackResources, [CanBeNull] byte[] blurayRawDfl,
|
||||
[CanBeNull] byte[] blurayPac, Window view)
|
||||
{
|
||||
_view = view;
|
||||
_discInformation = blurayDiscInformation;
|
||||
@@ -179,11 +179,8 @@ public sealed class BlurayInfoViewModel
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
@@ -101,12 +101,16 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
McnText = mcn;
|
||||
|
||||
if(isrcs is { Count: > 0 })
|
||||
{
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
{
|
||||
IsrcList.Add(new IsrcModel
|
||||
{
|
||||
Track = isrc.Key.ToString(),
|
||||
Isrc = isrc.Value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
MiscellaneousVisible = McnText != null || isrcs?.Count > 0 || pma != null;
|
||||
CdPmaVisible = pma != null;
|
||||
@@ -155,11 +159,8 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -179,11 +180,8 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -203,11 +201,8 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -227,11 +222,8 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -251,11 +243,8 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -275,11 +264,8 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -299,11 +285,8 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
@@ -132,11 +132,8 @@ public sealed class DvdInfoViewModel
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
@@ -63,11 +63,11 @@ public sealed class DvdWritableInfoViewModel
|
||||
readonly Window _view;
|
||||
|
||||
public DvdWritableInfoViewModel(MediaType mediaType, byte[] dds, byte[] cartridgeStatus, byte[] spareArea,
|
||||
byte[] lastBorderOutRmd, byte[] preRecordedInfo, byte[] mediaIdentifier,
|
||||
byte[] physicalInformation, byte[] mediumStatus, byte[] hdLastRmd,
|
||||
byte[] layerCapacity, byte[] middleZoneStart, byte[] jumpIntervalSize,
|
||||
byte[] manualLayerJumpStartLba, byte[] remapAnchorPoint, byte[] adip, byte[] dcb,
|
||||
Window view)
|
||||
byte[] lastBorderOutRmd, byte[] preRecordedInfo, byte[] mediaIdentifier,
|
||||
byte[] physicalInformation, byte[] mediumStatus, byte[] hdLastRmd,
|
||||
byte[] layerCapacity, byte[] middleZoneStart, byte[] jumpIntervalSize,
|
||||
byte[] manualLayerJumpStartLba, byte[] remapAnchorPoint, byte[] adip, byte[] dcb,
|
||||
Window view)
|
||||
{
|
||||
_view = view;
|
||||
SaveDvdRamDdsCommand = ReactiveCommand.Create(ExecuteSaveDvdRamDdsCommand);
|
||||
@@ -260,11 +260,8 @@ public sealed class DvdWritableInfoViewModel
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
@@ -47,11 +47,11 @@ namespace Aaru.Gui.ViewModels.Tabs;
|
||||
|
||||
public class PcmciaInfoViewModel : ViewModelBase
|
||||
{
|
||||
const string MODULE_NAME = "PCMCIA Information ViewModel";
|
||||
readonly byte[] _cis;
|
||||
readonly Window _view;
|
||||
string _pcmciaCisText;
|
||||
PcmciaCisModel _selectedCis;
|
||||
const string MODULE_NAME = "PCMCIA Information ViewModel";
|
||||
readonly byte[] _cis;
|
||||
readonly Window _view;
|
||||
string _pcmciaCisText;
|
||||
PcmciaCisModel _selectedCis;
|
||||
|
||||
internal PcmciaInfoViewModel([CanBeNull] byte[] pcmciaCis, Window view)
|
||||
{
|
||||
@@ -67,6 +67,7 @@ public class PcmciaInfoViewModel : ViewModelBase
|
||||
Tuple[] tuples = CIS.GetTuples(_cis);
|
||||
|
||||
if(tuples != null)
|
||||
{
|
||||
foreach(Tuple tuple in tuples)
|
||||
{
|
||||
string tupleCode;
|
||||
@@ -75,7 +76,8 @@ public class PcmciaInfoViewModel : ViewModelBase
|
||||
switch(tuple.Code)
|
||||
{
|
||||
case TupleCodes.CISTPL_NULL:
|
||||
case TupleCodes.CISTPL_END: continue;
|
||||
case TupleCodes.CISTPL_END:
|
||||
continue;
|
||||
case TupleCodes.CISTPL_DEVICEGEO:
|
||||
case TupleCodes.CISTPL_DEVICEGEO_A:
|
||||
tupleCode = UI.Device_Geometry_Tuples;
|
||||
@@ -143,6 +145,7 @@ public class PcmciaInfoViewModel : ViewModelBase
|
||||
Description = tupleDescription
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, UI.PCMCIA_CIS_returned_no_tuples);
|
||||
}
|
||||
@@ -179,11 +182,8 @@ public class PcmciaInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
@@ -51,17 +51,17 @@ namespace Aaru.Gui.ViewModels.Tabs;
|
||||
|
||||
public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
{
|
||||
const string MODULE_NAME = "SCSI Information ViewModel";
|
||||
readonly byte[] _configuration;
|
||||
readonly byte[] _scsiModeSense10;
|
||||
readonly byte[] _scsiModeSense6;
|
||||
readonly Window _view;
|
||||
string _evpdPageText;
|
||||
string _mmcFeatureText;
|
||||
string _scsiModeSensePageText;
|
||||
object _selectedEvpdPage;
|
||||
object _selectedMmcFeature;
|
||||
object _selectedModeSensePage;
|
||||
const string MODULE_NAME = "SCSI Information ViewModel";
|
||||
readonly byte[] _configuration;
|
||||
readonly byte[] _scsiModeSense10;
|
||||
readonly byte[] _scsiModeSense6;
|
||||
readonly Window _view;
|
||||
string _evpdPageText;
|
||||
string _mmcFeatureText;
|
||||
string _scsiModeSensePageText;
|
||||
object _selectedEvpdPage;
|
||||
object _selectedMmcFeature;
|
||||
object _selectedModeSensePage;
|
||||
|
||||
public ScsiInfoViewModel(byte[] scsiInquiryData, Inquiry? scsiInquiry, Dictionary<byte, byte[]> scsiEvpdPages,
|
||||
Modes.DecodedMode? scsiMode, PeripheralDeviceTypes scsiType, byte[] scsiModeSense6,
|
||||
@@ -97,9 +97,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
if(scsiMode.Value.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage page in scsiMode.Value.Pages.OrderBy(t => t.Page).ThenBy(t => t.Subpage))
|
||||
{
|
||||
string pageNumberText = page.Subpage == 0 ? string.Format(UI.MODE_0, page.Page)
|
||||
string pageNumberText = page.Subpage == 0
|
||||
? string.Format(UI.MODE_0, page.Page)
|
||||
: string.Format(UI.MODE_0_Subpage_1, page.Page, page.Subpage);
|
||||
|
||||
string decodedText;
|
||||
@@ -119,9 +121,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
case 0x01:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
{
|
||||
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_01_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_01(page.PageResponse);
|
||||
}
|
||||
else
|
||||
goto default;
|
||||
|
||||
@@ -175,9 +179,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
case 0x07:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
{
|
||||
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_07_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_07(page.PageResponse);
|
||||
}
|
||||
else
|
||||
goto default;
|
||||
|
||||
@@ -242,9 +248,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
case 0x10:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
{
|
||||
decodedText = scsiType == PeripheralDeviceTypes.SequentialAccess
|
||||
? Modes.PrettifyModePage_10_SSC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_10(page.PageResponse);
|
||||
}
|
||||
else
|
||||
goto default;
|
||||
|
||||
@@ -293,9 +301,11 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
case 0x1C:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
{
|
||||
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_1C_SFF(page.PageResponse)
|
||||
: Modes.PrettifyModePage_1C(page.PageResponse);
|
||||
}
|
||||
else if(page.Subpage == 1)
|
||||
decodedText = Modes.PrettifyModePage_1C_S01(page.PageResponse);
|
||||
else
|
||||
@@ -423,12 +433,14 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
Description = decodedText
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiEvpdPages != null)
|
||||
{
|
||||
foreach(KeyValuePair<byte, byte[]> page in scsiEvpdPages.OrderBy(t => t.Key))
|
||||
{
|
||||
string evpdPageTitle = "";
|
||||
var evpdPageTitle = "";
|
||||
string evpdDecodedPage;
|
||||
|
||||
switch(page.Key)
|
||||
@@ -538,14 +550,14 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "certance":
|
||||
evpdPageTitle = page.Key switch
|
||||
{
|
||||
0xC2 => UI.Head_Assembly_Serial_Number,
|
||||
0xC3 => UI.Reel_Motor_1_Serial_Number,
|
||||
0xC4 => UI.Reel_Motor_2_Serial_Number,
|
||||
0xC5 => UI.Board_Serial_Number,
|
||||
0xC6 => UI.Base_Mechanical_Serial_Number,
|
||||
_ => evpdPageTitle
|
||||
};
|
||||
{
|
||||
0xC2 => UI.Head_Assembly_Serial_Number,
|
||||
0xC3 => UI.Reel_Motor_1_Serial_Number,
|
||||
0xC4 => UI.Reel_Motor_2_Serial_Number,
|
||||
0xC5 => UI.Board_Serial_Number,
|
||||
0xC6 => UI.Base_Mechanical_Serial_Number,
|
||||
_ => evpdPageTitle
|
||||
};
|
||||
|
||||
evpdDecodedPage = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(page.Value);
|
||||
|
||||
@@ -554,15 +566,15 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "hp":
|
||||
evpdPageTitle = page.Key switch
|
||||
{
|
||||
0xC0 => UI.HP_Drive_Firmware_Revision_Levels_page,
|
||||
0xC1 => UI.HP_Drive_Hardware_Revision_Levels_page,
|
||||
0xC2 => UI.HP_Drive_PCA_Revision_Levels_page,
|
||||
0xC3 => UI.HP_Drive_Mechanism_Revision_Levels_page,
|
||||
0xC4 => UI.HP_Drive_Head_Assembly_Revision_Levels_page,
|
||||
0xC5 => UI.HP_Drive_ACI_Revision_Levels_page,
|
||||
_ => evpdPageTitle
|
||||
};
|
||||
{
|
||||
0xC0 => UI.HP_Drive_Firmware_Revision_Levels_page,
|
||||
0xC1 => UI.HP_Drive_Hardware_Revision_Levels_page,
|
||||
0xC2 => UI.HP_Drive_PCA_Revision_Levels_page,
|
||||
0xC3 => UI.HP_Drive_Mechanism_Revision_Levels_page,
|
||||
0xC4 => UI.HP_Drive_Head_Assembly_Revision_Levels_page,
|
||||
0xC5 => UI.HP_Drive_ACI_Revision_Levels_page,
|
||||
_ => evpdPageTitle
|
||||
};
|
||||
|
||||
evpdDecodedPage = EVPD.PrettifyPage_C0_to_C5_HP(page.Value);
|
||||
|
||||
@@ -595,6 +607,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
Description = evpdDecodedPage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(_configuration == null)
|
||||
return;
|
||||
@@ -608,73 +621,74 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
ftr.CurrentProfile);
|
||||
|
||||
if(ftr.Descriptors != null)
|
||||
{
|
||||
foreach(Features.FeatureDescriptor desc in ftr.Descriptors)
|
||||
{
|
||||
string featureNumber = string.Format(Localization.Core.Feature_0, desc.Code);
|
||||
var featureNumber = string.Format(Localization.Core.Feature_0, desc.Code);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Feature_0, desc.Code);
|
||||
|
||||
string featureDescription = desc.Code switch
|
||||
{
|
||||
0x0000 => Features.Prettify_0000(desc.Data),
|
||||
0x0001 => Features.Prettify_0001(desc.Data),
|
||||
0x0002 => Features.Prettify_0002(desc.Data),
|
||||
0x0003 => Features.Prettify_0003(desc.Data),
|
||||
0x0004 => Features.Prettify_0004(desc.Data),
|
||||
0x0010 => Features.Prettify_0010(desc.Data),
|
||||
0x001D => Features.Prettify_001D(desc.Data),
|
||||
0x001E => Features.Prettify_001E(desc.Data),
|
||||
0x001F => Features.Prettify_001F(desc.Data),
|
||||
0x0020 => Features.Prettify_0020(desc.Data),
|
||||
0x0021 => Features.Prettify_0021(desc.Data),
|
||||
0x0022 => Features.Prettify_0022(desc.Data),
|
||||
0x0023 => Features.Prettify_0023(desc.Data),
|
||||
0x0024 => Features.Prettify_0024(desc.Data),
|
||||
0x0025 => Features.Prettify_0025(desc.Data),
|
||||
0x0026 => Features.Prettify_0026(desc.Data),
|
||||
0x0027 => Features.Prettify_0027(desc.Data),
|
||||
0x0028 => Features.Prettify_0028(desc.Data),
|
||||
0x0029 => Features.Prettify_0029(desc.Data),
|
||||
0x002A => Features.Prettify_002A(desc.Data),
|
||||
0x002B => Features.Prettify_002B(desc.Data),
|
||||
0x002C => Features.Prettify_002C(desc.Data),
|
||||
0x002D => Features.Prettify_002D(desc.Data),
|
||||
0x002E => Features.Prettify_002E(desc.Data),
|
||||
0x002F => Features.Prettify_002F(desc.Data),
|
||||
0x0030 => Features.Prettify_0030(desc.Data),
|
||||
0x0031 => Features.Prettify_0031(desc.Data),
|
||||
0x0032 => Features.Prettify_0032(desc.Data),
|
||||
0x0033 => Features.Prettify_0033(desc.Data),
|
||||
0x0035 => Features.Prettify_0035(desc.Data),
|
||||
0x0037 => Features.Prettify_0037(desc.Data),
|
||||
0x0038 => Features.Prettify_0038(desc.Data),
|
||||
0x003A => Features.Prettify_003A(desc.Data),
|
||||
0x003B => Features.Prettify_003B(desc.Data),
|
||||
0x0040 => Features.Prettify_0040(desc.Data),
|
||||
0x0041 => Features.Prettify_0041(desc.Data),
|
||||
0x0042 => Features.Prettify_0042(desc.Data),
|
||||
0x0050 => Features.Prettify_0050(desc.Data),
|
||||
0x0051 => Features.Prettify_0051(desc.Data),
|
||||
0x0080 => Features.Prettify_0080(desc.Data),
|
||||
0x0100 => Features.Prettify_0100(desc.Data),
|
||||
0x0101 => Features.Prettify_0101(desc.Data),
|
||||
0x0102 => Features.Prettify_0102(desc.Data),
|
||||
0x0103 => Features.Prettify_0103(desc.Data),
|
||||
0x0104 => Features.Prettify_0104(desc.Data),
|
||||
0x0105 => Features.Prettify_0105(desc.Data),
|
||||
0x0106 => Features.Prettify_0106(desc.Data),
|
||||
0x0107 => Features.Prettify_0107(desc.Data),
|
||||
0x0108 => Features.Prettify_0108(desc.Data),
|
||||
0x0109 => Features.Prettify_0109(desc.Data),
|
||||
0x010A => Features.Prettify_010A(desc.Data),
|
||||
0x010B => Features.Prettify_010B(desc.Data),
|
||||
0x010C => Features.Prettify_010C(desc.Data),
|
||||
0x010D => Features.Prettify_010D(desc.Data),
|
||||
0x010E => Features.Prettify_010E(desc.Data),
|
||||
0x0110 => Features.Prettify_0110(desc.Data),
|
||||
0x0113 => Features.Prettify_0113(desc.Data),
|
||||
0x0142 => Features.Prettify_0142(desc.Data),
|
||||
_ => UI.Unknown_feature
|
||||
};
|
||||
{
|
||||
0x0000 => Features.Prettify_0000(desc.Data),
|
||||
0x0001 => Features.Prettify_0001(desc.Data),
|
||||
0x0002 => Features.Prettify_0002(desc.Data),
|
||||
0x0003 => Features.Prettify_0003(desc.Data),
|
||||
0x0004 => Features.Prettify_0004(desc.Data),
|
||||
0x0010 => Features.Prettify_0010(desc.Data),
|
||||
0x001D => Features.Prettify_001D(desc.Data),
|
||||
0x001E => Features.Prettify_001E(desc.Data),
|
||||
0x001F => Features.Prettify_001F(desc.Data),
|
||||
0x0020 => Features.Prettify_0020(desc.Data),
|
||||
0x0021 => Features.Prettify_0021(desc.Data),
|
||||
0x0022 => Features.Prettify_0022(desc.Data),
|
||||
0x0023 => Features.Prettify_0023(desc.Data),
|
||||
0x0024 => Features.Prettify_0024(desc.Data),
|
||||
0x0025 => Features.Prettify_0025(desc.Data),
|
||||
0x0026 => Features.Prettify_0026(desc.Data),
|
||||
0x0027 => Features.Prettify_0027(desc.Data),
|
||||
0x0028 => Features.Prettify_0028(desc.Data),
|
||||
0x0029 => Features.Prettify_0029(desc.Data),
|
||||
0x002A => Features.Prettify_002A(desc.Data),
|
||||
0x002B => Features.Prettify_002B(desc.Data),
|
||||
0x002C => Features.Prettify_002C(desc.Data),
|
||||
0x002D => Features.Prettify_002D(desc.Data),
|
||||
0x002E => Features.Prettify_002E(desc.Data),
|
||||
0x002F => Features.Prettify_002F(desc.Data),
|
||||
0x0030 => Features.Prettify_0030(desc.Data),
|
||||
0x0031 => Features.Prettify_0031(desc.Data),
|
||||
0x0032 => Features.Prettify_0032(desc.Data),
|
||||
0x0033 => Features.Prettify_0033(desc.Data),
|
||||
0x0035 => Features.Prettify_0035(desc.Data),
|
||||
0x0037 => Features.Prettify_0037(desc.Data),
|
||||
0x0038 => Features.Prettify_0038(desc.Data),
|
||||
0x003A => Features.Prettify_003A(desc.Data),
|
||||
0x003B => Features.Prettify_003B(desc.Data),
|
||||
0x0040 => Features.Prettify_0040(desc.Data),
|
||||
0x0041 => Features.Prettify_0041(desc.Data),
|
||||
0x0042 => Features.Prettify_0042(desc.Data),
|
||||
0x0050 => Features.Prettify_0050(desc.Data),
|
||||
0x0051 => Features.Prettify_0051(desc.Data),
|
||||
0x0080 => Features.Prettify_0080(desc.Data),
|
||||
0x0100 => Features.Prettify_0100(desc.Data),
|
||||
0x0101 => Features.Prettify_0101(desc.Data),
|
||||
0x0102 => Features.Prettify_0102(desc.Data),
|
||||
0x0103 => Features.Prettify_0103(desc.Data),
|
||||
0x0104 => Features.Prettify_0104(desc.Data),
|
||||
0x0105 => Features.Prettify_0105(desc.Data),
|
||||
0x0106 => Features.Prettify_0106(desc.Data),
|
||||
0x0107 => Features.Prettify_0107(desc.Data),
|
||||
0x0108 => Features.Prettify_0108(desc.Data),
|
||||
0x0109 => Features.Prettify_0109(desc.Data),
|
||||
0x010A => Features.Prettify_010A(desc.Data),
|
||||
0x010B => Features.Prettify_010B(desc.Data),
|
||||
0x010C => Features.Prettify_010C(desc.Data),
|
||||
0x010D => Features.Prettify_010D(desc.Data),
|
||||
0x010E => Features.Prettify_010E(desc.Data),
|
||||
0x0110 => Features.Prettify_0110(desc.Data),
|
||||
0x0113 => Features.Prettify_0113(desc.Data),
|
||||
0x0142 => Features.Prettify_0142(desc.Data),
|
||||
_ => UI.Unknown_feature
|
||||
};
|
||||
|
||||
MmcFeatures.Add(new ScsiPageModel
|
||||
{
|
||||
@@ -682,9 +696,12 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
Description = featureDescription
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] InquiryData { get; }
|
||||
@@ -782,11 +799,8 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -806,11 +820,8 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveText.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.txt"
|
||||
}),
|
||||
Name = UI.Dialog_Text_files
|
||||
Extensions = new List<string>(new[] { "*.txt" }),
|
||||
Name = UI.Dialog_Text_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveText.ShowAsync(_view);
|
||||
@@ -830,11 +841,8 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -854,11 +862,8 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -881,11 +886,8 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
@@ -905,11 +907,8 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace Aaru.Gui.ViewModels.Tabs;
|
||||
|
||||
public sealed class SdMmcInfoViewModel
|
||||
{
|
||||
public SdMmcInfoViewModel(DeviceType deviceType, [CanBeNull] byte[] cid, [CanBeNull] byte[] csd,
|
||||
[CanBeNull] byte[] ocr, [CanBeNull] byte[] extendedCsd, [CanBeNull] byte[] scr)
|
||||
public SdMmcInfoViewModel(DeviceType deviceType, [CanBeNull] byte[] cid, [CanBeNull] byte[] csd,
|
||||
[CanBeNull] byte[] ocr, [CanBeNull] byte[] extendedCsd, [CanBeNull] byte[] scr)
|
||||
{
|
||||
switch(deviceType)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ public sealed class XboxInfoViewModel
|
||||
readonly byte[] _xboxSecuritySector;
|
||||
|
||||
public XboxInfoViewModel([CanBeNull] XgdInfo xgdInfo, [CanBeNull] byte[] dmi, [CanBeNull] byte[] securitySector,
|
||||
SS.SecuritySector? decodedSecuritySector, Window view)
|
||||
SS.SecuritySector? decodedSecuritySector, Window view)
|
||||
{
|
||||
_xboxSecuritySector = securitySector;
|
||||
_view = view;
|
||||
@@ -108,11 +108,8 @@ public sealed class XboxInfoViewModel
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
}),
|
||||
Name = UI.Dialog_Binary_files
|
||||
Extensions = new List<string>(new[] { "*.bin" }),
|
||||
Name = UI.Dialog_Binary_files
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
@@ -77,11 +77,13 @@ public sealed class DecodeMediaTagsViewModel : ViewModelBase
|
||||
ErrorNumber errno = inputFormat.ReadMediaTag(tag, out byte[] data);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
TagsList.Add(new MediaTagModel
|
||||
{
|
||||
Tag = tag,
|
||||
Data = data
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +219,8 @@ public sealed class DecodeMediaTagsViewModel : ViewModelBase
|
||||
|
||||
break;
|
||||
case MediaTagType.Xbox_DMI:
|
||||
DecodedText = DMI.IsXbox360(value.Data) ? DMI.PrettifyXbox360(value.Data)
|
||||
DecodedText = DMI.IsXbox360(value.Data)
|
||||
? DMI.PrettifyXbox360(value.Data)
|
||||
: DMI.PrettifyXbox(value.Data);
|
||||
|
||||
break;
|
||||
|
||||
@@ -395,10 +395,11 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void DoWork()
|
||||
{
|
||||
var opticalMediaImage = _inputFormat as IOpticalMediaImage;
|
||||
bool formatHasTracks = false;
|
||||
var opticalMediaImage = _inputFormat as IOpticalMediaImage;
|
||||
var formatHasTracks = false;
|
||||
|
||||
if(opticalMediaImage != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
formatHasTracks = opticalMediaImage.Tracks?.Count > 0;
|
||||
@@ -407,6 +408,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
{
|
||||
formatHasTracks = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Setup progress bars
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -470,6 +472,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
ErrorNumber errno;
|
||||
|
||||
if(opticalMediaImage?.Tracks != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Checksum trackChecksum = null;
|
||||
@@ -490,6 +493,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
if(currentTrack.StartSector - previousTrackEnd != 0 && ChecksumMediaChecked)
|
||||
{
|
||||
for(ulong i = previousTrackEnd + 1; i < currentTrack.StartSector; i++)
|
||||
{
|
||||
ulong sector = i;
|
||||
@@ -514,6 +518,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
|
||||
mediaChecksum?.Update(hiddenSector);
|
||||
}
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, UI.Track_0_starts_at_sector_1_and_ends_at_sector_2,
|
||||
currentTrack.Sequence, currentTrack.StartSector, currentTrack.EndSector);
|
||||
@@ -612,18 +617,21 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
return;
|
||||
|
||||
foreach(CommonTypes.AaruMetadata.Checksum chk in trackChecksum.End())
|
||||
{
|
||||
TrackChecksums.Add(new ChecksumModel
|
||||
{
|
||||
Track = currentTrack.Sequence.ToString(),
|
||||
Algorithm = chk.Type.ToString(),
|
||||
Hash = chk.Value
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
previousTrackEnd = currentTrack.EndSector;
|
||||
}
|
||||
|
||||
if(opticalMediaImage.Info.Sectors - previousTrackEnd != 0 && ChecksumMediaChecked)
|
||||
{
|
||||
for(ulong i = previousTrackEnd + 1; i < opticalMediaImage.Info.Sectors; i++)
|
||||
{
|
||||
ulong sector = i;
|
||||
@@ -648,6 +656,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
|
||||
mediaChecksum?.Update(hiddenSector);
|
||||
}
|
||||
}
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
@@ -655,11 +664,13 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
return;
|
||||
|
||||
foreach(CommonTypes.AaruMetadata.Checksum chk in mediaChecksum.End())
|
||||
{
|
||||
MediaChecksums.Add(new ChecksumModel
|
||||
{
|
||||
Algorithm = chk.Type.ToString(),
|
||||
Hash = chk.Value
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
catch(Exception ex)
|
||||
@@ -667,12 +678,10 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
AaruConsole.DebugWriteLine(Localization.Core.Could_not_get_tracks_because_0, ex.Message);
|
||||
AaruConsole.WriteLine("Unable to get separate tracks, not checksumming them");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress1Visible = false;
|
||||
});
|
||||
await Dispatcher.UIThread.InvokeAsync(() => { Progress1Visible = false; });
|
||||
|
||||
mediaChecksum = new Checksum(enabledChecksums);
|
||||
|
||||
@@ -755,25 +764,25 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
foreach(CommonTypes.AaruMetadata.Checksum chk in mediaChecksum.End())
|
||||
{
|
||||
MediaChecksums.Add(new ChecksumModel
|
||||
{
|
||||
Algorithm = chk.Type.ToString(),
|
||||
Hash = chk.Value
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(ChecksumTracksChecked)
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
TrackChecksumsVisible = true;
|
||||
});
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(() => { TrackChecksumsVisible = true; });
|
||||
}
|
||||
|
||||
if(ChecksumMediaChecked)
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
MediaChecksumsVisible = true;
|
||||
});
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(() => { MediaChecksumsVisible = true; });
|
||||
}
|
||||
|
||||
Statistics.AddCommand("checksum");
|
||||
|
||||
|
||||
@@ -67,10 +67,9 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
{
|
||||
readonly IMediaImage _inputFormat;
|
||||
readonly Window _view;
|
||||
bool _cancel;
|
||||
Metadata _aaruMetadata;
|
||||
bool _aaruMetadataFromImageVisible;
|
||||
string _metadataJsonText;
|
||||
bool _cancel;
|
||||
bool _closeVisible;
|
||||
string _commentsText;
|
||||
bool _commentsVisible;
|
||||
@@ -106,6 +105,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
bool _mediaSerialNumberVisible;
|
||||
string _mediaTitleText;
|
||||
bool _mediaTitleVisible;
|
||||
string _metadataJsonText;
|
||||
bool _optionsVisible;
|
||||
bool _progress1Visible;
|
||||
bool _progress2Indeterminate;
|
||||
@@ -128,35 +128,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
bool _stopVisible;
|
||||
string _title;
|
||||
|
||||
public string SourceImageLabel => UI.Source_image;
|
||||
public string OutputFormatLabel => UI.Output_format;
|
||||
public string ChooseLabel => UI.ButtonLabel_Choose;
|
||||
public string SectorsLabel => UI.How_many_sectors_to_convert_at_once;
|
||||
public string ForceLabel => UI.Continue_conversion_even_if_data_lost;
|
||||
public string CreatorLabel => UI.Who_person_created_the_image;
|
||||
public string GetFromSourceImageLabel => UI.ButtonLabel_Get_from_source_image;
|
||||
public string MetadataLabel => UI.Title_Metadata;
|
||||
public string MediaLabel => UI.Title_Media;
|
||||
public string TitleLabel => UI.Title_Title;
|
||||
public string ManufacturerLabel => UI.Title_Manufacturer;
|
||||
public string ModelLabel => UI.Title_Model;
|
||||
public string SerialNumberLabel => UI.Title_Serial_number;
|
||||
public string BarcodeLabel => UI.Title_Barcode;
|
||||
public string PartNumberLabel => UI.Title_Part_number;
|
||||
public string NumberInSequenceLabel => UI.Title_Number_in_sequence;
|
||||
public string LastMediaOfTheSequenceLabel => UI.Title_Last_media_of_the_sequence;
|
||||
public string DriveLabel => UI.Title_Drive;
|
||||
public string FirmwareRevisionLabel => UI.Title_Firmware_revision;
|
||||
public string CommentsLabel => UI.Title_Comments;
|
||||
public string AaruMetadataLabel => UI.Title_Existing_Aaru_Metadata_sidecar;
|
||||
public string FromImageLabel => UI.Title_From_image;
|
||||
public string ResumeFileLabel => UI.Title_Existing_resume_file;
|
||||
public string StartLabel => UI.ButtonLabel_Start;
|
||||
public string CloseLabel => UI.ButtonLabel_Close;
|
||||
public string StopLabel => UI.ButtonLabel_Stop;
|
||||
|
||||
public ImageConvertViewModel([JetBrains.Annotations.NotNull] IMediaImage inputFormat, string imageSource,
|
||||
Window view)
|
||||
Window view)
|
||||
{
|
||||
_view = view;
|
||||
_inputFormat = inputFormat;
|
||||
@@ -207,10 +180,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
continue;
|
||||
|
||||
if(plugin.SupportedMediaTypes.Contains(inputFormat.Info.MediaType))
|
||||
{
|
||||
PluginsList.Add(new ImagePluginModel
|
||||
{
|
||||
Plugin = plugin
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
AaruMetadataFromImageVisible = inputFormat.AaruMetadata != null;
|
||||
@@ -223,6 +198,33 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
ResumeFileText = _dumpHardware == null ? "" : UI._From_image_;
|
||||
}
|
||||
|
||||
public string SourceImageLabel => UI.Source_image;
|
||||
public string OutputFormatLabel => UI.Output_format;
|
||||
public string ChooseLabel => UI.ButtonLabel_Choose;
|
||||
public string SectorsLabel => UI.How_many_sectors_to_convert_at_once;
|
||||
public string ForceLabel => UI.Continue_conversion_even_if_data_lost;
|
||||
public string CreatorLabel => UI.Who_person_created_the_image;
|
||||
public string GetFromSourceImageLabel => UI.ButtonLabel_Get_from_source_image;
|
||||
public string MetadataLabel => UI.Title_Metadata;
|
||||
public string MediaLabel => UI.Title_Media;
|
||||
public string TitleLabel => UI.Title_Title;
|
||||
public string ManufacturerLabel => UI.Title_Manufacturer;
|
||||
public string ModelLabel => UI.Title_Model;
|
||||
public string SerialNumberLabel => UI.Title_Serial_number;
|
||||
public string BarcodeLabel => UI.Title_Barcode;
|
||||
public string PartNumberLabel => UI.Title_Part_number;
|
||||
public string NumberInSequenceLabel => UI.Title_Number_in_sequence;
|
||||
public string LastMediaOfTheSequenceLabel => UI.Title_Last_media_of_the_sequence;
|
||||
public string DriveLabel => UI.Title_Drive;
|
||||
public string FirmwareRevisionLabel => UI.Title_Firmware_revision;
|
||||
public string CommentsLabel => UI.Title_Comments;
|
||||
public string AaruMetadataLabel => UI.Title_Existing_Aaru_Metadata_sidecar;
|
||||
public string FromImageLabel => UI.Title_From_image;
|
||||
public string ResumeFileLabel => UI.Title_Existing_resume_file;
|
||||
public string StartLabel => UI.ButtonLabel_Start;
|
||||
public string CloseLabel => UI.ButtonLabel_Close;
|
||||
public string StopLabel => UI.ButtonLabel_Stop;
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => _title;
|
||||
@@ -606,7 +608,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void DoWork(object plugin)
|
||||
{
|
||||
bool warning = false;
|
||||
var warning = false;
|
||||
|
||||
if(plugin is not IWritableImage outputFormat)
|
||||
{
|
||||
@@ -714,13 +716,15 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
foreach(MediaTagType mediaTag in _inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
|
||||
!outputFormat.SupportedMediaTags.Contains(mediaTag) && !ForceChecked))
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Converting_image_will_lose_media_tag_0,
|
||||
mediaTag),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Converting_image_will_lose_media_tag_0,
|
||||
mediaTag),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -740,13 +744,15 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
continue;
|
||||
}
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Converting_image_will_lose_sector_tag_0,
|
||||
sectorTag),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Converting_image_will_lose_sector_tag_0,
|
||||
sectorTag),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -795,14 +801,14 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
if(!outputFormat.Create(DestinationText, _inputFormat.Info.MediaType, parsedOptions, _inputFormat.Info.Sectors,
|
||||
_inputFormat.Info.SectorSize))
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_creating_output_image,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_creating_output_image,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Error_0_creating_output_image, outputFormat.ErrorMessage);
|
||||
|
||||
@@ -838,18 +844,21 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
};
|
||||
|
||||
if(!_cancel)
|
||||
{
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
{
|
||||
if(ForceChecked != true)
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_setting_metadata_not_continuing,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Error_0_setting_metadata_not_continuing,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Error_0_setting_metadata_not_continuing, outputFormat.ErrorMessage);
|
||||
|
||||
@@ -859,6 +868,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
warning = true;
|
||||
AaruConsole.ErrorWriteLine(Localization.Core.Error_0_setting_metadata, outputFormat.ErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
if(tracks != null &&
|
||||
!_cancel &&
|
||||
@@ -874,14 +884,16 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
|
||||
if(!outputOptical.SetTracks(tracks))
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_sending_tracks_list_to_output_image,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Error_0_sending_tracks_list_to_output_image,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Error_0_sending_tracks_list_to_output_image, outputFormat.ErrorMessage);
|
||||
|
||||
@@ -923,11 +935,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
{
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () =>
|
||||
await Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_writing_media_tag_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_writing_media_tag_not_continuing,
|
||||
outputFormat.ErrorMessage),
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view));
|
||||
|
||||
@@ -935,11 +949,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () =>
|
||||
await Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_media_tag_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_media_tag_not_continuing,
|
||||
errno), icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
@@ -1012,12 +1028,16 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
|
||||
if(useLong)
|
||||
{
|
||||
errno = sectorsToDo == 1 ? _inputFormat.ReadSectorLong(doneSectors, out sector)
|
||||
errno = sectorsToDo == 1
|
||||
? _inputFormat.ReadSectorLong(doneSectors, out sector)
|
||||
: _inputFormat.ReadSectorsLong(doneSectors, sectorsToDo, out sector);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
result = sectorsToDo == 1 ? outputFormat.WriteSectorLong(sector, doneSectors)
|
||||
{
|
||||
result = sectorsToDo == 1
|
||||
? outputFormat.WriteSectorLong(sector, doneSectors)
|
||||
: outputFormat.WriteSectorsLong(sector, doneSectors, sectorsToDo);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
@@ -1030,12 +1050,15 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Error_0_reading_sector_1_not_continuing, errno, doneSectors);
|
||||
|
||||
@@ -1045,12 +1068,16 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = sectorsToDo == 1 ? _inputFormat.ReadSector(doneSectors, out sector)
|
||||
errno = sectorsToDo == 1
|
||||
? _inputFormat.ReadSector(doneSectors, out sector)
|
||||
: _inputFormat.ReadSectors(doneSectors, sectorsToDo, out sector);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
result = sectorsToDo == 1 ? outputFormat.WriteSector(sector, doneSectors)
|
||||
{
|
||||
result = sectorsToDo == 1
|
||||
? outputFormat.WriteSector(sector, doneSectors)
|
||||
: outputFormat.WriteSectors(sector, doneSectors, sectorsToDo);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
@@ -1063,12 +1090,15 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Error_0_reading_sector_1_not_continuing, errno, doneSectors);
|
||||
|
||||
@@ -1078,6 +1108,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(!result)
|
||||
{
|
||||
if(ForceChecked)
|
||||
{
|
||||
warning = true;
|
||||
@@ -1087,19 +1118,23 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_writing_sector_1_not_continuing,
|
||||
outputFormat.ErrorMessage,
|
||||
doneSectors),
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Error_0_writing_sector_1_not_continuing,
|
||||
outputFormat.ErrorMessage,
|
||||
doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Error_0_writing_sector_1_not_continuing,
|
||||
outputFormat.ErrorMessage, doneSectors);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
doneSectors += sectorsToDo;
|
||||
}
|
||||
@@ -1249,10 +1284,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_sector_1_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
@@ -1302,10 +1339,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_sector_1_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
@@ -1319,6 +1358,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(!result)
|
||||
{
|
||||
if(ForceChecked)
|
||||
{
|
||||
warning = true;
|
||||
@@ -1328,20 +1368,24 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_writing_sector_1_not_continuing,
|
||||
outputFormat.
|
||||
ErrorMessage,
|
||||
doneSectors),
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Error_0_writing_sector_1_not_continuing,
|
||||
outputFormat.
|
||||
ErrorMessage,
|
||||
doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Error_0_writing_sector_1_not_continuing,
|
||||
outputFormat.ErrorMessage, doneSectors);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
doneSectors += sectorsToDo;
|
||||
}
|
||||
@@ -1355,16 +1399,21 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
if(isrcs.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
{
|
||||
outputOptical.WriteSectorTag(Encoding.UTF8.GetBytes(isrc.Value), isrc.Key,
|
||||
SectorTagType.CdTrackIsrc);
|
||||
}
|
||||
}
|
||||
|
||||
if(trackFlags.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<byte, byte> flags in trackFlags)
|
||||
outputOptical.WriteSectorTag(new[]
|
||||
{
|
||||
flags.Value
|
||||
}, flags.Key, SectorTagType.CdTrackFlags);
|
||||
{
|
||||
outputOptical.WriteSectorTag(new[] { flags.Value }, flags.Key, SectorTagType.CdTrackFlags);
|
||||
}
|
||||
}
|
||||
|
||||
if(mcn != null)
|
||||
outputOptical.WriteMediaTag(Encoding.UTF8.GetBytes(mcn), MediaTagType.CD_MCN);
|
||||
@@ -1423,10 +1472,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
out sector);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
result = sectorsToDo == 1
|
||||
? outputFormat.WriteSectorLong(sector, doneSectors + track.StartSector)
|
||||
: outputFormat.WriteSectorsLong(sector, doneSectors + track.StartSector,
|
||||
sectorsToDo);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
@@ -1439,10 +1490,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_sector_1_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
@@ -1453,15 +1506,18 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = sectorsToDo == 1 ? _inputFormat.ReadSector(doneSectors + track.StartSector, out sector)
|
||||
errno = sectorsToDo == 1
|
||||
? _inputFormat.ReadSector(doneSectors + track.StartSector, out sector)
|
||||
: _inputFormat.ReadSectors(doneSectors + track.StartSector, sectorsToDo,
|
||||
out sector);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
result = sectorsToDo == 1
|
||||
? outputFormat.WriteSector(sector, doneSectors + track.StartSector)
|
||||
: outputFormat.WriteSectors(sector, doneSectors + track.StartSector,
|
||||
sectorsToDo);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
@@ -1474,10 +1530,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_sector_1_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
@@ -1488,6 +1546,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(!result)
|
||||
{
|
||||
if(ForceChecked)
|
||||
{
|
||||
warning = true;
|
||||
@@ -1497,17 +1556,21 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_writing_sector_1_not_continuing,
|
||||
outputFormat.
|
||||
ErrorMessage,
|
||||
doneSectors),
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view));
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Error_0_writing_sector_1_not_continuing,
|
||||
outputFormat.
|
||||
ErrorMessage,
|
||||
doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
doneSectors += sectorsToDo;
|
||||
}
|
||||
@@ -1576,11 +1639,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () =>
|
||||
await Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_media_tag_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_media_tag_not_continuing,
|
||||
errno),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
@@ -1592,6 +1657,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(!result)
|
||||
{
|
||||
if(ForceChecked)
|
||||
{
|
||||
warning = true;
|
||||
@@ -1601,11 +1667,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () =>
|
||||
await Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_writing_tag_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_writing_tag_not_continuing,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
@@ -1613,6 +1681,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -1648,10 +1717,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
out sector);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
{
|
||||
result = sectorsToDo == 1
|
||||
? outputFormat.WriteSectorTag(sector, doneSectors + track.StartSector, tag)
|
||||
: outputFormat.WriteSectorsTag(sector, doneSectors + track.StartSector,
|
||||
sectorsToDo, tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
@@ -1665,10 +1736,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_reading_tag_for_sector_1_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_reading_tag_for_sector_1_not_continuing,
|
||||
errno, doneSectors),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
@@ -1678,6 +1751,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(!result)
|
||||
{
|
||||
if(ForceChecked)
|
||||
{
|
||||
warning = true;
|
||||
@@ -1687,10 +1761,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_writing_tag_for_sector_1_not_continuing,
|
||||
Format(
|
||||
UI.
|
||||
Error_0_writing_tag_for_sector_1_not_continuing,
|
||||
outputFormat.
|
||||
ErrorMessage,
|
||||
doneSectors),
|
||||
@@ -1699,6 +1775,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
doneSectors += sectorsToDo;
|
||||
}
|
||||
@@ -1758,7 +1835,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
{
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error, UI.Operation_canceled_the_output_file_is_not_correct,
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view);
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view);
|
||||
|
||||
CloseVisible = true;
|
||||
StopVisible = false;
|
||||
@@ -1771,13 +1848,15 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
if(!outputFormat.Close())
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(UI.Error_0_closing_output_image_Contents_are_not_correct,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
GetMessageBoxStandard(UI.Title_Error,
|
||||
string.
|
||||
Format(
|
||||
UI.
|
||||
Error_0_closing_output_image_Contents_are_not_correct,
|
||||
outputFormat.
|
||||
ErrorMessage),
|
||||
icon: Icon.Error).
|
||||
ShowWindowDialogAsync(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1786,9 +1865,10 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
{
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(warning ? UI.Title_Warning : UI.Title_Conversion_success,
|
||||
warning ? UI.Some_warnings_happened_Check_console
|
||||
: UI.Image_converted_successfully,
|
||||
icon: warning ? Icon.Warning : Icon.Info).ShowWindowDialogAsync(_view);
|
||||
warning
|
||||
? UI.Some_warnings_happened_Check_console
|
||||
: UI.Image_converted_successfully,
|
||||
icon: warning ? Icon.Warning : Icon.Info).ShowWindowDialogAsync(_view);
|
||||
|
||||
CloseVisible = true;
|
||||
StopVisible = false;
|
||||
@@ -2018,11 +2098,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
|
||||
dlgMetadata.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
".json"
|
||||
})
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[] { ".json" })
|
||||
});
|
||||
|
||||
string[] result = await dlgMetadata.ShowAsync(_view);
|
||||
@@ -2067,11 +2144,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
|
||||
dlgMetadata.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = UI.Dialog_Choose_existing_resume_file,
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
".json"
|
||||
})
|
||||
Name = UI.Dialog_Choose_existing_resume_file,
|
||||
Extensions = new List<string>(new[] { ".json" })
|
||||
});
|
||||
|
||||
string[] result = await dlgMetadata.ShowAsync(_view);
|
||||
@@ -2096,9 +2170,11 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
ResumeFileText = result[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error, UI.Resume_file_does_not_contain_dump_hardware_information,
|
||||
icon: Icon.Error).ShowWindowDialogAsync(_view);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -291,6 +291,7 @@ public sealed class ImageEntropyViewModel : ViewModelBase
|
||||
|
||||
[JetBrains.Annotations.NotNull]
|
||||
public string Title => UI.Title_Calculating_entropy;
|
||||
|
||||
public ObservableCollection<TrackEntropyModel> TrackEntropy { get; }
|
||||
public ReactiveCommand<Unit, Unit> StartCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
@@ -331,9 +332,11 @@ public sealed class ImageEntropyViewModel : ViewModelBase
|
||||
AaruConsole.WriteLine(UI.Entropy_for_track_0_is_1, trackEntropy.Track, trackEntropy.Entropy);
|
||||
|
||||
if(trackEntropy.UniqueSectors != null)
|
||||
{
|
||||
AaruConsole.WriteLine(UI.Track_0_has_1_unique_sectors_2, trackEntropy.Track,
|
||||
trackEntropy.UniqueSectors,
|
||||
(double)trackEntropy.UniqueSectors / trackEntropy.Sectors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +361,9 @@ public sealed class ImageEntropyViewModel : ViewModelBase
|
||||
ResultsVisible = true;
|
||||
|
||||
if(SeparatedTracksChecked)
|
||||
{
|
||||
foreach(EntropyResults trackEntropy in _tracksEntropy)
|
||||
{
|
||||
TrackEntropy.Add(new TrackEntropyModel
|
||||
{
|
||||
Track = trackEntropy.Track.ToString(),
|
||||
@@ -366,6 +371,8 @@ public sealed class ImageEntropyViewModel : ViewModelBase
|
||||
UniqueSectors = $"{trackEntropy.UniqueSectors} ({
|
||||
(trackEntropy.UniqueSectors ?? 0) / (double)trackEntropy.Sectors:P3})"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(WholeDiscChecked != true)
|
||||
return;
|
||||
|
||||
@@ -79,7 +79,7 @@ public sealed class ImageSidecarViewModel : ViewModelBase
|
||||
bool _stopVisible;
|
||||
|
||||
public ImageSidecarViewModel(IMediaImage inputFormat, string imageSource, Guid filterId, Encoding encoding,
|
||||
Window view)
|
||||
Window view)
|
||||
{
|
||||
_view = view;
|
||||
_inputFormat = inputFormat;
|
||||
@@ -275,10 +275,7 @@ public sealed class ImageSidecarViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void EndProgress2() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress2Visible = false;
|
||||
});
|
||||
async void EndProgress2() => await Dispatcher.UIThread.InvokeAsync(() => { Progress2Visible = false; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void UpdateProgress2(string text, long current, long maximum) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -291,16 +288,10 @@ public sealed class ImageSidecarViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void InitProgress2() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress2Visible = true;
|
||||
});
|
||||
async void InitProgress2() => await Dispatcher.UIThread.InvokeAsync(() => { Progress2Visible = true; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void EndProgress() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress1Visible = false;
|
||||
});
|
||||
async void EndProgress() => await Dispatcher.UIThread.InvokeAsync(() => { Progress1Visible = false; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void UpdateProgress(string text, long current, long maximum) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -313,16 +304,10 @@ public sealed class ImageSidecarViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void InitProgress() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress1Visible = true;
|
||||
});
|
||||
async void InitProgress() => await Dispatcher.UIThread.InvokeAsync(() => { Progress1Visible = true; });
|
||||
|
||||
[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();
|
||||
|
||||
@@ -342,11 +327,8 @@ public sealed class ImageSidecarViewModel : ViewModelBase
|
||||
|
||||
dlgDestination.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.json"
|
||||
})
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[] { "*.json" })
|
||||
});
|
||||
|
||||
string result = await dlgDestination.ShowAsync(_view);
|
||||
|
||||
@@ -402,11 +402,13 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
if(VerifyImageChecked)
|
||||
{
|
||||
if(_inputFormat is not IVerifiableImage verifiableImage)
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
ImageResultVisible = true;
|
||||
ImageResultText = UI.Disc_image_does_not_support_verification;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -423,7 +425,7 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
|
||||
var chkStopwatch = new Stopwatch();
|
||||
chkStopwatch.Start();
|
||||
bool? discCheckStatus = verifiableImage.VerifyMediaImage();
|
||||
bool? discCheckStatus = verifiableImage.VerifyMediaImage();
|
||||
chkStopwatch.Stop();
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -431,11 +433,11 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
ImageResultVisible = true;
|
||||
|
||||
ImageResultText = discCheckStatus switch
|
||||
{
|
||||
true => UI.Disc_image_checksums_are_correct,
|
||||
false => UI.Disc_image_checksums_are_incorrect,
|
||||
null => UI.Disc_image_does_not_contain_checksums
|
||||
};
|
||||
{
|
||||
true => UI.Disc_image_checksums_are_correct,
|
||||
false => UI.Disc_image_checksums_are_incorrect,
|
||||
null => UI.Disc_image_does_not_contain_checksums
|
||||
};
|
||||
});
|
||||
|
||||
AaruConsole.VerboseWriteLine(UI.Checking_disc_image_checksums_took_0,
|
||||
@@ -504,11 +506,15 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
List<ulong> tempUnknownLbas;
|
||||
|
||||
if(remainingSectors < 512)
|
||||
{
|
||||
inputOptical.VerifySectors(currentSector, (uint)remainingSectors, currentTrack.Sequence,
|
||||
out tempFailingLbas, out tempUnknownLbas);
|
||||
}
|
||||
else
|
||||
{
|
||||
inputOptical.VerifySectors(currentSector, 512, currentTrack.Sequence, out tempFailingLbas,
|
||||
out tempUnknownLbas);
|
||||
}
|
||||
|
||||
failingLbas.AddRange(tempFailingLbas);
|
||||
|
||||
@@ -564,11 +570,15 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
List<ulong> tempUnknownLbas;
|
||||
|
||||
if(remainingSectors < 512)
|
||||
{
|
||||
verifiableSectorsImage.VerifySectors(currentSector, (uint)remainingSectors, out tempFailingLbas,
|
||||
out tempUnknownLbas);
|
||||
}
|
||||
else
|
||||
{
|
||||
verifiableSectorsImage.VerifySectors(currentSector, 512, out tempFailingLbas,
|
||||
out tempUnknownLbas);
|
||||
}
|
||||
|
||||
failingLbas.AddRange(tempFailingLbas);
|
||||
|
||||
@@ -607,10 +617,12 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
SectorErrorsVisible = true;
|
||||
|
||||
foreach(ulong t in failingLbas)
|
||||
{
|
||||
ErrorList.Add(new LbaModel
|
||||
{
|
||||
Lba = t.ToString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,16 +639,18 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
SectorsUnknownsVisible = true;
|
||||
|
||||
foreach(ulong t in unknownLbas)
|
||||
{
|
||||
UnknownList.Add(new LbaModel
|
||||
{
|
||||
Lba = t.ToString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SectorSummaryVisible = true;
|
||||
TotalSectorsText = string.Format(UI.Total_sectors, _inputFormat.Info.Sectors);
|
||||
TotalSectorErrorsText = string.Format(UI.Total_errors, failingLbas.Count);
|
||||
TotalSectorsText = string.Format(UI.Total_sectors, _inputFormat.Info.Sectors);
|
||||
TotalSectorErrorsText = string.Format(UI.Total_errors, failingLbas.Count);
|
||||
TotalSectorUnknownsText = string.Format(UI.Total_unknowns, unknownLbas.Count);
|
||||
|
||||
TotalSectorErrorsUnknownsText =
|
||||
|
||||
@@ -72,22 +72,22 @@ namespace Aaru.Gui.ViewModels.Windows;
|
||||
|
||||
public sealed class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
const string MODULE_NAME = "Main Window ViewModel";
|
||||
readonly DevicesRootModel _devicesRoot;
|
||||
readonly Bitmap _ejectIcon;
|
||||
readonly Bitmap _genericFolderIcon;
|
||||
readonly Bitmap _genericHddIcon;
|
||||
readonly Bitmap _genericOpticalIcon;
|
||||
readonly Bitmap _genericTapeIcon;
|
||||
readonly ImagesRootModel _imagesRoot;
|
||||
readonly Bitmap _removableIcon;
|
||||
readonly Bitmap _sdIcon;
|
||||
readonly Bitmap _usbIcon;
|
||||
readonly MainWindow _view;
|
||||
Views.Dialogs.Console _console;
|
||||
object _contentPanel;
|
||||
bool _devicesSupported;
|
||||
object _treeViewSelectedItem;
|
||||
const string MODULE_NAME = "Main Window ViewModel";
|
||||
readonly DevicesRootModel _devicesRoot;
|
||||
readonly Bitmap _ejectIcon;
|
||||
readonly Bitmap _genericFolderIcon;
|
||||
readonly Bitmap _genericHddIcon;
|
||||
readonly Bitmap _genericOpticalIcon;
|
||||
readonly Bitmap _genericTapeIcon;
|
||||
readonly ImagesRootModel _imagesRoot;
|
||||
readonly Bitmap _removableIcon;
|
||||
readonly Bitmap _sdIcon;
|
||||
readonly Bitmap _usbIcon;
|
||||
readonly MainWindow _view;
|
||||
Views.Dialogs.Console _console;
|
||||
object _contentPanel;
|
||||
bool _devicesSupported;
|
||||
object _treeViewSelectedItem;
|
||||
|
||||
public MainWindowViewModel(MainWindow view)
|
||||
{
|
||||
@@ -148,15 +148,18 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
|
||||
_usbIcon =
|
||||
new
|
||||
Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media-usb.png")));
|
||||
Bitmap(AssetLoader.Open(
|
||||
new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media-usb.png")));
|
||||
|
||||
_removableIcon =
|
||||
new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media.png")));
|
||||
new Bitmap(AssetLoader.Open(
|
||||
new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media.png")));
|
||||
|
||||
_sdIcon =
|
||||
new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/media-flash-sd-mmc.png")));
|
||||
|
||||
_ejectIcon = new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/media-eject.png")));
|
||||
_ejectIcon =
|
||||
new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/media-eject.png")));
|
||||
}
|
||||
|
||||
public string FileLabel => UI.Menu_File;
|
||||
@@ -193,6 +196,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
|
||||
[NotNull]
|
||||
public string Greeting => UI.Welcome_to_Aaru;
|
||||
|
||||
public ObservableCollection<RootModel> TreeRoot { get; }
|
||||
public ReactiveCommand<Unit, Unit> AboutCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ConsoleCommand { get; }
|
||||
@@ -292,23 +296,27 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
deviceModel.ViewModel = new DeviceInfoViewModel(devInfo, _view);
|
||||
|
||||
if(!dev.IsRemovable)
|
||||
{
|
||||
deviceModel.Media.Add(new MediaModel
|
||||
{
|
||||
NonRemovable = true,
|
||||
Name = UI.Non_removable_device_commands_not_yet_implemented
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Removable non-SCSI?
|
||||
var scsiInfo = new ScsiInfo(dev);
|
||||
|
||||
if(!scsiInfo.MediaInserted)
|
||||
{
|
||||
deviceModel.Media.Add(new MediaModel
|
||||
{
|
||||
NoMediaInserted = true,
|
||||
Icon = _ejectIcon,
|
||||
Name = UI.No_media_inserted
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var mediaResource =
|
||||
@@ -317,7 +325,8 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
deviceModel.Media.Add(new MediaModel
|
||||
{
|
||||
DevicePath = deviceModel.Path,
|
||||
Icon = AssetLoader.Exists(mediaResource) ? new Bitmap(AssetLoader.Open(mediaResource))
|
||||
Icon = AssetLoader.Exists(mediaResource)
|
||||
? new Bitmap(AssetLoader.Open(mediaResource))
|
||||
: null,
|
||||
Name = $"{scsiInfo.MediaType}",
|
||||
ViewModel = new MediaInfoViewModel(scsiInfo, deviceModel.Path, _view)
|
||||
@@ -346,10 +355,12 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
case MediaModel mediaModel:
|
||||
{
|
||||
if(mediaModel.ViewModel != null)
|
||||
{
|
||||
ContentPanel = new MediaInfo
|
||||
{
|
||||
DataContext = mediaModel.ViewModel
|
||||
};
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -533,7 +544,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
if(inputFilter == null)
|
||||
{
|
||||
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Cannot_open_specified_file, ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
Icon.Error);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -543,7 +554,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
if(ImageFormat.Detect(inputFilter) is not IMediaImage imageFormat)
|
||||
{
|
||||
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Image_format_not_identified,
|
||||
ButtonEnum.Ok, Icon.Error);
|
||||
ButtonEnum.Ok, Icon.Error);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -557,8 +568,8 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
if(opened != ErrorNumber.NoError)
|
||||
{
|
||||
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
string.Format(UI.Error_0_opening_image_format,
|
||||
opened), ButtonEnum.Ok, Icon.Error);
|
||||
string.Format(UI.Error_0_opening_image_format,
|
||||
opened), ButtonEnum.Ok, Icon.Error);
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format);
|
||||
AaruConsole.ErrorWriteLine(UI.No_error_given);
|
||||
@@ -587,7 +598,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
List<CommonTypes.Partition> partitions = Core.Partitions.GetAll(imageFormat);
|
||||
Core.Partitions.AddSchemesToStats(partitions);
|
||||
|
||||
bool checkRaw = false;
|
||||
var checkRaw = false;
|
||||
List<string> idPlugins;
|
||||
Type pluginType;
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
@@ -632,6 +643,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
AaruConsole.WriteLine(string.Format(UI.Identified_by_0_plugins, idPlugins.Count));
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(plugins.Filesystems.TryGetValue(pluginName, out pluginType))
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IFilesystem fs)
|
||||
@@ -655,13 +667,14 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
var filesystemModel = new FileSystemModel
|
||||
{
|
||||
VolumeName = rofs?.Metadata.VolumeName is null
|
||||
? fsMetadata.VolumeName is null ? $"{fsMetadata.Type}"
|
||||
? fsMetadata.VolumeName is null
|
||||
? $"{fsMetadata.Type}"
|
||||
: $"{fsMetadata.VolumeName} ({fsMetadata.Type})"
|
||||
: $"{rofs.Metadata.VolumeName} ({rofs.Metadata.Type})",
|
||||
Filesystem = fs,
|
||||
ReadOnlyFilesystem = rofs,
|
||||
ViewModel = new FileSystemViewModel(rofs?.Metadata ?? fsMetadata,
|
||||
information)
|
||||
information)
|
||||
};
|
||||
|
||||
// TODO: Trap expanding item
|
||||
@@ -680,6 +693,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
Statistics.AddFilesystem(rofs?.Metadata.Type ?? fsMetadata.Type);
|
||||
partitionModel.FileSystems.Add(filesystemModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
schemeModel.Partitions.Add(partitionModel);
|
||||
@@ -707,6 +721,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
AaruConsole.WriteLine(string.Format(UI.Identified_by_0_plugins, idPlugins.Count));
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(plugins.Filesystems.TryGetValue(pluginName, out pluginType))
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IFilesystem fs)
|
||||
@@ -729,7 +744,8 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
var filesystemModel = new FileSystemModel
|
||||
{
|
||||
VolumeName = rofs?.Metadata.VolumeName is null
|
||||
? fsMetadata.VolumeName is null ? $"{fsMetadata.Type}"
|
||||
? fsMetadata.VolumeName is null
|
||||
? $"{fsMetadata.Type}"
|
||||
: $"{fsMetadata.VolumeName} ({fsMetadata.Type})"
|
||||
: $"{rofs.Metadata.VolumeName} ({rofs.Metadata.Type})",
|
||||
Filesystem = fs,
|
||||
@@ -753,6 +769,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
Statistics.AddFilesystem(rofs?.Metadata.Type ?? fsMetadata.Type);
|
||||
imageModel.PartitionSchemesOrFileSystems.Add(filesystemModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -765,7 +782,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Unable_to_open_image_format,
|
||||
ButtonEnum.Ok, Icon.Error);
|
||||
ButtonEnum.Ok, Icon.Error);
|
||||
|
||||
AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format);
|
||||
AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message);
|
||||
@@ -775,7 +792,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Exception_reading_file, ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
Icon.Error);
|
||||
|
||||
AaruConsole.ErrorWriteLine(string.Format(UI.Error_reading_file_0, ex.Message));
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, ex.StackTrace);
|
||||
@@ -817,9 +834,11 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
if(dev != null)
|
||||
{
|
||||
if(dev is Devices.Remote.Device remoteDev)
|
||||
{
|
||||
Statistics.AddRemote(remoteDev.RemoteApplication, remoteDev.RemoteVersion,
|
||||
remoteDev.RemoteOperatingSystem, remoteDev.RemoteOperatingSystemVersion,
|
||||
remoteDev.RemoteArchitecture);
|
||||
}
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
@@ -830,7 +849,8 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
case PeripheralDeviceTypes.DirectAccess:
|
||||
case PeripheralDeviceTypes.SCSIZonedBlockDevice:
|
||||
case PeripheralDeviceTypes.SimplifiedDevice:
|
||||
deviceModel.Icon = dev.IsRemovable ? dev.IsUsb ? _usbIcon : _removableIcon
|
||||
deviceModel.Icon = dev.IsRemovable
|
||||
? dev.IsUsb ? _usbIcon : _removableIcon
|
||||
: _genericHddIcon;
|
||||
|
||||
break;
|
||||
|
||||
@@ -112,7 +112,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
bool _useResume;
|
||||
bool _useSidecar;
|
||||
|
||||
public MediaDumpViewModel(string devicePath, DeviceInfo deviceInfo, Window view,
|
||||
public MediaDumpViewModel(string devicePath, DeviceInfo deviceInfo, Window view,
|
||||
[CanBeNull] ScsiInfo scsiInfo = null)
|
||||
{
|
||||
_view = view;
|
||||
@@ -144,6 +144,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
if(scsiInfo != null)
|
||||
mediaType = scsiInfo.MediaType;
|
||||
else
|
||||
{
|
||||
switch(deviceInfo.Type)
|
||||
{
|
||||
case DeviceType.SecureDigital:
|
||||
@@ -164,6 +165,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
|
||||
@@ -173,10 +175,12 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
continue;
|
||||
|
||||
if(plugin.SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
PluginsList.Add(new ImagePluginModel
|
||||
{
|
||||
Plugin = plugin
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Encodings.AddRange(Encoding.GetEncodings().Select(info => new EncodingModel
|
||||
@@ -514,11 +518,8 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
|
||||
dlgMetadata.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
".json"
|
||||
})
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[] { ".json" })
|
||||
});
|
||||
|
||||
string[] result = dlgMetadata.ShowAsync(_view).Result;
|
||||
@@ -719,16 +720,16 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
else if(File.Exists(_outputPrefix + ".resume.xml"))
|
||||
{
|
||||
// Should be covered by virtue of being the same exact class as the JSON above
|
||||
#pragma warning disable IL2026
|
||||
#pragma warning disable IL2026
|
||||
var xs = new XmlSerializer(typeof(Resume));
|
||||
#pragma warning restore IL2026
|
||||
#pragma warning restore IL2026
|
||||
|
||||
var sr = new StreamReader(_outputPrefix + ".resume.xml");
|
||||
|
||||
// Should be covered by virtue of being the same exact class as the JSON above
|
||||
#pragma warning disable IL2026
|
||||
#pragma warning disable IL2026
|
||||
_resume = (Resume)xs.Deserialize(sr);
|
||||
#pragma warning restore IL2026
|
||||
#pragma warning restore IL2026
|
||||
|
||||
sr.Close();
|
||||
}
|
||||
@@ -737,7 +738,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
{
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error, UI.Incorrect_resume_file_cannot_use_it, ButtonEnum.Ok,
|
||||
Icon.Error).ShowWindowDialogAsync(_view);
|
||||
Icon.Error).ShowWindowDialogAsync(_view);
|
||||
|
||||
Resume = false;
|
||||
|
||||
@@ -746,13 +747,13 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
|
||||
if(_resume == null ||
|
||||
_resume.NextBlock <= _resume.LastBlock ||
|
||||
(_resume.BadBlocks.Count != 0 && !_resume.Tape))
|
||||
_resume.BadBlocks.Count != 0 && !_resume.Tape)
|
||||
return;
|
||||
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Warning,
|
||||
UI.Media_already_dumped_correctly_please_choose_another_destination,
|
||||
ButtonEnum.Ok, Icon.Warning).ShowWindowDialogAsync(_view);
|
||||
UI.Media_already_dumped_correctly_please_choose_another_destination,
|
||||
ButtonEnum.Ok, Icon.Warning).ShowWindowDialogAsync(_view);
|
||||
|
||||
Resume = false;
|
||||
}
|
||||
@@ -814,6 +815,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
Encoding encoding = null;
|
||||
|
||||
if(SelectedEncoding is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encoding = Claunia.Encoding.Encoding.GetEncoding(SelectedEncoding.Name);
|
||||
@@ -824,6 +826,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<string, string> parsedOptions = new();
|
||||
|
||||
@@ -901,10 +904,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void EndProgress2() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress2Visible = false;
|
||||
});
|
||||
async void EndProgress2() => await Dispatcher.UIThread.InvokeAsync(() => { Progress2Visible = false; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void UpdateProgress2(string text, long current, long maximum) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -917,16 +917,10 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void InitProgress2() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress2Visible = true;
|
||||
});
|
||||
async void InitProgress2() => await Dispatcher.UIThread.InvokeAsync(() => { Progress2Visible = true; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void EndProgress() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress1Visible = false;
|
||||
});
|
||||
async void EndProgress() => await Dispatcher.UIThread.InvokeAsync(() => { Progress1Visible = false; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void UpdateProgress(string text, long current, long maximum) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -939,10 +933,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void InitProgress() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress1Visible = true;
|
||||
});
|
||||
async void InitProgress() => await Dispatcher.UIThread.InvokeAsync(() => { Progress1Visible = true; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void PulseProgress(string text) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
|
||||
@@ -110,10 +110,10 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
CloseVisible = true;
|
||||
BlockMapList = new ObservableCollection<(ulong block, double duration)>();
|
||||
// ChartPoints = new ObservableCollection<DataPoint>();
|
||||
StepsX = double.NaN;
|
||||
StepsY = double.NaN;
|
||||
AxesColor = Colors.Black;
|
||||
LineColor = Colors.Yellow;
|
||||
StepsX = double.NaN;
|
||||
StepsY = double.NaN;
|
||||
AxesColor = Colors.Black;
|
||||
LineColor = Colors.Yellow;
|
||||
}
|
||||
|
||||
public string SpeedLabel => UI.ButtonLabel_Stop;
|
||||
@@ -350,7 +350,7 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
case null:
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error, string.Format(UI.Error_0_opening_device, devErrno),
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
|
||||
StopVisible = false;
|
||||
StartVisible = true;
|
||||
@@ -370,7 +370,7 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
{
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandard(UI.Title_Error, string.Format(UI.Error_0_opening_device, dev.LastError),
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
|
||||
|
||||
StopVisible = false;
|
||||
StartVisible = true;
|
||||
@@ -412,12 +412,12 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
MinSpeed = string.Format(Localization.Core.Slowest_speed_burst_0,
|
||||
ByteSize.FromBytes(results.MinSpeed).Per(1.Seconds()).Humanize());
|
||||
|
||||
A = string.Format(Localization.Core._0_sectors_took_less_than_3_ms, results.A);
|
||||
B = string.Format(Localization.Core._0_sectors_took_less_than_10_ms_but_more_than_3_ms, results.B);
|
||||
C = string.Format(Localization.Core._0_sectors_took_less_than_50_ms_but_more_than_10_ms, results.C);
|
||||
D = string.Format(Localization.Core._0_sectors_took_less_than_150_ms_but_more_than_50_ms, results.D);
|
||||
A = string.Format(Localization.Core._0_sectors_took_less_than_3_ms, results.A);
|
||||
B = string.Format(Localization.Core._0_sectors_took_less_than_10_ms_but_more_than_3_ms, results.B);
|
||||
C = string.Format(Localization.Core._0_sectors_took_less_than_50_ms_but_more_than_10_ms, results.C);
|
||||
D = string.Format(Localization.Core._0_sectors_took_less_than_150_ms_but_more_than_50_ms, results.D);
|
||||
E = string.Format(Localization.Core._0_sectors_took_less_than_500_ms_but_more_than_150_ms, results.E);
|
||||
F = string.Format(Localization.Core._0_sectors_took_more_than_500_ms, results.F);
|
||||
F = string.Format(Localization.Core._0_sectors_took_more_than_500_ms, results.F);
|
||||
|
||||
UnreadableSectors = string.Format(Localization.Core._0_sectors_could_not_be_read,
|
||||
results.UnreadableSectors.Count);
|
||||
@@ -456,7 +456,7 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
*/
|
||||
|
||||
if(currentSpeed > MaxY)
|
||||
MaxY = currentSpeed + (currentSpeed / 10d);
|
||||
MaxY = currentSpeed + currentSpeed / 10d;
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
@@ -479,12 +479,12 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
case 0x0021:
|
||||
case 0x0022:
|
||||
MaxX = blocks switch
|
||||
{
|
||||
<= 360000 => 360000,
|
||||
<= 405000 => 405000,
|
||||
<= 445500 => 445500,
|
||||
_ => blocks
|
||||
};
|
||||
{
|
||||
<= 360000 => 360000,
|
||||
<= 405000 => 405000,
|
||||
<= 445500 => 445500,
|
||||
_ => blocks
|
||||
};
|
||||
|
||||
StepsX = MaxX / 10;
|
||||
StepsY = 150 * 4;
|
||||
@@ -521,13 +521,13 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
case 0x0043:
|
||||
case 0x0040: // BD
|
||||
MaxX = blocks switch
|
||||
{
|
||||
<= 12219392 => 12219392,
|
||||
<= 24438784 => 24438784,
|
||||
<= 48878592 => 48878592,
|
||||
<= 62500864 => 62500864,
|
||||
_ => blocks
|
||||
};
|
||||
{
|
||||
<= 12219392 => 12219392,
|
||||
<= 24438784 => 24438784,
|
||||
<= 48878592 => 48878592,
|
||||
<= 62500864 => 62500864,
|
||||
_ => blocks
|
||||
};
|
||||
|
||||
StepsX = MaxX / 10;
|
||||
StepsY = 4394.5;
|
||||
@@ -541,11 +541,11 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
case 0x0058:
|
||||
case 0x005A:
|
||||
MaxX = blocks switch
|
||||
{
|
||||
<= 7361599 => 7361599,
|
||||
<= 16305407 => 16305407,
|
||||
_ => blocks
|
||||
};
|
||||
{
|
||||
<= 7361599 => 7361599,
|
||||
<= 16305407 => 16305407,
|
||||
_ => blocks
|
||||
};
|
||||
|
||||
StepsX = MaxX / 10;
|
||||
StepsY = 4394.5;
|
||||
@@ -571,10 +571,7 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void EndProgress() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress1Visible = false;
|
||||
});
|
||||
async void EndProgress() => await Dispatcher.UIThread.InvokeAsync(() => { Progress1Visible = false; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void UpdateProgress(string text, long current, long maximum) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -587,10 +584,7 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void InitProgress() => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Progress1Visible = true;
|
||||
});
|
||||
async void InitProgress() => await Dispatcher.UIThread.InvokeAsync(() => { Progress1Visible = true; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void PulseProgress(string text) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -613,10 +607,7 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void UpdateStatus(string text) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
ProgressText = text;
|
||||
});
|
||||
async void UpdateStatus(string text) => await Dispatcher.UIThread.InvokeAsync(() => { ProgressText = text; });
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void OnScanUnreadable(ulong sector) => await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
@@ -659,11 +650,11 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
break;
|
||||
}
|
||||
|
||||
A = string.Format(Localization.Core._0_sectors_took_less_than_3_ms, _localResults.A);
|
||||
B = string.Format(Localization.Core._0_sectors_took_less_than_10_ms_but_more_than_3_ms, _localResults.B);
|
||||
C = string.Format(Localization.Core._0_sectors_took_less_than_50_ms_but_more_than_10_ms, _localResults.C);
|
||||
D = string.Format(Localization.Core._0_sectors_took_less_than_150_ms_but_more_than_50_ms, _localResults.D);
|
||||
A = string.Format(Localization.Core._0_sectors_took_less_than_3_ms, _localResults.A);
|
||||
B = string.Format(Localization.Core._0_sectors_took_less_than_10_ms_but_more_than_3_ms, _localResults.B);
|
||||
C = string.Format(Localization.Core._0_sectors_took_less_than_50_ms_but_more_than_10_ms, _localResults.C);
|
||||
D = string.Format(Localization.Core._0_sectors_took_less_than_150_ms_but_more_than_50_ms, _localResults.D);
|
||||
E = string.Format(Localization.Core._0_sectors_took_less_than_500_ms_but_more_than_150_ms, _localResults.E);
|
||||
F = string.Format(Localization.Core._0_sectors_took_more_than_500_ms, _localResults.F);
|
||||
F = string.Format(Localization.Core._0_sectors_took_more_than_500_ms, _localResults.F);
|
||||
});
|
||||
}
|
||||
@@ -147,12 +147,15 @@ public sealed class SplashWindowViewModel : ViewModelBase
|
||||
ctx.Database.EnsureCreated();
|
||||
|
||||
ctx.Database.
|
||||
ExecuteSqlRaw("CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)");
|
||||
ExecuteSqlRaw(
|
||||
"CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)");
|
||||
|
||||
foreach(string migration in ctx.Database.GetPendingMigrations())
|
||||
{
|
||||
ctx.Database.
|
||||
ExecuteSqlRaw($"INSERT INTO \"__EFMigrationsHistory\" (MigrationId, ProductVersion) VALUES ('{
|
||||
migration}', '0.0.0')");
|
||||
}
|
||||
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
@@ -165,9 +168,11 @@ public sealed class SplashWindowViewModel : ViewModelBase
|
||||
a.Revision,
|
||||
a.Bus
|
||||
}).Where(a => a.Count() > 1).Distinct().Select(a => a.Key))
|
||||
{
|
||||
ctx.RemoveRange(ctx.SeenDevices.
|
||||
Where(d => d.Manufacturer == duplicate.Manufacturer && d.Model == duplicate.Model &&
|
||||
d.Revision == duplicate.Revision && d.Bus == duplicate.Bus).Skip(1));
|
||||
}
|
||||
|
||||
// Remove nulls
|
||||
ctx.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null && d.Model == null &&
|
||||
|
||||
@@ -83,7 +83,8 @@ public sealed class ViewSectorViewModel : ViewModelBase
|
||||
|
||||
byte[] sector;
|
||||
|
||||
ErrorNumber errno = LongSectorChecked ? _inputFormat.ReadSectorLong((ulong)SectorNumber, out sector)
|
||||
ErrorNumber errno = LongSectorChecked
|
||||
? _inputFormat.ReadSectorLong((ulong)SectorNumber, out sector)
|
||||
: _inputFormat.ReadSector((ulong)SectorNumber, out sector);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
|
||||
Reference in New Issue
Block a user