mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General code style and feature fixes.
This commit is contained in:
@@ -34,9 +34,9 @@ namespace Aaru.Gui.ViewModels.Windows;
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reactive;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
@@ -368,6 +368,7 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
StopCommandEnabled = false;
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void DoWork()
|
||||
{
|
||||
var opticalMediaImage = _inputFormat as IOpticalMediaImage;
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Aaru.Gui.ViewModels.Windows;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
@@ -54,7 +55,6 @@ using Aaru.Devices;
|
||||
using Aaru.Gui.Models;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using MessageBox.Avalonia;
|
||||
using MessageBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
@@ -62,6 +62,7 @@ using Schemas;
|
||||
using ImageInfo = Aaru.CommonTypes.Structs.ImageInfo;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidLambda")]
|
||||
public sealed class ImageConvertViewModel : ViewModelBase
|
||||
{
|
||||
readonly IMediaImage _inputFormat;
|
||||
@@ -127,7 +128,8 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
bool _stopVisible;
|
||||
string _title;
|
||||
|
||||
public ImageConvertViewModel([NotNull] IMediaImage inputFormat, string imageSource, Window view)
|
||||
public ImageConvertViewModel([JetBrains.Annotations.NotNull] IMediaImage inputFormat, string imageSource,
|
||||
Window view)
|
||||
{
|
||||
_view = view;
|
||||
_inputFormat = inputFormat;
|
||||
@@ -172,8 +174,10 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
|
||||
PluginBase plugins = GetPluginBase.Instance;
|
||||
|
||||
foreach(IWritableImage plugin in
|
||||
plugins.WritableImages.Values.Where(p => p.SupportedMediaTypes.Contains(inputFormat.Info.MediaType)))
|
||||
foreach(IWritableImage plugin in plugins.WritableImages.Values.
|
||||
Where(p => p.SupportedMediaTypes.Contains(inputFormat.Info.MediaType)).
|
||||
Select(baseWritableImage => baseWritableImage as IWritableImage).
|
||||
Where(plugin => plugin is not null))
|
||||
PluginsList.Add(new ImagePluginModel
|
||||
{
|
||||
Plugin = plugin
|
||||
@@ -569,6 +573,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
new Thread(DoWork).Start(SelectedPlugin.Plugin);
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void DoWork(object plugin)
|
||||
{
|
||||
var warning = false;
|
||||
@@ -1866,7 +1871,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
Title = "Choose destination file"
|
||||
};
|
||||
|
||||
dlgDestination.Filters.Add(new FileDialogFilter
|
||||
dlgDestination.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = SelectedPlugin.Plugin.Name,
|
||||
Extensions = SelectedPlugin.Plugin.KnownExtensions.ToList()
|
||||
@@ -1932,7 +1937,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
Title = "Choose existing metadata sidecar"
|
||||
};
|
||||
|
||||
dlgMetadata.Filters.Add(new FileDialogFilter
|
||||
dlgMetadata.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = "CICM XML metadata",
|
||||
Extensions = new List<string>(new[]
|
||||
@@ -1979,7 +1984,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
Title = "Choose existing resume file"
|
||||
};
|
||||
|
||||
dlgMetadata.Filters.Add(new FileDialogFilter
|
||||
dlgMetadata.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = "CICM XML metadata",
|
||||
Extensions = new List<string>(new[]
|
||||
|
||||
@@ -307,6 +307,7 @@ public sealed class ImageEntropyViewModel : ViewModelBase
|
||||
WholeDiscChecked = false;
|
||||
}
|
||||
|
||||
// ReSharper disable once AsyncVoidLambda
|
||||
var thread = new Thread(async () =>
|
||||
{
|
||||
if(SeparatedTracksChecked)
|
||||
|
||||
@@ -330,7 +330,7 @@ public sealed class ImageSidecarViewModel : ViewModelBase
|
||||
Title = "Choose destination file"
|
||||
};
|
||||
|
||||
dlgDestination.Filters.Add(new FileDialogFilter
|
||||
dlgDestination.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = "CICM XML metadata",
|
||||
Extensions = new List<string>(new[]
|
||||
|
||||
@@ -418,11 +418,11 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
{
|
||||
this.RaiseAndSetIfChanged(ref _useResume, value);
|
||||
|
||||
if(value == false)
|
||||
if(!value)
|
||||
return;
|
||||
|
||||
if(_outputPrefix != null)
|
||||
CheckResumeFile();
|
||||
CheckResumeFile().GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
Title = "Choose existing metadata sidecar"
|
||||
};
|
||||
|
||||
dlgMetadata.Filters.Add(new FileDialogFilter
|
||||
dlgMetadata.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = "CICM XML metadata",
|
||||
Extensions = new List<string>(new[]
|
||||
@@ -643,7 +643,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
Title = "Choose destination file"
|
||||
};
|
||||
|
||||
dlgDestination.Filters.Add(new FileDialogFilter
|
||||
dlgDestination.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = SelectedPlugin.Plugin.Name,
|
||||
Extensions = SelectedPlugin.Plugin.KnownExtensions.ToList()
|
||||
|
||||
@@ -576,6 +576,8 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
|
||||
// ReSharper disable once AsyncVoidLambda
|
||||
async void StoppingErrorMessage(string text) => await Dispatcher.UIThread.InvokeAsync(action: async () =>
|
||||
{
|
||||
ProgressText = text;
|
||||
@@ -583,7 +585,7 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
await MessageBoxManager.GetMessageBoxStandardWindow("Error", $"{text}", ButtonEnum.Ok, Icon.Error).
|
||||
ShowDialog(_view);
|
||||
|
||||
WorkFinished();
|
||||
await WorkFinished();
|
||||
});
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
namespace Aaru.Gui.ViewModels.Windows;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -184,10 +185,7 @@ public sealed class SplashWindowViewModel : ViewModelBase
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var mainDbUpdate = false;
|
||||
|
||||
if(!File.Exists(Settings.MainDbPath))
|
||||
mainDbUpdate = true;
|
||||
bool mainDbUpdate = !File.Exists(Settings.MainDbPath);
|
||||
|
||||
// TODO: Update database
|
||||
|
||||
@@ -217,6 +215,7 @@ public sealed class SplashWindowViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
|
||||
async void CheckGdprCompliance()
|
||||
{
|
||||
CurrentProgress++;
|
||||
|
||||
Reference in New Issue
Block a user