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);
     }
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 public static bool IsExpiringSoon(License license, DateTime now)
 {
     return(LicenseVerificator.DaysToExpire(license, now) <= 7);
 }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
 public static bool IsExpired(License license, DateTime now)
 {
     return(license.EndTime < now);
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 public static bool IsPregenerated(License license)
 {
     return(license.IsPregenerated);
 }
Exemplo n.º 8
0
 public static bool IsTimeLimited(License license)
 {
     return(license.StartTime != DateTime.MinValue && license.EndTime != DateTime.MaxValue);
 }
Exemplo n.º 9
0
 public static bool IsStarted(License license, DateTime now)
 {
     return(license.StartTime <= now);
 }
Exemplo n.º 10
0
 public static int DaysToExpire(License license, DateTime now)
 {
     return((int)(license.EndTime - now).TotalDays);
 }