static WindowsFingerprint() { using (var sec = new SHA1CryptoServiceProvider()) { var sb = new StringBuilder(); ManagementObjectCollection collection = null; ManagementObjectSearcher searcher = null; searcher = new ManagementObjectSearcher("Select * From Win32_BIOS"); collection = searcher.Get(); foreach (ManagementObject mo in collection) { try { sb.Append(mo["SerialNumber"].ToString()); } catch { } try { sb.Append(mo["Manufacturer"].ToString()); } catch { } try { sb.Append(mo["Name"].ToString()); } catch { } } collection.Dispose(); searcher.Dispose(); searcher = new ManagementObjectSearcher("Select * From Win32_BaseBoard"); collection = searcher.Get(); foreach (ManagementObject mo in collection) { try { sb.Append(mo["SerialNumber"].ToString()); } catch { } try { sb.Append(mo["Manufacturer"].ToString()); } catch { } try { sb.Append(mo["Name"].ToString()); } catch { } } collection.Dispose(); searcher.Dispose(); byte[] bt = sec.ComputeHash(Encoding.UTF8.GetBytes(sb.ToString())); s_fingerPrint = BitConverter.ToString(bt).Replace("-", ""); LoggerUtil.GetAppWideLogger()?.Info("My fingerprint is {0}", s_fingerPrint); } }
private WebServiceUtil() { m_logger = LoggerUtil.GetAppWideLogger(); }