|
|
|
@ -2,7 +2,6 @@
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using DiscordChatExporter.Core.Discord.Data.Common;
|
|
|
|
|
using DiscordChatExporter.Core.Utils;
|
|
|
|
|
using DiscordChatExporter.Core.Utils.Extensions;
|
|
|
|
|
using JsonExtensions.Reading;
|
|
|
|
|
|
|
|
|
@ -20,11 +19,26 @@ public partial record Attachment(
|
|
|
|
|
{
|
|
|
|
|
public string FileExtension => Path.GetExtension(FileName);
|
|
|
|
|
|
|
|
|
|
public bool IsImage => FileFormat.IsImage(FileExtension);
|
|
|
|
|
|
|
|
|
|
public bool IsVideo => FileFormat.IsVideo(FileExtension);
|
|
|
|
|
|
|
|
|
|
public bool IsAudio => FileFormat.IsAudio(FileExtension);
|
|
|
|
|
public bool IsImage =>
|
|
|
|
|
string.Equals(FileExtension, ".jpg", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".jpeg", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".png", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".gif", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".bmp", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".webp", StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
public bool IsVideo =>
|
|
|
|
|
string.Equals(FileExtension, ".gifv", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".mp4", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".webm", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".mov", StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
public bool IsAudio =>
|
|
|
|
|
string.Equals(FileExtension, ".mp3", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".wav", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".ogg", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".flac", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(FileExtension, ".m4a", StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
public bool IsSpoiler => FileName.StartsWith("SPOILER_", StringComparison.Ordinal);
|
|
|
|
|
}
|
|
|
|
|