diff --git a/YoutubeDownloader.Core/Downloading/VideoDownloadPreference.cs b/YoutubeDownloader.Core/Downloading/VideoDownloadPreference.cs index 9bf7906d1..68a2047fd 100644 --- a/YoutubeDownloader.Core/Downloading/VideoDownloadPreference.cs +++ b/YoutubeDownloader.Core/Downloading/VideoDownloadPreference.cs @@ -20,36 +20,33 @@ VideoQualityPreference PreferredVideoQuality var preferredOption = PreferredVideoQuality switch { - VideoQualityPreference.Highest - => orderedOptions.LastOrDefault(o => o.Container == PreferredContainer), - - VideoQualityPreference.UpTo1080p - => orderedOptions - .Where(o => o.VideoQuality?.MaxHeight <= 1080) - .LastOrDefault(o => o.Container == PreferredContainer), - - VideoQualityPreference.UpTo720p - => orderedOptions - .Where(o => o.VideoQuality?.MaxHeight <= 720) - .LastOrDefault(o => o.Container == PreferredContainer), - - VideoQualityPreference.UpTo480p - => orderedOptions - .Where(o => o.VideoQuality?.MaxHeight <= 480) - .LastOrDefault(o => o.Container == PreferredContainer), - - VideoQualityPreference.UpTo360p - => orderedOptions - .Where(o => o.VideoQuality?.MaxHeight <= 360) - .LastOrDefault(o => o.Container == PreferredContainer), - - VideoQualityPreference.Lowest - => orderedOptions.LastOrDefault(o => o.Container == PreferredContainer), - - _ - => throw new InvalidOperationException( - $"Unknown video quality preference '{PreferredVideoQuality}'." - ) + VideoQualityPreference.Highest => orderedOptions.LastOrDefault(o => + o.Container == PreferredContainer + ), + + VideoQualityPreference.UpTo1080p => orderedOptions + .Where(o => o.VideoQuality?.MaxHeight <= 1080) + .LastOrDefault(o => o.Container == PreferredContainer), + + VideoQualityPreference.UpTo720p => orderedOptions + .Where(o => o.VideoQuality?.MaxHeight <= 720) + .LastOrDefault(o => o.Container == PreferredContainer), + + VideoQualityPreference.UpTo480p => orderedOptions + .Where(o => o.VideoQuality?.MaxHeight <= 480) + .LastOrDefault(o => o.Container == PreferredContainer), + + VideoQualityPreference.UpTo360p => orderedOptions + .Where(o => o.VideoQuality?.MaxHeight <= 360) + .LastOrDefault(o => o.Container == PreferredContainer), + + VideoQualityPreference.Lowest => orderedOptions.LastOrDefault(o => + o.Container == PreferredContainer + ), + + _ => throw new InvalidOperationException( + $"Unknown video quality preference '{PreferredVideoQuality}'." + ), }; return preferredOption diff --git a/YoutubeDownloader.Core/Downloading/VideoQualityPreference.cs b/YoutubeDownloader.Core/Downloading/VideoQualityPreference.cs index 9605dd1bc..944a71f05 100644 --- a/YoutubeDownloader.Core/Downloading/VideoQualityPreference.cs +++ b/YoutubeDownloader.Core/Downloading/VideoQualityPreference.cs @@ -10,7 +10,7 @@ public enum VideoQualityPreference UpTo480p, UpTo720p, UpTo1080p, - Highest + Highest, // ReSharper restore InconsistentNaming } @@ -25,6 +25,6 @@ public static string GetDisplayName(this VideoQualityPreference preference) => VideoQualityPreference.UpTo720p => "≤ 720p", VideoQualityPreference.UpTo1080p => "≤ 1080p", VideoQualityPreference.Highest => "Highest quality", - _ => throw new ArgumentOutOfRangeException(nameof(preference)) + _ => throw new ArgumentOutOfRangeException(nameof(preference)), }; } diff --git a/YoutubeDownloader.Core/Resolving/QueryResultKind.cs b/YoutubeDownloader.Core/Resolving/QueryResultKind.cs index e6fe8e9ea..4dbfe35d3 100644 --- a/YoutubeDownloader.Core/Resolving/QueryResultKind.cs +++ b/YoutubeDownloader.Core/Resolving/QueryResultKind.cs @@ -6,5 +6,5 @@ public enum QueryResultKind Playlist, Channel, Search, - Aggregate + Aggregate, } diff --git a/YoutubeDownloader.Core/Utils/Http.cs b/YoutubeDownloader.Core/Utils/Http.cs index d17ac3bda..20a15582c 100644 --- a/YoutubeDownloader.Core/Utils/Http.cs +++ b/YoutubeDownloader.Core/Utils/Http.cs @@ -17,8 +17,8 @@ public static class Http new ProductInfoHeaderValue( "YoutubeDownloader", Assembly.GetExecutingAssembly().GetName().Version?.ToString(3) - ) - } - } + ), + }, + }, }; } diff --git a/YoutubeDownloader.Core/Utils/PathEx.cs b/YoutubeDownloader.Core/Utils/PathEx.cs index f704193c2..ee5408b84 100644 --- a/YoutubeDownloader.Core/Utils/PathEx.cs +++ b/YoutubeDownloader.Core/Utils/PathEx.cs @@ -8,7 +8,7 @@ public static class PathEx { private static readonly HashSet InvalidFileNameChars = [ - .. Path.GetInvalidFileNameChars() + .. Path.GetInvalidFileNameChars(), ]; public static string EscapeFileName(string path) diff --git a/YoutubeDownloader/App.axaml.cs b/YoutubeDownloader/App.axaml.cs index cb74ef16b..977c772ca 100644 --- a/YoutubeDownloader/App.axaml.cs +++ b/YoutubeDownloader/App.axaml.cs @@ -65,7 +65,7 @@ public App() { ThemeVariant.Light => Avalonia.Styling.ThemeVariant.Light, ThemeVariant.Dark => Avalonia.Styling.ThemeVariant.Dark, - _ => Avalonia.Styling.ThemeVariant.Default + _ => Avalonia.Styling.ThemeVariant.Default, }; InitializeTheme(); @@ -97,7 +97,7 @@ private void InitializeTheme() { "Light" => PlatformThemeVariant.Light, "Dark" => PlatformThemeVariant.Dark, - _ => PlatformSettings?.GetColorValues().ThemeVariant ?? PlatformThemeVariant.Light + _ => PlatformSettings?.GetColorValues().ThemeVariant ?? PlatformThemeVariant.Light, }; this.LocateMaterialTheme().CurrentTheme = diff --git a/YoutubeDownloader/Framework/DialogManager.cs b/YoutubeDownloader/Framework/DialogManager.cs index 431c67ca0..2e1755e5f 100644 --- a/YoutubeDownloader/Framework/DialogManager.cs +++ b/YoutubeDownloader/Framework/DialogManager.cs @@ -61,7 +61,7 @@ await DialogHost.Show( { FileTypeChoices = fileTypes, SuggestedFileName = defaultFilePath, - DefaultExtension = Path.GetExtension(defaultFilePath).TrimStart('.') + DefaultExtension = Path.GetExtension(defaultFilePath).TrimStart('.'), } ); @@ -82,7 +82,7 @@ await DialogHost.Show( new FolderPickerOpenOptions { AllowMultiple = false, - SuggestedStartLocation = startLocation + SuggestedStartLocation = startLocation, } ); diff --git a/YoutubeDownloader/Framework/ThemeVariant.cs b/YoutubeDownloader/Framework/ThemeVariant.cs index 331d68e1d..b439427ce 100644 --- a/YoutubeDownloader/Framework/ThemeVariant.cs +++ b/YoutubeDownloader/Framework/ThemeVariant.cs @@ -4,5 +4,5 @@ public enum ThemeVariant { System, Light, - Dark + Dark, } diff --git a/YoutubeDownloader/Framework/ViewManager.cs b/YoutubeDownloader/Framework/ViewManager.cs index 397150dc2..1a4f22c66 100644 --- a/YoutubeDownloader/Framework/ViewManager.cs +++ b/YoutubeDownloader/Framework/ViewManager.cs @@ -21,7 +21,7 @@ public partial class ViewManager DownloadSingleSetupViewModel => new DownloadSingleSetupView(), MessageBoxViewModel => new MessageBoxView(), SettingsViewModel => new SettingsView(), - _ => null + _ => null, }; public Control? TryBindView(ViewModelBase viewModel) diff --git a/YoutubeDownloader/ViewModels/Components/DownloadStatus.cs b/YoutubeDownloader/ViewModels/Components/DownloadStatus.cs index 695962611..d59f1b701 100644 --- a/YoutubeDownloader/ViewModels/Components/DownloadStatus.cs +++ b/YoutubeDownloader/ViewModels/Components/DownloadStatus.cs @@ -6,5 +6,5 @@ public enum DownloadStatus Started, Completed, Failed, - Canceled + Canceled, } diff --git a/YoutubeDownloader/ViewModels/Dialogs/DownloadSingleSetupViewModel.cs b/YoutubeDownloader/ViewModels/Dialogs/DownloadSingleSetupViewModel.cs index ff50b93b8..42ea6509d 100644 --- a/YoutubeDownloader/ViewModels/Dialogs/DownloadSingleSetupViewModel.cs +++ b/YoutubeDownloader/ViewModels/Dialogs/DownloadSingleSetupViewModel.cs @@ -58,8 +58,8 @@ private async Task ConfirmAsync() [ new FilePickerFileType($"{container.Name} file") { - Patterns = [$"*.{container.Name}"] - } + Patterns = [$"*.{container.Name}"], + }, ], FileNameTemplate.Apply(settingsService.FileNameTemplate, Video, container) );