-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
1,057 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+14.5 KB
LegionInfoDLL/.vs/LegionInfoDLL/FileContentIndex/e0bafda9-ef22-4297-baeb-3e7eff50fab3.vsidx
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Management; | ||
|
||
namespace LegionInfoDLL | ||
{ | ||
public static class Fan | ||
{ | ||
public static int GetFanSpeed(int fanID) | ||
{ | ||
var speed = -1; | ||
try// Get the client's SMS_Client class. | ||
{ | ||
speed = Call("root\\WMI", | ||
$"SELECT * FROM LENOVO_FAN_METHOD", | ||
"Fan_GetCurrentFanSpeed", | ||
new Dictionary<string, object>() { { "FanID", fanID } }, | ||
pdc => Convert.ToInt32(pdc["CurrentFanSpeed"].Value)); | ||
} | ||
catch (Exception ignore) | ||
{ | ||
return -1; | ||
} | ||
return speed; | ||
} | ||
|
||
private static T Call<T>(string scope, FormattableString query, string methodName, Dictionary<string, object> methodParams, Func<PropertyDataCollection, T> converter) | ||
{ | ||
try | ||
{ | ||
var queryFormatted = query.ToString(WMIPropertyValueFormatter.Instance); | ||
|
||
var mos = new ManagementObjectSearcher(scope, queryFormatted); | ||
var managementObject = mos.Get().Cast<ManagementBaseObject>().FirstOrDefault() ?? throw new InvalidOperationException("No results in query"); | ||
|
||
var mo = (ManagementObject)managementObject; | ||
var methodParamsObject = mo.GetMethodParameters(methodName); | ||
foreach (var pair in methodParams) | ||
methodParamsObject[pair.Key] = pair.Value; | ||
|
||
var resultProperties = mo.InvokeMethod(methodName, methodParamsObject, new InvokeMethodOptions()); | ||
var result = converter(resultProperties.Properties); | ||
return result; | ||
} | ||
catch (ManagementException ex) | ||
{ | ||
throw new ManagementException($"Call failed: {ex.Message}. [scope={scope}, query={query}, methodName={methodName}]", ex); | ||
} | ||
} | ||
|
||
private class WMIPropertyValueFormatter : IFormatProvider, ICustomFormatter | ||
{ | ||
public static readonly WMIPropertyValueFormatter Instance = new WMIPropertyValueFormatter(); | ||
|
||
private WMIPropertyValueFormatter() { } | ||
|
||
public object GetFormat(Type formatType) | ||
{ | ||
if (formatType == typeof(ICustomFormatter)) | ||
return this; | ||
|
||
throw new InvalidOperationException("Invalid type of formatted"); | ||
} | ||
|
||
public string Format(string format, object arg, IFormatProvider formatProvider) | ||
{ | ||
var stringArg = arg?.ToString()?.Replace("\\", "\\\\"); | ||
return stringArg ?? string.Empty; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?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>{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>LegionInfoDLL</RootNamespace> | ||
<AssemblyName>LegionInfoDLL</AssemblyName> | ||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<PlatformTarget>x64</PlatformTarget> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\x64\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<LangVersion>7.3</LangVersion> | ||
<ErrorReport>prompt</ErrorReport> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
<OutputPath>bin\x64\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<LangVersion>7.3</LangVersion> | ||
<ErrorReport>prompt</ErrorReport> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Management" /> | ||
<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="Class1.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.8.34322.80 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LegionInfoDLL", "LegionInfoDLL.csproj", "{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}.Debug|x64.ActiveCfg = Debug|x64 | ||
{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}.Debug|x64.Build.0 = Debug|x64 | ||
{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}.Release|x64.ActiveCfg = Release|x64 | ||
{C37E94F1-73B0-4FB1-9AAE-F5D533785F9D}.Release|x64.Build.0 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {53FA2AAC-8B47-4775-811D-4A12899625A0} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("LegionInfoDLL")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("LegionInfoDLL")] | ||
[assembly: AssemblyCopyright("Copyright © 2023")] | ||
[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("c37e94f1-73b0-4fb1-9aae-f5d533785f9d")] | ||
|
||
// 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")] |
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
LegionInfoDLL/obj/Debug/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// <autogenerated /> | ||
using System; | ||
using System.Reflection; | ||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] |
Binary file added
BIN
+1.76 KB
LegionInfoDLL/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions
1
LegionInfoDLL/obj/Debug/LegionInfoDLL.csproj.CoreCompileInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5f6e7e3d846851f5ef04a1bb0e5300da5eceff0ee74dd83a7cb3dff536718092 |
6 changes: 6 additions & 0 deletions
6
LegionInfoDLL/obj/Debug/LegionInfoDLL.csproj.FileListAbsolute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
D:\projects\vs\LegionInfoDLL\bin\Debug\LegionInfoDLL.dll | ||
D:\projects\vs\LegionInfoDLL\bin\Debug\LegionInfoDLL.pdb | ||
D:\projects\vs\LegionInfoDLL\obj\Debug\LegionInfoDLL.csproj.AssemblyReference.cache | ||
D:\projects\vs\LegionInfoDLL\obj\Debug\LegionInfoDLL.csproj.CoreCompileInputs.cache | ||
D:\projects\vs\LegionInfoDLL\obj\Debug\LegionInfoDLL.dll | ||
D:\projects\vs\LegionInfoDLL\obj\Debug\LegionInfoDLL.pdb |
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
LegionInfoDLL/obj/x64/Debug/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// <autogenerated /> | ||
using System; | ||
using System.Reflection; | ||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] |
Binary file added
BIN
+1.77 KB
LegionInfoDLL/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file added
BIN
+4.42 KB
LegionInfoDLL/obj/x64/Debug/LegionInfoDLL.csproj.AssemblyReference.cache
Binary file not shown.
1 change: 1 addition & 0 deletions
1
LegionInfoDLL/obj/x64/Debug/LegionInfoDLL.csproj.CoreCompileInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a961d9b8077c5584f75c109fee4e71700d1a6717be6a6d7609b7fde947f9621c |
6 changes: 6 additions & 0 deletions
6
LegionInfoDLL/obj/x64/Debug/LegionInfoDLL.csproj.FileListAbsolute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
D:\projects\vs\LegionInfoDLL\bin\x64\Debug\LegionInfoDLL.dll | ||
D:\projects\vs\LegionInfoDLL\bin\x64\Debug\LegionInfoDLL.pdb | ||
D:\projects\vs\LegionInfoDLL\obj\x64\Debug\LegionInfoDLL.csproj.AssemblyReference.cache | ||
D:\projects\vs\LegionInfoDLL\obj\x64\Debug\LegionInfoDLL.csproj.CoreCompileInputs.cache | ||
D:\projects\vs\LegionInfoDLL\obj\x64\Debug\LegionInfoDLL.dll | ||
D:\projects\vs\LegionInfoDLL\obj\x64\Debug\LegionInfoDLL.pdb |
Binary file not shown.
Binary file added
BIN
+107 Bytes
...foPlugin/.vs/LegionInfoPlugin/FileContentIndex/21674e5e-be36-48db-b49f-2df438490c63.vsidx
Binary file not shown.
Binary file added
BIN
+10.8 KB
...foPlugin/.vs/LegionInfoPlugin/FileContentIndex/21c99575-269a-4195-8e70-8cc8b62261d7.vsidx
Binary file not shown.
Binary file added
BIN
+19.9 KB
...foPlugin/.vs/LegionInfoPlugin/FileContentIndex/55978ae8-8e0f-4a72-aa83-f559318ed501.vsidx
Binary file not shown.
Binary file added
BIN
+635 Bytes
...foPlugin/.vs/LegionInfoPlugin/FileContentIndex/79649fdd-2e80-4d56-8066-0c5b0c7327c1.vsidx
Binary file not shown.
Binary file added
BIN
+2.54 KB
...foPlugin/.vs/LegionInfoPlugin/FileContentIndex/c1681d2c-d3bb-4dba-ad69-d462106c5ec3.vsidx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+45.1 MB
LegionInfoPlugin/.vs/LegionInfoPlugin/v17/ipch/AutoPCH/16fed6df89651979/DLLMAIN.ipch
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "pch.h" | ||
#include "InfoItem.h" | ||
|
||
InfoItem::InfoItem(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
#include "PluginInterface.h" | ||
#include <string> | ||
|
||
class InfoItem : public IPluginItem | ||
{ | ||
public: | ||
InfoItem(); | ||
|
||
const wchar_t* GetItemName() const override { | ||
return itemName; | ||
} | ||
const wchar_t* GetItemId() const override { | ||
return itemId; | ||
} | ||
const wchar_t* GetItemLableText() const override { | ||
return itemLableText; | ||
} | ||
const wchar_t* GetItemValueText() const override { | ||
return itemValueText.c_str(); | ||
} | ||
const wchar_t* GetItemValueSampleText() const override { | ||
return itemValueSampleText; | ||
} | ||
bool IsCustomDraw() const override { | ||
return false; | ||
} | ||
|
||
const wchar_t* itemName; | ||
const wchar_t* itemId; | ||
const wchar_t* itemLableText; | ||
std::wstring itemValueText; | ||
const wchar_t* itemValueSampleText; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.8.34322.80 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LegionInfoPlugin", "LegionInfoPlugin.vcxproj", "{14E138BC-22AB-45E8-9341-6E8D9291EF40}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{14E138BC-22AB-45E8-9341-6E8D9291EF40}.Debug|x64.ActiveCfg = Debug|x64 | ||
{14E138BC-22AB-45E8-9341-6E8D9291EF40}.Debug|x64.Build.0 = Debug|x64 | ||
{14E138BC-22AB-45E8-9341-6E8D9291EF40}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{14E138BC-22AB-45E8-9341-6E8D9291EF40}.Debug|x86.Build.0 = Debug|Win32 | ||
{14E138BC-22AB-45E8-9341-6E8D9291EF40}.Release|x64.ActiveCfg = Release|x64 | ||
{14E138BC-22AB-45E8-9341-6E8D9291EF40}.Release|x64.Build.0 = Release|x64 | ||
{14E138BC-22AB-45E8-9341-6E8D9291EF40}.Release|x86.ActiveCfg = Release|Win32 | ||
{14E138BC-22AB-45E8-9341-6E8D9291EF40}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {1D7324D2-C76F-4107-A4E9-7DD4017740C0} | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.