SystemInfoLibrary icon indicating copy to clipboard operation
SystemInfoLibrary copied to clipboard

OperatingSystemInfo.Update() is invalid in `.NETStandard,Version=v2.0`

Open Zaitonn opened this issue 2 years ago • 1 comments

// my code
using Newtonsoft.Json;
using SystemInfoLibrary.OperatingSystem;

var a = OperatingSystemInfo.GetOperatingSystemInfo();
while (true)
{
    Console.WriteLine(JsonConvert.SerializeObject(a.Update(), Formatting.Indented));
    Console.ReadKey();
}

the ram info never changed

{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}
{
  "Architecture": "64 位",
  "Name": "Microsoft Windows Server 2019 Datacenter SP0.0",
  "FrameworkVersion": "6.0.5",
  "JavaVersion": "0.0",
  "Hardware": {
    "CPUs": [
      {
        "Name": "Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz",
        "Brand": "GenuineIntel",
        "Architecture": "x64",
        "Cores": 1,
        "Frequency": 2500.0
      }
    ],
    "GPUs": [
      {
        "Name": "SeaBIOS VBE(C) 2011",
        "Brand": "Microsoft 基本显示适配器",
        "Resolution": "1024x768",
        "RefreshRate": 1,
        "MemoryTotal": 0
      }
    ],
    "RAM": {
      "Free": 1459072,
      "Total": 2096628
    }
  },
  "OperatingSystemType": 0,
  "IsMono": false
}

here are some outputs

Zaitonn avatar Jan 09 '23 03:01 Zaitonn