License CreateTrialLicense() { var trialStartDate = TrialStartDateStore.GetTrialStartDate(); LogTo.Information("Configuring ServiceInsight to run in trial mode."); return(License.TrialLicense(trialStartDate)); }
public int GetRemainingTrialDays() { var now = DateTime.UtcNow.Date; var expiration = (CurrentLicense == null || CurrentLicense.ExpirationDate == null) ? TrialStartDateStore.GetTrialStartDate().AddDays(14) : CurrentLicense.ExpirationDate.Value; var remainingDays = (expiration - now).Days; return(remainingDays > 0 ? remainingDays : 0); }
static ActiveLicense DetermineActiveLicense() { var activeLicense = new ActiveLicense { IsValid = false }; var licenseText = TryFindLicense(); if (string.IsNullOrEmpty(licenseText)) { Logger.Warn("No valid license could be found, falling back to trial license"); activeLicense.Details = License.TrialLicense(TrialStartDateStore.GetTrialStartDate()); } else { Exception validationFailure; if (!LicenseVerifier.TryVerify(licenseText, out validationFailure)) { Logger.WarnFormat("Found license was not valid: {0}", validationFailure); return(activeLicense); } var licenseDetails = LicenseDeserializer.Deserialize(licenseText); if (!licenseDetails.ValidForApplication("ServiceControl")) { Logger.WarnFormat("Found license was is not valid for ServiceControl. Valid apps: '{0}'", string.Join(",", licenseDetails.ValidApplications)); return(activeLicense); } activeLicense.Details = licenseDetails; } activeLicense.HasExpired = LicenseExpirationChecker.HasLicenseExpired(activeLicense.Details); if (activeLicense.HasExpired) { Logger.WarnFormat("Found license has expired"); } else { activeLicense.IsValid = true; } return(activeLicense); }
static Particular.Licensing.License GetTrialLicense() { 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); }
static License GetTrialLicense() { var trialStartDate = TrialStartDateStore.GetTrialStartDate(); var trialLicense = 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 = $"Trial for Particular Service Platform is still active, trial expires on {trialLicense.ExpirationDate.Value.ToLocalTime().ToShortDateString()}."; Logger.Info(message); } return(trialLicense); }
void getTrialLicenseButton_Click(object sender, EventArgs e) { string baseUrl; if (CurrentLicense != null && !CurrentLicense.IsExtendedTrial) { // Original 14 day trial expired, give the user a chance to extend trial baseUrl = "https://particular.net/extend-nservicebus-trial"; } else { // Extended trial license expired, ask the user to Contact Sales baseUrl = "https://particular.net/extend-your-trial-45"; } var trialStart = TrialStartDateStore.GetTrialStartDate().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); var url = $"{baseUrl}?NugetUser={IsNugetUser()}&PlatformInstaller={HasUserInstalledPlatform()}&TrialStartDate={trialStart}"; // Open the url with the querystrings Process.Start(url); }
License GetTrialLicense() { if (UserSidChecker.IsNotSystemSid()) { var trialStartDate = TrialStartDateStore.GetTrialStartDate(); var trialLicense = License.TrialLicense(trialStartDate); //Check trial is still valid if (LicenseExpirationChecker.HasLicenseExpired(trialLicense)) { tracer.Warn("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.ToShortDateString()); tracer.Info(message); } return(trialLicense); } tracer.Error("Could not access registry for the current user sid. Please ensure that the license has been properly installed."); return(null); }