Esempio n. 1
0
        /// <summary>
        /// Creates a new instance of the <see cref="SlickUploadModule" /> class.
        /// </summary>
        public SlickUploadModule()
        {
            _licenseType = LicenseType.Evaluation;
            _licenseScope = LicenseScope.WebSite;
            //_license = (KrystalwareRuntimeLicense)new KrystalwareLicenseProvider().GetLicense(null, typeof(SlickUploadModule), this, false);
            _license = (KrystalwareRuntimeLicense)KrystalwareLicenseProvider.GetLicense(typeof(SlickUploadModule), "<RSAKeyValue><Modulus>tk384UItx23mrOJcdDqipI05NXJKZAbUL0ewFaloFzpUBFV8AQd1hUSZ9XVgNAPqBLej9rUz4v08vi2rQ/fqJXtWieQSdwa7fe+ZjaS2qYGeBWZVpEDXwT5fG63+c2MlLjX0fKMQ7FU0OkZPo76Sj1O5cIjMlX9nvOQnevW0ABM=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");
            
            List<string> licensedUrls = new List<string>();

            if (_license != null)
            {
                foreach (RuntimeLicensedProduct product in _license.LicensedProducts)
                {
                    if (product.AssemblyName.EndsWith(".SlickUpload") && Convert.ToInt32(product.Version) >= 6 && DateTime.Now <= product.ExpirationDate)
                    {
                        // changed to fix obfuscation issue
                        // if (product.Type > _licenseType)
                        if (product.Type != _licenseType)
                            _licenseType = product.Type;

                        // changed to fix obfuscation issue
                        // if (product.Scope > _licenseScope)
                        if (product.Scope != _licenseScope)
                                _licenseScope = product.Scope;

                        if (!string.IsNullOrEmpty(product.LicenseUrl))
                            licensedUrls.Add("." + product.LicenseUrl);
                    }
                }
            }

            _licensedUrls = licensedUrls.ToArray();
        }
		internal RuntimeLicensedProduct(XmlElement el)
		{
			_assemblyName = el.GetAttribute("AssemblyName");
			_version = el.GetAttribute("Version");
            _licenseUrl = el.GetAttribute("LicenseUrl");

			try
			{
				_expirationDate = DateTime.Parse(el.GetAttribute("ExpirationDate"));
			}
			catch
			{
				_expirationDate = DateTime.MaxValue;
			}
			
			try
			{
				_type = (LicenseType)Enum.Parse(typeof(LicenseType), el.GetAttribute("Type"));
			}
			catch
			{
				_type = LicenseType.Evaluation; 
			}

			try
			{
				_scope = (LicenseScope)Enum.Parse(typeof(LicenseScope), el.GetAttribute("Scope"));
			}
			catch
			{
				_scope = LicenseScope.WebSite; 
			}
		}
		internal RuntimeLicensedProduct(string assemblyName, string assemblyVersion)
		{
			_assemblyName = assemblyName;
			_version = assemblyVersion;
			_type = LicenseType.Evaluation;
			_scope = LicenseScope.WebSite;
			_expirationDate = DateTime.MaxValue;
		}