Exemple #1
0
        public static string Render(List <EnginePrimitive> primitives)
        {
            Template template;

            using (StreamReader reader = new StreamReader("Resources/Templates/PrimitiveSizes.scriban")) {
                template = Template.Parse(reader.ReadToEnd());
            }

            var scriptObject = new ScriptObject {
                { "primitives", primitives }
            };

            scriptObject.Import(BaseTemplate.GetScriptObject());

            var context = BaseTemplate.GetTemplateContext();

            context.PushGlobal(scriptObject);

            return(template.Render(context));
        }
Exemple #2
0
        public static string Render(List <EngineStruct> structs, string scope)
        {
            Template template;

            using (StreamReader reader = new StreamReader("Resources/Templates/SimStruct.scriban")) {
                template = Template.Parse(reader.ReadToEnd());
            }

            var scriptObject = new ScriptObject {
                { "structs", structs },
                { "scope", scope }
            };

            scriptObject.Import(BaseTemplate.GetScriptObject());

            var context = BaseTemplate.GetTemplateContext();

            context.PushGlobal(scriptObject);

            return(template.Render(context));
        }