Exemplo n.º 1
0
        public static string GenerateCID(string aCustomer, DateTime aRegTime)
        {
            aCustomer = aCustomer.ToUpper();

            string DateStr = aRegTime.Year.ToString() + aRegTime.Month.ToString() + aRegTime.Day.ToString();

            if (aCustomer.Length > 10)
            {
                aCustomer = aCustomer.Substring(0, 10);
            }
            else
            {
                for (int i = 0; aCustomer.Length < 10; i++)
                {
                    aCustomer += aCustomer[i];
                }
            }

            return(PasswordTools.EncryptPassword_1(DateStr, aCustomer, 10, true));
        }
Exemplo n.º 2
0
        public static string GeneratePID(string aProjectId, string aAppId, string aAppVer)
        {
            aProjectId = aProjectId.ToUpper();
            aAppId     = aAppId.ToUpper();
            aAppVer    = aAppVer.ToUpper();

            CApplicationVersion lAppVer = CApplicationVersion.StringToApplicationVersion(aAppVer);

            string
                lPID1   = aProjectId.Substring(0, 5),
                lPID2   = aProjectId.Substring(5),
                lPID3   = aAppId + __VERCH[lAppVer.Major] + __VERCH[lAppVer.Minor],
                lResult = "";

            lResult  = PasswordTools.EncryptPassword_1(lPID2, lPID1, 5, true);
            lResult += PasswordTools.EncryptPassword_1(lPID3, lPID2, 5, true);
            lResult += PasswordTools.EncryptPassword_1(lPID1, lPID3, 5, true);

            return(lResult);
        }
Exemplo n.º 3
0
        public static string Generate(string aProjectId, string aAppId, string aAppVer, string aCustomer, DateTime aRegTime)
        {
            string aPID = GeneratePID(aProjectId, aAppId, aAppVer);
            string aCID = GenerateCID(aCustomer, aRegTime);

            string[] aLicList = new string[5];
            string   aLicKey  = "";

            for (int i = 0; i < 5; i++)
            {
                aLicList[i]  = aPID.Substring(i * 3, 3);
                aLicList[i] += aCID.Substring(i * 2, 2);
            }

            for (int i = 0; i < 5; i++)
            {
                aLicKey += PasswordTools.EncryptPassword_1(aLicList[((4 - i) + 1) % 5], aLicList[(4 - i)], 5, true);
            }

            return(aLicKey);
        }