Example #1
0
        public static DetectedLicense FindLicense()
        {
            var sources = LicenseSource.GetStandardLicenseSources().ToArray();
            var result  = ActiveLicense.Find("ServiceControl", sources);

            return(new DetectedLicense("HKEY_LOCAL_MACHINE", LicenseDetails.FromLicense(result.License)));
        }
        public static LicenseSource[] GetLicenseSources(string licenseText, string licenseFilePath)
        {
            var sources = new List <LicenseSource>();

            if (licenseText != null)
            {
                sources.Add(new LicenseSourceUserProvided(licenseText));
            }

            if (licenseFilePath != null)
            {
                sources.Add(new LicenseSourceFilePath(licenseFilePath));
            }

            var standardSources = LicenseSource.GetStandardLicenseSources();

            sources.AddRange(standardSources);

#if APPCONFIGLICENSESOURCE
            sources.Add(new LicenseSourceAppConfigLicenseSetting());
            sources.Add(new LicenseSourceAppConfigLicensePathSetting());
#endif

            return(sources.ToArray());
        }
        public AppLicenseManager()
        {
            var sources = LicenseSource.GetStandardLicenseSources().ToArray();
            var result  = ActiveLicense.Find("ServiceInsight", sources);

            CurrentLicense = result.License;
        }
Example #4
0
        public static DetectedLicense FindLicense()
        {
            var sources = LicenseSource.GetStandardLicenseSources().ToArray();
            var result  = ActiveLicense.Find("ServiceControl", sources);

            var detectedLicense = new DetectedLicense("HKEY_LOCAL_MACHINE", LicenseDetails.FromLicense(result.License));

            detectedLicense.IsEvaluationLicense = string.Equals(result.Location, "Trial License", StringComparison.OrdinalIgnoreCase);

            return(detectedLicense);
        }
        public void Refresh()
        {
            Logger.Debug("Refreshing ActiveLicense");
            var sources = LicenseSource.GetStandardLicenseSources();

            sources.Add(new LicenseSourceFilePath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "License", "License.xml")));
            sources.Add(new LicenseSourceFilePath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ParticularPlatformLicense.xml")));
            var result = Particular.Licensing.ActiveLicense.Find("ServiceControl", sources.ToArray());

            if (result.HasExpired)
            {
                foreach (var report in result.Report)
                {
                    Logger.Info(report);
                }
                Logger.Warn("License has expired");
            }
            Details = result.License;
            IsValid = !result.HasExpired;
        }