[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

@@ -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,11 +99,8 @@ public sealed class ConsoleViewModel : ViewModelBase
dlgSave.Filters?.Add(new FileDialogFilter
{
Extensions = new List<string>(new[]
{
"log"
}),
Name = UI.Dialog_Log_files
Extensions = new List<string>(new[] { "log" }),
Name = UI.Dialog_Log_files
});
string result = await dlgSave.ShowAsync(_view);
@@ -132,7 +133,7 @@ public sealed class ConsoleViewModel : ViewModelBase
logSw.WriteLine();
logSw.WriteLine(Localization.Core.Program_information);
logSw.WriteLine("Aaru {0}", assemblyVersion?.InformationalVersion);
logSw.WriteLine("Aaru {0}", assemblyVersion?.InformationalVersion);
logSw.WriteLine(Localization.Core.Running_in_0_bit, Environment.Is64BitProcess ? 64 : 32);
#if DEBUG
logSw.WriteLine(Localization.Core.DEBUG_version);
@@ -143,10 +144,12 @@ public sealed class ConsoleViewModel : ViewModelBase
logSw.WriteLine(UI.Console_with_ornament);
foreach(LogEntry entry in ConsoleHandler.Entries)
{
if(entry.Type != UI.LogEntry_Type_Info)
logSw.WriteLine("{0}: ({1}) {2}", entry.Timestamp, entry.Type.ToLower(), entry.Message);
else
logSw.WriteLine("{0}: {1}", entry.Timestamp, entry.Message);
}
logSw.Close();
logFs.Close();
@@ -155,8 +158,10 @@ public sealed class ConsoleViewModel : ViewModelBase
{
await MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
string.
Format(UI.Exception_0_trying_to_save_logfile_details_has_been_sent_to_console,
exception.Message), ButtonEnum.Ok, Icon.Error).
Format(
UI.
Exception_0_trying_to_save_logfile_details_has_been_sent_to_console,
exception.Message), ButtonEnum.Ok, Icon.Error).
ShowWindowDialogAsync(_view);
AaruConsole.ErrorWriteLine("Console", exception.Message);

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,
@@ -399,6 +402,7 @@ public sealed class StatisticsViewModel : ViewModelBase
Revision = ds.Revision,
Bus = ds.Bus
});
}
}
if(!ctx.Medias.Any())
@@ -414,12 +418,14 @@ public sealed class StatisticsViewModel : ViewModelBase
count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && c.Real);
if(count > 0)
{
Medias.Add(new MediaStatsModel
{
Name = media,
Count = count,
Type = UI.Media_found_type_real
});
}
count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real).Select(c => c.Count).
FirstOrDefault();
@@ -674,42 +680,61 @@ public sealed class StatisticsViewModel : ViewModelBase
[NotNull]
public string CommandsLabel => UI.Title_Commands;
[NotNull]
public string FilterLabel => UI.Title_Filter;
[NotNull]
public string PartitionLabel => UI.Title_Partition;
[NotNull]
public string PartitionsLabel => UI.Title_Partitions;
[NotNull]
public string FiltersLabel => UI.Title_Filters;
[NotNull]
public string FormatsLabel => UI.Title_Formats;
[NotNull]
public string FormatLabel => UI.Title_Format;
[NotNull]
public string FilesystemsLabel => UI.Title_Filesystems;
[NotNull]
public string FilesystemLabel => UI.Title_Filesystem;
[NotNull]
public string TimesFoundLabel => UI.Title_Times_used;
[NotNull]
public string DevicesLabel => UI.Title_Devices;
[NotNull]
public string DeviceLabel => UI.Title_Device;
[NotNull]
public string ManufacturerLabel => UI.Title_Manufacturer;
[NotNull]
public string RevisionLabel => UI.Title_Revision;
[NotNull]
public string BusLabel => UI.Title_Bus;
[NotNull]
public string MediasLabel => UI.Title_Medias;
[NotNull]
public string MediaLabel => UI.Title_Media;
[NotNull]
public string TypeLabel => Localization.Core.Title_Type_for_media;
[NotNull]
public string Title => UI.Encodings;
[NotNull]
public string CloseLabel => UI.ButtonLabel_Close;