예제 #1
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);
     }
 }
예제 #2
0
        public static int ReadEvaluationDataManaged(int version, ref NCLicenseDll.EvaluationData evaluationData, short productId)
        {
            String[] systemFolder = GetStubPath();

            byte[] data = null;

            int fileRetryCount = 0;

            for (int i = 0; i < systemFolder.Length; i++)
            {
                //int dwSize = 0;
                bool fileExists = File.Exists(systemFolder[i]);
                if (fileExists)
                {
                    FileStream fs = File.OpenRead(systemFolder[i]);
                    data = new byte[(int)fs.Length];
                    fs.Read(data, 0, (int)fs.Length);
                    fs.Close();
                    if (data != null)
                    {
                        break;
                    }
                }
                fileRetryCount++;
            }
            if (fileRetryCount == systemFolder.Length || data == null)
            {
                return(-1);
            }
            //byte[] temp = new byte[data.Length - g_DataOffset];
            //Buffer.BlockCopy(data, (int)g_DataOffset, temp, 0, (int)(data.Length - g_DataOffset));
            NCCryptoCode.EncryptDecryptBytes(data, data.Length - (int)g_DataOffset, (int)g_DataOffset);
            evaluationData = GetInstallTime(data, version, productId);
            if (!IsValidVersionMark(evaluationData, productId))
            {
                return(-1);
            }
            //evaluationData.Hour = Misc::GetExtensionsUsed(prodId); //TODO: Licensing
            if (evaluationData.Extensions < 0)    //TODO: Licensing (These values need to be zero by them. This is not correct method)
            {
                evaluationData.Extensions = 0;
            }
            if (evaluationData.Res3 < 0)
            {
                evaluationData.Res3 = 0;
            }
            return(0);
        }
예제 #3
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();
     }
 }