Example #1
0
        public IList <DeploymentParameterWPI> GetAppDecalredParameters(string productId)
        {
            Product   app          = _productManager.GetProduct(productId);
            Installer appInstaller = app.GetInstaller(GetLanguage(null));

            return(appInstaller.MSDeployPackage.DeploymentParameters);
        }
Example #2
0
        private List <Installer> GetInstallers(List <Product> productsToInstall, Language lang)
        {
            Language         defaultLang     = GetLanguage(DeafultLanguage);
            List <Installer> installersToUse = new List <Installer>();

            foreach (Product product in productsToInstall)
            {
                Installer installer = product.GetInstaller(lang) ?? product.GetInstaller(defaultLang);
                if (null != installer)
                {
                    installersToUse.Add(installer);
                }
            }

            return(installersToUse);
        }
Example #3
0
        private Installer GetInstaller(string languageId, Product product)
        {
            Installer installer = product.GetInstaller(GetLanguage(languageId));

            if (null == installer)
            {
                installer = product.GetInstaller(GetLanguage(DeafultLanguage));
                if (null == installer)
                {
                    throw new Exception(
                              string.Format(
                                  "Could not get installer for product '{0}', language: {1}, default language: {2}",
                                  product.Title, languageId, DeafultLanguage)
                              );
                }
            }

            return(installer);
        }
Example #4
0
        public bool InstallApplication(
            string appId,
            List <WpiUpdatedDeploymentParameter> updatedValues,
            string languageId,
            EventHandler <InstallStatusEventArgs> installStatusUpdatedHandler,
            EventHandler <EventArgs> installCompleteHandler,
            out string log,
            out string failedMessage
            )
        {
            Product             app          = GetProduct(appId);
            Installer           appInstaller = GetInstaller(languageId, app);
            WpiAppInstallLogger logger       = new WpiAppInstallLogger();

            /*
             * if (null == _installManager)
             * {
             *  Debugger.Break();
             * }
             */

            if (null != installStatusUpdatedHandler)
            {
                _installManager.InstallerStatusUpdated += installStatusUpdatedHandler;
            }
            _installManager.InstallerStatusUpdated += logger.HanlderInstallerStatusUpdated;

            if (null != installCompleteHandler)
            {
                _installManager.InstallCompleted += installCompleteHandler;
            }
            _installManager.InstallCompleted += logger.HandlerInstallCompleted;

            // set updated parameters
            foreach (WpiUpdatedDeploymentParameter parameter in updatedValues)
            {
                if (!string.IsNullOrEmpty(parameter.Value))
                {
                    appInstaller.MSDeployPackage.SetParameters[parameter.Name] = parameter.Value;
                }
            }

            DeploymentWellKnownTag dbTag = (DeploymentWellKnownTag)GetDbTag(updatedValues);

            // remove parameters with alien db tags
            foreach (DeploymentParameterWPI parameter in appInstaller.MSDeployPackage.DeploymentParameters)
            {
                if (IsAlienDbTaggedParameter(dbTag, parameter))
                {
                    appInstaller.MSDeployPackage.RemoveParameters.Add(parameter.Name);
                }
            }

            // skip alien directives
            RemoveUnusedProviders(appInstaller.MSDeployPackage, dbTag);

            _installCompleted = false;

            _installManager.StartApplicationInstallation();
            while (!_installCompleted)
            {
                Thread.Sleep(1000);
            }

            WriteLog("InstallApplication complete");

            //save logs
            SaveLogDirectory();

            _installCompleted = false;

            log           = logger.GetLog();
            failedMessage = logger.FailedMessage;

            return(!logger.IsFailed);
        }