2025-03-19 23:47:17 +03:00
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace mROA.CodegenTools
|
|
|
|
|
{
|
2025-03-23 19:32:41 +03:00
|
|
|
public class ProgrammableTextSection : ITemplateSection, IBaking
|
2025-03-19 23:47:17 +03:00
|
|
|
{
|
|
|
|
|
public TemplateDocument Context { get; set; }
|
|
|
|
|
public int TargetLength => 0;
|
|
|
|
|
|
|
|
|
|
private Func<object, string> _bakeFunc;
|
|
|
|
|
|
2025-03-20 16:36:32 +03:00
|
|
|
public ProgrammableTextSection(Func<object, string> bakeFunc, TemplateDocument context)
|
2025-03-19 23:47:17 +03:00
|
|
|
{
|
|
|
|
|
_bakeFunc = bakeFunc;
|
|
|
|
|
Context = context;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Bake()
|
|
|
|
|
{
|
|
|
|
|
return _bakeFunc(Context.AdditionalContext);
|
|
|
|
|
}
|
2025-03-25 20:00:08 +03:00
|
|
|
|
|
|
|
|
public object Clone()
|
|
|
|
|
{
|
|
|
|
|
return new ProgrammableTextSection(_bakeFunc, Context);
|
|
|
|
|
}
|
2025-03-19 23:47:17 +03:00
|
|
|
}
|
|
|
|
|
}
|