MarkItUp.SingleUserBlog/Services/Category.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Xml ;
using System.Xml.Serialization ;

namespace MarkItUp.SingleUserBlog.Services
{
	public enum CategoryType : short {
		Folder = 1,
		Content = 2,
		Unknown = short.MaxValue
	}



	[Serializable()]
	public class Category : ModeratedItem
	{
		public Category() {}

		protected string _parentId = "0"; 
		[XmlAttribute("parentId")]
		public string ParentId { get { return this._parentId ; } set { this._parentId = value ; } }


		protected CategoryType _categoryType = CategoryType.Folder ; 
		[XmlAttribute("categoryType")]
		public CategoryType CategoryType { get { return this._categoryType ; } set { this._categoryType = value ; } }

		protected string _description = string.Empty ;
		public override string Description { get { return _description ; } set { _description = value ; } }



		public override void Fill(System.Xml.XmlNode node) {
			base.Fill (node);

			if(node.Attributes["parentId"] != null) {
				this.ParentId = node.Attributes["parentId"].Value ;
			}

			if(node.Attributes["categoryType"] != null) {
				this.CategoryType = (CategoryType) Enum.Parse( typeof(CategoryType), node.Attributes["categoryType"].Value) ;
			}

            this.Description = node.InnerText;
		}


		public override void Persist(XmlNode node) {
			base.Persist (node);

			XmlAttribute attr = node.OwnerDocument.CreateAttribute("parentId");
			attr.Value = this.ParentId;
			node.Attributes.Append(attr) ;

			attr = node.OwnerDocument.CreateAttribute("categoryType");
			attr.Value = ((short)this.CategoryType).ToString();
			node.Attributes.Append(attr) ;

            node.InnerText = this.Description;
后面还有 3 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。