예제 #1
0
        /// <summary>
        /// 从模板说明文件中获得模板说明信息
        /// </summary>
        /// <param name="xmlPath">模板路径(不包含文件名)</param>
        /// <returns>模板说明信息</returns>
        public static SpaceThemeAboutInfo GetThemeAboutInfo(string xmlPath)
        {
            SpaceThemeAboutInfo aboutInfo = new SpaceThemeAboutInfo();
            aboutInfo.name = "";
            aboutInfo.author = "";
            aboutInfo.createdate = "";
            aboutInfo.ver = "";
            aboutInfo.fordntver = "";
            aboutInfo.copyright = "";

            ///存放关于信息的文件 about.xml是否存在,不存在返回空串
            if (!System.IO.File.Exists(xmlPath + @"\about.xml"))
                return aboutInfo;
            
            XmlDocument xml = new XmlDocument();
            xml.Load(xmlPath + @"\about.xml");

            foreach (XmlNode n in xml.SelectSingleNode("about").ChildNodes)
            {
                if (n.NodeType != XmlNodeType.Comment && n.Name.ToLower() == "template")
                {
                    XmlAttribute name = n.Attributes["name"];
                    XmlAttribute author = n.Attributes["author"];
                    XmlAttribute createdate = n.Attributes["createdate"];
                    XmlAttribute ver = n.Attributes["ver"];
                    XmlAttribute fordntver = n.Attributes["fordntver"];
                    XmlAttribute copyright = n.Attributes["copyright"];

                    if (name != null)
                        aboutInfo.name = name.Value;

                    if (author != null)
                        aboutInfo.author = author.Value;

                    if (createdate != null)
                        aboutInfo.createdate = createdate.Value;

                    if (ver != null)
                        aboutInfo.ver = ver.Value;

                    if (fordntver != null)
                        aboutInfo.fordntver = fordntver.Value;

                    if (copyright != null)
                        aboutInfo.copyright = copyright.Value;
                }
            }
            return aboutInfo;
        }
예제 #2
0
        /// <summary>
        /// 从模板说明文件中获得模板说明信息
        /// </summary>
        /// <param name="xmlPath">模板路径(不包含文件名)</param>
        /// <returns>模板说明信息</returns>
        public static SpaceThemeAboutInfo GetThemeAboutInfo(string xmlPath)
        {
            SpaceThemeAboutInfo __aboutinfo = new SpaceThemeAboutInfo();

            __aboutinfo.name       = "";
            __aboutinfo.author     = "";
            __aboutinfo.createdate = "";
            __aboutinfo.ver        = "";
            __aboutinfo.fordntver  = "";
            __aboutinfo.copyright  = "";

            ///存放关于信息的文件 about.xml是否存在,不存在返回空串
            if (!System.IO.File.Exists(xmlPath + @"\about.xml"))
            {
                return(__aboutinfo);
            }


            XmlDocument xml = new XmlDocument();

            xml.Load(xmlPath + @"\about.xml");

            XmlNode root = xml.SelectSingleNode("about");

            foreach (XmlNode n in root.ChildNodes)
            {
                if (n.NodeType != XmlNodeType.Comment && n.Name.ToLower() == "template")
                {
                    XmlAttribute name       = n.Attributes["name"];
                    XmlAttribute author     = n.Attributes["author"];
                    XmlAttribute createdate = n.Attributes["createdate"];
                    XmlAttribute ver        = n.Attributes["ver"];
                    XmlAttribute fordntver  = n.Attributes["fordntver"];
                    XmlAttribute copyright  = n.Attributes["copyright"];

                    if (name != null)
                    {
                        __aboutinfo.name = name.Value.ToString();
                    }

                    if (author != null)
                    {
                        __aboutinfo.author = author.Value.ToString();
                    }

                    if (createdate != null)
                    {
                        __aboutinfo.createdate = createdate.Value.ToString();
                    }

                    if (ver != null)
                    {
                        __aboutinfo.ver = ver.Value.ToString();
                    }

                    if (fordntver != null)
                    {
                        __aboutinfo.fordntver = fordntver.Value.ToString();
                    }

                    if (copyright != null)
                    {
                        __aboutinfo.copyright = copyright.Value.ToString();
                    }
                }
            }
            return(__aboutinfo);
        }