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

@@ -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();