From 6d13c7f56ab0674840ccd2c38fcf512dcc40ace3 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:30:41 -0500 Subject: [PATCH] Increase readability with ternary operator --- .../Extensions/M3U8Extensions.cs | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/TwitchDownloaderCore/Extensions/M3U8Extensions.cs b/TwitchDownloaderCore/Extensions/M3U8Extensions.cs index a6fbcdd4..afb00d7a 100644 --- a/TwitchDownloaderCore/Extensions/M3U8Extensions.cs +++ b/TwitchDownloaderCore/Extensions/M3U8Extensions.cs @@ -110,35 +110,26 @@ public static string GetResolutionFramerateString(this M3U8.Stream stream) if (streamInfo.Resolution == default) { - if (stream.IsSource()) - { - return "Source"; - } - - return ""; + return stream.IsSource() + ? "Source" + : ""; } var frameHeight = streamInfo.Resolution.Height; if (streamInfo.Framerate == default) { - if (stream.IsSource()) - { - return $"{frameHeight}p (Source)"; - } - - return $"{frameHeight}p"; + return stream.IsSource() + ? $"{frameHeight}p (Source)" + : $"{frameHeight}p"; } // Some M3U8 responses have framerate values up to 2fps more/less than the typical framerate. var frameRate = (uint)(Math.Round(streamInfo.Framerate / 10) * 10); - if (stream.IsSource()) - { - return $"{frameHeight}p{frameRate} (Source)"; - } - - return $"{frameHeight}p{frameRate}"; + return stream.IsSource() + ? $"{frameHeight}p{frameRate} (Source)" + : $"{frameHeight}p{frameRate}"; } ///