graphics() improvement XML parser (macOS)
This commit is contained in:
parent
382053624f
commit
53569b272f
@ -144,7 +144,7 @@ function graphics(callback) {
|
|||||||
try {
|
try {
|
||||||
graphicsArr.forEach(function (item) {
|
graphicsArr.forEach(function (item) {
|
||||||
// controllers
|
// controllers
|
||||||
const bus = ((item.sppci_bus || '').indexOf('builtin') >= 0 ? 'Built-In' : ((item.sppci_bus || '').indexOf('pcie') >= 0 ? 'PCIe' : ''));
|
const bus = ((item.sppci_bus || '').indexOf('builtin') > -1 ? 'Built-In' : ((item.sppci_bus || '').indexOf('pcie') > -1 ? 'PCIe' : ''));
|
||||||
const vram = (parseInt((item.spdisplays_vram || ''), 10) || 0) * (((item.spdisplays_vram || '').indexOf('GB') > -1) ? 1024 : 1);
|
const vram = (parseInt((item.spdisplays_vram || ''), 10) || 0) * (((item.spdisplays_vram || '').indexOf('GB') > -1) ? 1024 : 1);
|
||||||
const vramDyn = (parseInt((item.spdisplays_vram_shared || ''), 10) || 0) * (((item.spdisplays_vram_shared || '').indexOf('GB') > -1) ? 1024 : 1);
|
const vramDyn = (parseInt((item.spdisplays_vram_shared || ''), 10) || 0) * (((item.spdisplays_vram_shared || '').indexOf('GB') > -1) ? 1024 : 1);
|
||||||
let metalVersion = getMetalVersion(item.spdisplays_metal || item.spdisplays_metalfamily || '');
|
let metalVersion = getMetalVersion(item.spdisplays_metal || item.spdisplays_metalfamily || '');
|
||||||
@ -164,7 +164,7 @@ function graphics(callback) {
|
|||||||
// displays
|
// displays
|
||||||
if (item.spdisplays_ndrvs && item.spdisplays_ndrvs.length) {
|
if (item.spdisplays_ndrvs && item.spdisplays_ndrvs.length) {
|
||||||
item.spdisplays_ndrvs.forEach(function (displayItem) {
|
item.spdisplays_ndrvs.forEach(function (displayItem) {
|
||||||
const connectionType = displayItem['spdisplays_connection_type'];
|
const connectionType = displayItem['spdisplays_connection_type'] || '';
|
||||||
const currentResolutionParts = (displayItem['_spdisplays_resolution'] || '').split('@');
|
const currentResolutionParts = (displayItem['_spdisplays_resolution'] || '').split('@');
|
||||||
const currentResolution = currentResolutionParts[0].split('x');
|
const currentResolution = currentResolutionParts[0].split('x');
|
||||||
const pixelParts = (displayItem['_spdisplays_pixels'] || '').split('x');
|
const pixelParts = (displayItem['_spdisplays_pixels'] || '').split('x');
|
||||||
@ -178,8 +178,8 @@ function graphics(callback) {
|
|||||||
serial: serial !== '0' ? serial : null,
|
serial: serial !== '0' ? serial : null,
|
||||||
displayId: displayItem['_spdisplays_displayID'] || null,
|
displayId: displayItem['_spdisplays_displayID'] || null,
|
||||||
main: displayItem['spdisplays_main'] ? displayItem['spdisplays_main'] === 'spdisplays_yes' : false,
|
main: displayItem['spdisplays_main'] ? displayItem['spdisplays_main'] === 'spdisplays_yes' : false,
|
||||||
builtin: (displayItem['spdisplays_display_type'] || '').indexOf('built-in') >= 0,
|
builtin: (displayItem['spdisplays_display_type'] || '').indexOf('built-in') > -1,
|
||||||
connection: ((connectionType.indexOf('_internal')) ? 'Internal' : ((connectionType.indexOf('_displayport')) ? 'Display Port' : ((connectionType.indexOf('_hdmi')) ? 'HDMI' : ''))),
|
connection: ((connectionType.indexOf('_internal') > -1) ? 'Internal' : ((connectionType.indexOf('_displayport') > -1) ? 'Display Port' : ((connectionType.indexOf('_hdmi') > -1) ? 'HDMI' : ''))),
|
||||||
sizeX: null,
|
sizeX: null,
|
||||||
sizeY: null,
|
sizeY: null,
|
||||||
pixelDepth: (pixelDepthString === 'CGSThirtyBitColor' ? 30 : (pixelDepthString === 'CGSThirtytwoBitColor' ? 32 : (pixelDepthString === 'CGSTwentyfourBitColor' ? 24 : ''))),
|
pixelDepth: (pixelDepthString === 'CGSThirtyBitColor' ? 30 : (pixelDepthString === 'CGSThirtytwoBitColor' ? 32 : (pixelDepthString === 'CGSTwentyfourBitColor' ? 24 : ''))),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user