This commit is contained in:
Alexey Golub 2019-09-27 01:02:46 +03:00
parent fa4bb3b693
commit d6980cef8d

View file

@ -4,32 +4,24 @@ namespace DiscordChatExporter.Core.Models
{ {
public static class Extensions public static class Extensions
{ {
public static string GetFileExtension(this ExportFormat format) public static string GetFileExtension(this ExportFormat format) =>
{ format switch
if (format == ExportFormat.PlainText) {
return "txt"; ExportFormat.PlainText => "txt",
if (format == ExportFormat.HtmlDark) ExportFormat.HtmlDark => "html",
return "html"; ExportFormat.HtmlLight => "html",
if (format == ExportFormat.HtmlLight) ExportFormat.Csv => "csv",
return "html"; _ => throw new ArgumentOutOfRangeException(nameof(format))
if (format == ExportFormat.Csv) };
return "csv";
throw new ArgumentOutOfRangeException(nameof(format)); public static string GetDisplayName(this ExportFormat format) =>
} format switch
{
public static string GetDisplayName(this ExportFormat format) ExportFormat.PlainText => "Plain Text",
{ ExportFormat.HtmlDark => "HTML (Dark)",
if (format == ExportFormat.PlainText) ExportFormat.HtmlLight => "HTML (Light)",
return "Plain Text"; ExportFormat.Csv => "Comma Seperated Values (CSV)",
if (format == ExportFormat.HtmlDark) _ => throw new ArgumentOutOfRangeException(nameof(format))
return "HTML (Dark)"; };
if (format == ExportFormat.HtmlLight)
return "HTML (Light)";
if (format == ExportFormat.Csv)
return "Comma Seperated Values (CSV)";
throw new ArgumentOutOfRangeException(nameof(format));
}
} }
} }