// Spludlow Software // Copyright © Samuel P. Ludlow 2020 All Rights Reserved // Distributed under the terms of the GNU General Public License version 3 // Distributed WITHOUT ANY WARRANTY; without implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE // https://www.spludlow.co.uk/LICENCE.TXT // The Spludlow logo is a registered trademark of Samuel P. Ludlow and may not be used without permission // v1.14 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using System.IO; namespace Spludlow.Mame { public class MameReport { private static readonly string Style = "body {" + " font-family: sans-serif;" + " font-size: small;" + " background-color: #c6eafb;" + "}" + "hr {" + " color: #00ADEF;" + " background-color: #00ADEF;" + " height: 6px;" + " border: none;" + " padding-left: 0px;" + "}" + "table {" + " border-collapse: collapse;" + "}" + "th, td {" + " padding: 2px;" + " text-align: left;" + "}" + "table, th, td {" + " border: 1px solid black;" + "}" + "th {" + " background-color: #00ADEF;" + " color: white;" + "}" + "tr:nth-child(even) {" + " background-color: #b6daeb;" + "}" + ""; public static void Report(string title, DataTable table) { if (table.DataSet == null) { DataSet dataSet = new DataSet(); dataSet.Tables.Add(table); } Report(title, table.DataSet); } public static void Report(string title, DataSet dataSet) { // If running Spludlow Spludlow.Log.Report(title, dataSet); MameConfiguration config = new MameConfiguration(); string name = Spludlow.Text.TimeStamp() + "_" + title; StringBuilder html = new StringBuilder(); html.AppendLine(""); html.AppendLine(""); html.AppendLine("
"); html.AppendLine(""); html.AppendLine("" + name + "Spludlow MAME Hash Store
"); html.AppendLine(""); string filename = config.ReportDirectory + @"\" + name + ".htm"; File.WriteAllText(filename, html.ToString(), Encoding.UTF8); } ///