From d6980cef8de6762abb701dca33351c7171d79a93 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Fri, 27 Sep 2019 01:02:46 +0300 Subject: [PATCH] Cleanup --- DiscordChatExporter.Core.Models/Extensions.cs | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/DiscordChatExporter.Core.Models/Extensions.cs b/DiscordChatExporter.Core.Models/Extensions.cs index 90817b9a..d34be089 100644 --- a/DiscordChatExporter.Core.Models/Extensions.cs +++ b/DiscordChatExporter.Core.Models/Extensions.cs @@ -4,32 +4,24 @@ namespace DiscordChatExporter.Core.Models { public static class Extensions { - public static string GetFileExtension(this ExportFormat format) - { - if (format == ExportFormat.PlainText) - return "txt"; - if (format == ExportFormat.HtmlDark) - return "html"; - if (format == ExportFormat.HtmlLight) - return "html"; - if (format == ExportFormat.Csv) - return "csv"; + public static string GetFileExtension(this ExportFormat format) => + format switch + { + ExportFormat.PlainText => "txt", + ExportFormat.HtmlDark => "html", + ExportFormat.HtmlLight => "html", + ExportFormat.Csv => "csv", + _ => throw new ArgumentOutOfRangeException(nameof(format)) + }; - throw new ArgumentOutOfRangeException(nameof(format)); - } - - public static string GetDisplayName(this ExportFormat format) - { - if (format == ExportFormat.PlainText) - return "Plain Text"; - if (format == ExportFormat.HtmlDark) - return "HTML (Dark)"; - if (format == ExportFormat.HtmlLight) - return "HTML (Light)"; - if (format == ExportFormat.Csv) - return "Comma Seperated Values (CSV)"; - - throw new ArgumentOutOfRangeException(nameof(format)); - } + public static string GetDisplayName(this ExportFormat format) => + format switch + { + ExportFormat.PlainText => "Plain Text", + ExportFormat.HtmlDark => "HTML (Dark)", + ExportFormat.HtmlLight => "HTML (Light)", + ExportFormat.Csv => "Comma Seperated Values (CSV)", + _ => throw new ArgumentOutOfRangeException(nameof(format)) + }; } } \ No newline at end of file