Hardware/ReportWriter.cs
author moel.mich
Sun, 31 Jan 2010 20:57:18 +0000
changeset 14 51c2f209da6d
child 18 49220085218d
permissions -rw-r--r--
Release version 0.1.5. Added support for AMD family 0Fh CPUs. Fixed saving of wrong window size values for minimized forms (by not saving them).
     1 using System;
     2 using System.Collections.Generic;
     3 using System.IO;
     4 using System.Text;
     5 
     6 namespace OpenHardwareMonitor.Hardware {
     7   public class ReportWriter {
     8 
     9     private static void NewSection(TextWriter writer) {      
    10       for (int i = 0; i < 8; i++)
    11         writer.Write("----------");
    12       writer.WriteLine();
    13       writer.WriteLine();
    14     }
    15 
    16     public static void Save(List<IGroup> groupList, Version version) {
    17 
    18       using (TextWriter w =
    19         new StreamWriter("OpenHardwareMonitor.Report.txt")) {
    20 
    21         w.WriteLine();
    22         w.WriteLine("Open Hardware Monitor Report");
    23         w.WriteLine();
    24         NewSection(w);
    25         w.Write("Version: "); w.WriteLine(version.ToString());
    26         w.WriteLine();
    27 
    28         foreach (IGroup group in groupList) {
    29           string report = group.GetReport();
    30           if (report != null) {
    31             NewSection(w);
    32             w.Write(report);            
    33           }
    34 
    35           IHardware[] hardwareArray = group.Hardware;
    36           foreach (IHardware hardware in hardwareArray) {
    37             string hardwareReport = hardware.GetReport();
    38             if (hardwareReport != null) {
    39               NewSection(w);
    40               w.Write(hardwareReport);
    41             }
    42           }
    43         }
    44       }
    45     }
    46   }
    47 }