dll加载路径错误

This commit is contained in:
2025-06-08 17:40:21 +08:00
parent 232ba1a5ae
commit 2298e69a1c
84 changed files with 4749 additions and 241 deletions

View File

@ -0,0 +1,65 @@
#pragma once
#include "Settings.h"
#include "SMBios.h"
#include "Visitor.h"
#include "IComputer.h"
#include "Hardware.h"
#include <vector>
#include <memory>
#include "dll_macro.h"
struct innerComputer;
struct innerComputerInterface;
class DLL_API Computer : public IComputer{
public:
Computer();
Computer(Settings &settigs);
Computer(std::shared_ptr<innerComputer> inner);
~Computer() override;
bool isNull() const;
bool operator==(const Computer&) const;
std::vector<Hardware> getHardware() override;
bool isBatteryEnabled() override;
void setBatteryEnabled(bool);
bool isControllerEnabled() override;
void setControllerEnabled(bool);
bool isCpuEnabled() override;
void setCpuEnabled(bool);
bool isGpuEnabled() override;
void setGpuEnabled(bool);
bool isMemoryEnabled() override;
void setMemoryEnabled(bool);
bool isMotherboardEnabled() override;
void setMotherboardEnabled(bool);
bool isNetworkEnabled() override;
void setNetworkEnabled(bool);
bool isPsuEnabled() override;
void setPsuEnabled(bool);
bool isStorageEnabled() override;
void setStorageEnabled(bool);
SMBios getSMBios();
std::string GetReport() override;
void Accept(Visitor* visitor) override;
void Traverse(Visitor* visitor) override;
void Open();
void Close();
void Reset();
private:
std::shared_ptr<innerComputer> inner;
};

View File

@ -0,0 +1,30 @@
#pragma once
struct innerCsControl;
class Sensor;
#include "Identifier.h"
#include "dll_macro.h"
#include <memory>
enum CsControlMode
{
Undefined,
Software,
Default,
ObjectIsNull
};
class DLL_API CsControl
{
public:
CsControl(std::shared_ptr<innerCsControl> inner);
~CsControl();
bool isNull() const;
CsControlMode getCsControlMode();
Identifier getIdentifier();
float getMaxSoftwareValue();
float getMinSoftwareValue();
Sensor getSensor();
float getSoftwareValue();
void SetDefault();
void SetSoftware(float value);
private:
std::shared_ptr<innerCsControl> inner;
};

View File

@ -0,0 +1,25 @@
#include "pch.h"
#include "Group.h"
#include <msclr/marshal_cppstd.h>
#include "internals.h"
bool Group::isNull() const
{
if (inner == nullptr)
return true;
return ((inner->getInner()->Equals(nullptr))) ? false : true;
}
std::string Group::GetReport()
{
if (isNull()) {
return "";
}
return msclr::interop::marshal_as<std::string>(inner->getInner()->GetReport());
}
void Group::Close()
{
if (isNull()) {
return;
}
inner->getInner()->Close();
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "dll_macro.h"
#include <string>
struct innerGroup;
class DLL_API Group {
public:
Group(std::shared_ptr<innerGroup> inner):inner(inner){}
virtual ~Group() {
}
bool isNull() const;
virtual std::string GetReport();
virtual void Close();
protected:
std::shared_ptr<innerGroup> inner;
};

View File

@ -0,0 +1,29 @@
#pragma once
#include "Hardware.h"
#include "dll_macro.h"
struct innerGroupAffinity;
namespace mikesolar {
template<typename T>
class List;
}
class DLL_API GroupAffinity
{
public:
GroupAffinity(unsigned short group, unsigned long mask);
GroupAffinity(std::shared_ptr<innerGroupAffinity> inner);
bool isNull() const;
static GroupAffinity Undifined();
static GroupAffinity Single(unsigned short group, int index);
unsigned short Group();
unsigned long Mask();
//public override bool Equals(object o)
int GetHashCode();
bool operator==(const GroupAffinity &other) const;
//static bool operator !=(GroupAffinity a1, GroupAffinity a2);
~GroupAffinity();
private:
std::shared_ptr<innerGroupAffinity> inner;
};

View File

@ -0,0 +1,33 @@
#pragma once
#include "dll_macro.h"
#include "HardwareType.h"
#include "Identifier.h"
#include <string>
#include <memory>
#include <vector>
class Sensor;
class Visitor;
struct innerHardware;
class DLL_API Hardware {
public:
Hardware(std::shared_ptr<innerHardware> inner);
Hardware(const Hardware& src);
bool isNull() const;
Hardware operator=(const Hardware& src) const{
return Hardware(src);
}
bool operator==(const Hardware& other) const;
HardwareType getHardwareType();
std::vector<Sensor> getSensors();
Hardware getParent();
std::vector<Hardware> getSubHardware();
void Update();
std::string Name();
std::string GetReport();
void Accept(Visitor* visitor);
void Traverse(Visitor* visitor);
Identifier getIdenifier();
~Hardware();
private:
std::shared_ptr<innerHardware> inner;
};

View File

@ -0,0 +1,19 @@
#pragma once
enum class HardwareType {
Motherboard,
SuperIO,
Cpu,
Memory,
GpuNvidia,
GpuAmd,
GpuIntel,
Storage,
Network,
Cooler,
EmbeddedController,
Psu,
Battery,
Other,
ObjectIsNull
};

View File

@ -0,0 +1,63 @@
#pragma once
#pragma once
#include "Settings.h"
#include "SMBios.h"
#include <vector>
#include "Hardware.h"
#include "IComputer.h"
#include "dll_macro.h"
class Visitor;
struct innerComputerInterface;
/**
* <20><>Ȼ<EFBFBD><C8BB>I<EFBFBD><49>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ϊ<EFBFBD>˺<EFBFBD>C#<23><EFBFBD><E0B1A3>һ<EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD>
* <20><>Ӧ<EFBFBD>ñ<EFBFBD><C3B1>ֶ<EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>Դӱ<D4B4><D3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡ
*/
class DLL_API IComputer {
public:
//<2F><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>innerComputerInterface<63><65>ʵ<EFBFBD>ֵģ<D6B5>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>͸ñ<CDB8><C3B1><EFBFBD><EFBFBD>ˡ<EFBFBD>
//<2F><>Ӧ<EFBFBD>ñ<EFBFBD><C3B1>ֶ<EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>Դӱ<D4B4><D3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡ
IComputer(std::shared_ptr<innerComputerInterface> inner);
virtual bool operator==(const IComputer& other) const;
bool isNull() const;
virtual ~IComputer();
virtual std::vector<Hardware> getHardware();
virtual bool isBatteryEnabled();
virtual bool isControllerEnabled();
virtual bool isCpuEnabled();
virtual bool isGpuEnabled();
virtual bool isMemoryEnabled();
virtual bool isMotherboardEnabled();
virtual bool isNetworkEnabled();
virtual bool isPsuEnabled();
virtual bool isStorageEnabled();
virtual std::string GetReport();
virtual void Accept(Visitor* visitor);
virtual void Traverse(Visitor* visitor);
protected:
std::shared_ptr<innerComputerInterface> inner;
//<2F><>Ӧ<EFBFBD><D3A6><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD>inner<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>getter<65><72>setter<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><E3B6A8><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void setIComputerInner(std::shared_ptr<innerComputerInterface> inner) {
this->inner = inner;
}
std::shared_ptr<innerComputerInterface> getIComputerInner() const {
return inner;
}
};

View File

@ -0,0 +1,26 @@
#pragma once
#include "dll_macro.h"
#include <string>
#include <memory>
struct innerIdentifier;
class DLL_API Identifier {
public:
Identifier(std::shared_ptr<innerIdentifier> inner);
//Identifier(params string[] identifiers);
//Identifier(Identifier identifier, params string[] extensions)
int CompareTo(Identifier other);
//static void CheckIdentifiers(IEnumerable<string> identifiers)
std::string ToString();
int GetHashCode();
bool operator==(const Identifier& other) const;
bool operator!=(const Identifier& other) const;
bool operator<(const Identifier& id) const;
bool operator>(const Identifier& id) const;
bool isNull() const;
private:
std::shared_ptr<innerIdentifier> inner;
};

View File

@ -0,0 +1,26 @@
#pragma once
#include <string>
class Visitor;
#include "Identifier.h"
class Sensor;
#include "dll_macro.h"
struct innerParameter;
class DLL_API Parameter {
public:
Parameter(innerParameter* inner);
~Parameter();
bool isNull() const;
bool operator==(const Parameter& other) const;
float getDefaultValue();
std::string getDescription();
Identifier getIdentifier();
bool isDefault();
std::string getName();
Sensor getSensor();
float getValue();
void Accept(Visitor* visitor);
void Traverse(Visitor* visitor);
private:
innerParameter* inner;
};

View File

@ -0,0 +1,14 @@
#pragma once
#include "dll_macro.h"
#include <string>
struct innerParameterDescription;
class DLL_API ParameterDescription
{
public:
ParameterDescription(char* name, char* description, float defaultValue);
bool isNull() const;
std::string getName();
float getDefaultValue();
private:
std::shared_ptr<innerParameterDescription> inner;
};

View File

@ -0,0 +1,195 @@
#pragma once
#ifdef DLL_EXPORT
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif
#include <ctime>
#include <string>
#include <vector>
#include "SMBiosEnums.h"
struct innerBiosInformation;
struct innerSystemEnclosure;
struct innerSMBios;
struct innerSystemInformation;
struct innerBaseBoardInformation;
struct innerProcessorInformation;
struct innerCacheInformation;
struct innerMemoryDevice;
struct innerSMBios;
class DLL_API BiosInformation {
public:
BiosInformation(std::shared_ptr<innerBiosInformation> inner);
~BiosInformation();
bool isNull() const;
time_t getDate();
std::string getVendor();
std::string getVersion();
unsigned long long getSize();
private:
std::shared_ptr<innerBiosInformation> inner;
};
class DLL_API SystemInformation {
public:
SystemInformation(std::shared_ptr<innerSystemInformation> inner);
~SystemInformation();
bool isNull() const;
std::string getFamily();
std::string getManufacturerName();
std::string getProductName();
std::string getSerialNumber();
std::string getVersion();
SystemWakeUp WakeUp();
private:
std::shared_ptr<innerSystemInformation> inner;
};
class DLL_API SystemEnclosure {
public:
SystemEnclosure(std::shared_ptr<innerSystemEnclosure> inner);
~SystemEnclosure();
bool isNull() const;
std::string getAssetTag();
SystemEnclosureState getBootUpState();
bool getLockDetected();
void setLockDetected(bool locked);
std::string getManufacturerName();
unsigned char getPowerCords();
SystemEnclosureState getPowerSupplyState();
unsigned char getRackHeight();
SystemEnclosureSecurityStatus getSecurityStatus();
void setSecurityStatus(SystemEnclosureSecurityStatus status);
std::string getSerialNumber();
std::string getSKU();
SystemEnclosureState getThermalState();
SystemEnclosureType getType();
std::string Version();
private:
std::shared_ptr<innerSystemEnclosure> inner;
};
class DLL_API BaseBoardInformation {
public:
BaseBoardInformation(std::shared_ptr<innerBaseBoardInformation> inner);
~BaseBoardInformation();
bool isNull() const;
std::string getManufacturerName();
std::string getProductName();
std::string getSerialNumber();
std::string getVersion();
private:
std::shared_ptr<innerBaseBoardInformation> inner;
};
class DLL_API CSProcessorInformation {
public:
CSProcessorInformation(std::shared_ptr<innerProcessorInformation> inner);
~CSProcessorInformation();
bool isNull() const;
ProcessorCharacteristics getCharacteristics();
unsigned short getCoreCount();
unsigned short getCoreEnabled();
unsigned short getCurrentSpeed();
unsigned short getExternalClock();
ProcessorFamily getFamily();
unsigned short getHandle();
unsigned long long getId();
unsigned short getL1CacheHandle();
unsigned short getL2CacheHandle();
unsigned short getL3CacheHandle();
std::string getManufacturerName();
unsigned short getMaxSpeed();
ProcessorType getProcessorType();
std::string getSerial();
ProcessorSocket getSocket();
std::string getSocketDesignation();
unsigned short getThreadCount();
std::string getVersion();
private:
std::shared_ptr<innerProcessorInformation> inner;
};
class DLL_API CacheInformation
{
public:
CacheInformation(std::shared_ptr<innerCacheInformation> inner);
~CacheInformation();
bool isNull() const;
CacheAssociativity getAssociativity();
CacheDesignation getDesignation();
unsigned short getHandle();
unsigned short getSize();
private:
std::shared_ptr<innerCacheInformation> inner;
};
class DLL_API MemoryDevice
{
public:
MemoryDevice(std::shared_ptr<innerMemoryDevice> inner);
~MemoryDevice();
bool isNull() const;
std::string getBankLocator();
std::string getDeviceLocator();
std::string getManufacturerName();
std::string getPartNumber();
std::string getSerialNumber();
unsigned int getSize();
unsigned short getSpeed();
unsigned short getConfiguredSpeed();
unsigned short getConfiguredVoltage();
MemoryType getType();
private:
std::shared_ptr<innerMemoryDevice> inner;
};
class DLL_API SMBios
{
public:
SMBios();
~SMBios();
bool isNull() const;
SMBios(std::shared_ptr<innerSMBios>);
bool operator==(const SMBios& other) const;
BiosInformation getBios();
BaseBoardInformation getBoard();
std::vector<MemoryDevice> getMemoryDevice();
std::vector<CacheInformation> getProcessorCaches();
std::vector<CSProcessorInformation> getProcessors();
SystemInformation getSystem();
SystemEnclosure getSystemEnclosure();
std::string getGetReport();
private:
std::shared_ptr<innerSMBios> inner;
};

View File

@ -0,0 +1,460 @@
#pragma once
enum class SystemEnclosureSecurityStatus
{
Other = 1,
Unknown,
None,
ExternalInterfaceLockedOut,
ExternalInterfaceEnabled,
ObjectIsNull
};
enum class SystemEnclosureState
{
Other = 1,
Unknown,
Safe,
Warning,
Critical,
NonRecoverable,
ObjectIsNull
};
enum class SystemEnclosureType
{
Other = 1,
Unknown,
Desktop,
LowProfileDesktop,
PizzaBox,
MiniTower,
Tower,
Portable,
Laptop,
Notebook,
HandHeld,
DockingStation,
AllInOne,
SubNotebook,
SpaceSaving,
LunchBox,
MainServerChassis,
ExpansionChassis,
SubChassis,
BusExpansionChassis,
PeripheralChassis,
RaidChassis,
RackMountChassis,
SealedCasePc,
MultiSystemChassis,
CompactPci,
AdvancedTca,
Blade,
BladeEnclosure,
Tablet,
Convertible,
Detachable,
IoTGateway,
EmbeddedPc,
MiniPc,
StickPc,
ObjectIsNull
};
enum class ProcessorFamily
{
Other = 1,
Intel8086 = 3,
Intel80286 = 4,
Intel386,
Intel486,
Intel8087,
Intel80287,
Intel80387,
Intel80487,
IntelPentium,
IntelPentiumPro,
IntelPentiumII,
IntelPentiumMMX,
IntelCeleron,
IntelPentiumIIXeon,
IntelPentiumIII,
M1,
M2,
IntelCeleronM,
IntelPentium4HT,
AmdDuron = 24,
AmdK5,
AmdK6,
AmdK62,
AmdK63,
AmdAthlon,
Amd2900,
AmdK62Plus,
PowerPc,
PowerPc601,
PowerPc603,
PowerPc603Plus,
PowerPc604,
PowerPc620,
PowerPcx704,
PowerPc750,
IntelCoreDuo,
IntelCoreDuoMobile,
IntelCoreSoloMobile,
IntelAtom,
IntelCoreM,
IntelCoreM3,
IntelCoreM5,
IntelCoreM7,
Alpha,
Alpha21064,
Alpha21066,
Alpha21164,
Alpha21164Pc,
Alpha21164a,
Alpha21264,
Alpha21364,
AmdTurionIIUltraDualCoreMobileM,
AmdTurionDualCoreMobileM,
AmdAthlonIIDualCoreM,
AmdOpteron6100Series,
AmdOpteron4100Series,
AmdOpteron6200Series,
AmdOpteron4200Series,
AmdFxSeries,
Mips,
MipsR4000,
MipsR4200,
MipsR4400,
MipsR4600,
MipsR10000,
AmdCSeries,
AmdESeries,
AmdASeries,
AmdGSeries,
AmdZSeries,
AmdRSeries,
AmdOpteron4300Series,
AmdOpteron6300Series,
AmdOpteron3300Series,
AmdFireProSeries,
Sparc,
SuperSparc,
MicroSparcII,
MicroSparcIIep,
UltraSparc,
UltraSparcII,
UltraSparcIIi,
UltraSparcIII,
UltraSparcIIIi,
Motorola68040 = 96,
Motorola68xxx,
Motorola68000,
Motorola68010,
Motorola68020,
Motorola68030,
AmdAthlonX4QuadCore,
AmdOpteronX1000Series,
AmdOpteronX2000Series,
AmdOpteronASeries,
AmdOpteronX3000Series,
AmdZen,
Hobbit = 112,
CrusoeTm5000 = 120,
CrusoeTm3000,
EfficeonTm8000,
Weitek = 128,
IntelItanium = 130,
AmdAthlon64,
AmdOpteron,
AmdSempron,
AmdTurio64Mobile,
AmdOpteronDualCore,
AmdAthlon64X2DualCore,
AmdTurion64X2Mobile,
AmdOpteronQuadCore,
AmdOpteronThirdGen,
AmdPhenomFXQuadCore,
AmdPhenomX4QuadCore,
AmdPhenomX2DualCore,
AmdAthlonX2DualCore,
PaRisc,
PaRisc8500,
PaRisc8000,
PaRisc7300LC,
PaRisc7200,
PaRisc7100LC,
PaRisc7100,
V30 = 160,
IntelXeon3200QuadCoreSeries,
IntelXeon3000DualCoreSeries,
IntelXeon5300QuadCoreSeries,
IntelXeon5100DualCoreSeries,
IntelXeon5000DualCoreSeries,
IntelXeonLVDualCore,
IntelXeonULVDualCore,
IntelXeon7100Series,
IntelXeon5400Series,
IntelXeonQuadCore,
IntelXeon5200DualCoreSeries,
IntelXeon7200DualCoreSeries,
IntelXeon7300QuadCoreSeries,
IntelXeon7400QuadCoreSeries,
IntelXeon7400MultiCoreSeries,
IntelPentiumIIIXeon,
IntelPentiumIIISpeedStep,
IntelPentium4,
IntelXeon,
As400,
IntelXeonMP,
AmdAthlonXP,
AmdAthlonMP,
IntelItanium2,
IntelPentiumM,
IntelCeleronD,
IntelPentiumD,
IntelPentiumExtreme,
IntelCoreSolo,
IntelCore2Duo = 191,
IntelCore2Solo,
IntelCore2Extreme,
IntelCore2Quad,
IntelCore2ExtremeMobile,
IntelCore2DuoMobile,
IntelCore2SoloMobile,
IntelCoreI7,
IntelCeleronDualCore,
Ibm390,
PowerPcG4,
PowerPcG5,
Esa390G6,
ZArchitecture,
IntelCoreI5,
IntelCoreI3,
IntelCoreI9,
ViaC7M = 210,
ViaC7D,
ViaC7,
ViaEden,
IntelXeonMultiCore,
IntelXeon3xxxDualCoreSeries,
IntelXeon3xxxQuadCoreSeries,
ViaNano,
IntelXeon5xxxDualCoreSeries,
IntelXeon5xxxQuadCoreSeries,
IntelXeon7xxxDualCoreSeries = 221,
IntelXeon7xxxQuadCoreSeries,
IntelXeon7xxxMultiCoreSeries,
IntelXeon3400MultiCoreSeries,
AmdOpteron3000Series = 228,
AmdSempronII,
AmdOpteronQuadCoreEmbedded,
AmdPhenomTripleCore,
AmdTurionUltraDualCoreMobile,
AmdTurionDualCoreMobile,
AmdTurionDualCore,
AmdAthlonDualCore,
AmdSempronSI,
AmdPhenomII,
AmdAthlonII,
AmdOpteronSixCore,
AmdSempronM,
IntelI860 = 250,
IntelI960,
ArmV7 = 256,
ArmV8,
HitachiSh3,
HitachiSh4,
Arm,
StrongArm,
_686,
MediaGX,
MII,
WinChip,
Dsp,
VideoProcessor,
ObjectIsNull
};
/// <summary>
/// Processor characteristics based on <see href="https://www.dmtf.org/dsp/DSP0134">DMTF SMBIOS Reference Specification v.3.3.0, Chapter 7.5.9</see>.
/// </summary>
enum class ProcessorCharacteristics
{
None = 0,
_64BitCapable = 1,
MultiCore = 2,
HardwareThread = 4,
ExecuteProtection = 8,
EnhancedVirtualization = 16,
PowerPerformanceControl = 32,
_128BitCapable = 64,
ObjectIsNull
};
/// <summary>
/// Processor type based on <see href="https://www.dmtf.org/dsp/DSP0134">DMTF SMBIOS Reference Specification v.3.3.0, Chapter 7.5.1</see>.
/// </summary>
enum class ProcessorType
{
Other = 1,
Unknown,
CentralProcessor,
MathProcessor,
DspProcessor,
VideoProcessor,
ObjectIsNull
};
/// <summary>
/// Processor socket based on <see href="https://www.dmtf.org/dsp/DSP0134">DMTF SMBIOS Reference Specification v.3.3.0, Chapter 7.5.5</see>.
/// </summary>
enum class ProcessorSocket
{
Other = 1,
Unknown,
DaughterBoard,
ZifSocket,
PiggyBack,
None,
LifSocket,
Zif423 = 13,
A,
Zif478,
Zif754,
Zif940,
Zif939,
MPga604,
Lga771,
Lga775,
S1,
AM2,
F,
Lga1366,
G34,
AM3,
C32,
Lga1156,
Lga1567,
Pga988A,
Bga1288,
RPga088B,
Bga1023,
Bga1224,
Lga1155,
Lga1356,
Lga2011,
FS1,
FS2,
FM1,
FM2,
Lga20113,
Lga13563,
Lga1150,
Bga1168,
Bga1234,
Bga1364,
AM4,
Lga1151,
Bga1356,
Bga1440,
Bga1515,
Lga36471,
SP3,
SP3R2,
Lga2066,
Bga1510,
Bga1528,
Lga4189,
ObjectIsNull
};
/// <summary>
/// System wake-up type based on <see href="https://www.dmtf.org/dsp/DSP0134">DMTF SMBIOS Reference Specification v.3.3.0, Chapter 7.2.2</see>.
/// </summary>
enum class SystemWakeUp
{
Reserved,
Other,
Unknown,
ApmTimer,
ModemRing,
LanRemote,
PowerSwitch,
PciPme,
AcPowerRestored,
ObjectIsNull
};
/// <summary>
/// Cache associativity based on <see href="https://www.dmtf.org/dsp/DSP0134">DMTF SMBIOS Reference Specification v.3.3.0, Chapter 7.8.5</see>.
/// </summary>
enum class CacheAssociativity
{
Other = 1,
Unknown,
DirectMapped,
_2Way,
_4Way,
FullyAssociative,
_8Way,
_16Way,
_12Way,
_24Way,
_32Way,
_48Way,
_64Way,
_20Way,
ObjectIsNull
};
/// <summary>
/// Processor cache level.
/// </summary>
enum class CacheDesignation
{
Other,
L1,
L2,
L3,
ObjectIsNull
};
/// <summary>
/// Memory type.
/// </summary>
enum class MemoryType
{
Other = 0x01,
Unknown = 0x02,
DRAM = 0x03,
EDRAM = 0x04,
VRAM = 0x05,
SRAM = 0x06,
RAM = 0x07,
ROM = 0x08,
FLASH = 0x09,
EEPROM = 0x0a,
FEPROM = 0x0b,
EPROM = 0x0c,
CDRAM = 0x0d,
_3DRAM = 0x0e,
SDRAM = 0x0f,
SGRAM = 0x10,
RDRAM = 0x11,
DDR = 0x12,
DDR2 = 0x13,
DDR2_FBDIMM = 0x14,
DDR3 = 0x18,
FBD2 = 0x19,
DDR4 = 0x1a,
LPDDR = 0x1b,
LPDDR2 = 0x1c,
LPDDR3 = 0x1d,
LPDDR4 = 0x1e,
LogicalNonVolatileDevice = 0x1f,
HBM = 0x20,
HBM2 = 0x21,
DDR5 = 0x22,
LPDDR5 = 0x23,
ObjectIsNull
};

View File

@ -0,0 +1,83 @@
#pragma once
#include <ctime>
#include "Hardware.h"
#include "Identifier.h"
#include "Parameter.h"
#include <vector>
#include "Control.h"
#include "dll_macro.h"
class Visitor;
struct innerSensor;
class DLL_API SensorValue {
public:
SensorValue(float value, time_t time) {
this->value = value;
this->timestamp = time;
}
time_t getTimestamp() {
return timestamp;
}
bool operator==(const SensorValue& other) const {
return (this->value == other.value) && (this->timestamp == other.timestamp);
}
float getValue() {
return value;
}
private:
time_t timestamp;
float value;
};
enum class SensorType
{
Voltage, // V
Current, // A
Power, // W
Clock, // MHz
Temperature, // °C
Load, // %
Frequency, // Hz
Fan, // RPM
Flow, // L/h
Control, // %
Level, // %
Factor, // 1
Data, // GB = 2^30 Bytes
SmallData, // MB = 2^20 Bytes
Throughput, // B/s
TimeSpan, // Seconds
Energy, // milliwatt-hour (mWh)
Noise, // dBA
Conductivity, // µS/cm
Humidity, // %
ObjectIsNull
};
class DLL_API Sensor {
public:
Sensor(std::shared_ptr<innerSensor> inner);
~Sensor();
bool isNull() const;
bool operator==(const Sensor& other) const;
float getMax();//如果是null返回FLT_MIN即float最小值
float getMin();//如果是null返回FLT_MAX即float最大值
std::vector<SensorValue> getValues();
SensorType getType();
float getValue();
//需自行delete[]
char* getName();
std::vector<Parameter> getParameters();
time_t getTimeSpan();
void resetMin();
void resetMax();
void clearValues();
void Accept(Visitor* visitor);
void Traverse(Visitor* visitor);
Hardware getHardware();
Identifier getIdentifier();
bool isDefaultHidden();
int getIndex();
CsControl getControl();
private:
std::shared_ptr<innerSensor> inner;
};

View File

@ -0,0 +1,24 @@
#pragma once
#ifdef DLL_EXPORT
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif
#include <memory>
#include <string>
struct innerSettings;
class DLL_API Settings {
public:
Settings(std::shared_ptr<innerSettings>);
virtual bool isNull() const;
virtual bool Contains(char*);
virtual void SetValue(char*, char*);
virtual std::string GetValue(char*, char*);
virtual void Remove(char*);
virtual std::shared_ptr<innerSettings> getInner();
virtual void setInner(std::shared_ptr<innerSettings>);
private:
std::shared_ptr<innerSettings> inner=nullptr;
};

View File

@ -0,0 +1,36 @@
#pragma once
#include "dll_macro.h"
#include "IComputer.h"
#include "Hardware.h"
class Sensor;
#include "Parameter.h"
struct innerVisitor;
class VisitorCallBacks;
typedef void (*VisitComputerDelegate)(IComputer& computer, Visitor* visitor);
typedef void (*VisitHardwareDelegate)(Hardware& hardware, Visitor* visitor);
typedef void (*VisitSensorDelegate)(Sensor& sensor, Visitor* visitor);
typedef void (*VisitParameterDelegate)(Parameter& parameter, Visitor* visitor);
class DLL_API Visitor {
public:
Visitor();
void setVisitComputerCallBack(VisitComputerDelegate);
void setVisitHardwareCallBack(VisitHardwareDelegate);
void setVisitSensorCallBack(VisitSensorDelegate);
void setVisitParameterCallBack(VisitParameterDelegate);
void commit();
VisitComputerDelegate getVisitComputerCallBack();
VisitHardwareDelegate getVisitHardwareCallBack();
VisitSensorDelegate getVisitSensorCallBack();
VisitParameterDelegate getVisitParameterCallBack();
innerVisitor* getInner();
protected:
innerVisitor* inner;
VisitComputerDelegate visitComputerCallBack;
VisitHardwareDelegate visitHardwareCallBack;
VisitSensorDelegate visitSensorCallBack;
VisitParameterDelegate visitParameterCallBack;
};

View File

@ -0,0 +1,6 @@
#pragma once
#ifdef DLL_EXPORT
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif