mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 19:16:33 +00:00
rework to have only 1 exe!
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Azaion.Common.Services;
|
||||
|
||||
public interface IHardwareService
|
||||
{
|
||||
Task<HardwareInfo> GetHardware();
|
||||
HardwareInfo GetHardware();
|
||||
}
|
||||
|
||||
public class HardwareService : IHardwareService
|
||||
@@ -23,11 +23,11 @@ public class HardwareService : IHardwareService
|
||||
"lscpu | grep 'Model name:' | cut -d':' -f2 && " +
|
||||
"lspci | grep VGA | cut -d':' -f3\"";
|
||||
|
||||
public async Task<HardwareInfo> GetHardware()
|
||||
public HardwareInfo GetHardware()
|
||||
{
|
||||
try
|
||||
{
|
||||
var output = await RunCommand(Environment.OSVersion.Platform == PlatformID.Win32NT
|
||||
var output = RunCommand(Environment.OSVersion.Platform == PlatformID.Win32NT
|
||||
? WIN32_GET_HARDWARE_COMMAND
|
||||
: UNIX_GET_HARDWARE_COMMAND);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class HardwareService : IHardwareService
|
||||
return macAddress ?? string.Empty;
|
||||
}
|
||||
|
||||
private async Task<string> RunCommand(string command)
|
||||
private string RunCommand(string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -91,8 +91,8 @@ public class HardwareService : IHardwareService
|
||||
process.StartInfo.CreateNoWindow = true;
|
||||
|
||||
process.Start();
|
||||
var result = await process.StandardOutput.ReadToEndAsync();
|
||||
await process.WaitForExitAsync();
|
||||
var result = process.StandardOutput.ReadToEnd();
|
||||
process.WaitForExit();
|
||||
|
||||
return result.Trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user