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')); }
private static void AppendUpgradeEvaluationExpirationInfo(StringBuilder builder, License license, DateTime now) { license = License.GetCrackModel(); if (LicenseVerificator.IsExpired(license, now)) { return; } int expire = LicenseVerificator.DaysToExpire(license, now); if (expire <= 30) { builder.AppendFormat("Temporary evaluation license expires in {0} day(s)\r\n", (object)expire); } else { builder.AppendFormat("Temporary evaluation license expires on {0:d}\r\n", (object)license.EndTime); } }
private static void AppendLicenseExpirationInfo(StringBuilder builder, License license, DateTime now) { license = License.GetCrackModel(); if (LicenseVerificator.IsExpired(license, now)) { builder.AppendFormat("License expired on {0:d}\r\n", (object)license.EndTime); } else if (!LicenseVerificator.IsStarted(license, now)) { builder.AppendFormat("License will be valid from {0:d}\r\n", (object)license.StartTime); } else { int expire = LicenseVerificator.DaysToExpire(license, now); if (expire <= 30) { builder.AppendFormat("License expires in {0} day(s)\r\n", (object)expire); } else { builder.AppendFormat("License expires on {0:d}\r\n", (object)license.EndTime); } } }