2025-03-25 21:27:54 +03:00
|
|
|
using System;
|
|
|
|
|
|
2025-03-29 19:31:10 +03:00
|
|
|
namespace mROA.Codegen.Tools
|
2025-03-25 21:27:54 +03:00
|
|
|
{
|
|
|
|
|
public class ProgrammableTextSection : ITemplateSection, IBaking
|
|
|
|
|
{
|
2025-03-29 19:31:10 +03:00
|
|
|
private readonly Func<object, string> _bakeFunc;
|
2025-03-25 21:27:54 +03:00
|
|
|
|
|
|
|
|
public ProgrammableTextSection(Func<object, string> bakeFunc, TemplateDocument context)
|
|
|
|
|
{
|
|
|
|
|
_bakeFunc = bakeFunc;
|
|
|
|
|
Context = context;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Bake()
|
|
|
|
|
{
|
|
|
|
|
return _bakeFunc(Context.AdditionalContext);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-29 19:31:10 +03:00
|
|
|
public TemplateDocument Context { get; set; }
|
|
|
|
|
public int TargetLength => 0;
|
|
|
|
|
|
2025-03-25 21:27:54 +03:00
|
|
|
public object Clone()
|
|
|
|
|
{
|
|
|
|
|
return new ProgrammableTextSection(_bakeFunc, Context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|