mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Use collection expressions.
This commit is contained in:
@@ -68,7 +68,7 @@ public sealed class DecodeMediaTagsViewModel : ViewModelBase
|
||||
|
||||
public DecodeMediaTagsViewModel([NotNull] IMediaImage inputFormat)
|
||||
{
|
||||
TagsList = new ObservableCollection<MediaTagModel>();
|
||||
TagsList = [];
|
||||
|
||||
_mediaType = inputFormat.Info.MediaType;
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ public sealed class ImageChecksumViewModel : ViewModelBase
|
||||
Md5Checked = true;
|
||||
Sha1Checked = true;
|
||||
SpamsumChecked = true;
|
||||
TrackChecksums = new ObservableCollection<ChecksumModel>();
|
||||
MediaChecksums = new ObservableCollection<ChecksumModel>();
|
||||
TrackChecksums = [];
|
||||
MediaChecksums = [];
|
||||
StartCommand = ReactiveCommand.Create(ExecuteStartCommand);
|
||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
StopCommand = ReactiveCommand.Create(ExecuteStopCommand);
|
||||
|
||||
@@ -1145,7 +1145,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
Dictionary<byte, string> isrcs = new();
|
||||
Dictionary<byte, byte> trackFlags = new();
|
||||
string mcn = null;
|
||||
HashSet<int> subchannelExtents = new();
|
||||
HashSet<int> subchannelExtents = [];
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack = new();
|
||||
|
||||
foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags.Where(t => t == SectorTagType.CdTrackIsrc)
|
||||
@@ -1436,12 +1436,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
{
|
||||
foreach(KeyValuePair<byte, byte> flags in trackFlags)
|
||||
{
|
||||
outputOptical.WriteSectorTag(new[]
|
||||
{
|
||||
flags.Value
|
||||
},
|
||||
flags.Key,
|
||||
SectorTagType.CdTrackFlags);
|
||||
outputOptical.WriteSectorTag([flags.Value], flags.Key, SectorTagType.CdTrackFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2130,10 +2125,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
dlgMetadata.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
".json"
|
||||
})
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
".json"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
string[] result = await dlgMetadata.ShowAsync(_view);
|
||||
@@ -2178,10 +2176,13 @@ 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[]
|
||||
{
|
||||
".json"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
string[] result = await dlgMetadata.ShowAsync(_view);
|
||||
|
||||
@@ -86,7 +86,7 @@ public sealed class ImageEntropyViewModel : ViewModelBase
|
||||
{
|
||||
_inputFormat = inputFormat;
|
||||
_view = view;
|
||||
TrackEntropy = new ObservableCollection<TrackEntropyModel>();
|
||||
TrackEntropy = [];
|
||||
StartCommand = ReactiveCommand.Create(ExecuteStartCommand);
|
||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
StopCommand = ReactiveCommand.Create(ExecuteStopCommand);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
@@ -331,10 +330,13 @@ public sealed class ImageSidecarViewModel : ViewModelBase
|
||||
dlgDestination.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.json"
|
||||
})
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.json"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
string result = await dlgDestination.ShowAsync(_view);
|
||||
|
||||
@@ -100,8 +100,8 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
StopCommand = ReactiveCommand.Create(ExecuteStopCommand);
|
||||
_inputFormat = inputFormat;
|
||||
_cancel = false;
|
||||
ErrorList = new ObservableCollection<LbaModel>();
|
||||
UnknownList = new ObservableCollection<LbaModel>();
|
||||
ErrorList = [];
|
||||
UnknownList = [];
|
||||
VerifyImageEnabled = true;
|
||||
VerifySectorsEnabled = true;
|
||||
CloseVisible = true;
|
||||
@@ -447,8 +447,8 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
if(VerifySectorsChecked)
|
||||
{
|
||||
var chkStopwatch = new Stopwatch();
|
||||
List<ulong> failingLbas = new();
|
||||
List<ulong> unknownLbas = new();
|
||||
List<ulong> failingLbas = [];
|
||||
List<ulong> unknownLbas = [];
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
DecodeImageMediaTagsCommand = ReactiveCommand.Create(ExecuteDecodeImageMediaTagsCommand);
|
||||
RefreshDevicesCommand = ReactiveCommand.Create(ExecuteRefreshDevicesCommand);
|
||||
_view = view;
|
||||
TreeRoot = new ObservableCollection<RootModel>();
|
||||
TreeRoot = [];
|
||||
ContentPanel = Greeting;
|
||||
|
||||
_imagesRoot = new ImagesRootModel
|
||||
|
||||
@@ -125,8 +125,8 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
StopCommand = ReactiveCommand.Create(ExecuteStopCommand);
|
||||
DestinationCommand = ReactiveCommand.Create(ExecuteDestinationCommand);
|
||||
PluginsList = new ObservableCollection<ImagePluginModel>();
|
||||
Encodings = new ObservableCollection<EncodingModel>();
|
||||
PluginsList = [];
|
||||
Encodings = [];
|
||||
|
||||
// Defaults
|
||||
StopOnError = false;
|
||||
@@ -519,10 +519,13 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
dlgMetadata.Filters?.Add(new FileDialogFilter
|
||||
{
|
||||
Name = UI.Dialog_Aaru_Metadata,
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
".json"
|
||||
})
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
".json"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
string[] result = dlgMetadata.ShowAsync(_view).Result;
|
||||
|
||||
@@ -108,7 +108,7 @@ public sealed class MediaScanViewModel : ViewModelBase
|
||||
StopCommand = ReactiveCommand.Create(ExecuteStopCommand);
|
||||
StartVisible = true;
|
||||
CloseVisible = true;
|
||||
BlockMapList = new ObservableCollection<(ulong block, double duration)>();
|
||||
BlockMapList = [];
|
||||
|
||||
// ChartPoints = new ObservableCollection<DataPoint>();
|
||||
StepsX = double.NaN;
|
||||
|
||||
Reference in New Issue
Block a user