1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Hardware/ReportWriter.cs Tue Jan 26 22:37:48 2010 +0000
1.3 @@ -0,0 +1,47 @@
1.4 +using System;
1.5 +using System.Collections.Generic;
1.6 +using System.IO;
1.7 +using System.Text;
1.8 +
1.9 +namespace OpenHardwareMonitor.Hardware {
1.10 + public class ReportWriter {
1.11 +
1.12 + private static void NewSection(TextWriter writer) {
1.13 + for (int i = 0; i < 8; i++)
1.14 + writer.Write("----------");
1.15 + writer.WriteLine();
1.16 + writer.WriteLine();
1.17 + }
1.18 +
1.19 + public static void Save(List<IGroup> groupList, Version version) {
1.20 +
1.21 + using (TextWriter w =
1.22 + new StreamWriter("OpenHardwareMonitor.Report.txt")) {
1.23 +
1.24 + w.WriteLine();
1.25 + w.WriteLine("Open Hardware Monitor Report");
1.26 + w.WriteLine();
1.27 + NewSection(w);
1.28 + w.Write("Version: "); w.WriteLine(version.ToString());
1.29 + w.WriteLine();
1.30 +
1.31 + foreach (IGroup group in groupList) {
1.32 + string report = group.GetReport();
1.33 + if (report != null) {
1.34 + NewSection(w);
1.35 + w.Write(report);
1.36 + }
1.37 +
1.38 + IHardware[] hardwareArray = group.Hardware;
1.39 + foreach (IHardware hardware in hardwareArray) {
1.40 + string hardwareReport = hardware.GetReport();
1.41 + if (hardwareReport != null) {
1.42 + NewSection(w);
1.43 + w.Write(hardwareReport);
1.44 + }
1.45 + }
1.46 + }
1.47 + }
1.48 + }
1.49 + }
1.50 +}