Redo Reformat and cleanup.

Rider EAP was having a bug interpreting .editorconfig that didn't generate the code style as we wanted.
This is now done with Rider-stable.
This commit is contained in:
2023-10-04 17:34:40 +01:00
parent bc8bf7a2dc
commit 7363a5d9c5
453 changed files with 7241 additions and 7126 deletions

View File

@@ -75,8 +75,7 @@ public sealed class AboutViewModel : ViewModelBase
(Attribute.GetCustomAttribute(assembly, typeof(AssemblyInformationalVersionAttribute)) as
AssemblyInformationalVersionAttribute)?.InformationalVersion;
if(name is null ||
version is null)
if(name is null || version is null)
continue;
Assemblies.Add(new AssemblyModel

View File

@@ -99,8 +99,11 @@ 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);
@@ -158,10 +161,8 @@ 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);

View File

@@ -55,17 +55,20 @@ public sealed class EncodingsViewModel : ViewModelBase
Task.Run(() =>
{
var encodings = Encoding.GetEncodings().Select(info => new EncodingModel
{
Name = info.Name,
DisplayName = info.GetEncoding().EncodingName
}).ToList();
var encodings = Encoding.GetEncodings().
Select(info => new EncodingModel
{
Name = info.Name,
DisplayName = info.GetEncoding().EncodingName
}).
ToList();
encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().Select(info => new EncodingModel
{
Name = info.Name,
DisplayName = info.DisplayName
}));
encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().
Select(info => new EncodingModel
{
Name = info.Name,
DisplayName = info.DisplayName
}));
foreach(EncodingModel encoding in encodings.OrderBy(t => t.DisplayName))
Encodings.Add(encoding);

View File

@@ -132,7 +132,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "fs-info"))
{
ulong count = ctx.Commands.Where(c => c.Name == "fs-info" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "fs-info" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "fs-info" && !c.Synchronized);
@@ -143,7 +144,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "checksum"))
{
ulong count = ctx.Commands.Where(c => c.Name == "checksum" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "checksum" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "checksum" && !c.Synchronized);
@@ -154,7 +156,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "compare"))
{
ulong count = ctx.Commands.Where(c => c.Name == "compare" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "compare" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "compare" && !c.Synchronized);
@@ -165,7 +168,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "convert-image"))
{
ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "convert-image" && !c.Synchronized);
@@ -177,7 +181,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "create-sidecar"))
{
ulong count = ctx.Commands.Where(c => c.Name == "create-sidecar" && c.Synchronized).
Select(c => c.Count).FirstOrDefault();
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "create-sidecar" && !c.Synchronized);
@@ -187,7 +192,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "decode"))
{
ulong count = ctx.Commands.Where(c => c.Name == "decode" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "decode" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "decode" && !c.Synchronized);
@@ -198,7 +204,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "device-info"))
{
ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-info" && !c.Synchronized);
@@ -209,7 +216,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "device-report"))
{
ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-report" && !c.Synchronized);
@@ -220,7 +228,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "dump-media"))
{
ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "dump-media" && !c.Synchronized);
@@ -231,7 +240,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "entropy"))
{
ulong count = ctx.Commands.Where(c => c.Name == "entropy" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "entropy" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "entropy" && !c.Synchronized);
@@ -242,7 +252,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "formats"))
{
ulong count = ctx.Commands.Where(c => c.Name == "formats" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "formats" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "formats" && !c.Synchronized);
@@ -253,7 +264,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "image-info"))
{
ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "image-info" && !c.Synchronized);
@@ -264,7 +276,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "media-info"))
{
ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-info" && !c.Synchronized);
@@ -275,7 +288,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "media-scan"))
{
ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-scan" && !c.Synchronized);
@@ -286,7 +300,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "printhex"))
{
ulong count = ctx.Commands.Where(c => c.Name == "printhex" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "printhex" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "printhex" && !c.Synchronized);
@@ -297,7 +312,8 @@ public sealed class StatisticsViewModel : ViewModelBase
if(ctx.Commands.Any(c => c.Name == "verify"))
{
ulong count = ctx.Commands.Where(c => c.Name == "verify" && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Commands.Where(c => c.Name == "verify" && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "verify" && !c.Synchronized);
@@ -306,10 +322,22 @@ public sealed class StatisticsViewModel : ViewModelBase
VerifyText = string.Format(UI.You_have_called_the_Verify_command_0_times, count);
}
CommandsVisible = FsInfoVisible || ChecksumVisible || CompareVisible || ConvertImageVisible ||
CreateSidecarVisible || DecodeVisible || DeviceInfoVisible || DeviceReportVisible ||
DumpMediaVisible || EntropyVisible || FormatsCommandVisible || ImageInfoVisible ||
MediaInfoVisible || MediaScanVisible || PrintHexVisible || VerifyVisible;
CommandsVisible = FsInfoVisible ||
ChecksumVisible ||
CompareVisible ||
ConvertImageVisible ||
CreateSidecarVisible ||
DecodeVisible ||
DeviceInfoVisible ||
DeviceReportVisible ||
DumpMediaVisible ||
EntropyVisible ||
FormatsCommandVisible ||
ImageInfoVisible ||
MediaInfoVisible ||
MediaScanVisible ||
PrintHexVisible ||
VerifyVisible;
}
if(ctx.Filters.Any())
@@ -318,7 +346,8 @@ public sealed class StatisticsViewModel : ViewModelBase
foreach(string nvs in ctx.Filters.Select(n => n.Name).Distinct())
{
ulong count = ctx.Filters.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Filters.Where(c => c.Name == nvs && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Filters.LongCount(c => c.Name == nvs && !c.Synchronized);
@@ -337,7 +366,8 @@ public sealed class StatisticsViewModel : ViewModelBase
foreach(string nvs in ctx.MediaFormats.Select(n => n.Name).Distinct())
{
ulong count = ctx.MediaFormats.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count).
ulong count = ctx.MediaFormats.Where(c => c.Name == nvs && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.MediaFormats.LongCount(c => c.Name == nvs && !c.Synchronized);
@@ -356,7 +386,8 @@ public sealed class StatisticsViewModel : ViewModelBase
foreach(string nvs in ctx.Partitions.Select(n => n.Name).Distinct())
{
ulong count = ctx.Partitions.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Partitions.Where(c => c.Name == nvs && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Partitions.LongCount(c => c.Name == nvs && !c.Synchronized);
@@ -375,7 +406,8 @@ public sealed class StatisticsViewModel : ViewModelBase
foreach(string nvs in ctx.Filesystems.Select(n => n.Name).Distinct())
{
ulong count = ctx.Filesystems.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count).
ulong count = ctx.Filesystems.Where(c => c.Name == nvs && c.Synchronized).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Filesystems.LongCount(c => c.Name == nvs && !c.Synchronized);
@@ -392,8 +424,10 @@ public sealed class StatisticsViewModel : ViewModelBase
{
DevicesVisible = true;
foreach(DeviceStat ds in ctx.SeenDevices.OrderBy(n => n.Manufacturer).ThenBy(n => n.Manufacturer).
ThenBy(n => n.Revision).ThenBy(n => n.Bus))
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
{
@@ -412,7 +446,8 @@ public sealed class StatisticsViewModel : ViewModelBase
foreach(string media in ctx.Medias.OrderBy(ms => ms.Type).Select(ms => ms.Type).Distinct())
{
ulong count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && c.Real).Select(c => c.Count).
ulong count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && c.Real).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && c.Real);
@@ -427,7 +462,8 @@ public sealed class StatisticsViewModel : ViewModelBase
});
}
count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real).Select(c => c.Count).
count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real).
Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && !c.Real);

View File

@@ -186,8 +186,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase
};
}
if(devInfo.AtaIdentify != null ||
devInfo.AtapiIdentify != null)
if(devInfo.AtaIdentify != null || devInfo.AtapiIdentify != null)
{
AtaInfo = new AtaInfo
{
@@ -365,8 +364,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase
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;
: 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);
@@ -1016,8 +1014,11 @@ 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);

View File

@@ -76,9 +76,9 @@ public sealed class FileSystemViewModel([NotNull] FileSystem metadata, string in
public string BackupDateText { get; } =
string.Format(Localization.Core.Volume_last_backed_up_on_0, metadata.BackupDate);
public string ClustersText { get; } = string.Format(
Localization.Core.Volume_has_0_clusters_of_1_bytes_each_total_of_2_bytes,
metadata.Clusters, metadata.ClusterSize, metadata.Clusters * metadata.ClusterSize);
public string ClustersText { get; } =
string.Format(Localization.Core.Volume_has_0_clusters_of_1_bytes_each_total_of_2_bytes, metadata.Clusters,
metadata.ClusterSize, metadata.Clusters * metadata.ClusterSize);
public string FreeClustersText { get; } = string.Format(Localization.Core.Volume_has_0_clusters_free_1,
metadata.FreeClusters,

View File

@@ -106,10 +106,13 @@ public sealed class ImageInfoViewModel : ViewModelBase
MediaLogo = AssetLoader.Exists(mediaResource)
? new Bitmap(AssetLoader.Open(mediaResource))
: imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia
:
imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia
? genericHddIcon
: imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc
? genericOpticalIcon
:
imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc
?
genericOpticalIcon
: genericFolderIcon;
ImagePathText = string.Format(UI.Path_0, imagePath);
@@ -154,8 +157,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
string.Format(Localization.Core.Last_modified_on_0, imageFormat.Info.LastModificationTime);
}
if(imageFormat.Info.MediaSequence != 0 &&
imageFormat.Info.LastMediaSequence != 0)
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);
@@ -297,8 +299,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
{
errno = imageFormat.ReadMediaTag(MediaTagType.CD_TOC, out toc);
if(errno == ErrorNumber.NoError &&
toc.Length > 0)
if(errno == ErrorNumber.NoError && toc.Length > 0)
{
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0));
@@ -319,8 +320,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
{
errno = imageFormat.ReadMediaTag(MediaTagType.CD_FullTOC, out fullToc);
if(errno == ErrorNumber.NoError &&
fullToc.Length > 0)
if(errno == ErrorNumber.NoError && fullToc.Length > 0)
{
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(fullToc, 0));
@@ -341,8 +341,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
{
errno = imageFormat.ReadMediaTag(MediaTagType.CD_PMA, out pma);
if(errno == ErrorNumber.NoError &&
pma.Length > 0)
if(errno == ErrorNumber.NoError && pma.Length > 0)
{
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0));
@@ -748,13 +747,18 @@ public sealed class ImageInfoViewModel : ViewModelBase
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 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 ||
public bool MediaInformationVisible => MediaSequenceText != null ||
MediaTitleText != null ||
MediaManufacturerText != null ||
MediaModelText != null ||
MediaSerialNumberText != null ||
MediaBarcodeText != null ||
MediaPartNumberText != null;
public string ImageInformationLabel => UI.Title_Image_information;

View File

@@ -102,8 +102,7 @@ public sealed class MediaInfoViewModel : ViewModelBase
MediaType = scsiInfo.MediaType.ToString();
if(scsiInfo.Blocks != 0 &&
scsiInfo.BlockSize != 0)
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,
@@ -128,7 +127,8 @@ public sealed class MediaInfoViewModel : ViewModelBase
SaveRecognizedFormatLayersVisible = scsiInfo.RecognizedFormatLayers != null;
SaveWriteProtectionStatusVisible = scsiInfo.WriteProtectionStatus != null;
MmcVisible = SaveGetConfigurationVisible || SaveRecognizedFormatLayersVisible ||
MmcVisible = SaveGetConfigurationVisible ||
SaveRecognizedFormatLayersVisible ||
SaveWriteProtectionStatusVisible;
if(scsiInfo.DensitySupportHeader.HasValue)
@@ -362,8 +362,11 @@ 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);
@@ -400,8 +403,9 @@ 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
@@ -410,7 +414,8 @@ 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;
}
@@ -432,8 +437,9 @@ 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;
@@ -444,7 +450,8 @@ public sealed class MediaInfoViewModel : ViewModelBase
await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
Localization.Core.
Scanning_Xbox_discs_is_not_yet_supported,
ButtonEnum.Ok, Icon.Error).ShowWindowDialogAsync(_view);
ButtonEnum.Ok, Icon.Error).
ShowWindowDialogAsync(_view);
return;
}

View File

@@ -43,8 +43,7 @@ public sealed class PartitionViewModel(Partition partition)
string.Format(Localization.Core.Partition_start_sector_0_byte_1, partition.Start, partition.Offset);
public string LengthText { get; } = string.Format(Localization.Core.Partition_length_0_sectors_1_bytes,
partition.Length,
partition.Size);
partition.Length, partition.Size);
public string DescriptionLabelText { get; } = Localization.Core.Title_Partition_description;
public string DescriptionText { get; } = partition.Description;

View File

@@ -79,8 +79,7 @@ public sealed class SubdirectoryViewModel
return;
}
while(model.Plugin.ReadDir(node, out string dirent) == ErrorNumber.NoError &&
dirent is not null)
while(model.Plugin.ReadDir(node, out string dirent) == ErrorNumber.NoError && dirent is not null)
{
errno = model.Plugin.Stat(model.Path + "/" + dirent, out FileEntryInfo stat);
@@ -93,8 +92,7 @@ public sealed class SubdirectoryViewModel
continue;
}
if(stat.Attributes.HasFlag(FileAttributes.Directory) &&
!model.Listed)
if(stat.Attributes.HasFlag(FileAttributes.Directory) && !model.Listed)
{
model.Subdirectories.Add(new SubdirectoryModel
{
@@ -197,8 +195,7 @@ public sealed class SubdirectoryViewModel
{
char[] chars;
if(filename.Last() == '.' ||
filename.Last() == ' ')
if(filename.Last() == '.' || filename.Last() == ' ')
chars = new char[filename.Length - 1];
else
chars = new char[filename.Length];
@@ -272,9 +269,7 @@ 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);
@@ -298,9 +293,9 @@ public sealed class SubdirectoryViewModel
if(File.Exists(outputPath))
{
mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Existing_file,
string.Format(
UI.File_named_0_exists_overwrite_Q,
filename),
string.
Format(UI.File_named_0_exists_overwrite_Q,
filename),
ButtonEnum.YesNoCancel, Icon.Warning).
ShowWindowDialogAsync(_view);
@@ -318,8 +313,10 @@ public sealed class SubdirectoryViewModel
catch(IOException)
{
mboxResult = await MessageBoxManager.GetMessageBoxStandard(UI.Cannot_delete,
UI.Could_note_delete_existe_file_continue_Q, ButtonEnum.YesNo,
Icon.Error).ShowWindowDialogAsync(_view);
UI.Could_note_delete_existe_file_continue_Q,
ButtonEnum.YesNo,
Icon.Error).
ShowWindowDialogAsync(_view);
if(mboxResult == ButtonResult.No)
return;
@@ -344,10 +341,11 @@ 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;

View File

@@ -58,8 +58,7 @@ public sealed class AtaInfoViewModel : ViewModelBase
_atapi = atapiIdentify;
_view = view;
if(ataIdentify == null &&
atapiIdentify == null)
if(ataIdentify == null && atapiIdentify == null)
return;
if(ataIdentify != null)
@@ -83,8 +82,7 @@ public sealed class AtaInfoViewModel : ViewModelBase
AtaMcptWriteProtectionChecked = (ataMcptError.Value.DeviceHead & 0x08) == 0x08;
var 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,8 +118,11 @@ 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);
@@ -145,8 +146,11 @@ 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);

View File

@@ -179,8 +179,11 @@ 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);

View File

@@ -159,8 +159,11 @@ 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);
@@ -180,8 +183,11 @@ 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);
@@ -201,8 +207,11 @@ 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);
@@ -222,8 +231,11 @@ 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);
@@ -243,8 +255,11 @@ 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);
@@ -264,8 +279,11 @@ 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);
@@ -285,8 +303,11 @@ 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);

View File

@@ -132,8 +132,11 @@ 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);

View File

@@ -260,8 +260,11 @@ 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);

View File

@@ -182,8 +182,11 @@ 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);

View File

@@ -82,8 +82,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
SaveEvpdPageCommand = ReactiveCommand.Create(ExecuteSaveEvpdPageCommand);
SaveMmcFeaturesCommand = ReactiveCommand.Create(ExecuteSaveMmcFeaturesCommand);
if(InquiryData == null ||
!scsiInquiry.HasValue)
if(InquiryData == null || !scsiInquiry.HasValue)
return;
ScsiInquiryText = Decoders.SCSI.Inquiry.Prettify(scsiInquiry);
@@ -110,8 +109,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
{
case 0x00:
{
if(scsiType == PeripheralDeviceTypes.MultiMediaDevice &&
page.Subpage == 0)
if(scsiType == PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0)
decodedText = Modes.PrettifyModePage_00_SFF(page.PageResponse);
else
decodedText = UI.Undecoded;
@@ -515,40 +513,52 @@ public sealed class ScsiInfoViewModel : ViewModelBase
evpdDecodedPage = EVPD.DecodePageB4(page.Value);
break;
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
Trim() == "quantum":
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).
ToLowerInvariant().
Trim() ==
"quantum":
evpdPageTitle = UI.Quantum_Firmware_Build_Information_page;
evpdDecodedPage = EVPD.PrettifyPage_C0_Quantum(page.Value);
break;
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
Trim() == "seagate":
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).
ToLowerInvariant().
Trim() ==
"seagate":
evpdPageTitle = UI.Seagate_Firmware_Numbers_page;
evpdDecodedPage = EVPD.PrettifyPage_C0_Seagate(page.Value);
break;
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
Trim() == "ibm":
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).
ToLowerInvariant().
Trim() ==
"ibm":
evpdPageTitle = UI.IBM_Drive_Component_Revision_Levels_page;
evpdDecodedPage = EVPD.PrettifyPage_C0_IBM(page.Value);
break;
case 0xC1 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
Trim() == "ibm":
case 0xC1 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).
ToLowerInvariant().
Trim() ==
"ibm":
evpdPageTitle = UI.IBM_Drive_Serial_Numbers_page;
evpdDecodedPage = EVPD.PrettifyPage_C1_IBM(page.Value);
break;
case 0xC0 or 0xC1
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
Trim() == "certance":
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).
ToLowerInvariant().
Trim() ==
"certance":
evpdPageTitle = UI.Certance_Drive_Component_Revision_Levels_page;
evpdDecodedPage = EVPD.PrettifyPage_C0_C1_Certance(page.Value);
break;
case 0xC2 or 0xC3 or 0xC4 or 0xC5 or 0xC6
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
Trim() == "certance":
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).
ToLowerInvariant().
Trim() ==
"certance":
evpdPageTitle = page.Key switch
{
0xC2 => UI.Head_Assembly_Serial_Number,
@@ -563,8 +573,10 @@ public sealed class ScsiInfoViewModel : ViewModelBase
break;
case 0xC0 or 0xC1 or 0xC2 or 0xC3 or 0xC4 or 0xC5
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
Trim() == "hp":
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).
ToLowerInvariant().
Trim() ==
"hp":
evpdPageTitle = page.Key switch
{
0xC0 => UI.HP_Drive_Firmware_Revision_Levels_page,
@@ -579,8 +591,10 @@ public sealed class ScsiInfoViewModel : ViewModelBase
evpdDecodedPage = EVPD.PrettifyPage_C0_to_C5_HP(page.Value);
break;
case 0xDF when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
Trim() == "certance":
case 0xDF when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).
ToLowerInvariant().
Trim() ==
"certance":
evpdPageTitle = UI.Certance_drive_status_page;
evpdDecodedPage = EVPD.PrettifyPage_DF_Certance(page.Value);
@@ -593,8 +607,8 @@ public sealed class ScsiInfoViewModel : ViewModelBase
evpdPageTitle = string.Format(UI.Page_0_h, page.Key);
evpdDecodedPage = UI.Undecoded;
AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.Found_undecoded_SCSI_VPD_page_0, page.Key);
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Found_undecoded_SCSI_VPD_page_0,
page.Key);
break;
}
@@ -614,8 +628,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
Features.SeparatedFeatures ftr = Features.Separate(_configuration);
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_length_is_0,
ftr.DataLength);
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_length_is_0, ftr.DataLength);
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.GET_CONFIGURATION_current_profile_is_0,
ftr.CurrentProfile);
@@ -799,8 +812,11 @@ 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);
@@ -820,8 +836,11 @@ 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);
@@ -841,8 +860,11 @@ 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);
@@ -862,8 +884,11 @@ 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);
@@ -886,8 +911,11 @@ 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);
@@ -907,8 +935,11 @@ 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);

View File

@@ -108,8 +108,11 @@ 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);

View File

@@ -419,9 +419,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase
ProgressMax = 1;
Progress2Max = (int)(_inputFormat.Info.Sectors / SECTORS_TO_READ);
if(formatHasTracks &&
ChecksumTracksChecked &&
opticalMediaImage != null)
if(formatHasTracks && ChecksumTracksChecked && opticalMediaImage != null)
ProgressMax += opticalMediaImage.Tracks.Count;
else
{
@@ -775,14 +773,10 @@ public sealed class ImageChecksumViewModel : ViewModelBase
}
if(ChecksumTracksChecked)
{
await Dispatcher.UIThread.InvokeAsync(() => { TrackChecksumsVisible = true; });
}
if(ChecksumMediaChecked)
{
await Dispatcher.UIThread.InvokeAsync(() => { MediaChecksumsVisible = true; });
}
Statistics.AddCommand("checksum");

View File

@@ -597,7 +597,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
if(SelectedPlugin is null)
{
await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Error_trying_to_find_selected_plugin,
icon: Icon.Error).ShowWindowDialogAsync(_view);
icon: Icon.Error).
ShowWindowDialogAsync(_view);
return;
}
@@ -613,7 +614,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
if(plugin is not IWritableImage outputFormat)
{
await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Error_trying_to_find_selected_plugin,
icon: Icon.Error).ShowWindowDialogAsync(_view);
icon: Icon.Error).
ShowWindowDialogAsync(_view);
return;
}
@@ -714,16 +716,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
});
foreach(MediaTagType mediaTag in _inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
!outputFormat.SupportedMediaTags.Contains(mediaTag) && !ForceChecked))
!outputFormat.SupportedMediaTags.Contains(mediaTag) && !ForceChecked))
{
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).
Format(UI.Converting_image_will_lose_media_tag_0,
mediaTag), icon: Icon.Error).
ShowWindowDialogAsync(_view));
return;
@@ -732,7 +731,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
bool useLong = _inputFormat.Info.ReadableSectorTags.Count != 0;
foreach(SectorTagType sectorTag in _inputFormat.Info.ReadableSectorTags.Where(sectorTag =>
!outputFormat.SupportedSectorTags.Contains(sectorTag)))
!outputFormat.SupportedSectorTags.Contains(sectorTag)))
{
if(ForceChecked)
{
@@ -747,11 +746,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
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).
Format(UI.Converting_image_will_lose_sector_tag_0,
sectorTag), icon: Icon.Error).
ShowWindowDialogAsync(_view));
return;
@@ -805,8 +801,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
GetMessageBoxStandard(UI.Title_Error,
string.
Format(UI.Error_0_creating_output_image,
outputFormat.
ErrorMessage),
outputFormat.ErrorMessage),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
@@ -852,9 +847,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_setting_metadata_not_continuing,
Format(UI.Error_0_setting_metadata_not_continuing,
outputFormat.
ErrorMessage),
icon: Icon.Error).
@@ -870,9 +863,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
}
}
if(tracks != null &&
!_cancel &&
outputOptical != null)
if(tracks != null && !_cancel && outputOptical != null)
{
await Dispatcher.UIThread.InvokeAsync(() =>
{
@@ -887,9 +878,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_sending_tracks_list_to_output_image,
Format(UI.Error_0_sending_tracks_list_to_output_image,
outputFormat.
ErrorMessage),
icon: Icon.Error).
@@ -918,8 +907,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
errno = _inputFormat.ReadMediaTag(mediaTag, out byte[] tag);
if(errno == ErrorNumber.NoError &&
outputFormat.WriteMediaTag(tag, mediaTag))
if(errno == ErrorNumber.NoError && outputFormat.WriteMediaTag(tag, mediaTag))
continue;
if(ForceChecked)
@@ -935,29 +923,26 @@ public sealed class ImageConvertViewModel : ViewModelBase
{
if(errno == ErrorNumber.NoError)
{
await Dispatcher.UIThread.InvokeAsync(async () =>
await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_writing_media_tag_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_writing_media_tag_not_continuing,
outputFormat.
ErrorMessage),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
AaruConsole.ErrorWriteLine(UI.Error_0_writing_media_tag_not_continuing, outputFormat.ErrorMessage);
}
else
{
await Dispatcher.UIThread.InvokeAsync(async () =>
await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_reading_media_tag_not_continuing,
errno), icon: Icon.Error).
ShowWindowDialogAsync(_view));
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(UI.Error_0_reading_media_tag_not_continuing,
errno),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
AaruConsole.ErrorWriteLine(UI.Error_0_reading_media_tag_not_continuing, errno);
}
@@ -968,8 +953,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
ulong doneSectors = 0;
if(tracks == null &&
!_cancel)
if(tracks == null && !_cancel)
{
await Dispatcher.UIThread.InvokeAsync(() =>
{
@@ -1053,10 +1037,9 @@ public sealed class ImageConvertViewModel : ViewModelBase
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_reading_sector_1_not_continuing,
errno, doneSectors),
Format(UI.Error_0_reading_sector_1_not_continuing,
errno,
doneSectors),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
@@ -1093,10 +1076,9 @@ public sealed class ImageConvertViewModel : ViewModelBase
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_reading_sector_1_not_continuing,
errno, doneSectors),
Format(UI.Error_0_reading_sector_1_not_continuing,
errno,
doneSectors),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
@@ -1121,10 +1103,9 @@ public sealed class ImageConvertViewModel : ViewModelBase
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_writing_sector_1_not_continuing,
outputFormat.ErrorMessage,
Format(UI.Error_0_writing_sector_1_not_continuing,
outputFormat.
ErrorMessage,
doneSectors),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
@@ -1154,7 +1135,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
Dictionary<byte, int> smallestPregapLbaPerTrack = new();
foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags.
Where(t => t == SectorTagType.CdTrackIsrc).OrderBy(t => t))
Where(t => t == SectorTagType.CdTrackIsrc).
OrderBy(t => t))
{
foreach(Track track in inputOptical.Tracks)
{
@@ -1168,7 +1150,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
}
foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags.
Where(t => t == SectorTagType.CdTrackFlags).OrderBy(t => t))
Where(t => t == SectorTagType.CdTrackFlags).
OrderBy(t => t))
{
foreach(Track track in inputOptical.Tracks)
{
@@ -1255,8 +1238,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
{
Track track = tracks.LastOrDefault(t => t.StartSector >= doneSectors);
if(tag == SectorTagType.CdSectorSubchannel &&
track != null)
if(tag == SectorTagType.CdSectorSubchannel && track != null)
{
bool indexesChanged = CompactDisc.WriteSubchannelToImage(MmcSubchannel.Raw,
MmcSubchannel.Raw, sector, doneSectors, 1, null, isrcs, (byte)track.Sequence,
@@ -1287,9 +1269,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
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));
@@ -1309,8 +1289,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
{
Track track = tracks.LastOrDefault(t => t.StartSector >= doneSectors);
if(tag == SectorTagType.CdSectorSubchannel &&
track != null)
if(tag == SectorTagType.CdSectorSubchannel && track != null)
{
bool indexesChanged = CompactDisc.WriteSubchannelToImage(MmcSubchannel.Raw,
@@ -1342,9 +1321,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
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));
@@ -1371,9 +1348,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_writing_sector_1_not_continuing,
Format(UI.Error_0_writing_sector_1_not_continuing,
outputFormat.
ErrorMessage,
doneSectors),
@@ -1410,9 +1385,10 @@ public sealed class ImageConvertViewModel : ViewModelBase
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)
@@ -1493,9 +1469,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
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));
@@ -1533,9 +1507,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
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));
@@ -1559,9 +1531,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_writing_sector_1_not_continuing,
Format(UI.Error_0_writing_sector_1_not_continuing,
outputFormat.
ErrorMessage,
doneSectors),
@@ -1639,16 +1609,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
}
else
{
await Dispatcher.UIThread.InvokeAsync(async () =>
await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_reading_media_tag_not_continuing,
errno),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(UI.Error_0_reading_media_tag_not_continuing,
errno),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
return;
}
@@ -1667,17 +1634,14 @@ public sealed class ImageConvertViewModel : ViewModelBase
}
else
{
await Dispatcher.UIThread.InvokeAsync(async () =>
await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(
UI.
Error_0_writing_tag_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_writing_tag_not_continuing,
outputFormat.
ErrorMessage),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
return;
}
@@ -1739,9 +1703,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
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));
@@ -1764,9 +1726,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
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),
@@ -1791,8 +1751,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
bool ret;
if(_dumpHardware != null &&
!_cancel)
if(_dumpHardware != null && !_cancel)
{
await Dispatcher.UIThread.InvokeAsync(() =>
{
@@ -1808,8 +1767,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
ret = false;
if(_aaruMetadata != null &&
!_cancel)
if(_aaruMetadata != null && !_cancel)
{
await Dispatcher.UIThread.InvokeAsync(() =>
{
@@ -1835,7 +1793,8 @@ 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;
@@ -1850,11 +1809,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
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),
Format(UI.Error_0_closing_output_image_Contents_are_not_correct,
outputFormat.ErrorMessage),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
@@ -1863,12 +1819,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
await Dispatcher.UIThread.InvokeAsync(async () =>
{
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);
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);
CloseVisible = true;
StopVisible = false;
@@ -2038,8 +1994,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
string result = await dlgDestination.ShowAsync(_view);
if(result is null ||
result.Length != 1)
if(result is null || result.Length != 1)
{
DestinationText = "";
@@ -2098,14 +2053,16 @@ 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);
if(result is null ||
result.Length != 1)
if(result is null || result.Length != 1)
return;
try
@@ -2122,7 +2079,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
catch
{
await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Incorrect_metadata_sidecar_file,
icon: Icon.Error).ShowWindowDialogAsync(_view);
icon: Icon.Error).
ShowWindowDialogAsync(_view);
}
}
@@ -2144,14 +2102,16 @@ 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);
if(result is null ||
result.Length != 1)
if(result is null || result.Length != 1)
return;
try
@@ -2173,7 +2133,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
{
await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error, UI.Resume_file_does_not_contain_dump_hardware_information,
icon: Icon.Error).ShowWindowDialogAsync(_view);
icon: Icon.Error).
ShowWindowDialogAsync(_view);
}
}
catch

View File

@@ -327,8 +327,11 @@ 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);

View File

@@ -147,13 +147,12 @@ public sealed class MainWindowViewModel : ViewModelBase
new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/inode-directory.png")));
_usbIcon =
new
Bitmap(AssetLoader.Open(
new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media-usb.png")));
new 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")));
@@ -194,8 +193,8 @@ public sealed class MainWindowViewModel : ViewModelBase
{
get
{
Window mainWindow = (Application.Current?.ApplicationLifetime as
IClassicDesktopStyleApplicationLifetime)?.MainWindow;
Window mainWindow = (Application.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.
MainWindow;
return mainWindow is not null && NativeMenu.GetIsNativeMenuExported(mainWindow);
}
}
@@ -559,8 +558,8 @@ 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);
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Image_format_not_identified, ButtonEnum.Ok,
Icon.Error);
return;
}
@@ -574,8 +573,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);
@@ -590,10 +589,13 @@ public sealed class MainWindowViewModel : ViewModelBase
Path = result[0],
Icon = AssetLoader.Exists(mediaResource)
? new Bitmap(AssetLoader.Open(mediaResource))
: imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia
:
imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia
? _genericHddIcon
: imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc
? _genericOpticalIcon
:
imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc
?
_genericOpticalIcon
: _genericFolderIcon,
FileName = Path.GetFileName(result[0]),
Image = imageFormat,
@@ -662,9 +664,8 @@ public sealed class MainWindowViewModel : ViewModelBase
if(rofs != null)
{
ErrorNumber error =
rofs.Mount(imageFormat, partition, null,
new Dictionary<string, string>(), null);
ErrorNumber error = rofs.Mount(imageFormat, partition, null,
new Dictionary<string, string>(), null);
if(error != ErrorNumber.NoError)
rofs = null;
@@ -677,10 +678,9 @@ public sealed class MainWindowViewModel : ViewModelBase
? $"{fsMetadata.Type}"
: $"{fsMetadata.VolumeName} ({fsMetadata.Type})"
: $"{rofs.Metadata.VolumeName} ({rofs.Metadata.Type})",
Filesystem = fs,
Filesystem = fs,
ReadOnlyFilesystem = rofs,
ViewModel = new FileSystemViewModel(rofs?.Metadata ?? fsMetadata,
information)
ViewModel = new FileSystemViewModel(rofs?.Metadata ?? fsMetadata, information)
};
// TODO: Trap expanding item
@@ -785,8 +785,8 @@ public sealed class MainWindowViewModel : ViewModelBase
}
catch(Exception ex)
{
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Unable_to_open_image_format,
ButtonEnum.Ok, Icon.Error);
MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Unable_to_open_image_format, ButtonEnum.Ok,
Icon.Error);
AaruConsole.ErrorWriteLine(UI.Unable_to_open_image_format);
AaruConsole.ErrorWriteLine(Localization.Core.Error_0, ex.Message);
@@ -819,7 +819,9 @@ public sealed class MainWindowViewModel : ViewModelBase
AaruConsole.WriteLine(UI.Refreshing_devices);
_devicesRoot.Devices.Clear();
foreach(Devices.DeviceInfo device in Device.ListDevices().Where(d => d.Supported).OrderBy(d => d.Vendor).
foreach(Devices.DeviceInfo device in Device.ListDevices().
Where(d => d.Supported).
OrderBy(d => d.Vendor).
ThenBy(d => d.Model))
{
AaruConsole.DebugWriteLine(MODULE_NAME,

View File

@@ -183,17 +183,19 @@ public sealed class MediaDumpViewModel : ViewModelBase
}
}
Encodings.AddRange(Encoding.GetEncodings().Select(info => new EncodingModel
{
Name = info.Name,
DisplayName = info.GetEncoding().EncodingName
}));
Encodings.AddRange(Encoding.GetEncodings().
Select(info => new EncodingModel
{
Name = info.Name,
DisplayName = info.GetEncoding().EncodingName
}));
Encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().Select(info => new EncodingModel
{
Name = info.Name,
DisplayName = info.DisplayName
}));
Encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().
Select(info => new EncodingModel
{
Name = info.Name,
DisplayName = info.DisplayName
}));
switch(mediaType)
{
@@ -518,8 +520,11 @@ 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;
@@ -548,7 +553,9 @@ public sealed class MediaDumpViewModel : ViewModelBase
// ReSharper restore AssignmentIsFullyDiscarded
GetMessageBoxStandard(UI.Title_Error, UI.Incorrect_metadata_sidecar_file, ButtonEnum.Ok,
Icon.Error).ShowWindowDialogAsync(_view).Result;
Icon.Error).
ShowWindowDialogAsync(_view).
Result;
ExistingMetadata = false;
}
@@ -738,22 +745,22 @@ 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;
return;
}
if(_resume == null ||
_resume.NextBlock <= _resume.LastBlock ||
_resume.BadBlocks.Count != 0 && !_resume.Tape)
if(_resume == null || _resume.NextBlock <= _resume.LastBlock || _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;
}

View File

@@ -337,10 +337,7 @@ public sealed class MediaScanViewModel : ViewModelBase
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
async void DoWork()
{
if(_devicePath.Length == 2 &&
_devicePath[1] == ':' &&
_devicePath[0] != '/' &&
char.IsLetter(_devicePath[0]))
if(_devicePath.Length == 2 && _devicePath[1] == ':' && _devicePath[0] != '/' && char.IsLetter(_devicePath[0]))
_devicePath = "\\\\.\\" + char.ToUpper(_devicePath[0]) + ':';
var dev = Device.Create(_devicePath, out ErrorNumber devErrno);
@@ -350,7 +347,8 @@ 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 +368,8 @@ 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;

View File

@@ -144,8 +144,7 @@ public sealed class SplashWindowViewModel(SplashWindow view) : 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())
{
@@ -158,21 +157,29 @@ public sealed class SplashWindowViewModel(SplashWindow view) : ViewModelBase
}
// Remove duplicates
foreach(var duplicate in ctx.SeenDevices.AsEnumerable().GroupBy(a => new
{
a.Manufacturer,
a.Model,
a.Revision,
a.Bus
}).Where(a => a.Count() > 1).Distinct().Select(a => a.Key))
foreach(var duplicate in ctx.SeenDevices.AsEnumerable().
GroupBy(a => new
{
a.Manufacturer,
a.Model,
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));
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 &&
ctx.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null &&
d.Model == null &&
d.Revision == null));
ctx.SaveChanges();