diff -r 77e062628ef5 -r 361e324a0ed4 Hardware/ReportWriter.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hardware/ReportWriter.cs Tue Jan 26 22:37:48 2010 +0000 @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace OpenHardwareMonitor.Hardware { + public class ReportWriter { + + private static void NewSection(TextWriter writer) { + for (int i = 0; i < 8; i++) + writer.Write("----------"); + writer.WriteLine(); + writer.WriteLine(); + } + + public static void Save(List groupList, Version version) { + + using (TextWriter w = + new StreamWriter("OpenHardwareMonitor.Report.txt")) { + + w.WriteLine(); + w.WriteLine("Open Hardware Monitor Report"); + w.WriteLine(); + NewSection(w); + w.Write("Version: "); w.WriteLine(version.ToString()); + w.WriteLine(); + + foreach (IGroup group in groupList) { + string report = group.GetReport(); + if (report != null) { + NewSection(w); + w.Write(report); + } + + IHardware[] hardwareArray = group.Hardware; + foreach (IHardware hardware in hardwareArray) { + string hardwareReport = hardware.GetReport(); + if (hardwareReport != null) { + NewSection(w); + w.Write(hardwareReport); + } + } + } + } + } + } +}