mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-22 09:57:20 +00:00
Added support for sensor parameters. Fixed Core and Thread count detection for Intel Core i7 CPUs with disabled HyperThreading.
This commit is contained in:
parent
f7d8eb1d48
commit
f208712a0d
5
GUI/AboutBox.Designer.cs
generated
5
GUI/AboutBox.Designer.cs
generated
@ -122,9 +122,9 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.label3.Location = new System.Drawing.Point(86, 36);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(12, 0, 12, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(99, 15);
|
||||
this.label3.Size = new System.Drawing.Size(132, 15);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "Version " + System.Windows.Forms.Application.ProductVersion + " Beta";
|
||||
this.label3.Text = "Version 9.0.30729.1 Beta";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
@ -189,6 +189,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AboutBox";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "About";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
|
23
GUI/MainForm.Designer.cs
generated
23
GUI/MainForm.Designer.cs
generated
@ -103,12 +103,12 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.timer = new System.Windows.Forms.Timer(this.components);
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
||||
this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
||||
this.columnsContextMenuStrip.SuspendLayout();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
@ -148,6 +148,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.treeView.TabIndex = 0;
|
||||
this.treeView.Text = "treeView";
|
||||
this.treeView.UseColumns = true;
|
||||
this.treeView.NodeMouseDoubleClick += new System.EventHandler<Aga.Controls.Tree.TreeNodeAdvMouseEventArgs>(this.treeView_NodeMouseDoubleClick);
|
||||
this.treeView.Click += new System.EventHandler(this.treeView_Click);
|
||||
//
|
||||
// sensor
|
||||
@ -501,6 +502,16 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.splitContainer.SplitterWidth = 3;
|
||||
this.splitContainer.TabIndex = 3;
|
||||
//
|
||||
// plotPanel
|
||||
//
|
||||
this.plotPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.plotPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.plotPanel.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.plotPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.plotPanel.Name = "plotPanel";
|
||||
this.plotPanel.Size = new System.Drawing.Size(478, 198);
|
||||
this.plotPanel.TabIndex = 0;
|
||||
//
|
||||
// notifyContextMenuStrip
|
||||
//
|
||||
this.notifyContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@ -535,16 +546,6 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
|
||||
this.sensorContextMenuStrip.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// plotPanel
|
||||
//
|
||||
this.plotPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.plotPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.plotPanel.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.plotPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.plotPanel.Name = "plotPanel";
|
||||
this.plotPanel.Size = new System.Drawing.Size(478, 198);
|
||||
this.plotPanel.TabIndex = 0;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
|
@ -63,7 +63,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
InitializeComponent();
|
||||
this.Font = SystemFonts.MessageBoxFont;
|
||||
treeView.Font = SystemFonts.MessageBoxFont;
|
||||
plotPanel.Font = SystemFonts.MessageBoxFont;
|
||||
plotPanel.Font = SystemFonts.MessageBoxFont;
|
||||
|
||||
nodeCheckBox.IsVisibleValueNeeded +=
|
||||
new EventHandler<NodeControlValueEventArgs>(
|
||||
@ -320,6 +320,13 @@ namespace OpenHardwareMonitor.GUI {
|
||||
if (node != null && node.Sensor != null) {
|
||||
|
||||
sensorContextMenuStrip.Items.Clear();
|
||||
if (node.Sensor.Parameters.Length > 0) {
|
||||
ToolStripMenuItem item = new ToolStripMenuItem("Parameters...");
|
||||
item.Click += delegate(object obj, EventArgs args) {
|
||||
ShowParameterForm(node.Sensor);
|
||||
};
|
||||
sensorContextMenuStrip.Items.Add(item);
|
||||
}
|
||||
if (sensorSystemTray.Contains(node.Sensor)) {
|
||||
ToolStripMenuItem item = new ToolStripMenuItem("Remove From Tray");
|
||||
item.Click += delegate(object obj, EventArgs args) {
|
||||
@ -398,5 +405,21 @@ namespace OpenHardwareMonitor.GUI {
|
||||
|
||||
sensorSystemTray.Remove(sensor);
|
||||
}
|
||||
|
||||
private void ShowParameterForm(ISensor sensor) {
|
||||
ParameterForm form = new ParameterForm();
|
||||
form.Parameters = sensor.Parameters;
|
||||
form.captionLabel.Text = sensor.Name;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void treeView_NodeMouseDoubleClick(object sender,
|
||||
TreeNodeAdvMouseEventArgs e) {
|
||||
SensorNode node = e.Node.Tag as SensorNode;
|
||||
if (node != null && node.Sensor != null &&
|
||||
node.Sensor.Parameters.Length > 0) {
|
||||
ShowParameterForm(node.Sensor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
188
GUI/ParameterForm.Designer.cs
generated
Normal file
188
GUI/ParameterForm.Designer.cs
generated
Normal file
@ -0,0 +1,188 @@
|
||||
namespace OpenHardwareMonitor.GUI {
|
||||
partial class ParameterForm {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.captionLabel = new System.Windows.Forms.Label();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.NameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Default = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.ValueColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.bindingSource = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.descriptionLabel = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.Location = new System.Drawing.Point(186, 213);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.okButton.TabIndex = 2;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(267, 213);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.cancelButton.TabIndex = 3;
|
||||
this.cancelButton.Text = "Canel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// captionLabel
|
||||
//
|
||||
this.captionLabel.AutoSize = true;
|
||||
this.captionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.captionLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.captionLabel.Name = "captionLabel";
|
||||
this.captionLabel.Size = new System.Drawing.Size(80, 13);
|
||||
this.captionLabel.TabIndex = 4;
|
||||
this.captionLabel.Text = "captionLabel";
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.AllowUserToResizeRows = false;
|
||||
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataGridView.AutoGenerateColumns = false;
|
||||
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
||||
this.dataGridView.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.NameColumn,
|
||||
this.Default,
|
||||
this.ValueColumn});
|
||||
this.dataGridView.DataSource = this.bindingSource;
|
||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dataGridView.DefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dataGridView.Location = new System.Drawing.Point(15, 30);
|
||||
this.dataGridView.MultiSelect = false;
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersVisible = false;
|
||||
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dataGridView.ShowRowErrors = false;
|
||||
this.dataGridView.Size = new System.Drawing.Size(327, 121);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
this.dataGridView.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_RowEnter);
|
||||
this.dataGridView.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView_CellValidating);
|
||||
this.dataGridView.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellEndEdit);
|
||||
this.dataGridView.CurrentCellDirtyStateChanged += new System.EventHandler(this.dataGridView_CurrentCellDirtyStateChanged);
|
||||
//
|
||||
// NameColumn
|
||||
//
|
||||
this.NameColumn.DataPropertyName = "Name";
|
||||
this.NameColumn.HeaderText = "Name";
|
||||
this.NameColumn.Name = "NameColumn";
|
||||
this.NameColumn.ReadOnly = true;
|
||||
this.NameColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Default
|
||||
//
|
||||
this.Default.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
this.Default.DataPropertyName = "Default";
|
||||
this.Default.HeaderText = "Default";
|
||||
this.Default.Name = "Default";
|
||||
this.Default.Width = 47;
|
||||
//
|
||||
// ValueColumn
|
||||
//
|
||||
this.ValueColumn.DataPropertyName = "Value";
|
||||
this.ValueColumn.HeaderText = "Value";
|
||||
this.ValueColumn.Name = "ValueColumn";
|
||||
this.ValueColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// bindingSource
|
||||
//
|
||||
this.bindingSource.AllowNew = false;
|
||||
//
|
||||
// descriptionLabel
|
||||
//
|
||||
this.descriptionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.descriptionLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.descriptionLabel.Location = new System.Drawing.Point(15, 154);
|
||||
this.descriptionLabel.Name = "descriptionLabel";
|
||||
this.descriptionLabel.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.descriptionLabel.Size = new System.Drawing.Size(327, 50);
|
||||
this.descriptionLabel.TabIndex = 6;
|
||||
this.descriptionLabel.Text = "descriptionLabel";
|
||||
//
|
||||
// ParameterForm
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(354, 248);
|
||||
this.Controls.Add(this.descriptionLabel);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.captionLabel);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Name = "ParameterForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Parameters";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
public System.Windows.Forms.Label captionLabel;
|
||||
private System.Windows.Forms.DataGridView dataGridView;
|
||||
private System.Windows.Forms.Label descriptionLabel;
|
||||
private System.Windows.Forms.BindingSource bindingSource;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn NameColumn;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn Default;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ValueColumn;
|
||||
|
||||
}
|
||||
}
|
122
GUI/ParameterForm.cs
Normal file
122
GUI/ParameterForm.cs
Normal file
@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using OpenHardwareMonitor.Hardware;
|
||||
using OpenHardwareMonitor.Utilities;
|
||||
|
||||
namespace OpenHardwareMonitor.GUI {
|
||||
public partial class ParameterForm : Form {
|
||||
|
||||
private IReadOnlyArray<IParameter> parameters;
|
||||
private BindingList<ParameterRow> parameterRows;
|
||||
|
||||
public ParameterForm() {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public IReadOnlyArray<IParameter> Parameters {
|
||||
get {
|
||||
return parameters;
|
||||
}
|
||||
set {
|
||||
parameters = value;
|
||||
parameterRows = new BindingList<ParameterRow>();
|
||||
foreach (IParameter parameter in parameters)
|
||||
parameterRows.Add(new ParameterRow(parameter));
|
||||
bindingSource.DataSource = parameterRows;
|
||||
}
|
||||
}
|
||||
|
||||
private class ParameterRow : INotifyPropertyChanged {
|
||||
public IParameter parameter;
|
||||
private float value;
|
||||
public bool isDefault;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private void NotifyPropertyChanged(String propertyName) {
|
||||
if (PropertyChanged != null) {
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
public ParameterRow(IParameter parameter){
|
||||
this.parameter = parameter;
|
||||
this.value = parameter.Value;
|
||||
this.isDefault = parameter.IsDefault;
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get { return parameter.Name; }
|
||||
}
|
||||
|
||||
public float Value {
|
||||
get { return value; }
|
||||
set {
|
||||
this.isDefault = false;
|
||||
this.value = value;
|
||||
NotifyPropertyChanged("Default");
|
||||
NotifyPropertyChanged("Value");
|
||||
}
|
||||
}
|
||||
|
||||
public bool Default {
|
||||
get { return isDefault; }
|
||||
set {
|
||||
isDefault = value;
|
||||
if (value)
|
||||
this.value = parameter.DefaultValue;
|
||||
NotifyPropertyChanged("Default");
|
||||
NotifyPropertyChanged("Value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_RowEnter(object sender,
|
||||
DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex >= 0 && e.RowIndex < parameters.Length)
|
||||
descriptionLabel.Text = parameters[e.RowIndex].Description;
|
||||
else
|
||||
descriptionLabel.Text = "";
|
||||
}
|
||||
|
||||
private void dataGridView_CellValidating(object sender,
|
||||
DataGridViewCellValidatingEventArgs e)
|
||||
{
|
||||
float value;
|
||||
if (e.ColumnIndex == 2 &&
|
||||
!float.TryParse(e.FormattedValue.ToString(), out value)) {
|
||||
dataGridView.Rows[e.RowIndex].Cells[0].ErrorText =
|
||||
"Invalid value";
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_CellEndEdit(object sender,
|
||||
DataGridViewCellEventArgs e) {
|
||||
dataGridView.Rows[e.RowIndex].Cells[0].ErrorText = "";
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e) {
|
||||
foreach (ParameterRow row in parameterRows) {
|
||||
if (row.Default) {
|
||||
row.parameter.IsDefault = true;
|
||||
} else {
|
||||
row.parameter.Value = row.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridView_CurrentCellDirtyStateChanged(object sender,
|
||||
EventArgs e) {
|
||||
if (dataGridView.CurrentCell is DataGridViewCheckBoxCell ||
|
||||
dataGridView.CurrentCell is DataGridViewComboBoxCell)
|
||||
{
|
||||
dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
132
GUI/ParameterForm.resx
Normal file
132
GUI/ParameterForm.resx
Normal file
@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="NameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Default.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ValueColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -79,13 +79,23 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
|
||||
totalLoad = new Sensor("CPU Total", 0, SensorType.Load, this);
|
||||
|
||||
offset = -49.0f;
|
||||
|
||||
// AM2+ 65nm +21 offset
|
||||
if (model >= 0x69 && model != 0xc1 && model != 0x6c && model != 0x7c)
|
||||
offset += 21;
|
||||
|
||||
coreTemperatures = new Sensor[coreCount];
|
||||
coreLoads = new Sensor[coreCount];
|
||||
for (int i = 0; i < coreCount; i++) {
|
||||
coreTemperatures[i] =
|
||||
new Sensor("Core #" + (i + 1), i, SensorType.Temperature, this);
|
||||
coreLoads[i] = new Sensor("Core #" + (i + 1), i + 1,
|
||||
SensorType.Load, this);
|
||||
coreLoads[i] = new Sensor("Core #" + (i + 1), i + 1, null,
|
||||
SensorType.Load, this, new ParameterDescription[] {
|
||||
new ParameterDescription("Offset",
|
||||
"Temperature offset of the thermal sensor.\n" +
|
||||
"Temperature = Value + Offset.", offset)
|
||||
});
|
||||
}
|
||||
|
||||
cpuLoad = new CPULoad(coreCount, 1);
|
||||
@ -98,12 +108,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID,
|
||||
PCI_AMD_0FH_MISCELLANEOUS_DEVICE_ID, 0);
|
||||
|
||||
offset = -49.0f;
|
||||
|
||||
// AM2+ 65nm +21 offset
|
||||
if (model >= 0x69 && model != 0xc1 && model != 0x6c && model != 0x7c)
|
||||
offset += 21;
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
@ -133,7 +137,8 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
uint value;
|
||||
if (WinRing0.ReadPciConfigDwordEx(
|
||||
pciAddress, THERMTRIP_STATUS_REGISTER, out value)) {
|
||||
coreTemperatures[i].Value = ((value >> 16) & 0xFF) + offset;
|
||||
coreTemperatures[i].Value = ((value >> 16) & 0xFF) +
|
||||
coreTemperatures[i].Parameters[0].Value;
|
||||
ActivateSensor(coreTemperatures[i]);
|
||||
} else {
|
||||
DeactivateSensor(coreTemperatures[i]);
|
||||
|
@ -86,8 +86,10 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
|
||||
// AMD family 10h processors support only one temperature sensor
|
||||
coreTemperature = new Sensor(
|
||||
"Core" + (coreCount > 1 ? " #1 - #" + coreCount : ""), 0,
|
||||
SensorType.Temperature, this);
|
||||
"Core" + (coreCount > 1 ? " #1 - #" + coreCount : ""), 0, null,
|
||||
SensorType.Temperature, this, new ParameterDescription[] {
|
||||
new ParameterDescription("Offset", "Temperature offset.", 0)
|
||||
});
|
||||
|
||||
pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID,
|
||||
PCI_AMD_10H_MISCELLANEOUS_DEVICE_ID, 0);
|
||||
@ -119,7 +121,8 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
uint value;
|
||||
if (WinRing0.ReadPciConfigDwordEx(pciAddress,
|
||||
REPORTED_TEMPERATURE_CONTROL_REGISTER, out value)) {
|
||||
coreTemperature.Value = ((value >> 21) & 0x7FF) / 8.0f;
|
||||
coreTemperature.Value = ((value >> 21) & 0x7FF) / 8.0f +
|
||||
coreTemperature.Parameters[0].Value;
|
||||
ActivateSensor(coreTemperature);
|
||||
} else {
|
||||
DeactivateSensor(coreTemperature);
|
||||
|
@ -40,6 +40,8 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
@ -53,15 +55,15 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
private uint stepping;
|
||||
|
||||
private Sensor[] coreTemperatures;
|
||||
|
||||
private Sensor totalLoad;
|
||||
private Sensor[] coreLoads;
|
||||
private Sensor[] coreClocks;
|
||||
private Sensor busClock;
|
||||
|
||||
private float tjMax = 0;
|
||||
private uint logicalProcessors;
|
||||
private uint logicalProcessorsPerCore;
|
||||
private uint coreCount;
|
||||
private ulong affinityMask;
|
||||
|
||||
private CPULoad cpuLoad;
|
||||
|
||||
@ -81,6 +83,10 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
return "CPU Core #" + (i + 1);
|
||||
}
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern bool GetProcessAffinityMask(IntPtr handle,
|
||||
out IntPtr processMask, out IntPtr systemMask);
|
||||
|
||||
public IntelCPU(string name, uint family, uint model, uint stepping,
|
||||
uint[,] cpuidData, uint[,] cpuidExtData) {
|
||||
|
||||
@ -117,8 +123,30 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
logicalProcessorsPerCore = 1;
|
||||
}
|
||||
|
||||
IntPtr processMask, systemMask;
|
||||
GetProcessAffinityMask(Process.GetCurrentProcess().Handle,
|
||||
out processMask, out systemMask);
|
||||
affinityMask = (ulong)systemMask;
|
||||
|
||||
// correct values in case HypeThreading is disabled
|
||||
if (logicalProcessorsPerCore > 1) {
|
||||
ulong affinity = affinityMask;
|
||||
int availableLogicalProcessors = 0;
|
||||
while (affinity != 0) {
|
||||
if ((affinity & 0x1) > 0)
|
||||
availableLogicalProcessors++;
|
||||
affinity >>= 1;
|
||||
}
|
||||
while (logicalProcessorsPerCore > 1 &&
|
||||
availableLogicalProcessors < logicalProcessors) {
|
||||
logicalProcessors >>= 1;
|
||||
logicalProcessorsPerCore >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
coreCount = logicalProcessors / logicalProcessorsPerCore;
|
||||
|
||||
|
||||
float tjMax;
|
||||
switch (family) {
|
||||
case 0x06: {
|
||||
switch (model) {
|
||||
@ -170,7 +198,13 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
coreTemperatures = new Sensor[coreCount];
|
||||
for (int i = 0; i < coreTemperatures.Length; i++) {
|
||||
coreTemperatures[i] = new Sensor(CoreString(i), i, tjMax,
|
||||
SensorType.Temperature, this);
|
||||
SensorType.Temperature, this, new ParameterDescription[] {
|
||||
new ParameterDescription(
|
||||
"TjMax", "TjMax temperature of the core.\n" +
|
||||
"Temperature = TjMax - TSlope * Value.", tjMax),
|
||||
new ParameterDescription(
|
||||
"TSlope", "Temperature slope of the digital thermal sensor.\n" +
|
||||
"Temperature = TjMax - TSlope * Value.", 1)});
|
||||
}
|
||||
} else {
|
||||
coreTemperatures = new Sensor[0];
|
||||
@ -237,11 +271,12 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
r.AppendLine("Intel CPU");
|
||||
r.AppendLine();
|
||||
r.AppendFormat("Name: {0}{1}", name, Environment.NewLine);
|
||||
r.AppendFormat("Number of cores: {0}{1}", coreCount,
|
||||
r.AppendFormat("Number of Cores: {0}{1}", coreCount,
|
||||
Environment.NewLine);
|
||||
r.AppendFormat("Threads per core: {0}{1}", logicalProcessorsPerCore,
|
||||
r.AppendFormat("Threads per Core: {0}{1}", logicalProcessorsPerCore,
|
||||
Environment.NewLine);
|
||||
r.AppendFormat("TjMax: {0}{1}", tjMax, Environment.NewLine);
|
||||
r.AppendFormat("Affinity Mask: 0x{0}{1}", affinityMask.ToString("X"),
|
||||
Environment.NewLine);
|
||||
r.AppendLine();
|
||||
|
||||
for (int i = 0; i < coreCount; i++) {
|
||||
@ -269,7 +304,10 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
// if reading is valid
|
||||
if ((eax & 0x80000000) != 0) {
|
||||
// get the dist from tjMax from bits 22:16
|
||||
coreTemperatures[i].Value = tjMax - ((eax & 0x007F0000) >> 16);
|
||||
float deltaT = ((eax & 0x007F0000) >> 16);
|
||||
float tjMax = coreTemperatures[i].Parameters[0].Value;
|
||||
float tSlope = coreTemperatures[i].Parameters[1].Value;
|
||||
coreTemperatures[i].Value = tjMax - tSlope * deltaT;
|
||||
ActivateSensor(coreTemperatures[i]);
|
||||
} else {
|
||||
DeactivateSensor(coreTemperatures[i]);
|
||||
|
@ -152,9 +152,15 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
new object[] { hardware.Name, hardware.Identifier });
|
||||
foreach (ISensor sensor in hardware.Sensors) {
|
||||
w.WriteLine("| +- {0} : {1} : {2} : {3}",
|
||||
new object[] { sensor.SensorType, sensor.Index, sensor.Name,
|
||||
string.Format(CultureInfo.InvariantCulture, "{0}",
|
||||
sensor.Value) });
|
||||
sensor.SensorType, sensor.Index, sensor.Name,
|
||||
string.Format(CultureInfo.InvariantCulture, "{0} : {1} : {2}",
|
||||
sensor.Value, sensor.Min, sensor.Max) );
|
||||
foreach (IParameter parameter in sensor.Parameters) {
|
||||
w.WriteLine("| +- {0} : {1} : {2}",
|
||||
parameter.Name, parameter.IsDefault,
|
||||
string.Format(CultureInfo.InvariantCulture, "{0} : {1}",
|
||||
parameter.DefaultValue, parameter.Value) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
54
Hardware/IParameter.cs
Normal file
54
Hardware/IParameter.cs
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
|
||||
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 interface IParameter {
|
||||
|
||||
ISensor Sensor { get; }
|
||||
string Identifier { get; }
|
||||
|
||||
string Name { get; }
|
||||
string Description { get; }
|
||||
float Value { get; set; }
|
||||
float DefaultValue { get; }
|
||||
bool IsDefault { get; set; }
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenHardwareMonitor.Utilities;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware {
|
||||
|
||||
@ -55,15 +56,21 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
}
|
||||
|
||||
public interface ISensor {
|
||||
|
||||
IHardware Hardware { get; }
|
||||
|
||||
SensorType SensorType { get; }
|
||||
string Identifier { get; }
|
||||
string Name { get; set; }
|
||||
int Index { get; }
|
||||
|
||||
IReadOnlyArray<IParameter> Parameters { get; }
|
||||
|
||||
float? Value { get; }
|
||||
float? Min { get; }
|
||||
float? Max { get; }
|
||||
float? Limit { get; set; }
|
||||
|
||||
IEnumerable<ISensorEntry> Plot { get; }
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,10 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
|
||||
temperatures = new Sensor[3];
|
||||
for (int i = 0; i < temperatures.Length; i++)
|
||||
temperatures[i] = new Sensor("Temperature #" + (i + 1), i,
|
||||
SensorType.Temperature, this);
|
||||
temperatures[i] = new Sensor("Temperature #" + (i + 1), i, null,
|
||||
SensorType.Temperature, this, new ParameterDescription[] {
|
||||
new ParameterDescription("Offset", "Temperature offset.", 0)
|
||||
});
|
||||
|
||||
fans = new Sensor[4];
|
||||
for (int i = 0; i < fans.Length; i++)
|
||||
@ -123,7 +125,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
foreach (Sensor sensor in temperatures) {
|
||||
sbyte value = (sbyte)ReadByte((byte)(
|
||||
TEMPERATURE_BASE_REG + 2 * sensor.Index));
|
||||
sensor.Value = value;
|
||||
sensor.Value = value + sensor.Parameters[0].Value;
|
||||
if (value < sbyte.MaxValue && value > 0)
|
||||
ActivateSensor(sensor);
|
||||
else
|
||||
|
@ -90,8 +90,10 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
|
||||
temperatures = new Sensor[3];
|
||||
for (int i = 0; i < temperatures.Length; i++)
|
||||
temperatures[i] = new Sensor("Temperature #" + (i + 1), i,
|
||||
SensorType.Temperature, this);
|
||||
temperatures[i] = new Sensor("Temperature #" + (i + 1), i, null,
|
||||
SensorType.Temperature, this, new ParameterDescription[] {
|
||||
new ParameterDescription("Offset", "Temperature offset.", 0)
|
||||
});
|
||||
|
||||
fans = new Sensor[5];
|
||||
for (int i = 0; i < fans.Length; i++)
|
||||
@ -150,8 +152,9 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
}
|
||||
|
||||
foreach (Sensor sensor in temperatures) {
|
||||
sbyte value = (sbyte)ReadByte((byte)(TEMPERATURE_BASE_REG + sensor.Index));
|
||||
sensor.Value = value;
|
||||
sbyte value =
|
||||
(sbyte)ReadByte((byte)(TEMPERATURE_BASE_REG + sensor.Index));
|
||||
sensor.Value = value + sensor.Parameters[0].Value;
|
||||
if (value < sbyte.MaxValue && value > 0)
|
||||
ActivateSensor(sensor);
|
||||
else
|
||||
|
@ -73,7 +73,6 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
new string[] {"CPU", "Auxiliary", "System"};
|
||||
private byte[] TEMPERATURE_REG = new byte[] { 0x50, 0x50, 0x27 };
|
||||
private byte[] TEMPERATURE_BANK = new byte[] { 1, 2, 0 };
|
||||
private byte[] TEMPERATURE_SEL = new byte[] { 1, 2, 0 };
|
||||
|
||||
private byte[] FAN_TACHO_REG = new byte[] { 0x28, 0x29, 0x2A, 0x3F, 0x53 };
|
||||
private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };
|
||||
@ -112,26 +111,42 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
|
||||
available = IsWinbondVendor();
|
||||
|
||||
ParameterDescription[] parameter = new ParameterDescription[] {
|
||||
new ParameterDescription("Offset", "Temperature offset.", 0)
|
||||
};
|
||||
List<Sensor> list = new List<Sensor>();
|
||||
switch (chip) {
|
||||
case Chip.W83627DHG:
|
||||
// do not add temperature sensor registers that read PECI agents
|
||||
case Chip.W83667HG:
|
||||
case Chip.W83667HGB:
|
||||
// do not add temperature sensor registers that read PECI
|
||||
byte flag = ReadByte(0, TEMPERATURE_SOURCE_SELECT_REG);
|
||||
if ((flag & 0x04) == 0)
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[0], 0, null,
|
||||
SensorType.Temperature, this, parameter));
|
||||
if ((flag & 0x40) == 0)
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[1], 1, null,
|
||||
SensorType.Temperature, this, parameter));
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[2], 2, null,
|
||||
SensorType.Temperature, this, parameter));
|
||||
break;
|
||||
case Chip.W83627DHG:
|
||||
case Chip.W83627DHGP:
|
||||
// do not add temperature sensor registers that read PECI
|
||||
byte sel = ReadByte(0, TEMPERATURE_SOURCE_SELECT_REG);
|
||||
if ((sel & 0x07) == 0)
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[0], 0,
|
||||
SensorType.Temperature, this));
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[0], 0, null,
|
||||
SensorType.Temperature, this, parameter));
|
||||
if ((sel & 0x70) == 0)
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[1], 1,
|
||||
SensorType.Temperature, this));
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[2], 2,
|
||||
SensorType.Temperature, this));
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[1], 1, null,
|
||||
SensorType.Temperature, this, parameter));
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[2], 2, null,
|
||||
SensorType.Temperature, this, parameter));
|
||||
break;
|
||||
default:
|
||||
// no PECI support or extra sensor report register
|
||||
for (int i = 0; i < TEMPERATURE_NAME.Length; i++) {
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[i], i,
|
||||
SensorType.Temperature, this));
|
||||
}
|
||||
// no PECI support, add all sensors
|
||||
for (int i = 0; i < TEMPERATURE_NAME.Length; i++)
|
||||
list.Add(new Sensor(TEMPERATURE_NAME[i], i, null,
|
||||
SensorType.Temperature, this, parameter));
|
||||
break;
|
||||
}
|
||||
temperatures = list.ToArray();
|
||||
@ -212,29 +227,15 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
}
|
||||
|
||||
foreach (Sensor sensor in temperatures) {
|
||||
int value;
|
||||
switch (chip) {
|
||||
case Chip.W83667HG:
|
||||
case Chip.W83667HGB:
|
||||
WriteByte(0, 0x7D, TEMPERATURE_SEL[sensor.Index]);
|
||||
value = ((sbyte)ReadByte(0, 0x7E)) << 1;
|
||||
break;
|
||||
case Chip.W83627DHGP:
|
||||
WriteByte(0, 0x7C, TEMPERATURE_SEL[sensor.Index]);
|
||||
value = ((sbyte)ReadByte(0, 0x7D)) << 1;
|
||||
break;
|
||||
default:
|
||||
value = ((sbyte)ReadByte(TEMPERATURE_BANK[sensor.Index],
|
||||
TEMPERATURE_REG[sensor.Index])) << 1;
|
||||
if (TEMPERATURE_BANK[sensor.Index] > 0) {
|
||||
value |= ReadByte(TEMPERATURE_BANK[sensor.Index],
|
||||
(byte)(TEMPERATURE_REG[sensor.Index] + 1)) >> 7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
int value = ((sbyte)ReadByte(TEMPERATURE_BANK[sensor.Index],
|
||||
TEMPERATURE_REG[sensor.Index])) << 1;
|
||||
if (TEMPERATURE_BANK[sensor.Index] > 0)
|
||||
value |= ReadByte(TEMPERATURE_BANK[sensor.Index],
|
||||
(byte)(TEMPERATURE_REG[sensor.Index] + 1)) >> 7;
|
||||
|
||||
float temperature = value / 2.0f;
|
||||
if (temperature <= 125 && temperature >= -55) {
|
||||
sensor.Value = temperature;
|
||||
sensor.Value = temperature + sensor.Parameters[0].Value;
|
||||
ActivateSensor(sensor);
|
||||
} else {
|
||||
DeactivateSensor(sensor);
|
||||
|
118
Hardware/Parameter.cs
Normal file
118
Hardware/Parameter.cs
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
|
||||
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 struct ParameterDescription {
|
||||
private string name;
|
||||
private string description;
|
||||
private float defaultValue;
|
||||
|
||||
public ParameterDescription(string name, string description,
|
||||
float defaultValue) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public string Name { get { return name; } }
|
||||
|
||||
public string Description { get { return description; } }
|
||||
|
||||
public float DefaultValue { get { return defaultValue; } }
|
||||
}
|
||||
|
||||
public class Parameter : IParameter {
|
||||
private ISensor sensor;
|
||||
private ParameterDescription description;
|
||||
private float value;
|
||||
private bool isDefault;
|
||||
|
||||
public Parameter(ParameterDescription description, ISensor sensor) {
|
||||
this.sensor = sensor;
|
||||
this.description = description;
|
||||
this.value = Utilities.Config.Get(Identifier, description.DefaultValue);
|
||||
this.isDefault = !Utilities.Config.Contains(Identifier);
|
||||
}
|
||||
|
||||
public ISensor Sensor {
|
||||
get {
|
||||
return sensor;
|
||||
}
|
||||
}
|
||||
|
||||
public string Identifier {
|
||||
get {
|
||||
return sensor.Identifier + "/parameter/" +
|
||||
Name.Replace(" ", "").ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
public string Name { get { return description.Name; } }
|
||||
|
||||
public string Description { get { return description.Description; } }
|
||||
|
||||
public float Value {
|
||||
get {
|
||||
return value;
|
||||
}
|
||||
set {
|
||||
this.isDefault = false;
|
||||
this.value = value;
|
||||
Utilities.Config.Set(Identifier, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float DefaultValue {
|
||||
get { return description.DefaultValue; }
|
||||
}
|
||||
|
||||
public bool IsDefault {
|
||||
get { return isDefault; }
|
||||
set {
|
||||
this.isDefault = value;
|
||||
if (value) {
|
||||
this.value = description.DefaultValue;
|
||||
Utilities.Config.Remove(Identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenHardwareMonitor.Utilities;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware {
|
||||
|
||||
@ -47,6 +48,7 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
private int index;
|
||||
private SensorType sensorType;
|
||||
private IHardware hardware;
|
||||
private ReadOnlyArray<IParameter> parameters;
|
||||
private float? value;
|
||||
private float? min;
|
||||
private float? max;
|
||||
@ -61,25 +63,32 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
private const int MAX_MINUTES = 120;
|
||||
|
||||
public Sensor(string name, int index, SensorType sensorType,
|
||||
IHardware hardware)
|
||||
: this(name, index, null, sensorType, hardware) { }
|
||||
IHardware hardware) : this(name, index, null, sensorType, hardware,
|
||||
new ParameterDescription[0]) { }
|
||||
|
||||
public Sensor(string name, int index, float? limit,
|
||||
SensorType sensorType, IHardware hardware)
|
||||
public Sensor(string name, int index, float? limit,
|
||||
SensorType sensorType, IHardware hardware) : this(name, index, limit,
|
||||
sensorType, hardware, new ParameterDescription[0]) { }
|
||||
|
||||
public Sensor(string name, int index, float? limit, SensorType sensorType,
|
||||
IHardware hardware, ParameterDescription[] parameterDescriptions)
|
||||
{
|
||||
this.defaultName = name;
|
||||
this.index = index;
|
||||
this.defaultLimit = limit;
|
||||
this.sensorType = sensorType;
|
||||
this.hardware = hardware;
|
||||
string configName =
|
||||
Utilities.Config.Settings[Identifier + "/name"];
|
||||
Parameter[] parameters = new Parameter[parameterDescriptions.Length];
|
||||
for (int i = 0; i < parameters.Length; i++ )
|
||||
parameters[i] = new Parameter(parameterDescriptions[i], this);
|
||||
this.parameters = parameters;
|
||||
|
||||
string configName = Config.Settings[Identifier + "/name"];
|
||||
if (configName != null)
|
||||
this.name = configName;
|
||||
else
|
||||
this.name = name;
|
||||
string configLimit =
|
||||
Utilities.Config.Settings[Identifier + "/limit"];
|
||||
string configLimit = Config.Settings[Identifier + "/limit"];
|
||||
if (configLimit != null && configLimit != "")
|
||||
this.limit = float.Parse(configLimit);
|
||||
else
|
||||
@ -110,7 +119,7 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
name = value;
|
||||
else
|
||||
name = defaultName;
|
||||
Utilities.Config.Settings[Identifier + "/name"] = name;
|
||||
Config.Settings[Identifier + "/name"] = name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,6 +127,10 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
get { return index; }
|
||||
}
|
||||
|
||||
public IReadOnlyArray<IParameter> Parameters {
|
||||
get { return parameters; }
|
||||
}
|
||||
|
||||
public float? Value {
|
||||
get {
|
||||
return value;
|
||||
@ -156,11 +169,11 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
set {
|
||||
if (value.HasValue) {
|
||||
limit = value;
|
||||
Utilities.Config.Settings[Identifier + "/limit"] =
|
||||
Config.Settings[Identifier + "/limit"] =
|
||||
limit.ToString();
|
||||
} else {
|
||||
limit = defaultLimit;
|
||||
Utilities.Config.Settings[Identifier + "/limit"] = "";
|
||||
Config.Settings[Identifier + "/limit"] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,30 +73,37 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
||||
this.icon = Utilities.EmbeddedResources.GetImage("bigng.png");
|
||||
this.protocolVersion = protocolVersion;
|
||||
|
||||
ParameterDescription[] parameter = new ParameterDescription[] {
|
||||
new ParameterDescription("Offset", "Temperature offset.", 0)
|
||||
};
|
||||
int offset = 0;
|
||||
for (int i = 0; i < digitalTemperatures.Length; i++)
|
||||
digitalTemperatures[i] = new Sensor("Digital Sensor #" + (i + 1),
|
||||
offset + i, SensorType.Temperature, this);
|
||||
offset + i, null, SensorType.Temperature, this, parameter);
|
||||
offset += digitalTemperatures.Length;
|
||||
|
||||
for (int i = 0; i < analogTemperatures.Length; i++)
|
||||
analogTemperatures[i] = new Sensor("Analog Sensor #" + (i + 1),
|
||||
offset + i, SensorType.Temperature, this);
|
||||
offset + i, null, SensorType.Temperature, this, parameter);
|
||||
offset += analogTemperatures.Length;
|
||||
|
||||
for (int i = 0; i < sensorhubTemperatures.Length; i++)
|
||||
sensorhubTemperatures[i] = new Sensor("Sensorhub Sensor #" + (i + 1),
|
||||
offset + i, SensorType.Temperature, this);
|
||||
offset + i, null, SensorType.Temperature, this, parameter);
|
||||
offset += sensorhubTemperatures.Length;
|
||||
|
||||
for (int i = 0; i < sensorhubFlows.Length; i++)
|
||||
sensorhubFlows[i] = new Sensor("Flowmeter #" + (i + 1),
|
||||
offset + i, SensorType.Flow, this);
|
||||
offset + i, null, SensorType.Flow, this, new ParameterDescription[] {
|
||||
new ParameterDescription("Impulse Rate",
|
||||
"The impulse rate of the flowmeter in pulses/L", 509)
|
||||
});
|
||||
offset += sensorhubFlows.Length;
|
||||
|
||||
for (int i = 0; i < miniNGTemperatures.Length; i++)
|
||||
miniNGTemperatures[i] = new Sensor("miniNG #" + (i / 2 + 1) +
|
||||
" Sensor #" + (i % 2 + 1), offset + i, SensorType.Temperature, this);
|
||||
miniNGTemperatures[i] = new Sensor("miniNG #" + (i / 2 + 1) +
|
||||
" Sensor #" + (i % 2 + 1), offset + i, null, SensorType.Temperature,
|
||||
this, parameter);
|
||||
offset += miniNGTemperatures.Length;
|
||||
|
||||
alternativeRequest = new MethodDelegate(DelayedAlternativeRequest);
|
||||
@ -138,7 +145,8 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Sensor sensor = miniNGTemperatures[number * 2 + i];
|
||||
if (data[offset + 7 + i] > 0) {
|
||||
sensor.Value = 0.5f * data[offset + 7 + i];
|
||||
sensor.Value = 0.5f * data[offset + 7 + i] +
|
||||
sensor.Parameters[0].Value;
|
||||
ActivateSensor(sensor);
|
||||
} else {
|
||||
DeactivateSensor(sensor);
|
||||
@ -179,7 +187,8 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
||||
|
||||
for (int i = 0; i < digitalTemperatures.Length; i++)
|
||||
if (data[238 + i] > 0) {
|
||||
digitalTemperatures[i].Value = 0.5f * data[238 + i];
|
||||
digitalTemperatures[i].Value = 0.5f * data[238 + i] +
|
||||
digitalTemperatures[i].Parameters[0].Value;
|
||||
ActivateSensor(digitalTemperatures[i]);
|
||||
} else {
|
||||
DeactivateSensor(digitalTemperatures[i]);
|
||||
@ -187,7 +196,8 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
||||
|
||||
for (int i = 0; i < analogTemperatures.Length; i++)
|
||||
if (data[260 + i] > 0) {
|
||||
analogTemperatures[i].Value = 0.5f * data[260 + i];
|
||||
analogTemperatures[i].Value = 0.5f * data[260 + i] +
|
||||
analogTemperatures[i].Parameters[0].Value;
|
||||
ActivateSensor(analogTemperatures[i]);
|
||||
} else {
|
||||
DeactivateSensor(analogTemperatures[i]);
|
||||
@ -195,7 +205,8 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
||||
|
||||
for (int i = 0; i < sensorhubTemperatures.Length; i++)
|
||||
if (data[246 + i] > 0) {
|
||||
sensorhubTemperatures[i].Value = 0.5f * data[246 + i];
|
||||
sensorhubTemperatures[i].Value = 0.5f * data[246 + i] +
|
||||
sensorhubTemperatures[i].Parameters[0].Value;
|
||||
ActivateSensor(sensorhubTemperatures[i]);
|
||||
} else {
|
||||
DeactivateSensor(sensorhubTemperatures[i]);
|
||||
@ -204,7 +215,7 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
||||
for (int i = 0; i < sensorhubFlows.Length; i++)
|
||||
if (data[231 + i] > 0 && data[234] > 0) {
|
||||
float pulsesPerSecond = ((float)data[231 + i]) / data[234];
|
||||
const float pulsesPerLiter = 509;
|
||||
float pulsesPerLiter = sensorhubFlows[i].Parameters[0].Value;
|
||||
sensorhubFlows[i].Value = pulsesPerSecond * 3600 / pulsesPerLiter;
|
||||
ActivateSensor(sensorhubFlows[i]);
|
||||
} else {
|
||||
@ -216,12 +227,15 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
||||
|
||||
if (fans[i] == null)
|
||||
fans[i] = new Sensor("Fan #" + (i + 1), i, maxRPM, SensorType.Fan,
|
||||
this);
|
||||
this, new ParameterDescription[] {
|
||||
new ParameterDescription("MaxRPM",
|
||||
"Maximum revolutions per minute (RPM) of the fan.", maxRPM)
|
||||
});
|
||||
|
||||
if ((data[136] & (1 << i)) == 0)
|
||||
fans[i].Value = maxRPM * 0.01f * data[156 + i]; // pwm mode
|
||||
else
|
||||
fans[i].Value = maxRPM * 0.01f * data[141 + i]; // analog mode
|
||||
if ((data[136] & (1 << i)) == 0) // pwm mode
|
||||
fans[i].Value = fans[i].Parameters[0].Value * 0.01f * data[156 + i];
|
||||
else // analog mode
|
||||
fans[i].Value = fans[i].Parameters[0].Value * 0.01f * data[141 + i];
|
||||
ActivateSensor(fans[i]);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F5E0C1F7-9E9B-46F2-AC88-8C9C1C923880}</ProjectGuid>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<NoStandardLibraries>false</NoStandardLibraries>
|
||||
@ -58,6 +58,12 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GUI\ParameterForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GUI\ParameterForm.Designer.cs">
|
||||
<DependentUpon>ParameterForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GUI\SensorNotifyIcon.cs" />
|
||||
<Compile Include="GUI\SensorSystemTray.cs" />
|
||||
<Compile Include="GUI\TypeNode.cs" />
|
||||
@ -68,9 +74,11 @@
|
||||
<Compile Include="Hardware\HDD\HDD.cs" />
|
||||
<Compile Include="Hardware\HDD\HDDGroup.cs" />
|
||||
<Compile Include="Hardware\HDD\SMART.cs" />
|
||||
<Compile Include="Hardware\IParameter.cs" />
|
||||
<Compile Include="Hardware\LPC\Chip.cs" />
|
||||
<Compile Include="Hardware\LPC\F718XX.cs" />
|
||||
<Compile Include="Hardware\LPC\LPCHardware.cs" />
|
||||
<Compile Include="Hardware\Parameter.cs" />
|
||||
<Compile Include="Hardware\SMBIOS\SMBIOSGroup.cs" />
|
||||
<Compile Include="Hardware\LPC\W836XX.cs" />
|
||||
<Compile Include="Hardware\Computer.cs" />
|
||||
@ -84,7 +92,7 @@
|
||||
<Compile Include="Hardware\ATI\ADL.cs" />
|
||||
<Compile Include="Hardware\ATI\ATIGroup.cs" />
|
||||
<Compile Include="Hardware\ATI\ATIGPU.cs" />
|
||||
<Compile Include="Utilities\Configuration.cs" />
|
||||
<Compile Include="Utilities\Config.cs" />
|
||||
<Compile Include="Utilities\CrashReport.cs" />
|
||||
<Compile Include="Utilities\EmbeddedResources.cs" />
|
||||
<Compile Include="GUI\HardwareNode.cs" />
|
||||
@ -104,6 +112,7 @@
|
||||
<Compile Include="Hardware\Nvidia\NvidiaGroup.cs" />
|
||||
<Compile Include="Utilities\HexStringArray.cs" />
|
||||
<Compile Include="Utilities\IconFactory.cs" />
|
||||
<Compile Include="Utilities\IReadOnlyArray.cs" />
|
||||
<Compile Include="Utilities\PInvokeDelegateFactory.cs" />
|
||||
<Compile Include="GUI\PlotPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
@ -119,6 +128,7 @@
|
||||
<Compile Include="Hardware\TBalancer\TBalancer.cs" />
|
||||
<Compile Include="Hardware\TBalancer\TBalancerGroup.cs" />
|
||||
<Compile Include="Hardware\WinRing0.cs" />
|
||||
<Compile Include="Utilities\ReadOnlyArray.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="GUI\AboutBox.resx">
|
||||
@ -157,6 +167,9 @@
|
||||
<EmbeddedResource Include="Resources\smallicon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="GUI\ParameterForm.resx">
|
||||
<DependentUpon>ParameterForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\flow.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.1.23.2")]
|
||||
[assembly: AssemblyFileVersion("0.1.23.2")]
|
||||
[assembly: AssemblyVersion("0.1.24.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.24.0")]
|
||||
|
@ -154,5 +154,26 @@ namespace OpenHardwareMonitor.Utilities {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Set(string name, float value) {
|
||||
instance[name] = value.ToString(
|
||||
System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
|
||||
}
|
||||
|
||||
public static float Get(string name, float value) {
|
||||
System.Configuration.KeyValueConfigurationElement element =
|
||||
instance.config.AppSettings.Settings[name];
|
||||
if (element == null)
|
||||
return value;
|
||||
else {
|
||||
float parsedValue;
|
||||
if (float.TryParse(element.Value,
|
||||
System.Globalization.NumberStyles.Float,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out parsedValue))
|
||||
return parsedValue;
|
||||
else
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
50
Utilities/IReadOnlyArray.cs
Normal file
50
Utilities/IReadOnlyArray.cs
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
|
||||
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.Utilities {
|
||||
|
||||
public interface IReadOnlyArray<T> : IEnumerable<T> {
|
||||
|
||||
T this[int index] { get; }
|
||||
|
||||
int Length { get; }
|
||||
|
||||
}
|
||||
}
|
70
Utilities/ReadOnlyArray.cs
Normal file
70
Utilities/ReadOnlyArray.cs
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
|
||||
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;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenHardwareMonitor.Utilities {
|
||||
|
||||
public class ReadOnlyArray<T> : IReadOnlyArray<T> {
|
||||
|
||||
private T[] array;
|
||||
|
||||
public ReadOnlyArray(T[] array) {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
public T this[int index] {
|
||||
get { return array[index]; }
|
||||
}
|
||||
|
||||
public int Length { get { return array.Length; } }
|
||||
|
||||
public IEnumerator<T> GetEnumerator() {
|
||||
return ((IEnumerable<T>)array).GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() {
|
||||
return array.GetEnumerator();
|
||||
}
|
||||
|
||||
public static implicit operator ReadOnlyArray<T>(T[] array) {
|
||||
return new ReadOnlyArray<T>(array);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user