Beispiel #1
0
        private void createHTMLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var css      = File.ReadAllText(Data.TemplateDir + "/style.css");
            var template = File.ReadAllText(Data.TemplateDir + "/index.html");

            var artCol  = new HTMLTableColumn("Article / Interview", "width: 55%");
            var dateCol = new HTMLTableColumn("Date");
            var pubCol  = new HTMLTableColumn("Publisher");
            var srcCol  = new HTMLTableColumn("Sources / Mirrors");
            var table   = new HTMLTable(artCol, dateCol, pubCol, srcCol);

            foreach (var a in articles)
            {
                table.Row(HTML.Link(a.title, a.primarySource), a.date, a.publisher ?? "", HTML.LinksString(a.sources));
            }
            template = template.Replace("<!--ARTICLES_TABLE-->", table.ToString());



            table = new HTMLTable(new HTMLTableColumn("Video", "width: 80%"), dateCol);
            foreach (var v in videos)
            {
                table.Row(HTML.Link(v.title, v.primarySource), v.dateHTMLLinks);
            }

            template = template.Replace("<!--VIDEOS_TABLE-->", table.ToString());

            table = new HTMLTable(new HTMLTableColumn("Game", "width: 80%"), new HTMLTableColumn("Year"));
            foreach (var s in source)
            {
                table.Row(HTML.Link(s.game, s.url), s.year);
            }
            template = template.Replace("<!--SOURCE_TABLE-->", table.ToString());

            table = new HTMLTable(new HTMLTableColumn("Audio", "width: 80%"), dateCol);
            foreach (var a in audio)
            {
                table.Row(HTML.Link(a.title, a.primarySource), a.dateHTMLLinks);
            }
            template = template.Replace("<!--AUDIO_TABLE-->", table.ToString());

            File.WriteAllText(Data.OutputDir + "/index.html", template);
            File.WriteAllText(Data.OutputDir + "/style.css", css);
        }