mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-28 20:23:42 +00:00
Improve performance (#162)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using Scriban.Parsing;
|
||||
using Scriban.Runtime;
|
||||
using Scriban;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Core.Rendering
|
||||
{
|
||||
public partial class HtmlChatLogRenderer
|
||||
{
|
||||
private class TemplateLoader : ITemplateLoader
|
||||
{
|
||||
private const string ResourceRootNamespace = "DiscordChatExporter.Core.Rendering.Resources";
|
||||
|
||||
public string Load(string templatePath) =>
|
||||
Assembly.GetExecutingAssembly().GetManifestResourceString($"{ResourceRootNamespace}.{templatePath}");
|
||||
|
||||
public string GetPath(TemplateContext context, SourceSpan callerSpan, string templateName) => templateName;
|
||||
|
||||
public string Load(TemplateContext context, SourceSpan callerSpan, string templatePath) => Load(templatePath);
|
||||
|
||||
public ValueTask<string> LoadAsync(TemplateContext context, SourceSpan callerSpan, string templatePath) =>
|
||||
new ValueTask<string>(Load(templatePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user