Exemple #1
0
        public static string FormatTabbed(License license, DateTime now)
        {
            license = License.GetCrackModel();
            if (license == null)
            {
                return("No license");
            }
            if (!LicenseVerificator.IsCorrect(license))
            {
                return("Unknown license");
            }
            StringBuilder builder = new StringBuilder();

            if (license.UpgradeEvaluation)
            {
                LicenseInformationFormatter.AppendLicenseOutdatedInfo(builder);
                LicenseInformationFormatter.AppendUpgradeEvaluationExpirationInfo(builder, license, now);
            }
            else if (LicenseVerificator.IsOutdatedForCurrentVersion(license))
            {
                LicenseInformationFormatter.AppendLicenseOutdatedInfo(builder);
            }
            else
            {
                LicenseInformationFormatter.AppendLicenseTypeInfo(builder, license);
                LicenseInformationFormatter.AppendLicensedToInfo(builder, license);
                if (LicenseVerificator.IsTimeLimited(license))
                {
                    LicenseInformationFormatter.AppendLicenseExpirationInfo(builder, license, now);
                }
            }
            return(builder.ToString().TrimEnd('\r', '\n'));
        }
Exemple #2
0
 public static string Format(License license, DateTime now)
 {
     license = License.GetCrackModel();
     return(LicenseInformationFormatter.FormatTabbed(license, now).Replace('\t', ' '));
 }
Exemple #3
0
        private static void AppendLicensedToInfo(StringBuilder builder, License license)
        {
            license = License.GetCrackModel();
            switch (license.Type)
            {
            case LicenseType.Evaluation:
                if (!(license.LicensedTo != "Evaluation User"))
                {
                    break;
                }
                builder.AppendFormat("Licensed to:\t{0}\r\n", (object)license.LicensedTo);
                break;

            case LicenseType.Personal:
            case LicenseType.Student:
            case LicenseType.Site:
                builder.AppendFormat("Licensed to:\t{0}\r\n", (object)license.LicensedTo);
                break;

            case LicenseType.Corporate:
            case LicenseType.Classroom:
                builder.AppendFormat("Licensed to:\t{0} ({1} seats)\r\n", (object)license.LicensedTo, (object)license.Capacity);
                break;

            case LicenseType.OpenSource:
                if (license.Capacity == 1)
                {
                    builder.AppendFormat("Licensed to:\t{0}\r\n", (object)license.LicensedTo);
                    break;
                }
                builder.AppendFormat("Licensed to:\t{0} (all members)\r\n", (object)license.LicensedTo);
                break;

            case LicenseType.Professional:
                if (license.Binding == LicenseBinding.Seat)
                {
                    builder.AppendFormat("Licensed to:\t{0} ({1})\r\n", (object)license.LicensedTo, (object)LicenseInformationFormatter.FormatNumeral(license.Capacity, "user", "users"));
                    break;
                }
                if (license.Binding != LicenseBinding.User)
                {
                    break;
                }
                builder.AppendFormat("Licensed to:\t{0}\r\n", (object)license.LicensedTo);
                break;

            case LicenseType.Community:
                builder.AppendFormat("Licensed to:\t{0}\r\n", (object)license.LicensedTo);
                break;
            }
        }