public HtmlGenerator(string _root, Subject _subject, AdditionalsConfigurations _config) { subject = _subject; htmlFilePath = _root + @"\index.html"; cssFilePath = _root + @"\site.css"; root = _root; string path = AppDomain.CurrentDomain.BaseDirectory; //HERE NEED TO CHANGE STATIC FILE PATH File.Copy(@"D:\VS17 Projects\subject_cms\subject_cms\subject_cms\html_templates\html_empty.html", htmlFilePath); index.Load(htmlFilePath); fillMainInfo(); HtmlNode semestersContainer = index.GetElementbyId(HtmlElementID.SEMESTERS_CONTAINER_ID); foreach (Semester current in subject.Semesters) { semestersContainer.ChildNodes.Add(createSemester(current)); } set_settings(_config); index.Save(htmlFilePath); }
private void set_settings(AdditionalsConfigurations _config) { //CSS FILE BY DEFAULT if (string.IsNullOrEmpty(_config.CSSFilePath)) { File.Copy(@"D:\VS17 Projects\subject_cms\subject_cms\subject_cms\html_templates\site.css", cssFilePath); File.Copy(@"D:\VS17 Projects\subject_cms\subject_cms\subject_cms\html_templates\content\bg5.png", root + @"\bg5.png"); File.Copy(@"D:\VS17 Projects\subject_cms\subject_cms\subject_cms\html_templates\content\header_background.png", root + @"\header_background.png"); addCSSLink(cssFilePath); } else { addCSSLink(_config.CSSFilePath); } if (_config.ScriptFilesPaths != null) { foreach (string path in _config.ScriptFilesPaths) { addScript(path); } } if (_config.BackgroundColor != null) { HtmlNode body = index.GetElementbyId("body"); body.SetAttributeValue("style" , string.Format("background: rgb({0},{1},{2})" , _config.BackgroundColor?.R , _config.BackgroundColor?.G , _config.BackgroundColor?.B)); } if (_config.HeaderColor != null) { HtmlNode body = index.GetElementbyId("main-info"); body.SetAttributeValue("style" , string.Format("background: rgb({0},{1},{2})" , _config.HeaderColor?.R , _config.HeaderColor?.G , _config.HeaderColor?.B)); } }