Example #1
0
        public static SimpleTemplateData BuildTemplate(string templateName)
        {
            if (string.IsNullOrEmpty(templateName))
            {
                return(null);
            }

            var data = new SimpleTemplateData();

            if (Settings.TemplateList.ContainsKey(templateName) && Settings.TemplateList[templateName].FileExists)
            {
                data = Settings.TemplateList[templateName];
                LoadTemplateFromTemplateData(data);
            }
            else
            {
                var templateFile = Path.Combine(SLContext.Config.ProjectPath, templateName);
                data = TemplateFileHelper.LoadTemplateFromFile(templateFile);

                if (!data.FileExists)
                {
                    SLLog.WriteWarning("BuildTemplate", "TemplateBuilder", "Template wurde nicht gefunden!");
                    return(null);
                }
            }

            data.StyleFiles = LoadStyleFromTemplate(data);
            CopyStyleToTemplate(data);

            return(data);
        }
        private void LogTester()
        {
            SLLog.WriteInfo("LogTester", "TestInfo!");
            SLLog.WriteWarning("LogTester", ToString(), "TestWarning");
            try
            {
                throw new ApplicationException("TestException!");
            }
            catch (Exception ex)
            {
                SLLog.WriteError(new LogData
                {
                    FunctionName = "LogTester",
                    Source       = ToString(),
                    Ex           = ex,
                });
            }

            Task.Run(() =>
            {
                SLLog.WriteInfo("LogTester", "TestInfo (Thread)!");
                SLLog.WriteWarning("LogTester", ToString(), "TestWarning (Thread)!");
                try
                {
                    throw new ApplicationException("TestException (Thread)!");
                }
                catch (Exception ex)
                {
                    SLLog.WriteError(new LogData
                    {
                        FunctionName = "LogTester",
                        Source       = ToString(),
                        Ex           = ex,
                    });
                }
            });
        }