Пример #1
0
        /// <summary>
        /// 从模板说明文件中获得模板说明信息
        /// </summary>
        /// <param name="xmlPath">模板路径(不包含文件名)</param>
        /// <returns>模板说明信息</returns>
        public static TemplateAboutInfo GetTemplateAboutInfo(string xmlPath)
        {
            TemplateAboutInfo aboutInfo = new TemplateAboutInfo();

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

            XmlDocument xml = new XmlDocument();

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

            try
            {
                XmlNode root = xml.SelectSingleNode("about");
                foreach (XmlNode n in root.ChildNodes)
                {
                    if (n.NodeType != XmlNodeType.Comment && n.Name.ToLower() == "template")
                    {
                        aboutInfo.name = n.Attributes["name"] != null ? n.Attributes["name"].Value.ToString() : "";
                        aboutInfo.author = n.Attributes["author"] != null ? n.Attributes["author"].Value.ToString() : "";
                        aboutInfo.createdate = n.Attributes["createdate"] != null ? n.Attributes["createdate"].Value.ToString() : "";
                        aboutInfo.ver = n.Attributes["ver"] != null ? n.Attributes["ver"].Value.ToString() : "";
                        aboutInfo.fordntver = n.Attributes["fordntver"] != null ? n.Attributes["fordntver"].Value.ToString() : "";
                        aboutInfo.copyright = n.Attributes["copyright"] != null ? n.Attributes["copyright"].Value.ToString() : "";
                        aboutInfo.width = n.Attributes["width"] != null ? n.Attributes["width"].Value.ToString() : "600";
                    }
                }
            }
            catch
            {
                aboutInfo = new TemplateAboutInfo();
            }
            return aboutInfo;
        }
Пример #2
0
 private static void SetTemplateDataRow(DataRow dr, TemplateAboutInfo aboutInfo)
 {
     dr["name"] = aboutInfo.name;// 模板名称
     dr["author"] = aboutInfo.author;// 作者
     dr["createdate"] = aboutInfo.createdate;// 创建日期
     dr["ver"] = aboutInfo.ver;// 模板版本
     dr["fordntver"] = aboutInfo.fordntver;// 适用的论坛版本
     dr["copyright"] = aboutInfo.copyright;// 版权
 }
Пример #3
0
		/// <summary>
		/// 从模板说明文件中获得模板说明信息
		/// </summary>
		/// <param name="xmlPath">模板路径(不包含文件名)</param>
		/// <returns>模板说明信息</returns>
		public static TemplateAboutInfo GetTemplateAboutInfo(string xmlPath)
		{
			TemplateAboutInfo __aboutinfo = new TemplateAboutInfo();
			__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");

            try
            {
                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();
                        }


                    }
                }
            }
            catch
            {
                __aboutinfo = new TemplateAboutInfo();
            }
			return __aboutinfo;
		}