/// <exclude />
        public override IEnumerable <XElement> Install()
        {
            if (_licenseFileExists)
            {
                return(new XElement[0]);
            }

            LicenseDefinitionDescriptor descriptor = LicenseServerFacade.GetTrialLicenseDefinition(InstallationInformationFacade.InstallationId, this.InstallerContext.PackageInformation.Id, _publicKeyXml);

            var definition = new PackageLicenseDefinition
            {
                ProductName     = this.InstallerContext.PackageInformation.Name,
                InstallationId  = descriptor.InstallationId,
                ProductId       = descriptor.ProductId,
                LicenseFileName = "",
                Permanent       = descriptor.Permanent,
                Expires         = descriptor.Expires,
                LicenseKey      = descriptor.LicenseKey,
                PurchaseUrl     = descriptor.PurchaseUrl
            };

            LicenseDefinitionManager.StoreLicenseDefinition(definition);

            return(new XElement[] { });
        }
        /// <exclude />
        public override IEnumerable <PackageFragmentValidationResult> Validate()
        {
            var validationResult = new List <PackageFragmentValidationResult>();

            Guid packageId = this.InstallerContext.PackageInformation.Id;

            if (LicenseDefinitionManager.GetLicenseDefinition(packageId) != null)
            {
                _licenseFileExists = true;
                return(validationResult);
            }

            XElement publicKeyElement = this.Configuration.SingleOrDefault(f => f.Name == "RSAKeyValue");

            if (publicKeyElement == null)
            {
                validationResult.AddFatal(GetResourceString("PackageLicenseFragmentInstaller.MissingPublicKeyElement"));
                return(validationResult);
            }

            _publicKeyXml = publicKeyElement.ToString();

            string validated = LicenseServerFacade.ValidateTrialLicenseDefinitionRequest(InstallationInformationFacade.InstallationId, packageId, _publicKeyXml);

            if (validated != "OK")
            {
                validationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, validated));
            }

            return(validationResult);
        }
Ejemplo n.º 3
0
        /// <exclude />
        public override void Uninstall()
        {
            PackageLicenseDefinition licenseDefinition = LicenseDefinitionManager.GetLicenseDefinition(this.UninstallerContext.PackageInformation.Id);

            if ((licenseDefinition != null) && (licenseDefinition.Permanent == false))
            {
                LicenseDefinitionManager.RemoveLicenseDefintion(this.UninstallerContext.PackageInformation.Id);
            }
        }
 /// <summary>
 /// <see cref="Composite.Core.PackageSystem.PackageLicenseHelper"/>
 /// </summary>
 /// <param name="productId"></param>
 public virtual void RemoveLicenseDefinition(Guid productId)
 {
     LicenseDefinitionManager.RemoveLicenseDefintion(productId);
 }
 /// <summary>
 /// <see cref="Composite.Core.PackageSystem.PackageLicenseHelper"/>
 /// </summary>
 /// <param name="licenseDefinition"></param>
 public virtual void StoreLicenseDefinition(PackageLicenseDefinition licenseDefinition)
 {
     LicenseDefinitionManager.StoreLicenseDefinition(licenseDefinition);
 }
 /// <summary>
 /// <see cref="Composite.Core.PackageSystem.PackageLicenseHelper"/>
 /// </summary>
 /// <param name="productId"></param>
 /// <returns></returns>
 public virtual PackageLicenseDefinition GetLicenseDefinition(Guid productId)
 {
     return(LicenseDefinitionManager.GetLicenseDefinition(productId));
 }