public static ComponentInstallerBase GetInstaller(XPathNavigator manifestNav, PackageInfo package)
        {
            string installerType             = Util.ReadAttribute(manifestNav, "type");
            string componentVersion          = Util.ReadAttribute(manifestNav, "version");
            ComponentInstallerBase installer = GetInstaller(installerType);

            if (installer != null)
            {
                installer.Package = package;
                installer.Type    = installerType;
                if (!string.IsNullOrEmpty(componentVersion))
                {
                    installer.Version = new Version(componentVersion);
                }
                else
                {
                    installer.Version = package.Version;
                }
                if (package.InstallerInfo.InstallMode != InstallMode.ManifestOnly || installer.SupportsManifestOnlyInstall)
                {
                    installer.ReadManifest(manifestNav);
                }
            }
            return(installer);
        }
 public override void UnInstall()
 {
     for (int index = 0; index <= ComponentInstallers.Count - 1; index++)
     {
         ComponentInstallerBase compInstaller = ComponentInstallers.Values[index];
         FileInstaller          fileInstaller = compInstaller as FileInstaller;
         if (fileInstaller != null)
         {
             fileInstaller.DeleteFiles = DeleteFiles;
         }
         Log.ResetFlags();
         Log.AddInfo(Util.UNINSTALL_StartComp + " - " + compInstaller.Type);
         compInstaller.UnInstall();
         Log.AddInfo(Util.COMPONENT_UnInstalled + " - " + compInstaller.Type);
         if (Log.Valid)
         {
             Log.AddInfo(Util.UNINSTALL_SuccessComp + " - " + compInstaller.Type);
         }
         else
         {
             Log.AddWarning(Util.UNINSTALL_WarningsComp + " - " + compInstaller.Type);
         }
     }
     PackageController.DeletePackage(Package);
 }
        public override void Install()
        {
            bool isCompleted = true;

            try
            {
                if (InstalledPackage != null)
                {
                    Package.PackageID = InstalledPackage.PackageID;
                }
                PackageController.SavePackage(Package);
                for (int index = 0; index <= ComponentInstallers.Count - 1; index++)
                {
                    ComponentInstallerBase compInstaller = ComponentInstallers.Values[index];
                    if ((InstalledPackage == null) || (compInstaller.Version > Package.InstalledVersion) || (Package.InstallerInfo.RepairInstall))
                    {
                        Log.AddInfo(Util.INSTALL_Start + " - " + compInstaller.Type);
                        compInstaller.Install();
                        if (compInstaller.Completed)
                        {
                            Log.AddInfo(Util.COMPONENT_Installed + " - " + compInstaller.Type);
                        }
                        else
                        {
                            Log.AddFailure(Util.INSTALL_Failed + " - " + compInstaller.Type);
                            isCompleted = false;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.AddFailure(Util.INSTALL_Aborted + " - " + Package.Name);
                ex.ToString();
            }
            if (isCompleted)
            {
                Commit();
            }
            else
            {
                Rollback();
            }
        }
 public PackageInstaller(PackageInfo package)
 {
     this.Package = package;
     if (!string.IsNullOrEmpty(package.Manifest))
     {
         XPathDocument  doc = new XPathDocument(new StringReader(package.Manifest));
         XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("package");
         ReadComponents(nav);
     }
     else
     {
         ComponentInstallerBase installer = InstallerFactory.GetInstaller(package.PackageType);
         if (installer != null)
         {
             installer.Package = package;
             installer.Type    = package.PackageType;
             ComponentInstallers.Add(0, installer);
         }
     }
 }
 public override void Commit()
 {
     for (int index = 0; index <= ComponentInstallers.Count - 1; index++)
     {
         ComponentInstallerBase compInstaller = ComponentInstallers.Values[index];
         if (compInstaller.Version >= Package.InstalledVersion && compInstaller.Completed)
         {
             compInstaller.Commit();
         }
     }
     if (Log.Valid)
     {
         Log.AddInfo(Util.INSTALL_Committed);
     }
     else
     {
         Log.AddFailure(Util.INSTALL_Aborted);
     }
     Package.InstallerInfo.PackageID = Package.PackageID;
 }
 public override void Rollback()
 {
     for (int index = 0; index <= ComponentInstallers.Count - 1; index++)
     {
         ComponentInstallerBase compInstaller = ComponentInstallers.Values[index];
         if (compInstaller.Version > Package.InstalledVersion && compInstaller.Completed)
         {
             Log.AddInfo(Util.COMPONENT_RollingBack + " - " + compInstaller.Type);
             compInstaller.Rollback();
             Log.AddInfo(Util.COMPONENT_RolledBack + " - " + compInstaller.Type);
         }
     }
     if (InstalledPackage == null)
     {
         PackageController.DeletePackage(Package);
     }
     else
     {
         PackageController.SavePackage(InstalledPackage);
     }
 }
 private void ReadComponents(XPathNavigator manifestNav)
 {
     foreach (XPathNavigator componentNav in manifestNav.CreateNavigator().Select("components/component"))
     {
         int    order = ComponentInstallers.Count;
         string type  = componentNav.GetAttribute("type", "");
         if (InstallMode == InstallMode.Install)
         {
             string installOrder = componentNav.GetAttribute("installOrder", "");
             if (!string.IsNullOrEmpty(installOrder))
             {
                 order = int.Parse(installOrder);
             }
         }
         else
         {
             string unInstallOrder = componentNav.GetAttribute("unInstallOrder", "");
             if (!string.IsNullOrEmpty(unInstallOrder))
             {
                 order = int.Parse(unInstallOrder);
             }
         }
         if (Package.InstallerInfo != null)
         {
             Log.AddInfo(Util.DNN_ReadingComponent + " - " + type);
         }
         ComponentInstallerBase installer = InstallerFactory.GetInstaller(componentNav, Package);
         if (installer == null)
         {
             Log.AddFailure(Util.EXCEPTION_InstallerCreate);
         }
         else
         {
             ComponentInstallers.Add(order, installer);
             this.Package.InstallerInfo.AllowableFiles += ", " + installer.AllowableFiles;
         }
     }
 }
        public static ComponentInstallerBase GetInstaller(string installerType)
        {
            ComponentInstallerBase installer = null;

            switch (installerType)
            {
            case "File":
                installer = new FileInstaller();
                break;

            case "Assembly":
                installer = new AssemblyInstaller();
                break;

            case "ResourceFile":
                installer = new ResourceFileInstaller();
                break;

            case "AuthenticationSystem":
            case "Auth_System":
                installer = new AuthenticationInstaller();
                break;

            case "DashboardControl":
                installer = new DashboardInstaller();
                break;

            case "Script":
                installer = new ScriptInstaller();
                break;

            case "Config":
                installer = new ConfigInstaller();
                break;

            case "Cleanup":
                installer = new CleanupInstaller();
                break;

            case "Skin":
                installer = new SkinInstaller();
                break;

            case "Container":
                installer = new ContainerInstaller();
                break;

            case "Module":
                installer = new ModuleInstaller();
                break;

            case "CoreLanguage":
                installer = new LanguageInstaller(LanguagePackType.Core);
                break;

            case "ExtensionLanguage":
                installer = new LanguageInstaller(LanguagePackType.Extension);
                break;

            case "Provider":
                installer = new ProviderInstaller();
                break;

            case "SkinObject":
                installer = new SkinControlInstaller();
                break;

            case "Widget":
                installer = new WidgetInstaller();
                break;

            default:
                ListController listController = new ListController();
                ListEntryInfo  entry          = listController.GetListEntryInfo("Installer", installerType);
                if (entry != null && !string.IsNullOrEmpty(entry.Text))
                {
                    installer = (ComponentInstallerBase)Reflection.CreateObject(entry.Text, "Installer_" + entry.Value);
                }
                break;
            }
            return(installer);
        }