Esempio n. 1
0
        public TemplateConfig AddTemplateconfig(TemplateConfigAddCommand command)
        {
            if (TemplateConfigs == null)
            {
                TemplateConfigs = new List <TemplateConfig>();
            }
            TemplateConfig templateConfig = new TemplateConfig();

            templateConfig.Init(command);
            TemplateConfigs.Add(templateConfig);

            AddEvent(ToAddOrChangeCacheEvent());
            return(templateConfig);
        }
Esempio n. 2
0
        void LoadTemplates(String templateDir, String[] lines)
        {
            var templatesConfigLines = lines.Where(l => !l.Contains("="));

            foreach (var l in templatesConfigLines)
            {
                if (!String.IsNullOrWhiteSpace(l) && !l.StartsWith("#"))
                {
                    var tc = new TemplateConfig(l);
                    //load template
                    tc.TemplateString = File.ReadAllText(Path.Combine(templateDir, tc.Name));
                    TemplateConfigs.Add(tc);
                }
            }
        }
Esempio n. 3
0
        public TemplateConfig RemoveTemplateconfig(TemplateConfigRemoveCommand command)
        {
            if (TemplateConfigs == null)
            {
                TemplateConfigs = new List <TemplateConfig>();
            }
            TemplateConfig templateConfig = TemplateConfigs.FirstOrDefault(p => p.Id == command.Id);

            if (templateConfig == null)
            {
                throw new Exception("TemplateConfig not found");
            }
            templateConfig.Remove(command);

            AddEvent(ToAddOrChangeCacheEvent());
            return(templateConfig);
        }