Exemple #1
0
        internal static void Verify()
        {
            //only do this if not been configured by the fluent API
            if (licenseText == null)
            {
                licenseText = LicenseLocationConventions.TryFindLicenseText();
                if (string.IsNullOrWhiteSpace(licenseText))
                {
                    ConfigureNServiceBusToRunInTrialMode();
                    return;
                }
            }
            SignedXmlVerifier.VerifyXml(licenseText);
            var tempLicense = LicenseDeserializer.Deserialize(licenseText);

            string message;

            if (LicenseDowngrader.ShouldLicenseDowngrade(tempLicense, out message))
            {
                message = message + " You can renew it at http://particular.net/licensing. Downgrading to basic mode";
                Logger.Warn(message);
                license = LicenseDeserializer.GetBasicLicense();
            }
            else
            {
                license = tempLicense;
            }
            WriteLicenseInfo();
        }
Exemple #2
0
        static void ConfigureNServiceBusToRunInTrialMode()
        {
            if (UserSidChecker.IsNotSystemSid())
            {
                var trialExpirationDate = TrialLicenseReader.GetTrialExpirationFromRegistry();
                //Check trial is still valid
                if (ExpiryChecker.IsExpired(trialExpirationDate))
                {
                    Logger.WarnFormat("Trial for NServiceBus v{0} has expired. Falling back to run in Basic1 license mode.", GitFlowVersion.MajorMinor);

                    license = LicenseDeserializer.GetBasicLicense();
                }
                else
                {
                    var message = string.Format("Trial for NServiceBus v{0} is still active, trial expires on {1}. Configuring NServiceBus to run in trial mode.", GitFlowVersion.MajorMinor, trialExpirationDate.ToLocalTime().ToShortDateString());
                    Logger.Info(message);

                    //Run in unlimited mode during trial period
                    license = LicenseDeserializer.GetTrialLicense(trialExpirationDate);
                }
                return;
            }

            Logger.Warn("Could not access registry for the current user sid. Falling back to run in Basic license mode.");

            license = LicenseDeserializer.GetBasicLicense();
        }