Exemple #1
0
        /// <summary>
        /// Gets the ImportInfos from a XmlNode.
        /// </summary>
        /// <param name="mod">The XmlNode to get the ImportInfos from.</param>
        /// <returns>The ImportInfos from a XmlNode.</returns>
        private static ImportInfo GetImportInfo(XmlNode mod)
        {
            ImportInfo importInfo = new ImportInfo();

            if (mod.Attributes == null)
            {
                return(null);
            }

            foreach (XmlAttribute att in mod.Attributes)
            {
                if (att.Name == Constants.KEY)
                {
                    importInfo.LocalPath = att.Value;
                }
                else if (att.Name == Constants.NAME)
                {
                    importInfo.Name = att.Value;
                }
                else if (att.Name == Constants.VERSIONCONTROLERNAME)
                {
                    importInfo.SiteHandlerName = att.Value;
                }
                else if (att.Name == Constants.PRODUCTID)
                {
                    importInfo.ProductID = att.Value;
                }
                else if (att.Name == Constants.MODURL)
                {
                    importInfo.ModURL = att.Value;
                }
                else if (att.Name == Constants.FORUMURL)
                {
                    importInfo.AdditionalURL = att.Value;
                }
                else if (att.Name == Constants.ISFILE)
                {
                    importInfo.IsFile = (att.Value == ONE);
                }
                else if (att.Name == Constants.INSTALL)
                {
                    importInfo.Install = (att.Value == ONE);
                }
                else if (att.Name == Constants.INSTALLDIR)
                {
                    importInfo.InstallDir = att.Value;
                }
            }

            foreach (XmlNode child in mod.ChildNodes)
            {
                importInfo.AddChild(GetImportInfo(child));
            }

            return(importInfo);
        }
        /// <summary>
        /// Gets the ImportInfos from a XmlNode.
        /// </summary>
        /// <param name="mod">The XmlNode to get the ImportInfos from.</param>
        /// <returns>The ImportInfos from a XmlNode.</returns>
        private static ImportInfo GetImportInfo(XmlNode mod)
        {
            ImportInfo importInfo = new ImportInfo();
            if (mod.Attributes == null)
                return null;

            foreach (XmlAttribute att in mod.Attributes)
            {
                if (att.Name == Constants.KEY)
                    importInfo.LocalPath = att.Value;
                else if (att.Name == Constants.NAME)
                    importInfo.Name = att.Value;
                else if (att.Name == Constants.VERSIONCONTROLERNAME)
                    importInfo.SiteHandlerName = att.Value;
                else if (att.Name == Constants.PRODUCTID)
                    importInfo.ProductID = att.Value;
                else if (att.Name == Constants.MODURL)
                    importInfo.ModURL = att.Value;
                else if (att.Name == Constants.FORUMURL)
                    importInfo.AdditionalURL = att.Value;
                else if (att.Name == Constants.ISFILE)
                    importInfo.IsFile = (att.Value == ONE);
                else if (att.Name == Constants.INSTALL)
                    importInfo.Install = (att.Value == ONE);
                else if (att.Name == Constants.INSTALLDIR)
                    importInfo.InstallDir = att.Value;
            }

            foreach (XmlNode child in mod.ChildNodes)
                importInfo.AddChild(GetImportInfo(child));

            return importInfo;
        }