Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string GetProductCode(LicenseProduct product, LicenseUtility.ProductCode type)
- {
- switch (type)
- {
- case LicenseUtility.ProductCode.MachineGuid:
- string str1 = (string) null;
- using (RegistryKey registryKey1 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, (RegistryView) 256))
- {
- using (RegistryKey registryKey2 = registryKey1.OpenSubKey("SOFTWARE\\Microsoft\\Cryptography", RegistryKeyPermissionCheck.ReadSubTree))
- {
- using (RegistryKey registryKey3 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, (RegistryView) 512))
- {
- using (RegistryKey registryKey4 = registryKey3.OpenSubKey("SOFTWARE\\Microsoft\\Cryptography", RegistryKeyPermissionCheck.ReadSubTree))
- {
- if (registryKey4 != null)
- {
- str1 = registryKey4.GetValue("MachineGuid", (object) "default").ToString();
- registryKey4.Close();
- }
- if ((str1 == null || str1 == "default") && registryKey2 != null)
- {
- str1 = registryKey2.GetValue("MachineGuid", (object) "default").ToString();
- registryKey2.Close();
- }
- registryKey1?.Close();
- registryKey3?.Close();
- }
- }
- }
- }
- if (str1 != null && str1 != "default")
- return LicenseUtility.GetProductCode(product, LicenseUtility.GetHash(str1));
- throw new Exception("MachineGuid is empty");
- case LicenseUtility.ProductCode.ProductId:
- string str2 = (string) null;
- using (RegistryKey registryKey1 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, (RegistryView) 256))
- {
- using (RegistryKey registryKey2 = registryKey1.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", RegistryKeyPermissionCheck.ReadSubTree))
- {
- using (RegistryKey registryKey3 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, (RegistryView) 512))
- {
- using (RegistryKey registryKey4 = registryKey3.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", RegistryKeyPermissionCheck.ReadSubTree))
- {
- if (registryKey4 != null)
- {
- str2 = registryKey4.GetValue("MachineGuid", (object) "default").ToString();
- registryKey4.Close();
- }
- if ((str2 == null || str2 == "default") && registryKey2 != null)
- {
- str2 = registryKey2.GetValue("MachineGuid", (object) "default").ToString();
- registryKey2.Close();
- }
- registryKey1?.Close();
- registryKey3?.Close();
- }
- }
- }
- }
- if (str2 != null && str2 != "default")
- return LicenseUtility.GetProductCode(product, LicenseUtility.GetHash(str2));
- throw new Exception("ProductId is empty");
- default:
- return LicenseUtility.GetProductCode(product, FingerPrint.Value());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement