예제 #1
0
        public static bool Generate(string filename, string macAddress, DateTime expiration, int clientLicenseCount, string disabledFeatureList)
        {
            DateTime installDate = DateTime.Now;

            string output = String.Concat(macAddress, "$", installDate.ToString(), "$", expiration.ToString(), "$", clientLicenseCount.ToString(), "$", disabledFeatureList, "$");

            Random rand = new Random(DateTime.Now.Second);

            for (int i = 0; i < 1024; i++)
            {
                char ch = (char)rand.Next('0', '9');
                output = String.Concat(output, ch);
            }

            Int64 checksum = 0;

            for (int i = 0; i < output.Length; i++)
            {
                checksum += Convert.ToInt64(Char.GetNumericValue(output[i]));
            }

            output = String.Concat(checksum.ToString(), "$", output);

            output = MOG_Encryption.Encrypt(output);
            return(DosUtils.FileWrite(filename, output));
        }