/// <summary>
        /// Allows user to specify the license string.
        /// </summary>
        /// <param name="config">The current <see cref="Configure"/>.</param>
        /// <param name="licenseText">The license text.</param>
        /// <returns>The current <see cref="Configure"/>.</returns>
        public static Configure License(this Configure config, string licenseText)
        {
            var licenseManager = new LicenseManager(licenseText);

            config.Configurer.RegisterSingleton<LicenseManager>(licenseManager);

            return config;
        }
Example #2
0
        /// <summary>
        /// Allows user to specify the license string.
        /// </summary>
        /// <param name="config">The current <see cref="BusConfiguration"/>.</param>
        /// <param name="licenseText">The license text.</param>
// ReSharper disable UnusedParameter.Global
        public static void License(this BusConfiguration config, string licenseText)
// ReSharper restore UnusedParameter.Global
        {
            if (string.IsNullOrWhiteSpace(licenseText))
            {
                throw new ArgumentException("licenseText is required", "licenseText");
            }
            Logger.Info(@"Using license supplied via fluent API.");
            LicenseManager.InitializeLicenseText(licenseText);
        }
Example #3
0
        /// <summary>
        /// Allows user to specify the path for the license file.
        /// </summary>
        /// <param name="config">The current <see cref="Configure"/>.</param>
        /// <param name="licenseFile">A relative or absolute path to the license file.</param>
        /// <returns>The current <see cref="Configure"/>.</returns>
        public static Configure LicensePath(this Configure config, string licenseFile)
        {
            if (!File.Exists(licenseFile))
            {
                throw new FileNotFoundException("License file not found", licenseFile);
            }

            var licenseText = LicenseManager.ReadAllTextWithoutLocking(licenseFile);

            return(config.License(licenseText));
        }
Example #4
0
        /// <summary>
        /// Allows user to specify the license string.
        /// </summary>
        /// <param name="config">The current <see cref="Configure"/>.</param>
        /// <param name="licenseText">The license text.</param>
        /// <returns>The current <see cref="Configure"/>.</returns>
        public static Configure License(this Configure config, string licenseText)
        {
            if (string.IsNullOrWhiteSpace(licenseText))
            {
                throw new ArgumentException("licenseText is required", "licenseText");
            }
            Logger.Info(@"Using license supplied via fluent API.");
            LicenseManager.InitializeLicenseText(licenseText);

            return(config);
        }
Example #5
0
        public void Invoke(IncomingContext context, Action next)
        {
            context.PhysicalMessage.Headers[Headers.HasLicenseExpired] = LicenseExpired.ToString().ToLower();

            next();

            if (Debugger.IsAttached)
            {
                if (LicenseManager.HasLicenseExpired())
                {
                    Log.Error("Your license has expired");
                }
            }
        }
Example #6
0
        /// <summary>
        /// Allows user to specify the license string.
        /// </summary>
        /// <param name="config">The current <see cref="Configure"/>.</param>
        /// <param name="licenseText">The license text.</param>
        /// <returns>The current <see cref="Configure"/>.</returns>
        public static Configure License(this Configure config, string licenseText)
        {
            LicenseManager.Parse(licenseText);

            return(config);
        }