public static string Format(License license, DateTime now) { if (license == null) { return("No license"); } if (!LicenseVerificator.IsCorrect(license)) { return("Unknown license"); } StringBuilder stringBuilder = new StringBuilder(); if (license.UpgradeEvaluation) { LicenseInformationFormatter.AppendLicenseOutdatedInfo(stringBuilder); LicenseInformationFormatter.AppendUpgradeEvaluationExpirationInfo(stringBuilder, license, now); } else { if (LicenseVerificator.IsOutdatedForVersion2x(license)) { LicenseInformationFormatter.AppendLicenseOutdatedInfo(stringBuilder); } else { LicenseInformationFormatter.AppendLicenseTypeInfo(stringBuilder, license); LicenseInformationFormatter.AppendLicensedToInfo(stringBuilder, license); if (LicenseVerificator.IsTimeLimited(license)) { LicenseInformationFormatter.AppendLicenseExpirationInfo(stringBuilder, license, now); } } } return(stringBuilder.ToString().TrimEnd(new char[] { '\r', '\n' })); }
public static bool IsOutdatedForVersion2x(License license) { return(!(license.PurchaseDate == DateTime.MinValue) && !(license.PurchaseDate == DateTime.MaxValue) && license.Type != LicenseType.OpenSource && !LicenseVerificator.IsTimeLimited(license) && license.PurchaseDate < LicenseVerificator.VisualStudio2010Beta2ReleaseDate); }