|
|
|
@ -3,6 +3,7 @@ using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Resources;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using DiscordChatExporter.Models;
|
|
|
|
|
using HtmlAgilityPack;
|
|
|
|
|
using Tyrrrz.Extensions;
|
|
|
|
@ -18,7 +19,9 @@ namespace DiscordChatExporter.Services
|
|
|
|
|
_settingsService = settingsService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Export(string filePath, ChannelChatLog log, Theme theme)
|
|
|
|
|
public Task ExportAsync(string filePath, ChannelChatLog log, Theme theme)
|
|
|
|
|
{
|
|
|
|
|
return Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
var doc = GetTemplate();
|
|
|
|
|
var style = GetStyle(theme);
|
|
|
|
@ -53,14 +56,16 @@ namespace DiscordChatExporter.Services
|
|
|
|
|
var messageHtml = logHtml.AppendChild(HtmlNode.CreateNode("<div class=\"msg\"></div>"));
|
|
|
|
|
|
|
|
|
|
// Left
|
|
|
|
|
var messageLeftHtml = messageHtml.AppendChild(HtmlNode.CreateNode("<div class=\"msg-left\"></div>"));
|
|
|
|
|
var messageLeftHtml =
|
|
|
|
|
messageHtml.AppendChild(HtmlNode.CreateNode("<div class=\"msg-left\"></div>"));
|
|
|
|
|
|
|
|
|
|
// Avatar
|
|
|
|
|
messageLeftHtml.AppendChild(
|
|
|
|
|
HtmlNode.CreateNode($"<img class=\"msg-avatar\" src=\"{messageGroup.Author.AvatarUrl}\" />"));
|
|
|
|
|
|
|
|
|
|
// Right
|
|
|
|
|
var messageRightHtml = messageHtml.AppendChild(HtmlNode.CreateNode("<div class=\"msg-right\"></div>"));
|
|
|
|
|
var messageRightHtml =
|
|
|
|
|
messageHtml.AppendChild(HtmlNode.CreateNode("<div class=\"msg-right\"></div>"));
|
|
|
|
|
|
|
|
|
|
// Author
|
|
|
|
|
var authorName = HtmlDocument.HtmlEncode(messageGroup.Author.Name);
|
|
|
|
@ -116,6 +121,7 @@ namespace DiscordChatExporter.Services
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
doc.Save(filePath);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|