Example #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes licenser instance.
        /// </summary>
        /// <param name="licenseCacheStorage">The reference to the license cache
        /// storage object.</param>
        /// <exception cref="T:System.ArgumentException">
        /// <paramref name="licenseCacheStorage"/> is a null reference.</exception>
        public static void Initialize(ILicenseCacheStorage licenseCacheStorage)
        {
            if (licenseCacheStorage == null)
            {
                throw new ArgumentNullException("licenseCacheStorage");
            }

            // load license component
            Assembly  licAssembly = null;
            ILicenser licenser    = _LoadLicenseComponent(out licAssembly);

            if (licenser == null)
            {
                throw new LicenseException(LicenseError.LicenseComponentNotFound,
                                           Properties.Messages.Error_LicenseComponentNotFound);
            }

            // verify if assembly correctly signed
            _VerifySignature(licAssembly);

            _innerLicenser       = licenser;
            _licenseCacheStorage = licenseCacheStorage;

            Licenser.LicenseExpirationChecker = new LicenseExpirationChecker(
                _licenseCacheStorage);
        }
        /// <summary>
        /// Initializes a new instance of the LicenseManager class.
        /// </summary>
        /// <param name="licenseCacheStorage">The reference to the license cache
        /// storage object.</param>
        /// <param name="proxyConfigurationService">The reference to the proxy configuration
        /// service object.</param>
        public LicenseManager(
            ILicenseCacheStorage licenseCacheStorage,
            IProxyConfigurationService proxyConfigurationService)
        {
            Debug.Assert(licenseCacheStorage != null);
            Debug.Assert(proxyConfigurationService != null);

            _licenseCacheStorage       = licenseCacheStorage;
            _proxyConfigurationService = proxyConfigurationService;

            this.LicenseActivationStatus = LicenseActivationStatus.None;
            if (this.AppLicense != null)
            {
                this.LicenseActivationStatus = LicenseActivationStatus.Activated;
            }
            else if (this.ExpiredLicense != null)
            {
                this.LicenseActivationStatus = LicenseActivationStatus.Expired;
            }
        }
        /// <summary>
        /// Initializes a new instance of the LicenseManager class.
        /// </summary>
        /// <param name="licenseCacheStorage">The reference to the license cache
        /// storage object.</param>
        /// <param name="proxyConfigurationService">The reference to the proxy configuration
        /// service object.</param>
        public LicenseManager(
            ILicenseCacheStorage licenseCacheStorage,
            IProxyConfigurationService proxyConfigurationService)
        {
            Debug.Assert(licenseCacheStorage != null);
            Debug.Assert(proxyConfigurationService != null);

            _licenseCacheStorage = licenseCacheStorage;
            _proxyConfigurationService = proxyConfigurationService;

            this.LicenseActivationStatus = LicenseActivationStatus.None;
            if (this.AppLicense != null)
            {
                this.LicenseActivationStatus = LicenseActivationStatus.Activated;
            }
            else if (this.ExpiredLicense != null)
            {
                this.LicenseActivationStatus = LicenseActivationStatus.Expired;
            }
        }
Example #4
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Initializes licenser instance.
        /// </summary>
        /// <param name="licenseCacheStorage">The reference to the license cache
        /// storage object.</param>
        /// <exception cref="T:System.ArgumentException">
        /// <paramref name="licenseCacheStorage"/> is a null reference.</exception>
        public static void Initialize(ILicenseCacheStorage licenseCacheStorage)
        {
            if (licenseCacheStorage == null)
            {
                throw new ArgumentNullException("licenseCacheStorage");
            }

            // load license component
            Assembly licAssembly = null;
            ILicenser licenser = _LoadLicenseComponent(out licAssembly);
            if (licenser == null)
            {
                throw new LicenseException(LicenseError.LicenseComponentNotFound,
                    Properties.Messages.Error_LicenseComponentNotFound);
            }

            // verify if assembly correctly signed
            _VerifySignature(licAssembly);

            _innerLicenser = licenser;
            _licenseCacheStorage = licenseCacheStorage;

            Licenser.LicenseExpirationChecker = new LicenseExpirationChecker(
                _licenseCacheStorage);
        }
        /// <summary>
        /// Initializes new instance of the LicenseExpirationChecker class.
        /// </summary>
        /// <param name="licenseCacheStorage">The reference to the license cache
        /// storage object.</param>
        public LicenseExpirationChecker(ILicenseCacheStorage licenseCacheStorage)
        {
            Debug.Assert(licenseCacheStorage != null);

            _licenseCacheStorage = licenseCacheStorage;
        }