mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-29 13:28:04 +00:00
Added a dialog for the report filename. Added additional checks to T-Balancer code for cases where the port gets closed. Moved the timer to the Computer class.
This commit is contained in:
parent
e0e30c4b55
commit
d5ed83e09a
31
GUI/MainForm.Designer.cs
generated
31
GUI/MainForm.Designer.cs
generated
@ -102,7 +102,6 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.timer = new System.Windows.Forms.Timer(this.components);
|
|
||||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||||
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
||||||
this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
@ -110,6 +109,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.columnsContextMenuStrip.SuspendLayout();
|
this.columnsContextMenuStrip.SuspendLayout();
|
||||||
this.menuStrip.SuspendLayout();
|
this.menuStrip.SuspendLayout();
|
||||||
this.splitContainer.Panel1.SuspendLayout();
|
this.splitContainer.Panel1.SuspendLayout();
|
||||||
@ -314,14 +314,14 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
// saveReportToolStripMenuItem
|
// saveReportToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.saveReportToolStripMenuItem.Name = "saveReportToolStripMenuItem";
|
this.saveReportToolStripMenuItem.Name = "saveReportToolStripMenuItem";
|
||||||
this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(136, 22);
|
this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.saveReportToolStripMenuItem.Text = "Save Report";
|
this.saveReportToolStripMenuItem.Text = "Save Report...";
|
||||||
this.saveReportToolStripMenuItem.Click += new System.EventHandler(this.saveReportToolStripMenuItem_Click);
|
this.saveReportToolStripMenuItem.Click += new System.EventHandler(this.saveReportToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem
|
// exitToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(136, 22);
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.exitToolStripMenuItem.Text = "Exit";
|
this.exitToolStripMenuItem.Text = "Exit";
|
||||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
@ -486,11 +486,6 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.aboutToolStripMenuItem.Text = "About";
|
this.aboutToolStripMenuItem.Text = "About";
|
||||||
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
|
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// timer
|
|
||||||
//
|
|
||||||
this.timer.Interval = 1000;
|
|
||||||
this.timer.Tick += new System.EventHandler(this.timer_Tick);
|
|
||||||
//
|
|
||||||
// splitContainer
|
// splitContainer
|
||||||
//
|
//
|
||||||
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
@ -528,25 +523,25 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.toolStripMenuItem2,
|
this.toolStripMenuItem2,
|
||||||
this.exitToolStripMenuItem1});
|
this.exitToolStripMenuItem1});
|
||||||
this.notifyContextMenuStrip.Name = "notifyContextMenuStrip";
|
this.notifyContextMenuStrip.Name = "notifyContextMenuStrip";
|
||||||
this.notifyContextMenuStrip.Size = new System.Drawing.Size(153, 76);
|
this.notifyContextMenuStrip.Size = new System.Drawing.Size(137, 54);
|
||||||
//
|
//
|
||||||
// hideShowToolStripMenuItem
|
// hideShowToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.hideShowToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
this.hideShowToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||||
this.hideShowToolStripMenuItem.Name = "hideShowToolStripMenuItem";
|
this.hideShowToolStripMenuItem.Name = "hideShowToolStripMenuItem";
|
||||||
this.hideShowToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
this.hideShowToolStripMenuItem.Size = new System.Drawing.Size(136, 22);
|
||||||
this.hideShowToolStripMenuItem.Text = "Hide/Show";
|
this.hideShowToolStripMenuItem.Text = "Hide/Show";
|
||||||
this.hideShowToolStripMenuItem.Click += new System.EventHandler(this.hideShowClick);
|
this.hideShowToolStripMenuItem.Click += new System.EventHandler(this.hideShowClick);
|
||||||
//
|
//
|
||||||
// toolStripMenuItem2
|
// toolStripMenuItem2
|
||||||
//
|
//
|
||||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
|
this.toolStripMenuItem2.Size = new System.Drawing.Size(133, 6);
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem1
|
// exitToolStripMenuItem1
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1";
|
this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1";
|
||||||
this.exitToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
|
this.exitToolStripMenuItem1.Size = new System.Drawing.Size(136, 22);
|
||||||
this.exitToolStripMenuItem1.Text = "Exit";
|
this.exitToolStripMenuItem1.Text = "Exit";
|
||||||
this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
@ -555,6 +550,14 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
|
this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
|
||||||
this.sensorContextMenuStrip.Size = new System.Drawing.Size(61, 4);
|
this.sensorContextMenuStrip.Size = new System.Drawing.Size(61, 4);
|
||||||
//
|
//
|
||||||
|
// saveFileDialog
|
||||||
|
//
|
||||||
|
this.saveFileDialog.DefaultExt = "txt";
|
||||||
|
this.saveFileDialog.FileName = "OpenHardwareMonitor.Report.txt";
|
||||||
|
this.saveFileDialog.Filter = "Text Documents|*.txt|All Files|*.*";
|
||||||
|
this.saveFileDialog.RestoreDirectory = true;
|
||||||
|
this.saveFileDialog.Title = "Save Report As";
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
@ -596,7 +599,6 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxValue;
|
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxValue;
|
||||||
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxMin;
|
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxMin;
|
||||||
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxMax;
|
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxMax;
|
||||||
private System.Windows.Forms.Timer timer;
|
|
||||||
private System.Windows.Forms.SplitContainer splitContainer;
|
private System.Windows.Forms.SplitContainer splitContainer;
|
||||||
private PlotPanel plotPanel;
|
private PlotPanel plotPanel;
|
||||||
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
|
||||||
@ -631,6 +633,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private System.Windows.Forms.ToolStripMenuItem startMinMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem startMinMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem flowsMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem flowsMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem startupMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem startupMenuItem;
|
||||||
|
private System.Windows.Forms.SaveFileDialog saveFileDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Aga.Controls.Tree;
|
using Aga.Controls.Tree;
|
||||||
@ -112,6 +113,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
|
|
||||||
computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
|
computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
|
||||||
computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
|
computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
|
||||||
|
computer.Updated += new UpdateEventHandler(Updated);
|
||||||
computer.Open();
|
computer.Open();
|
||||||
|
|
||||||
plotColorPalette = new Color[14];
|
plotColorPalette = new Color[14];
|
||||||
@ -147,8 +149,6 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
fansMenuItem.Checked = Config.Get(fansMenuItem.Name, true);
|
fansMenuItem.Checked = Config.Get(fansMenuItem.Name, true);
|
||||||
flowsMenuItem.Checked = Config.Get(flowsMenuItem.Name, true);
|
flowsMenuItem.Checked = Config.Get(flowsMenuItem.Name, true);
|
||||||
|
|
||||||
timer.Enabled = true;
|
|
||||||
|
|
||||||
if (startMinMenuItem.Checked) {
|
if (startMinMenuItem.Checked) {
|
||||||
if (!minTrayMenuItem.Checked) {
|
if (!minTrayMenuItem.Checked) {
|
||||||
WindowState = FormWindowState.Minimized;
|
WindowState = FormWindowState.Minimized;
|
||||||
@ -239,19 +239,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void timer_Tick(object sender, EventArgs e) {
|
private void Updated() {
|
||||||
|
|
||||||
#if !DEBUG
|
|
||||||
try {
|
|
||||||
#endif
|
|
||||||
computer.Update();
|
|
||||||
#if !DEBUG
|
|
||||||
} catch (Exception exception) {
|
|
||||||
CrashReport.Save(exception);
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
treeView.Invalidate();
|
treeView.Invalidate();
|
||||||
plotPanel.Invalidate();
|
plotPanel.Invalidate();
|
||||||
sensorSystemTray.Redraw();
|
sensorSystemTray.Redraw();
|
||||||
@ -359,7 +347,12 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveReportToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void saveReportToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
computer.SaveReport(new Version(Application.ProductVersion));
|
string report = computer.GetReport();
|
||||||
|
if (saveFileDialog.ShowDialog() == DialogResult.OK) {
|
||||||
|
using (TextWriter w = new StreamWriter(saveFileDialog.FileName)) {
|
||||||
|
w.Write(report);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hddsensorsToolStripMenuItem_CheckedChanged(object sender,
|
private void hddsensorsToolStripMenuItem_CheckedChanged(object sender,
|
||||||
|
@ -118,19 +118,19 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="columnsContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="columnsContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>204, 15</value>
|
<value>125, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>124, 15</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="notifyContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="notifyContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>399, 15</value>
|
<value>322, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="sensorContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="sensorContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>571, 15</value>
|
<value>504, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>690, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>55</value>
|
<value>55</value>
|
||||||
|
@ -45,10 +45,10 @@ using OpenHardwareMonitor.Utilities;
|
|||||||
|
|
||||||
namespace OpenHardwareMonitor.GUI {
|
namespace OpenHardwareMonitor.GUI {
|
||||||
public class SensorSystemTray : IDisposable {
|
public class SensorSystemTray : IDisposable {
|
||||||
private Computer computer;
|
private IComputer computer;
|
||||||
private List<SensorNotifyIcon> list = new List<SensorNotifyIcon>();
|
private List<SensorNotifyIcon> list = new List<SensorNotifyIcon>();
|
||||||
|
|
||||||
public SensorSystemTray(Computer computer) {
|
public SensorSystemTray(IComputer computer) {
|
||||||
this.computer = computer;
|
this.computer = computer;
|
||||||
computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
|
computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
|
||||||
computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
|
computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
|
||||||
|
@ -40,12 +40,13 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace OpenHardwareMonitor.Hardware {
|
namespace OpenHardwareMonitor.Hardware {
|
||||||
|
|
||||||
public delegate void HardwareEventHandler(IHardware hardware);
|
public class Computer : IComputer {
|
||||||
|
|
||||||
public class Computer {
|
private Timer timer;
|
||||||
|
|
||||||
private List<IGroup> groups = new List<IGroup>();
|
private List<IGroup> groups = new List<IGroup>();
|
||||||
|
|
||||||
@ -90,6 +91,20 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
Add(new HDD.HDDGroup());
|
Add(new HDD.HDDGroup());
|
||||||
|
|
||||||
open = true;
|
open = true;
|
||||||
|
|
||||||
|
timer = new Timer(
|
||||||
|
delegate(Object stateInfo) {
|
||||||
|
#if !DEBUG
|
||||||
|
try {
|
||||||
|
#endif
|
||||||
|
Update();
|
||||||
|
#if !DEBUG
|
||||||
|
} catch (Exception exception) {
|
||||||
|
Utilities.CrashReport.Save(exception);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}, null, 1000, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SubHardwareUpdate(IHardware hardware) {
|
private void SubHardwareUpdate(IHardware hardware) {
|
||||||
@ -99,12 +114,14 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update() {
|
private void Update() {
|
||||||
foreach (IGroup group in groups)
|
foreach (IGroup group in groups)
|
||||||
foreach (IHardware hardware in group.Hardware) {
|
foreach (IHardware hardware in group.Hardware) {
|
||||||
hardware.Update();
|
hardware.Update();
|
||||||
SubHardwareUpdate(hardware);
|
SubHardwareUpdate(hardware);
|
||||||
}
|
}
|
||||||
|
if (Updated != null)
|
||||||
|
Updated();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HDDEnabled {
|
public bool HDDEnabled {
|
||||||
@ -124,11 +141,13 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IHardware> Hardware {
|
public IHardware[] Hardware {
|
||||||
get {
|
get {
|
||||||
|
List<IHardware> list = new List<IHardware>();
|
||||||
foreach (IGroup group in groups)
|
foreach (IGroup group in groups)
|
||||||
foreach (IHardware hardware in group.Hardware)
|
foreach (IHardware hardware in group.Hardware)
|
||||||
yield return hardware;
|
list.Add(hardware);
|
||||||
|
return list.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,8 +159,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ReportHardwareTree(IHardware hardware, TextWriter w,
|
private void ReportHardwareTree(IHardware hardware, TextWriter w,
|
||||||
string space)
|
string space) {
|
||||||
{
|
|
||||||
w.WriteLine("{0}|", space);
|
w.WriteLine("{0}|", space);
|
||||||
w.WriteLine("{0}+-+ {1} ({2})",
|
w.WriteLine("{0}+-+ {1} ({2})",
|
||||||
space, hardware.Name, hardware.Identifier);
|
space, hardware.Name, hardware.Identifier);
|
||||||
@ -171,15 +189,16 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
ReportHardware(subHardware, w);
|
ReportHardware(subHardware, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveReport(Version version) {
|
public string GetReport() {
|
||||||
|
|
||||||
using (TextWriter w =
|
using (StringWriter w = new StringWriter()) {
|
||||||
new StreamWriter("OpenHardwareMonitor.Report.txt")) {
|
|
||||||
|
|
||||||
w.WriteLine();
|
w.WriteLine();
|
||||||
w.WriteLine("Open Hardware Monitor Report");
|
w.WriteLine("Open Hardware Monitor Report");
|
||||||
w.WriteLine();
|
w.WriteLine();
|
||||||
|
|
||||||
|
Version version = typeof(Computer).Assembly.GetName().Version;
|
||||||
|
|
||||||
NewSection(w);
|
NewSection(w);
|
||||||
w.Write("Version: "); w.WriteLine(version.ToString());
|
w.Write("Version: "); w.WriteLine(version.ToString());
|
||||||
w.WriteLine();
|
w.WriteLine();
|
||||||
@ -203,10 +222,14 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
ReportHardware(hardware, w);
|
ReportHardware(hardware, w);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return w.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close() {
|
public void Close() {
|
||||||
|
timer.Dispose();
|
||||||
|
timer = null;
|
||||||
|
|
||||||
if (!open)
|
if (!open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -217,6 +240,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
open = false;
|
open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event UpdateEventHandler Updated;
|
||||||
public event HardwareEventHandler HardwareAdded;
|
public event HardwareEventHandler HardwareAdded;
|
||||||
public event HardwareEventHandler HardwareRemoved;
|
public event HardwareEventHandler HardwareRemoved;
|
||||||
|
|
||||||
|
58
Hardware/IComputer.cs
Normal file
58
Hardware/IComputer.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
|
||||||
|
The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
for the specific language governing rights and limitations under the License.
|
||||||
|
|
||||||
|
The Original Code is the Open Hardware Monitor code.
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is
|
||||||
|
Michael Möller <m.moeller@gmx.ch>.
|
||||||
|
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
||||||
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
|
||||||
|
Alternatively, the contents of this file may be used under the terms of
|
||||||
|
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
of those above. If you wish to allow use of your version of this file only
|
||||||
|
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
use your version of this file under the terms of the MPL, indicate your
|
||||||
|
decision by deleting the provisions above and replace them with the notice
|
||||||
|
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
the provisions above, a recipient may use your version of this file under
|
||||||
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OpenHardwareMonitor.Hardware {
|
||||||
|
|
||||||
|
public delegate void UpdateEventHandler();
|
||||||
|
public delegate void HardwareEventHandler(IHardware hardware);
|
||||||
|
|
||||||
|
public interface IComputer {
|
||||||
|
|
||||||
|
IHardware[] Hardware { get; }
|
||||||
|
|
||||||
|
bool HDDEnabled { get; set; }
|
||||||
|
|
||||||
|
string GetReport();
|
||||||
|
|
||||||
|
event UpdateEventHandler Updated;
|
||||||
|
event HardwareEventHandler HardwareAdded;
|
||||||
|
event HardwareEventHandler HardwareRemoved;
|
||||||
|
}
|
||||||
|
}
|
@ -326,17 +326,23 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Update() {
|
public void Update() {
|
||||||
while (serialPort.BytesToRead >= 285)
|
try {
|
||||||
ReadData();
|
while (serialPort.IsOpen && serialPort.BytesToRead >= 285)
|
||||||
if (serialPort.BytesToRead == 1)
|
ReadData();
|
||||||
serialPort.ReadByte();
|
if (serialPort.BytesToRead == 1)
|
||||||
|
serialPort.ReadByte();
|
||||||
|
|
||||||
serialPort.Write(new byte[] { 0x38 }, 0, 1);
|
serialPort.Write(new byte[] { 0x38 }, 0, 1);
|
||||||
alternativeRequest.BeginInvoke(null, null);
|
alternativeRequest.BeginInvoke(null, null);
|
||||||
|
} catch (InvalidOperationException) {
|
||||||
|
foreach (Sensor sensor in active)
|
||||||
|
sensor.Value = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close() {
|
public void Close() {
|
||||||
serialPort.Close();
|
if (serialPort.IsOpen)
|
||||||
|
serialPort.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public event SensorEventHandler SensorAdded;
|
public event SensorEventHandler SensorAdded;
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
<Compile Include="Hardware\HDD\HDD.cs" />
|
<Compile Include="Hardware\HDD\HDD.cs" />
|
||||||
<Compile Include="Hardware\HDD\HDDGroup.cs" />
|
<Compile Include="Hardware\HDD\HDDGroup.cs" />
|
||||||
<Compile Include="Hardware\HDD\SMART.cs" />
|
<Compile Include="Hardware\HDD\SMART.cs" />
|
||||||
|
<Compile Include="Hardware\IComputer.cs" />
|
||||||
<Compile Include="Hardware\IParameter.cs" />
|
<Compile Include="Hardware\IParameter.cs" />
|
||||||
<Compile Include="Hardware\LPC\Chip.cs" />
|
<Compile Include="Hardware\LPC\Chip.cs" />
|
||||||
<Compile Include="Hardware\LPC\F718XX.cs" />
|
<Compile Include="Hardware\LPC\F718XX.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user