|
////新加授权程序
|
//using System;
|
//using System.Management;
|
//using System.Security.Cryptography;
|
//using System.Text;
|
|
//namespace Common
|
//{
|
// public abstract class HardwareHelper
|
// {
|
// public static string GetMachineID()
|
// {
|
// return BitConverter.ToString(MD5.Create().ComputeHash(Encoding.Default.GetBytes(string.Format("{0}-{1}", (object)HardwareHelper.GetDiskID(), (object)HardwareHelper.GetCpuID()))));
|
// }
|
|
// public static string GetDiskID()
|
// {
|
// try
|
// {
|
// ManagementClass managementClass = new ManagementClass("Win32_DiskDrive");
|
// using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = managementClass.GetInstances(new EnumerationOptions()
|
// {
|
// EnumerateDeep = false,
|
// ReturnImmediately = false
|
// }).GetEnumerator())
|
// {
|
// if (enumerator.MoveNext())
|
// return (string)enumerator.Current.Properties["Model"].Value;
|
// }
|
// }
|
// catch (Exception ex)
|
// {
|
// return ex.ToString();
|
// }
|
// return string.Empty;
|
// }
|
|
// public static string GetCpuID()
|
// {
|
// string str = string.Empty;
|
// try
|
// {
|
// ManagementClass managementClass = new ManagementClass("Win32_Processor");
|
// using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = managementClass.GetInstances(new EnumerationOptions()
|
// {
|
// EnumerateDeep = false,
|
// ReturnImmediately = false
|
// }).GetEnumerator())
|
// {
|
// if (enumerator.MoveNext())
|
// str = (string)enumerator.Current.Properties["ProcessorID"].Value;
|
// }
|
// }
|
// catch (Exception ex)
|
// {
|
// str = ex.ToString();
|
// }
|
// return str;
|
// }
|
// }
|
//}
|