private static void AppendUpgradeEvaluationExpirationInfo(StringBuilder builder, License license, DateTime now)
 {
     if (!LicenseVerificator.IsExpired(license, now))
     {
         int num = LicenseVerificator.DaysToExpire(license, now);
         if (num <= 30)
         {
             builder.AppendFormat("Temporary evaluation license expires in {0} day(s)\r\n", num);
             return;
         }
         builder.AppendFormat("Temporary evaluation license expires on {0:d}\r\n", license.EndTime);
     }
 }
 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);
 }
 public static bool IsExpiringSoon(License license, DateTime now)
 {
     return(LicenseVerificator.DaysToExpire(license, now) <= 7);
 }
 public static bool IsValid(License license, DateTime now)
 {
     return(license != null && LicenseVerificator.IsCorrect(license) && LicenseVerificator.IsStarted(license, now) && !LicenseVerificator.IsExpired(license, now) && !LicenseVerificator.IsOutdatedForVersion2x(license));
 }
 public static bool IsExpired(License license, DateTime now)
 {
     return(license.EndTime < now);
 }
        public static bool IsCorrect(License license)
        {
            if (license.Version < 1 || license.Version > 2)
            {
                return(false);
            }
            switch (license.Type)
            {
            case LicenseType.Evaluation:
                if (license.EndTime == DateTime.MaxValue)
                {
                    return(false);
                }
                break;

            case LicenseType.Personal:
                if (license.Binding != LicenseBinding.User)
                {
                    return(false);
                }
                if (license.Capacity != 1)
                {
                    return(false);
                }
                break;

            case LicenseType.Corporate:
                if (license.Binding != LicenseBinding.Seat)
                {
                    return(false);
                }
                if (license.Capacity == 2147483647)
                {
                    return(false);
                }
                break;

            case LicenseType.Classroom:
                if (license.Binding != LicenseBinding.Seat)
                {
                    return(false);
                }
                if (license.Capacity == 2147483647)
                {
                    return(false);
                }
                break;

            case LicenseType.OpenSource:
                if (license.Binding != LicenseBinding.User)
                {
                    return(false);
                }
                if (license.Capacity != 1 && license.Capacity != 2147483647)
                {
                    return(false);
                }
                break;

            case LicenseType.Student:
                if (license.Binding != LicenseBinding.User)
                {
                    return(false);
                }
                if (license.Capacity != 1)
                {
                    return(false);
                }
                break;

            default:
                return(false);
            }
            return(true);
        }
 public static bool IsPregenerated(License license)
 {
     return(license.IsPregenerated);
 }
 public static bool IsTimeLimited(License license)
 {
     return(license.StartTime != DateTime.MinValue && license.EndTime != DateTime.MaxValue);
 }
 public static bool IsStarted(License license, DateTime now)
 {
     return(license.StartTime <= now);
 }
 public static int DaysToExpire(License license, DateTime now)
 {
     return((int)(license.EndTime - now).TotalDays);
 }