dll加载路径错误
This commit is contained in:
31
hardware_monitor_wrapper/native/storage.cpp
Normal file
31
hardware_monitor_wrapper/native/storage.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include "include.h"
|
||||
Napi::Array disk_name(const Napi::CallbackInfo& info){
|
||||
Napi::Env env = info.Env();
|
||||
Napi::Array array;
|
||||
int i=0;
|
||||
for (Hardware hardware:computer->getHardware()){
|
||||
if(hardware.getHardwareType()==HardwareType::Storage){
|
||||
Napi::String str2= Napi::String::New(env,hardware.Name());
|
||||
array.Set(i, str2);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
Napi::Array current_disk_used(const Napi::CallbackInfo& info){
|
||||
Napi::Env env = info.Env();
|
||||
Napi::Array myarray=Napi::Array::New(env);
|
||||
std::vector<Hardware> hardwares=computer->getHardware();
|
||||
for (int i=0;i<hardwares.size();i++){
|
||||
if(hardwares[i].getHardwareType()==HardwareType::Storage){
|
||||
Napi::Object object=Napi::Object::New(env);
|
||||
std::string name_str=hardwares[i].Name();
|
||||
for(Sensor sen:hardwares[i].getSensors()){
|
||||
if(sen.getType()==SensorType::Load && name_str=="Used Space"){
|
||||
myarray.Set<float>(i, sen.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return myarray;
|
||||
}
|
Reference in New Issue
Block a user