|
@@ -1,5 +1,6 @@
|
|
|
using InABox.Core;
|
|
|
using InABox.Core.Postable;
|
|
|
+using InABox.Poster.Shared;
|
|
|
using InABox.Scripting;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Formats.Asn1;
|
|
@@ -10,14 +11,10 @@ using System.Threading.Tasks;
|
|
|
|
|
|
namespace InABox.Poster.Timberline;
|
|
|
|
|
|
-public class TimberlinePosterEngine<TPostable, TSettings> : PosterEngine<TPostable, ITimberlinePoster<TPostable, TSettings>, TSettings>
|
|
|
+public class TimberlinePosterEngine<TPostable, TSettings> : BasePosterEngine<TPostable, ITimberlinePoster<TPostable, TSettings>, TSettings>
|
|
|
where TPostable : Entity, IPostable, IRemotable, IPersistent, new()
|
|
|
where TSettings : TimberlinePosterSettings<TPostable>, new()
|
|
|
{
|
|
|
-
|
|
|
- private ScriptDocument? _script;
|
|
|
- private bool _hasCheckedScript;
|
|
|
-
|
|
|
protected override ITimberlinePoster<TPostable, TSettings> CreatePoster()
|
|
|
{
|
|
|
var poster = base.CreatePoster();
|
|
@@ -25,32 +22,6 @@ public class TimberlinePosterEngine<TPostable, TSettings> : PosterEngine<TPostab
|
|
|
return poster;
|
|
|
}
|
|
|
|
|
|
- private ScriptDocument? GetScriptDocument()
|
|
|
- {
|
|
|
- if (_hasCheckedScript)
|
|
|
- {
|
|
|
- return _script;
|
|
|
- }
|
|
|
-
|
|
|
- var settings = GetSettings();
|
|
|
- if (settings.ScriptEnabled && !string.IsNullOrWhiteSpace(settings.Script))
|
|
|
- {
|
|
|
- var document = new ScriptDocument(settings.Script);
|
|
|
- if (!document.Compile())
|
|
|
- {
|
|
|
- throw new Exception("Script failed to compile!");
|
|
|
- }
|
|
|
- _script = document;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _script = null;
|
|
|
- }
|
|
|
-
|
|
|
- _hasCheckedScript = true;
|
|
|
- return _script;
|
|
|
- }
|
|
|
-
|
|
|
public override bool BeforePost(IDataModel<TPostable> model)
|
|
|
{
|
|
|
return Poster.BeforePost(model);
|