/// <summary> /// Returns 0 or 1, If VM based OS found returns 1 else 0 /// </summary> public static int IsEmulatedOS() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(UnManagedNCLicense.IsEmulatedOS()); } throw new NotImplementedException(); }
public static void GetRegKeys(StringBuilder RegVal, StringBuilder section, StringBuilder key, StringBuilder defaultVal, short prodId) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { UnManagedNCLicense.GetRegKeys(RegVal, section, key, defaultVal, prodId); } else { throw new NotImplementedException(); } }
/// <summary> /// Returns the total number of cores available in the system. /// </summary> public static int GetNumCores() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(UnManagedNCLicense.GetNumCores()); } if (_numOfCores <= 0) { _numOfCores = MachineInfo.TotalAvailableCores; } return(_numOfCores); }
/// <summary> /// Returns the number of processors on the system. /// </summary> public static int GetNumProcessors() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(UnManagedNCLicense.GetNumProcessors()); } if (_numOfProcessors <= 0) { _numOfProcessors = MachineInfo.PhysicalCores; } return(_numOfProcessors); }
public static void ReadActivationCode(StringBuilder code, short prodId) { // if (RegUtil.LicenseProperties == null || RegUtil.LicenseProperties.UserInfo == null) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { UnManagedNCLicense.ReadActivationCode(code, prodId); } else { RegUtil.LoadRegistry(); NCCryptoCode.Decode(RegUtil.LicenseProperties.UserInfo.AuthCode, code); } }
/// <summary> /// Returns a list of mac addresses found on the system. /// </summary> public static int GetAdaptersAddressList(StringBuilder list) { try { if (Environment.OSVersion.Platform == PlatformID.Win32NT || RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(UnManagedNCLicense.GetAdaptersAddressList(list)); } } catch (DllNotFoundException) { // Eating this exception on purpose // because of Nano Server } return(GetAdaptersAddressListManaged(list)); }
public static int ReadEvaluationData(int version, ref NCLicenseDll.EvaluationData evaluationData, short productId) { try { if (Environment.OSVersion.Platform == PlatformID.Win32NT || RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(UnManagedNCLicense.ReadEvaluationData(version, ref evaluationData, productId)); } } catch (DllNotFoundException) { // Eating this exception on purpose // because of Nano Server } return(ReadEvaluationDataManaged(version, ref evaluationData, productId)); }
public static void ReadInstallCode(StringBuilder s, short productId) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { UnManagedNCLicense.ReadInstallCode(s, productId); } else { if (!string.IsNullOrEmpty(_installCode)) { s.Append(_installCode); return; } RegUtil.LoadRegistry(); var installCode = RegUtil.GetInstallCode(); NCCryptoCode.Decode(installCode, s); _installCode = s.ToString(); } }