[HTML] Special case plain image embeds

Closes #537
This commit is contained in:
Tyrrrz
2021-07-23 02:29:05 +03:00
parent 28b2039a33
commit aae3790a5f
6 changed files with 109 additions and 14 deletions

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
namespace DiscordChatExporter.Core.Utils
{
public static class FileFormat
{
private static readonly HashSet<string> ImageFormats = new(StringComparer.OrdinalIgnoreCase)
{
".jpg",
".jpeg",
".png",
".gif",
".gifv",
".bmp",
".webp"
};
public static bool IsImage(string format) => ImageFormats.Contains(format);
private static readonly HashSet<string> VideoFormats = new(StringComparer.OrdinalIgnoreCase)
{
".mp4",
".webm",
".mov"
};
public static bool IsVideo(string format) => VideoFormats.Contains(format);
private static readonly HashSet<string> AudioFormats = new(StringComparer.OrdinalIgnoreCase)
{
".mp3",
".wav",
".ogg",
".flac",
".m4a"
};
public static bool IsAudio(string format) => AudioFormats.Contains(format);
}
}