33 lines
997 B
C#
33 lines
997 B
C#
namespace IronLicensing.Client;
|
|
|
|
public partial class MachineIdentifier
|
|
{
|
|
private partial List<string> GetMachineComponents()
|
|
{
|
|
var components = new List<string>();
|
|
|
|
try
|
|
{
|
|
// Try to get Windows-specific identifiers
|
|
// Note: Full WMI access requires additional setup
|
|
components.Add(Environment.MachineName);
|
|
components.Add(Environment.OSVersion.ToString());
|
|
|
|
// Use registry for additional machine identification
|
|
using var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Cryptography");
|
|
var machineGuid = key?.GetValue("MachineGuid")?.ToString();
|
|
if (!string.IsNullOrEmpty(machineGuid))
|
|
{
|
|
components.Add(machineGuid);
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
// Fallback if registry access fails
|
|
components.Add(Environment.MachineName);
|
|
}
|
|
|
|
return components;
|
|
}
|
|
}
|