Ejemplo n.º 1
0
        protected virtual InstallFile ReadManifestItem(XPathNavigator nav, bool checkFileExists)
        {
            string         fileName = Null.NullString;
            XPathNavigator pathNav  = nav.SelectSingleNode("path");

            if (pathNav == null)
            {
                fileName = DefaultPath;
            }
            else
            {
                fileName = pathNav.Value + "\\";
            }
            XPathNavigator nameNav = nav.SelectSingleNode("name");

            if (nameNav != null)
            {
                fileName += nameNav.Value;
            }
            string      sourceFileName = Util.ReadElement(nav, "sourceFileName");
            InstallFile file           = new InstallFile(fileName, sourceFileName, Package.InstallerInfo);

            if ((!string.IsNullOrEmpty(BasePath)) && (BasePath.ToLowerInvariant().StartsWith("app_code") && file.Type == InstallFileType.Other))
            {
                file.Type = InstallFileType.AppCode;
            }
            if (file != null)
            {
                string strVersion = XmlUtils.GetNodeValue(nav, "version");
                if (!string.IsNullOrEmpty(strVersion))
                {
                    file.SetVersion(new System.Version(strVersion));
                }
                else
                {
                    file.SetVersion(Package.Version);
                }
                string strAction = XmlUtils.GetAttributeValue(nav, "action");
                if (!string.IsNullOrEmpty(strAction))
                {
                    file.Action = strAction;
                }
                if (InstallMode == InstallMode.Install && checkFileExists && file.Action != "UnRegister")
                {
                    if (System.IO.File.Exists(file.TempFileName))
                    {
                        Log.AddInfo(string.Format(Util.FILE_Found, file.Path, file.Name));
                    }
                    else
                    {
                        Log.AddFailure(Util.FILE_NotFound + " - " + file.TempFileName);
                    }
                }
            }
            return(file);
        }
Ejemplo n.º 2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The ReadManifestItem method reads a single node
        /// </summary>
        /// <param name="nav">The XPathNavigator representing the node</param>
        /// <param name="checkFileExists">Flag that determines whether a check should be made</param>
        /// <history>
        /// 	[cnurse]	08/07/2007  created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected virtual InstallFile ReadManifestItem(XPathNavigator nav, bool checkFileExists)
        {
            string fileName = Null.NullString;

            //Get the path
            XPathNavigator pathNav = nav.SelectSingleNode("path");
            if (pathNav == null)
            {
                fileName = DefaultPath;
            }
            else
            {
                fileName = pathNav.Value + "\\";
            }
			
            //Get the name
            XPathNavigator nameNav = nav.SelectSingleNode("name");
            if (nameNav != null)
            {
                fileName += nameNav.Value;
            }
            
			//Get the sourceFileName
			string sourceFileName = Util.ReadElement(nav, "sourceFileName");
            var file = new InstallFile(fileName, sourceFileName, Package.InstallerInfo);
            if ((!string.IsNullOrEmpty(BasePath)) && (BasePath.ToLowerInvariant().StartsWith("app_code") && file.Type == InstallFileType.Other))
            {
                file.Type = InstallFileType.AppCode;
            }
            if (file != null)
            {
                //Set the Version
				string strVersion = XmlUtils.GetNodeValue(nav, "version");
                if (!string.IsNullOrEmpty(strVersion))
                {
                    file.SetVersion(new Version(strVersion));
                }
                else
                {
                    file.SetVersion(Package.Version);
                }
                
				//Set the Action
				string strAction = XmlUtils.GetAttributeValue(nav, "action");
                if (!string.IsNullOrEmpty(strAction))
                {
                    file.Action = strAction;
                }
                if (InstallMode == InstallMode.Install && checkFileExists && file.Action != "UnRegister")
                {
                    if (File.Exists(file.TempFileName))
                    {
                        Log.AddInfo(string.Format(Util.FILE_Found, file.Path, file.Name));
                    }
                    else
                    {
                        Log.AddFailure(Util.FILE_NotFound + " - " + file.TempFileName);
                    }
                }
            }
            return file;
        }
Ejemplo n.º 3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The ReadManifestItem method reads a single node.
        /// </summary>
        /// <param name="nav">The XPathNavigator representing the node.</param>
        /// <param name="checkFileExists">Flag that determines whether a check should be made.</param>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        protected virtual InstallFile ReadManifestItem(XPathNavigator nav, bool checkFileExists)
        {
            string fileName = Null.NullString;

            // Get the path
            XPathNavigator pathNav = nav.SelectSingleNode("path");

            if (pathNav == null)
            {
                fileName = this.DefaultPath;
            }
            else
            {
                fileName = pathNav.Value + "\\";
            }

            // Get the name
            XPathNavigator nameNav = nav.SelectSingleNode("name");

            if (nameNav != null)
            {
                fileName += nameNav.Value;
            }

            // Get the sourceFileName
            string sourceFileName = Util.ReadElement(nav, "sourceFileName");
            var    file           = new InstallFile(fileName, sourceFileName, this.Package.InstallerInfo);

            if ((!string.IsNullOrEmpty(this.BasePath)) && (this.BasePath.StartsWith("app_code", StringComparison.InvariantCultureIgnoreCase) && file.Type == InstallFileType.Other))
            {
                file.Type = InstallFileType.AppCode;
            }

            if (file != null)
            {
                // Set the Version
                string strVersion = XmlUtils.GetNodeValue(nav, "version");
                if (!string.IsNullOrEmpty(strVersion))
                {
                    file.SetVersion(new Version(strVersion));
                }
                else
                {
                    file.SetVersion(this.Package.Version);
                }

                // Set the Action
                string strAction = XmlUtils.GetAttributeValue(nav, "action");
                if (!string.IsNullOrEmpty(strAction))
                {
                    file.Action = strAction;
                }

                if (this.InstallMode == InstallMode.Install && checkFileExists && file.Action != "UnRegister")
                {
                    if (File.Exists(file.TempFileName))
                    {
                        this.Log.AddInfo(string.Format(Util.FILE_Found, file.Path, file.Name));
                    }
                    else
                    {
                        this.Log.AddFailure(Util.FILE_NotFound + " - " + file.TempFileName);
                    }
                }
            }

            return(file);
        }