Пример #1
0
        // ----- Artem's Information Storage Format ------------------------------
        /// <summary>
        /// Compute data using SKA-2 encrypted number.
        /// </summary>
        /// <param name="days">Number of days left.</param>
        /// <param name="features">Features to be included on serial (8 features).</param>
        /// <param name="id">Random ID, usually machine code (see <see cref="MachineIdentificator"/>).</param>
        /// <param name="creationDate"><see cref="DateTime"/> value when this serial is generated.</param>
        /// <returns>Number representation of encrypted informations.</returns>
        public override decimal ComputeData(int days, bool[] features, int id, DateTime creationDate)
        {
            decimal result = 0;

            // adding the current date; the generation date; today.
            result += Convert.ToInt32(creationDate.ToString("yyyyMMdd"));

            // shifting three times at left
            MathEx.ShiftNumber(ref result, 1000);

            // adding time left
            result += days;

            // shifting three times at left
            MathEx.ShiftNumber(ref result, 1000);

            // adding features
            result += MathEx.BoolArrayToInt32(features);

            //shifting three times at left
            MathEx.ShiftNumber(ref result, 100000);

            // adding random id
            result += id;

            return(result);
        }