| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | using InABox.Core;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace InABox.Poster.Custom{    public class CustomPosterSettings : PosterSettings    {        public override string DefaultScript(Type TPostable)        {            var tName = TPostable.Name;            var decapital = tName[0..1].ToLower() + tName[1..];            var ns = TPostable.Namespace;            return @"using " + ns + @";using InABox.Core;using System.Collections.Generic;public class Module{    // Customise 'model' before loading data. Return false if the post needs to be cancelled.    public bool BeforePost(IDataModel<" + tName + @"> model)    {        return true;    }    public bool Process(IDataModel<" + tName + @"> model)    {        foreach(var " + decapital + @" in model.GetTable<" + tName + @">().ToObjects<" + tName + @">())        {            // Do processing        }        return true; // return true for success.    }    // Perform any post-processing. All the items of type '" + tName + @" will be saved after this function is called.    public void AfterPost(IDataModel<" + tName + @"> model)    {    }}";        }    }}
 |