Exemple #1
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();
        }
Exemple #2
0
        static string GetExistingLicense()
        {
            string existingLicense;

            //look in HKCU
            if (UserSidChecker.IsNotSystemSid() && new RegistryLicenseStore().TryReadLicense(out existingLicense))
            {
                return(existingLicense);
            }

            //look in HKLM
            if (new RegistryLicenseStore(Registry.LocalMachine).TryReadLicense(out existingLicense))
            {
                return(existingLicense);
            }

            return(LicenseLocationConventions.TryFindLicenseText());
        }
Exemple #3
0
        static Particular.Licensing.License GetTrialLicense()
        {
            if (UserSidChecker.IsNotSystemSid())
            {
                var trialStartDate = TrialStartDateStore.GetTrialStartDate();
                var trialLicense   = Particular.Licensing.License.TrialLicense(trialStartDate);

                //Check trial is still valid
                if (LicenseExpirationChecker.HasLicenseExpired(trialLicense))
                {
                    Logger.WarnFormat("Trial for the Particular Service Platform has expired");
                }
                else
                {
                    var message = string.Format("Trial for Particular Service Platform is still active, trial expires on {0}. Configuring NServiceBus to run in trial mode.", trialLicense.ExpirationDate.Value.ToLocalTime().ToShortDateString());
                    Logger.Info(message);
                }
                return(trialLicense);
            }

            Logger.Fatal("Could not access registry for the current user sid. Please ensure that the license has been properly installed.");

            return(null);
        }