Files
2024-01-08 09:30:50 +08:00

45 lines
1.3 KiB
C#

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using KGdev.BI3D.Revit.Common;
namespace KGdev.BI3D.Revit.Implementations
{
internal class DefaultMuidProvider : IMuidProvider
{
public string GetMuid()
{
string text = "wmic";
bool flag = File.Exists("C:\\Windows\\System32\\wbem\\WMIC.exe");
if (flag)
{
text = "C:\\Windows\\System32\\wbem\\WMIC.exe";
}
else
{
bool flag2 = File.Exists("C:\\Windows\\System32\\WMIC.exe");
if (flag2)
{
text = "C:\\Windows\\System32\\WMIC.exe";
}
}
Process process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = text,
Arguments = "path win32_computersystemproduct get uuid /Value",
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
process.Start();
string text2 = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return text2.Trim().Split(new char[] { '=' }).Last<string>();
}
}
}