Exemplo n.º 1
0
        private void CreateLicense()
        {
            CurrentLicense = new ProfilerLicense();

            switch (_validator.LicenseType)
            {
            case LicenseType.None:
                CurrentLicense.LicenseType = ProfilerLicenseTypes.Trial;
                break;

            case LicenseType.Standard:
                SetLicenseType(ProfilerLicenseTypes.Standard);
                break;

            case LicenseType.Trial:
                SetLicenseType(ProfilerLicenseTypes.Trial);
                break;

            default:
                Logger.Error(string.Format("Got unexpected license type [{0}], setting Basic1 free license type.", _validator.LicenseType), null);
                CurrentLicense.LicenseType = ProfilerLicenseTypes.Trial;
                break;
            }

            CurrentLicense.ExpirationDate = _validator.ExpirationDate;
            ConfigureLicenseBasedOnAttribute(_validator.LicenseAttributes);
        }
Exemplo n.º 2
0
        private void CreateTrialLicense()
        {
            var trialExpirationDate = TryGetExpirationDate();

            if (trialExpirationDate.HasValue && trialExpirationDate.Value > DateTime.UtcNow.Date)
            {
                Logger.InfoFormat("Trial for ServiceInsight v{0} is still active, trial expires on {1}.",
                                  LicenseDescriptor.SoftwareVersion,
                                  trialExpirationDate.Value.ToLocalTime().ToShortDateString());

                Logger.InfoFormat("Configuring ServiceInsight to run in trial mode.");

                CurrentLicense = new ProfilerLicense
                {
                    LicenseType    = ProfilerLicenseTypes.Trial,
                    ExpirationDate = trialExpirationDate.Value,
                    Version        = LicenseDescriptor.SoftwareVersion,
                    RegisteredTo   = ProfilerLicense.UnRegisteredUser
                };

                StoreTrialStart(ParseDateString(LicenseDescriptor.TrialStart));
            }
            else
            {
                Logger.InfoFormat("Trial for ServiceInsight v{0} has expired.", LicenseDescriptor.SoftwareVersion);
                Logger.Warn("Falling back to run in Trial license mode.");

                TrialExpired = true;
            }
        }
        private void CreateTrialLicense()
        {
            var trialExpirationDate = TryGetExpirationDate();

            if (trialExpirationDate.HasValue && trialExpirationDate.Value > DateTime.UtcNow.Date)
            {
                Logger.InfoFormat("Trial for ServiceInsight v{0} is still active, trial expires on {1}.",
                                   LicenseDescriptor.SoftwareVersion, 
                                   trialExpirationDate.Value.ToLocalTime().ToShortDateString());

                Logger.InfoFormat("Configuring ServiceInsight to run in trial mode.");

                CurrentLicense = new ProfilerLicense
                {
                    LicenseType = ProfilerLicenseTypes.Trial,
                    ExpirationDate = trialExpirationDate.Value,
                    Version = LicenseDescriptor.SoftwareVersion,
                    RegisteredTo = ProfilerLicense.UnRegisteredUser
                };

                StoreTrialStart(ParseDateString(LicenseDescriptor.TrialStart));
            }
            else
            {
                Logger.InfoFormat("Trial for ServiceInsight v{0} has expired.", LicenseDescriptor.SoftwareVersion);
                Logger.Warn("Falling back to run in Trial license mode.");

                TrialExpired = true;
            }
        }
        private void CreateLicense()
        {
            CurrentLicense = new ProfilerLicense();

            switch (_validator.LicenseType)
            {
                case LicenseType.None:
                    CurrentLicense.LicenseType = ProfilerLicenseTypes.Trial;
                    break;
                case LicenseType.Standard:
                    SetLicenseType(ProfilerLicenseTypes.Standard);
                    break;
                case LicenseType.Trial:
                    SetLicenseType(ProfilerLicenseTypes.Trial);
                    break;
                default:
                    Logger.Error(string.Format("Got unexpected license type [{0}], setting Basic1 free license type.", _validator.LicenseType), null);
                    CurrentLicense.LicenseType = ProfilerLicenseTypes.Trial;
                    break;
            }

            CurrentLicense.ExpirationDate = _validator.ExpirationDate;
            ConfigureLicenseBasedOnAttribute(_validator.LicenseAttributes);
        }
Exemplo n.º 5
0
        public void should_validate_trial_license()
        {
            const string RegisteredUser = "******";
            const string LicenseType = "Trial";
            const int NumberOfDaysRemainingFromTrial = 5;

            var IssuedLicense = new ProfilerLicense
            {
                LicenseType = LicenseType,
                ExpirationDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day),
                RegisteredTo = RegisteredUser
            };

            LicenseManager.CurrentLicense.Returns(IssuedLicense);
            LicenseManager.GetRemainingTrialDays().Returns(NumberOfDaysRemainingFromTrial);

            shell.OnApplicationIdle();

            StatusbarManager.Registration.ShouldContain(NumberOfDaysRemainingFromTrial.ToString());
            StatusbarManager.Registration.ShouldContain("Unlicensed");
        }