示例#1
0
 /// <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();
 }
示例#2
0
 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();
     }
 }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
        }
示例#5
0
 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);
     }
 }
示例#6
0
        /// <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));
        }
示例#7
0
        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));
        }
示例#8
0
 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();
     }
 }