graphics() added deviceName (windows)
This commit is contained in:
+4
-3
@@ -43,9 +43,10 @@ function fsSize(callback) {
|
||||
lines.forEach(function (line) {
|
||||
if (line !== '') {
|
||||
line = line.replace(/ +/g, ' ').split(' ');
|
||||
if (line && (line[0].startsWith('/')) || (line[6] && line[6] === '/')) {
|
||||
console.log(line);
|
||||
if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0))) {
|
||||
const fs = line[0];
|
||||
const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : 'HFS');
|
||||
const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : (line[0].startsWith('/')) ? 'HFS' : 'NFS');
|
||||
const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
|
||||
const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024;
|
||||
const use = parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2));
|
||||
@@ -71,7 +72,7 @@ function fsSize(callback) {
|
||||
let data = [];
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
let cmd = '';
|
||||
if (_darwin) cmd = 'df -lkP | grep ^/';
|
||||
if (_darwin) cmd = 'df -kP';
|
||||
if (_linux) cmd = 'df -lkPTx squashfs | grep ^/';
|
||||
if (_freebsd || _openbsd || _netbsd) cmd = 'df -lkPT';
|
||||
exec(cmd, function (error, stdout) {
|
||||
|
||||
+12
-1
@@ -72,6 +72,7 @@ function graphics(callback) {
|
||||
let currentDisplay = {
|
||||
vendor: '',
|
||||
model: '',
|
||||
deviceName: '',
|
||||
main: false,
|
||||
builtin: false,
|
||||
connection: '',
|
||||
@@ -109,6 +110,7 @@ function graphics(callback) {
|
||||
currentDisplay = {
|
||||
vendor: '',
|
||||
model: '',
|
||||
deviceName: '',
|
||||
main: false,
|
||||
builtin: false,
|
||||
connection: '',
|
||||
@@ -304,6 +306,7 @@ function graphics(callback) {
|
||||
let result = {
|
||||
vendor: '',
|
||||
model: '',
|
||||
deviceName: '',
|
||||
main: false,
|
||||
builtin: false,
|
||||
connection: '',
|
||||
@@ -363,6 +366,7 @@ function graphics(callback) {
|
||||
let currentDisplay = {
|
||||
vendor: '',
|
||||
model: '',
|
||||
deviceName: '',
|
||||
main: false,
|
||||
builtin: false,
|
||||
connection: '',
|
||||
@@ -718,9 +722,14 @@ function graphics(callback) {
|
||||
if (ssections[i].trim() !== '') {
|
||||
ssections[i] = 'BitsPerPixel ' + ssections[i];
|
||||
msections[i] = 'Active ' + msections[i];
|
||||
|
||||
// tsections can be empty on earlier versions of powershell (<=2.0). Tag connection type as UNKNOWN
|
||||
// if this information is missing
|
||||
if (tsections.length === 0) {
|
||||
tsections[i] = 'Unknown';
|
||||
}
|
||||
let linesScreen = ssections[i].split(os.EOL);
|
||||
let linesMonitor = msections[i].split(os.EOL);
|
||||
|
||||
let linesConnection = tsections[i].split(os.EOL);
|
||||
const bitsPerPixel = util.getValue(linesScreen, 'BitsPerPixel');
|
||||
const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').split(',');
|
||||
@@ -729,6 +738,7 @@ function graphics(callback) {
|
||||
const sizey = util.getValue(linesMonitor, 'MaxVerticalImageSize');
|
||||
const instanceName = util.getValue(linesMonitor, 'InstanceName').toLowerCase();
|
||||
const videoOutputTechnology = util.getValue(linesConnection, 'VideoOutputTechnology');
|
||||
const deviceName = util.getValue(linesScreen, 'DeviceName');
|
||||
let displayVendor = '';
|
||||
let displayModel = '';
|
||||
isections.forEach(element => {
|
||||
@@ -740,6 +750,7 @@ function graphics(callback) {
|
||||
displays.push({
|
||||
vendor: instanceName.startsWith(deviceID) && displayVendor === '' ? vendor : displayVendor,
|
||||
model: instanceName.startsWith(deviceID) && displayModel === '' ? model : displayModel,
|
||||
deviceName,
|
||||
main: primary.toLowerCase() === 'true',
|
||||
builtin: videoOutputTechnology === '2147483648',
|
||||
connection: videoOutputTechnology && videoTypes[videoOutputTechnology] ? videoTypes[videoOutputTechnology] : '',
|
||||
|
||||
Vendored
+1
@@ -252,6 +252,7 @@ export namespace Systeminformation {
|
||||
interface GraphicsDisplayData {
|
||||
vendor: string;
|
||||
model: string;
|
||||
deviceName: string;
|
||||
main: boolean;
|
||||
builtin: boolean;
|
||||
connection: string;
|
||||
|
||||
Reference in New Issue
Block a user