[Aaru.Gui] Reformat and cleanup.

This commit is contained in:
2023-10-03 23:27:57 +01:00
parent 0bcfdb28cb
commit 6ffde343ce
183 changed files with 10346 additions and 10135 deletions

View File

@@ -32,15 +32,15 @@
<ItemGroup>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.4"/>
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.4"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.4" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.4"/>
<PackageReference Include="Claunia.Encoding" Version="1.9.2"/>
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
<PackageReference Include="MessageBox.Avalonia" Version="3.1.4" />
<PackageReference Include="Humanizer.Core" Version="2.14.1"/>
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0"/>
<PackageReference Include="MessageBox.Avalonia" Version="3.1.4"/>
<!-- TODO: Abandoned project need to find replacement
<PackageReference Include="OxyPlot.Avalonia-alpha-2020-04-15" Version="1.0.0"/>
-->
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0-rc.1.23419.4" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0-rc.1.23419.4"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@@ -85,7 +85,10 @@ public sealed class App : Application
{
if(ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime
{
MainWindow: MainWindow { DataContext: MainWindowViewModel mainWindowViewModel }
MainWindow: MainWindow
{
DataContext: MainWindowViewModel mainWindowViewModel
}
})
return;
@@ -96,7 +99,10 @@ public sealed class App : Application
{
if(ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime
{
MainWindow: MainWindow { DataContext: MainWindowViewModel mainWindowViewModel }
MainWindow: MainWindow
{
DataContext: MainWindowViewModel mainWindowViewModel
}
})
return;
@@ -107,7 +113,10 @@ public sealed class App : Application
{
if(ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime
{
MainWindow: MainWindow { DataContext: MainWindowViewModel mainWindowViewModel }
MainWindow: MainWindow
{
DataContext: MainWindowViewModel mainWindowViewModel
}
})
return;

View File

@@ -488,3 +488,4 @@ public sealed class BlockMap : ItemsControl
}
}
*/

View File

@@ -39,29 +39,42 @@ namespace Aaru.Gui.Models;
public sealed class FileModel
{
public string Name { get; set; }
[NotNull]
public string Size => $"{Stat.Length}";
[NotNull]
public string CreationTime => Stat.CreationTime == default(DateTime) ? "" : $"{Stat.CreationTime:G}";
[NotNull]
public string LastAccessTime => Stat.AccessTime == default(DateTime) ? "" : $"{Stat.AccessTime:G}";
[NotNull]
public string ChangedTime => Stat.StatusChangeTime == default(DateTime) ? "" : $"{Stat.StatusChangeTime:G}";
[NotNull]
public string LastBackupTime => Stat.BackupTime == default(DateTime) ? "" : $"{Stat.BackupTime:G}";
[NotNull]
public string LastWriteTime => Stat.LastWriteTime == default(DateTime) ? "" : $"{Stat.LastWriteTime:G}";
[NotNull]
public string Attributes => $"{Stat.Attributes}";
[NotNull]
public string Gid => $"{Stat.GID}";
[NotNull]
public string Uid => $"{Stat.UID}";
[NotNull]
public string Inode => $"{Stat.Inode}";
[NotNull]
public string Links => $"{Stat.Links}";
[NotNull]
public string Mode => $"{Stat.Mode}";
public FileEntryInfo Stat { get; set; }
}

View File

@@ -40,6 +40,7 @@ public sealed class MediaTagModel
public MediaTagType Tag { get; set; }
public byte[] Data { get; set; }
public string Decoded { get; set; }
[NotNull]
public string Name => Tag.ToString();
}

View File

@@ -33,7 +33,6 @@
using System;
using Aaru.Gui.ViewModels;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using Avalonia.Markup.Xaml.Templates;
using JetBrains.Annotations;

View File

@@ -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; }

View File

@@ -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,10 +99,7 @@ public sealed class ConsoleViewModel : ViewModelBase
dlgSave.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"log"
}),
Extensions = new List<string>(new[] { "log" }),
Name = UI.Dialog_Log_files
});
@@ -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,7 +158,9 @@ 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,
Format(
UI.
Exception_0_trying_to_save_logfile_details_has_been_sent_to_console,
exception.Message), ButtonEnum.Ok, Icon.Error).
ShowWindowDialogAsync(_view);

View File

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

View File

@@ -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; }

View File

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

View File

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

View File

@@ -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,
@@ -400,6 +403,7 @@ public sealed class StatisticsViewModel : ViewModelBase
Bus = ds.Bus
});
}
}
if(!ctx.Medias.Any())
return;
@@ -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;

View File

@@ -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)
{
@@ -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,19 +356,23 @@ 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.
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,
@@ -369,10 +380,13 @@ public sealed class DeviceInfoViewModel : ViewModelBase
}
}
}
}
if(devInfo.DensitySupport != null)
{
if(devInfo.DensitySupportHeader.HasValue)
Densities = DensitySupport.PrettifyDensity(devInfo.DensitySupportHeader);
}
if(devInfo.MediumDensitySupport != null)
{
@@ -1002,10 +1016,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -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;
@@ -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,9 +653,11 @@ public sealed class ImageInfoViewModel : ViewModelBase
try
{
if(opticalMediaImage.Sessions is { Count: > 0 })
{
foreach(Session session in opticalMediaImage.Sessions)
Sessions.Add(session);
}
}
catch
{
// ignored
@@ -643,9 +666,11 @@ public sealed class ImageInfoViewModel : ViewModelBase
try
{
if(opticalMediaImage.Tracks is { Count: > 0 })
{
foreach(Track track in opticalMediaImage.Tracks)
Tracks.Add(track);
}
}
catch
{
// ignored
@@ -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,
@@ -671,6 +697,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
});
}
}
}
public ScsiInfo ScsiInfo { get; }
public AtaInfo AtaInfo { get; }
@@ -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 ||

View File

@@ -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,10 +362,7 @@ public sealed class MediaInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -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,7 +344,9 @@ 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,
string.Format(
UI.Error_0_reading_file_continue_Q,
error), ButtonEnum.YesNo,
Icon.Error).ShowWindowDialogAsync(_view);
if(mboxResult == ButtonResult.No)

View File

@@ -83,8 +83,8 @@ public sealed class AtaInfoViewModel : ViewModelBase
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,10 +120,7 @@ public sealed class AtaInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -148,10 +145,7 @@ public sealed class AtaInfoViewModel : ViewModelBase
dlgSaveText.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.txt"
}),
Extensions = new List<string>(new[] { "*.txt" }),
Name = UI.Dialog_Text_files
});

View File

@@ -179,10 +179,7 @@ public sealed class BlurayInfoViewModel
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -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,10 +159,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -179,10 +180,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -203,10 +201,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -227,10 +222,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -251,10 +243,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -275,10 +264,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -299,10 +285,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -132,10 +132,7 @@ public sealed class DvdInfoViewModel
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -260,10 +260,7 @@ public sealed class DvdWritableInfoViewModel
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -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,10 +182,7 @@ public class PcmciaInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -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
@@ -424,11 +434,13 @@ public sealed class ScsiInfoViewModel : ViewModelBase
});
}
}
}
if(scsiEvpdPages != null)
{
foreach(KeyValuePair<byte, byte[]> page in scsiEvpdPages.OrderBy(t => t.Key))
{
string evpdPageTitle = "";
var evpdPageTitle = "";
string evpdDecodedPage;
switch(page.Key)
@@ -595,6 +607,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
Description = evpdDecodedPage
});
}
}
if(_configuration == null)
return;
@@ -608,9 +621,10 @@ 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
@@ -682,10 +696,13 @@ public sealed class ScsiInfoViewModel : ViewModelBase
Description = featureDescription
});
}
}
else
{
AaruConsole.DebugWriteLine(MODULE_NAME,
Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors);
}
}
public byte[] InquiryData { get; }
public string ScsiInquiryText { get; }
@@ -782,10 +799,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -806,10 +820,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
dlgSaveText.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.txt"
}),
Extensions = new List<string>(new[] { "*.txt" }),
Name = UI.Dialog_Text_files
});
@@ -830,10 +841,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -854,10 +862,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -881,10 +886,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});
@@ -905,10 +907,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -108,10 +108,7 @@ public sealed class XboxInfoViewModel
dlgSaveBinary.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"*.bin"
}),
Extensions = new List<string>(new[] { "*.bin" }),
Name = UI.Dialog_Binary_files
});

View File

@@ -77,6 +77,7 @@ public sealed class DecodeMediaTagsViewModel : ViewModelBase
ErrorNumber errno = inputFormat.ReadMediaTag(tag, out byte[] data);
if(errno == ErrorNumber.NoError)
{
TagsList.Add(new MediaTagModel
{
Tag = tag,
@@ -84,6 +85,7 @@ public sealed class DecodeMediaTagsViewModel : ViewModelBase
});
}
}
}
public string Title { get; }
public ObservableCollection<MediaTagModel> TagsList { get; }
@@ -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;

View File

@@ -396,9 +396,10 @@ public sealed class ImageChecksumViewModel : ViewModelBase
async void DoWork()
{
var opticalMediaImage = _inputFormat as IOpticalMediaImage;
bool formatHasTracks = false;
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");

View File

@@ -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,33 +128,6 @@ 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)
{
@@ -207,11 +180,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
continue;
if(plugin.SupportedMediaTypes.Contains(inputFormat.Info.MediaType))
{
PluginsList.Add(new ImagePluginModel
{
Plugin = plugin
});
}
}
AaruMetadataFromImageVisible = inputFormat.AaruMetadata != null;
ResumeFileFromImageVisible = inputFormat.DumpHardware?.Any() == true;
@@ -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,10 +716,12 @@ 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.
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(UI.Converting_image_will_lose_media_tag_0,
Format(
UI.
Converting_image_will_lose_media_tag_0,
mediaTag),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
@@ -740,10 +744,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
continue;
}
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(UI.Converting_image_will_lose_sector_tag_0,
Format(
UI.
Converting_image_will_lose_sector_tag_0,
sectorTag),
icon: Icon.Error).
ShowWindowDialogAsync(_view));
@@ -795,7 +801,7 @@ 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.
await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager.
GetMessageBoxStandard(UI.Title_Error,
string.
Format(UI.Error_0_creating_output_image,
@@ -838,14 +844,17 @@ public sealed class ImageConvertViewModel : ViewModelBase
};
if(!_cancel)
{
if(!outputFormat.SetImageInfo(metadata))
{
if(ForceChecked != true)
{
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
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).
@@ -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,10 +884,12 @@ public sealed class ImageConvertViewModel : ViewModelBase
if(!outputOptical.SetTracks(tracks))
{
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
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).
@@ -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.
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));
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.
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));
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.
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),
icon: Icon.Error).ShowWindowDialogAsync(_view));
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.
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),
icon: Icon.Error).ShowWindowDialogAsync(_view));
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);
foreach(KeyValuePair<byte, byte> flags in trackFlags)
{
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.
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),
icon: Icon.Error).ShowWindowDialogAsync(_view));
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;
}
@@ -1773,7 +1850,9 @@ 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,
Format(
UI.
Error_0_closing_output_image_Contents_are_not_correct,
outputFormat.
ErrorMessage),
icon: Icon.Error).
@@ -1786,7 +1865,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
{
await MessageBoxManager.
GetMessageBoxStandard(warning ? UI.Title_Warning : UI.Title_Conversion_success,
warning ? UI.Some_warnings_happened_Check_console
warning
? UI.Some_warnings_happened_Check_console
: UI.Image_converted_successfully,
icon: warning ? Icon.Warning : Icon.Info).ShowWindowDialogAsync(_view);
@@ -2019,10 +2099,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
dlgMetadata.Filters?.Add(new FileDialogFilter
{
Name = UI.Dialog_Aaru_Metadata,
Extensions = new List<string>(new[]
{
".json"
})
Extensions = new List<string>(new[] { ".json" })
});
string[] result = await dlgMetadata.ShowAsync(_view);
@@ -2068,10 +2145,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
dlgMetadata.Filters?.Add(new FileDialogFilter
{
Name = UI.Dialog_Choose_existing_resume_file,
Extensions = new List<string>(new[]
{
".json"
})
Extensions = new List<string>(new[] { ".json" })
});
string[] result = await dlgMetadata.ShowAsync(_view);
@@ -2096,10 +2170,12 @@ 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
{
await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error, UI.Incorrect_resume_file, icon: Icon.Error).

View File

@@ -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,11 +332,13 @@ 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);
}
}
}
if(WholeDiscChecked != true)
return;
@@ -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;

View File

@@ -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();
@@ -343,10 +328,7 @@ public sealed class ImageSidecarViewModel : ViewModelBase
dlgDestination.Filters?.Add(new FileDialogFilter
{
Name = UI.Dialog_Aaru_Metadata,
Extensions = new List<string>(new[]
{
"*.json"
})
Extensions = new List<string>(new[] { "*.json" })
});
string result = await dlgDestination.ShowAsync(_view);

View File

@@ -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(() =>
@@ -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,12 +617,14 @@ public sealed class ImageVerifyViewModel : ViewModelBase
SectorErrorsVisible = true;
foreach(ulong t in failingLbas)
{
ErrorList.Add(new LbaModel
{
Lba = t.ToString()
});
}
}
}
if(unknownLbas.Count > 0)
{
@@ -627,12 +639,14 @@ 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);

View File

@@ -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;
}
@@ -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,7 +667,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,
@@ -681,6 +694,7 @@ public sealed class MainWindowViewModel : ViewModelBase
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,
@@ -755,6 +771,7 @@ public sealed class MainWindowViewModel : ViewModelBase
}
}
}
}
Statistics.AddMediaFormat(imageFormat.Format);
Statistics.AddMedia(imageFormat.Info.MediaType, false);
@@ -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;

View File

@@ -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,11 +175,13 @@ 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
{
@@ -515,10 +519,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
dlgMetadata.Filters?.Add(new FileDialogFilter
{
Name = UI.Dialog_Aaru_Metadata,
Extensions = new List<string>(new[]
{
".json"
})
Extensions = new List<string>(new[] { ".json" })
});
string[] result = dlgMetadata.ShowAsync(_view).Result;
@@ -746,7 +747,7 @@ 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.
@@ -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(() =>

View File

@@ -456,7 +456,7 @@ public sealed class MediaScanViewModel : ViewModelBase
*/
if(currentSpeed > MaxY)
MaxY = currentSpeed + (currentSpeed / 10d);
MaxY = currentSpeed + currentSpeed / 10d;
});
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
@@ -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(() =>

View File

@@ -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 &&

View File

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

View File

@@ -30,11 +30,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using JetBrains.Annotations;
namespace Aaru.Gui.Views.Dialogs;

View File

@@ -140,7 +140,8 @@
</DataGrid.Columns>
</DataGrid>
<TextBlock Grid.Row="2" Text="{Binding WritableLabel}" FontWeight="Bold" />
<DataGrid Grid.Row="3" ItemsSource="{Binding WritableImages}" HorizontalScrollBarVisibility="Visible">
<DataGrid Grid.Row="3" ItemsSource="{Binding WritableImages}"
HorizontalScrollBarVisibility="Visible">
<DataGrid.Columns>
<DataGridTextColumn Header="{Binding NameLabel}" Binding="{Binding Name}" Width="Auto"
IsReadOnly="True" />

View File

@@ -63,7 +63,8 @@
</TabItem.Header>
<StackPanel>
<StackPanel Orientation="Horizontal">
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Stretch" ItemsSource="{Binding ModeSensePages}"
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Stretch"
ItemsSource="{Binding ModeSensePages}"
SelectedItem="{Binding SelectedModeSensePage}" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="{Binding PageLabel}" Binding="{Binding Page}" />
@@ -110,7 +111,8 @@
</TabItem.Header>
<StackPanel>
<StackPanel Orientation="Horizontal">
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Stretch" ItemsSource="{Binding MmcFeatures}"
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Stretch"
ItemsSource="{Binding MmcFeatures}"
SelectedItem="{Binding SelectedMmcFeature}" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="{Binding FeatureLabel}" Binding="{Binding Page}" />

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel;
using Aaru.Gui.ViewModels.Windows;
using Avalonia;
using Avalonia.Controls;

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel;
using Aaru.Gui.ViewModels.Windows;
using Avalonia;
using Avalonia.Controls;

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel;
using Aaru.Gui.ViewModels.Windows;
using Avalonia;
using Avalonia.Controls;

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel;
using Aaru.Gui.ViewModels.Windows;
using Avalonia;
using Avalonia.Controls;

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel;
using Aaru.Gui.ViewModels.Windows;
using Avalonia;
using Avalonia.Controls;

View File

@@ -34,7 +34,8 @@
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:windows="clr-namespace:Aaru.Gui.ViewModels.Windows" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:windows="clr-namespace:Aaru.Gui.ViewModels.Windows" mc:Ignorable="d" d:DesignWidth="800"
d:DesignHeight="450"
x:Class="Aaru.Gui.Views.Windows.MediaScan" Icon="/Assets/aaru-logo.png" Title="{Binding Title}">
<Design.DataContext>
<windows:MediaScanViewModel />
@@ -59,7 +60,7 @@
<TabItem.Header>
<TextBlock Text="Graph" />
</TabItem.Header>
<!-- <controls:BlockMap Width="750" Height="400" Blocks="{Binding Blocks}" ItemsSource="{Binding BlockMapList}" /> -->
<!-- <controls:BlockMap Width="750" Height="400" Blocks="{Binding Blocks}" ItemsSource="{Binding BlockMapList}" /> -->
</TabItem>
<TabItem>
<TabItem.Header>

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel;
using Aaru.Gui.ViewModels.Windows;
using Avalonia;
using Avalonia.Controls;