/// ----------------------------------------------------------------------------- /// <summary> /// This Constructor creates a new PackageInstaller instance /// </summary> /// <param name="package">A PackageInfo instance</param> /// <history> /// [cnurse] 01/21/2008 created /// </history> /// ----------------------------------------------------------------------------- public PackageInstaller(PackageInfo package) { IsValid = true; DeleteFiles = Null.NullBoolean; Package = package; if (!string.IsNullOrEmpty(package.Manifest)) { //Create an XPathDocument from the Xml var 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) { //Set package installer.Package = package; //Set type installer.Type = package.PackageType; _componentInstallers.Add(0, installer); } } }
/// ----------------------------------------------------------------------------- /// <summary> /// The ReadComponents method reads the components node of the manifest file. /// </summary> /// ----------------------------------------------------------------------------- private void ReadComponents(XPathNavigator manifestNav) { foreach (XPathNavigator componentNav in manifestNav.CreateNavigator().Select("components/component")) { // Set default order to next value (ie the same as the size of the collection) int order = this._componentInstallers.Count; string type = componentNav.GetAttribute("type", string.Empty); if (this.InstallMode == InstallMode.Install) { string installOrder = componentNav.GetAttribute("installOrder", string.Empty); if (!string.IsNullOrEmpty(installOrder)) { order = int.Parse(installOrder); } } else { string unInstallOrder = componentNav.GetAttribute("unInstallOrder", string.Empty); if (!string.IsNullOrEmpty(unInstallOrder)) { order = int.Parse(unInstallOrder); } } if (this.Package.InstallerInfo != null) { this.Log.AddInfo(Util.DNN_ReadingComponent + " - " + type); } ComponentInstallerBase installer = InstallerFactory.GetInstaller(componentNav, this.Package); if (installer == null) { this.Log.AddFailure(Util.EXCEPTION_InstallerCreate); } else { this._componentInstallers.Add(order, installer); this.Package.InstallerInfo.AllowableFiles += ", " + installer.AllowableFiles; } } }