Skip to content

Commit 01005d9

Browse files
committed
readme update
1 parent 8d18b1c commit 01005d9

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
![Downloads](https://img.shields.io/github/downloads/sergiye/openhardwaremonitor/total?style=for-the-badge&color=ff4f42)
44
![Last commit](https://img.shields.io/github/last-commit/sergiye/openhardwaremonitor?style=for-the-badge&color=00AD00)
55

6+
[![Nuget](https://img.shields.io/nuget/v/OpenHardwareMonitorLib?style=for-the-badge)](https://www.nuget.org/packages/OpenHardwareMonitorLib/)
7+
[![Nuget](https://img.shields.io/nuget/dt/OpenHardwareMonitorLib?label=nuget-downloads&style=for-the-badge)](https://www.nuget.org/packages/OpenHardwareMonitorLib/)
8+
69
Open hardware monitor - is free software that can monitor the temperature sensors, fan speeds, voltages, load and clock speeds of your computer.
710

811
This application is based on the "original" [openhardwaremonitor](https://github.com/openhardwaremonitor/openhardwaremonitor) project.
@@ -59,6 +62,63 @@ You can see information about devices such as:
5962
**or download build from [releases](https://github.com/sergiye/openhardwaremonitor/releases).**
6063

6164

65+
# Developer information
66+
**Integrate the library in own application**
67+
1. Add the [OpenHardwareMonitorLib](https://www.nuget.org/packages/OpenHardwareMonitorLib/) NuGet package to your application.
68+
2. Use the sample code below.
69+
70+
71+
**Sample code**
72+
```c#
73+
public class UpdateVisitor : IVisitor {
74+
public void VisitComputer(IComputer computer) {
75+
computer.Traverse(this);
76+
}
77+
public void VisitHardware(IHardware hardware) {
78+
hardware.Update();
79+
foreach (IHardware subHardware in hardware.SubHardware) subHardware.Accept(this);
80+
}
81+
public void VisitSensor(ISensor sensor) { }
82+
public void VisitParameter(IParameter parameter) { }
83+
}
84+
85+
public void Monitor() {
86+
Computer computer = new Computer {
87+
IsCpuEnabled = true,
88+
IsGpuEnabled = true,
89+
IsMemoryEnabled = true,
90+
IsMotherboardEnabled = true,
91+
IsControllerEnabled = true,
92+
IsNetworkEnabled = true,
93+
IsStorageEnabled = true
94+
};
95+
96+
computer.Open();
97+
computer.Accept(new UpdateVisitor());
98+
99+
foreach (IHardware hardware in computer.Hardware) {
100+
Console.WriteLine("Hardware: {0}", hardware.Name);
101+
foreach (IHardware subhardware in hardware.SubHardware) {
102+
Console.WriteLine("\tSubhardware: {0}", subhardware.Name);
103+
foreach (ISensor sensor in subhardware.Sensors) {
104+
Console.WriteLine("\t\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
105+
}
106+
}
107+
108+
foreach (ISensor sensor in hardware.Sensors) {
109+
Console.WriteLine("\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
110+
}
111+
}
112+
113+
computer.Close();
114+
}
115+
```
116+
117+
**Administrator rights**
118+
119+
Some sensors require administrator privileges to access the data. Restart your IDE with admin privileges, or add an [app.manifest](https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests) file to your project with requestedExecutionLevel on requireAdministrator.
120+
121+
62122
## How can I help improve it?
63123
The OpenHardwareMonitor team welcomes feedback and contributions!<br/>
64124
You can check if it works properly on your motherboard. For many manufacturers, the way of reading data differs a bit, so if you notice any inaccuracies, please send us a pull request. If you have any suggestions or improvements, don't hesitate to create an issue.

0 commit comments

Comments
 (0)