add files and projects

This commit is contained in:
Sem van der Hoeven
2025-09-02 20:05:48 +02:00
commit 4bb2769e37
66 changed files with 5591 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{51B3AE9F-5C37-451D-B0CA-5BF5D7BF9C95}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>HardwareTempArduino</RootNamespace>
<AssemblyName>HardwareTempArduino</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenHardwareMonitorLib">
<HintPath>.\OpenHardwareMonitorLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="app.manifest" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HardwareTempArduino", "HardwareTempArduino.csproj", "{51B3AE9F-5C37-451D-B0CA-5BF5D7BF9C95}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{51B3AE9F-5C37-451D-B0CA-5BF5D7BF9C95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51B3AE9F-5C37-451D-B0CA-5BF5D7BF9C95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51B3AE9F-5C37-451D-B0CA-5BF5D7BF9C95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51B3AE9F-5C37-451D-B0CA-5BF5D7BF9C95}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3DDBAAE3-3703-4B52-826B-E017848DB027}
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,189 @@
using System;
using OpenHardwareMonitor.Hardware;
using System.IO.Ports;
using System.Timers;
namespace HardwareTempArduino
{
class Program
{
//https://www.hackster.io/zakrzu/arduino-pc-monitor-66c07a
// cpu: 8 temp reads voor elke core
// gpu: 1 temp read
// drives:
// /hdd/0 l2
// /hdd/1 c
// /hdd/2 l1
// /hdd/3 d
// /hdd/4 f
static SerialPort serialPort;
static Timer timer; // timer for sending to arduino
static Timer cpuGpuTimer;
static Computer c;
static float cpuTemp, gpuTemp, l2Temp, cTemp, l1Temp, dTemp, fTemp;
static bool canWriteTime = true;
static void Main(string[] args)
{
setupPort();
Console.WriteLine("test");
c = new Computer();
c.GPUEnabled = true;
c.CPUEnabled = true;
c.HDDEnabled = true;
c.Open();
serialPort.Write("i");
setupTimer();
Console.ReadLine();
}
static void setupPort()
{
Console.WriteLine("serial ports:");
foreach (string s in SerialPort.GetPortNames())
{
Console.WriteLine(" {0}", s);
}
serialPort = new SerialPort();
serialPort.BaudRate = 9600;
serialPort.PortName = "COM7";
serialPort.Parity = Parity.None;
serialPort.Handshake = Handshake.None;
serialPort.DataBits = 8;
serialPort.StopBits = StopBits.One;
serialPort.RtsEnable = true;
if (!serialPort.IsOpen)
{
try
{
serialPort.Open();
}
catch (Exception e)
{
Console.WriteLine("[ERROR] could not open serial port!");
Console.WriteLine(e.Message);
return;
}
}
else Console.WriteLine("could not open serial port!");
}
static void setupTimer()
{
timer = new Timer(20000);
timer.Elapsed += onTimerElapsed;
timer.AutoReset = true;
timer.Enabled = true;
updateTime();
cpuGpuTimer = new Timer(10000);
cpuGpuTimer.Elapsed += onTempTimerElapsed;
cpuGpuTimer.AutoReset = true;
cpuGpuTimer.Enabled = true;
updateSensors();
}
static void onTimerElapsed(Object source, ElapsedEventArgs e)
{
updateTime();
}
static void onTempTimerElapsed(Object source, ElapsedEventArgs e)
{
updateSensors();
}
static void updateTime()
{
Console.WriteLine("time is now: " + DateTime.Now.ToString("HH:mm").Replace(":", ""));
if (canWriteTime)
serialPort.Write("t" + DateTime.Now.ToString("HH:mm").Replace(":", ""));
}
static void updateSensors()
{
Console.WriteLine("updating sensors...");
foreach (var h in c.Hardware)
{
if (h.HardwareType == HardwareType.GpuAti)
{
h.Update();
foreach (var s in h.Sensors)
{
if (s.SensorType == SensorType.Temperature)
{
gpuTemp = s.Value.GetValueOrDefault();
Console.WriteLine("gpu temp is " + gpuTemp);
}
}
}
if (h.HardwareType == HardwareType.CPU)
{
h.Update();
foreach (var s in h.Sensors)
{
if (s.SensorType == SensorType.Temperature)
{
if (s.Index == 8)
{
cpuTemp = s.Value.GetValueOrDefault();
Console.WriteLine("cpu temp is " + cpuTemp);
}
}
}
}
//Console.WriteLine(h.GetReport());
//foreach (var sensor in h.Sensors)
//{
// if (sensor.SensorType == SensorType.Temperature)
// {
// Console.WriteLine("{0} {1} {2} = {3} ({4})", sensor.Name, sensor.Hardware, sensor.SensorType, sensor.Value, sensor.Index);
// Console.WriteLine();
// }
//}
}
try
{
Console.WriteLine("writing to serial --> :" + gpuTemp
+ ";" + cpuTemp
+ "e");
canWriteTime = false;
serialPort.Write(
":" + gpuTemp
+ ";" + cpuTemp
+ "e");
canWriteTime = true;
}
catch (Exception e)
{
timer.Stop();
Console.WriteLine("error! " + e.Message);
}
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HardwareTempArduino")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HardwareTempArduino")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("51b3ae9f-5c37-451d-b0ca-5bf5d7bf9c95")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@@ -0,0 +1 @@
32ca844df1cd33278577d6876634826759b1bac7

View File

@@ -0,0 +1,9 @@
G:\Projects\C#\HardwareTempArduino\bin\Debug\HardwareTempArduino.exe.config
G:\Projects\C#\HardwareTempArduino\bin\Debug\HardwareTempArduino.exe
G:\Projects\C#\HardwareTempArduino\bin\Debug\HardwareTempArduino.pdb
G:\Projects\C#\HardwareTempArduino\obj\Debug\HardwareTempArduino.csprojAssemblyReference.cache
G:\Projects\C#\HardwareTempArduino\obj\Debug\HardwareTempArduino.csproj.CoreCompileInputs.cache
G:\Projects\C#\HardwareTempArduino\obj\Debug\HardwareTempArduino.exe
G:\Projects\C#\HardwareTempArduino\obj\Debug\HardwareTempArduino.pdb
G:\Projects\C#\HardwareTempArduino\bin\Debug\OpenHardwareMonitorLib.dll
G:\Projects\C#\HardwareTempArduino\obj\Debug\HardwareTempArduino.csproj.CopyComplete

Binary file not shown.

Binary file not shown.