First commit

This commit is contained in:
2026-03-15 22:15:34 -05:00
commit 0858a8a751
79 changed files with 6010 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
using Tesses.WebServer;
using Scriban;
namespace Tesses.YouTubeDownloader2025Companion
{
public class ReloadingScript(string path)
{
DateTime created=new DateTime(1970,1,1);
Template? template;
private string path = path;
public string Render(object val)
{
Template? template;
lock(this)
{
template = this.template;
var cd = File.GetLastWriteTime(path);
if(cd > created || this.template is null)
{
template = Template.Parse(File.ReadAllText(path));
this.template = template;
created = cd;
}
}
if(template is not null)
{
return template.Render(val);
}
throw new FileNotFoundException("Not found");
}
}
}