Fix formatting
This commit is contained in:
parent
6cc77d0542
commit
cdfafad26a
@ -20,36 +20,33 @@ public record VideoDownloadPreference(
|
||||
|
||||
var preferredOption = PreferredVideoQuality switch
|
||||
{
|
||||
VideoQualityPreference.Highest
|
||||
=> orderedOptions.LastOrDefault(o => o.Container == PreferredContainer),
|
||||
VideoQualityPreference.Highest => orderedOptions.LastOrDefault(o =>
|
||||
o.Container == PreferredContainer
|
||||
),
|
||||
|
||||
VideoQualityPreference.UpTo1080p
|
||||
=> orderedOptions
|
||||
.Where(o => o.VideoQuality?.MaxHeight <= 1080)
|
||||
.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.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.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.UpTo360p => orderedOptions
|
||||
.Where(o => o.VideoQuality?.MaxHeight <= 360)
|
||||
.LastOrDefault(o => o.Container == PreferredContainer),
|
||||
|
||||
VideoQualityPreference.Lowest
|
||||
=> orderedOptions.LastOrDefault(o => o.Container == PreferredContainer),
|
||||
VideoQualityPreference.Lowest => orderedOptions.LastOrDefault(o =>
|
||||
o.Container == PreferredContainer
|
||||
),
|
||||
|
||||
_
|
||||
=> throw new InvalidOperationException(
|
||||
$"Unknown video quality preference '{PreferredVideoQuality}'."
|
||||
)
|
||||
_ => throw new InvalidOperationException(
|
||||
$"Unknown video quality preference '{PreferredVideoQuality}'."
|
||||
),
|
||||
};
|
||||
|
||||
return preferredOption
|
||||
|
@ -10,7 +10,7 @@ public enum VideoQualityPreference
|
||||
UpTo480p,
|
||||
UpTo720p,
|
||||
UpTo1080p,
|
||||
Highest
|
||||
Highest,
|
||||
// ReSharper restore InconsistentNaming
|
||||
}
|
||||
|
||||
@ -25,6 +25,6 @@ public static class VideoQualityPreferenceExtensions
|
||||
VideoQualityPreference.UpTo720p => "≤ 720p",
|
||||
VideoQualityPreference.UpTo1080p => "≤ 1080p",
|
||||
VideoQualityPreference.Highest => "Highest quality",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(preference))
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(preference)),
|
||||
};
|
||||
}
|
||||
|
@ -6,5 +6,5 @@ public enum QueryResultKind
|
||||
Playlist,
|
||||
Channel,
|
||||
Search,
|
||||
Aggregate
|
||||
Aggregate,
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ public static class Http
|
||||
new ProductInfoHeaderValue(
|
||||
"YoutubeDownloader",
|
||||
Assembly.GetExecutingAssembly().GetName().Version?.ToString(3)
|
||||
)
|
||||
}
|
||||
}
|
||||
),
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ public static class PathEx
|
||||
{
|
||||
private static readonly HashSet<char> InvalidFileNameChars =
|
||||
[
|
||||
.. Path.GetInvalidFileNameChars()
|
||||
.. Path.GetInvalidFileNameChars(),
|
||||
];
|
||||
|
||||
public static string EscapeFileName(string path)
|
||||
|
@ -65,7 +65,7 @@ public class App : Application, IDisposable
|
||||
{
|
||||
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 @@ public class App : Application, IDisposable
|
||||
{
|
||||
"Light" => PlatformThemeVariant.Light,
|
||||
"Dark" => PlatformThemeVariant.Dark,
|
||||
_ => PlatformSettings?.GetColorValues().ThemeVariant ?? PlatformThemeVariant.Light
|
||||
_ => PlatformSettings?.GetColorValues().ThemeVariant ?? PlatformThemeVariant.Light,
|
||||
};
|
||||
|
||||
this.LocateMaterialTheme<MaterialThemeBase>().CurrentTheme =
|
||||
|
@ -61,7 +61,7 @@ public class DialogManager : IDisposable
|
||||
{
|
||||
FileTypeChoices = fileTypes,
|
||||
SuggestedFileName = defaultFilePath,
|
||||
DefaultExtension = Path.GetExtension(defaultFilePath).TrimStart('.')
|
||||
DefaultExtension = Path.GetExtension(defaultFilePath).TrimStart('.'),
|
||||
}
|
||||
);
|
||||
|
||||
@ -82,7 +82,7 @@ public class DialogManager : IDisposable
|
||||
new FolderPickerOpenOptions
|
||||
{
|
||||
AllowMultiple = false,
|
||||
SuggestedStartLocation = startLocation
|
||||
SuggestedStartLocation = startLocation,
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -4,5 +4,5 @@ public enum ThemeVariant
|
||||
{
|
||||
System,
|
||||
Light,
|
||||
Dark
|
||||
Dark,
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public partial class ViewManager
|
||||
DownloadSingleSetupViewModel => new DownloadSingleSetupView(),
|
||||
MessageBoxViewModel => new MessageBoxView(),
|
||||
SettingsViewModel => new SettingsView(),
|
||||
_ => null
|
||||
_ => null,
|
||||
};
|
||||
|
||||
public Control? TryBindView(ViewModelBase viewModel)
|
||||
|
@ -6,5 +6,5 @@ public enum DownloadStatus
|
||||
Started,
|
||||
Completed,
|
||||
Failed,
|
||||
Canceled
|
||||
Canceled,
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ public partial class DownloadSingleSetupViewModel(
|
||||
[
|
||||
new FilePickerFileType($"{container.Name} file")
|
||||
{
|
||||
Patterns = [$"*.{container.Name}"]
|
||||
}
|
||||
Patterns = [$"*.{container.Name}"],
|
||||
},
|
||||
],
|
||||
FileNameTemplate.Apply(settingsService.FileNameTemplate, Video, container)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user