Fixed Issue 164.
authormoel.mich
Sat, 12 Feb 2011 21:17:42 +0000
changeset 2566dc6410489f4
parent 255 a608358af258
child 257 f4bcb097746d
Fixed Issue 164.
Hardware/Computer.cs
Hardware/Heatmaster/HeatmasterGroup.cs
Hardware/Ring0.cs
Hardware/TBalancer/TBalancerGroup.cs
     1.1 --- a/Hardware/Computer.cs	Fri Feb 11 22:29:26 2011 +0000
     1.2 +++ b/Hardware/Computer.cs	Sat Feb 12 21:17:42 2011 +0000
     1.3 @@ -151,42 +151,43 @@
     1.4        IHardware hardware, TextWriter w, string space) 
     1.5      {
     1.6        w.WriteLine("{0}|", space);
     1.7 -      w.WriteLine("{0}+-+ {1} ({2})",
     1.8 +      w.WriteLine("{0}+- {1} ({2})",
     1.9          space, hardware.Name, hardware.Identifier);
    1.10        ISensor[] sensors = hardware.Sensors;
    1.11        Array.Sort(sensors, CompareSensor);
    1.12        foreach (ISensor sensor in sensors) {
    1.13 -        w.WriteLine("{0}|   +- {1}[{2}] : {3} : {4}",
    1.14 -          space, sensor.SensorType, sensor.Index, 
    1.15 -            string.Format(CultureInfo.InvariantCulture, "{0} : {1} : {2}",
    1.16 -            sensor.Value, sensor.Min, sensor.Max), sensor.Name);
    1.17 +        w.WriteLine("{0}|  +- {1,-14} : {2,8:G6} {3,8:G6} {4,8:G6} ({5})", 
    1.18 +          space, sensor.Name, sensor.Value, sensor.Min, sensor.Max, 
    1.19 +          sensor.Identifier);
    1.20        }
    1.21        foreach (IHardware subHardware in hardware.SubHardware)
    1.22 -        ReportHardwareSensorTree(subHardware, w, "|   ");
    1.23 +        ReportHardwareSensorTree(subHardware, w, "|  ");
    1.24      }
    1.25  
    1.26      private static void ReportHardwareParameterTree(
    1.27 -      IHardware hardware, TextWriter w, string space) 
    1.28 -    {
    1.29 +      IHardware hardware, TextWriter w, string space) {
    1.30        w.WriteLine("{0}|", space);
    1.31 -      w.WriteLine("{0}+-+ {1} ({2})",
    1.32 +      w.WriteLine("{0}+- {1} ({2})",
    1.33          space, hardware.Name, hardware.Identifier);
    1.34        ISensor[] sensors = hardware.Sensors;
    1.35        Array.Sort(sensors, CompareSensor);
    1.36        foreach (ISensor sensor in sensors) {
    1.37 +        string innerSpace = space + "|  ";
    1.38          if (sensor.Parameters.Length > 0) {
    1.39 -          w.WriteLine("{0}|   +- {1}[{2}] : {3}",
    1.40 -            space, sensor.SensorType, sensor.Index, sensor.Name);
    1.41 +          w.WriteLine("{0}|", innerSpace);
    1.42 +          w.WriteLine("{0}+- {1} ({2})",
    1.43 +            innerSpace, sensor.Name, sensor.Identifier);
    1.44            foreach (IParameter parameter in sensor.Parameters) {
    1.45 -            w.WriteLine("{0}|      +- {1} : {2}",
    1.46 -              space, parameter.Name,
    1.47 +            string innerInnerSpace = innerSpace + "|  ";
    1.48 +            w.WriteLine("{0}+- {1} : {2}",
    1.49 +              innerInnerSpace, parameter.Name,
    1.50                string.Format(CultureInfo.InvariantCulture, "{0} : {1}",
    1.51                  parameter.DefaultValue, parameter.Value));
    1.52            }
    1.53          }
    1.54        }
    1.55        foreach (IHardware subHardware in hardware.SubHardware)
    1.56 -        ReportHardwareParameterTree(subHardware, w, "|   ");
    1.57 +        ReportHardwareParameterTree(subHardware, w, "|  ");
    1.58      }
    1.59  
    1.60      private static void ReportHardware(IHardware hardware, TextWriter w) {
     2.1 --- a/Hardware/Heatmaster/HeatmasterGroup.cs	Fri Feb 11 22:29:26 2011 +0000
     2.2 +++ b/Hardware/Heatmaster/HeatmasterGroup.cs	Sat Feb 12 21:17:42 2011 +0000
     2.3 @@ -182,10 +182,12 @@
     2.4  
     2.5      public string GetReport() {
     2.6        if (report.Length > 0) {
     2.7 -        report.Insert(0, "Serial Port Heatmaster" + Environment.NewLine +
     2.8 -          Environment.NewLine);
     2.9 -        report.AppendLine();
    2.10 -        return report.ToString();
    2.11 +        StringBuilder r = new StringBuilder();
    2.12 +        r.AppendLine("Serial Port Heatmaster");
    2.13 +        r.AppendLine();
    2.14 +        r.Append(report);
    2.15 +        r.AppendLine();
    2.16 +        return r.ToString();
    2.17        } else
    2.18          return null;
    2.19      }
     3.1 --- a/Hardware/Ring0.cs	Fri Feb 11 22:29:26 2011 +0000
     3.2 +++ b/Hardware/Ring0.cs	Sat Feb 12 21:17:42 2011 +0000
     3.3 @@ -168,10 +168,12 @@
     3.4  
     3.5      public static string GetReport() {
     3.6        if (report.Length > 0) {
     3.7 -        report.Insert(0, "Ring0" + Environment.NewLine +
     3.8 -          Environment.NewLine);
     3.9 -        report.AppendLine();
    3.10 -        return report.ToString();
    3.11 +        StringBuilder r = new StringBuilder();
    3.12 +        r.AppendLine("Ring0");
    3.13 +        r.AppendLine();
    3.14 +        r.Append(report);
    3.15 +        r.AppendLine();
    3.16 +        return r.ToString();
    3.17        } else
    3.18          return null;
    3.19      }
     4.1 --- a/Hardware/TBalancer/TBalancerGroup.cs	Fri Feb 11 22:29:26 2011 +0000
     4.2 +++ b/Hardware/TBalancer/TBalancerGroup.cs	Sat Feb 12 21:17:42 2011 +0000
     4.3 @@ -163,10 +163,12 @@
     4.4  
     4.5      public string GetReport() {
     4.6        if (report.Length > 0) {
     4.7 -        report.Insert(0, "FTD2XX" + Environment.NewLine +
     4.8 -          Environment.NewLine);
     4.9 -        report.AppendLine();
    4.10 -        return report.ToString();
    4.11 +        StringBuilder r = new StringBuilder();
    4.12 +        r.AppendLine("FTD2XX");
    4.13 +        r.AppendLine();
    4.14 +        r.Append(report);
    4.15 +        r.AppendLine();
    4.16 +        return r.ToString();
    4.17        } else
    4.18          return null;
    4.19      }