コード例 #1
0
ファイル: Post.cs プロジェクト: jerrymds/Concord
 /// <summary>
 /// Constructor
 /// </summary>
 public Post()
 {
     Authors = new Authors();
     Categories = new Categories();
     Tags = new Tags();
     Comments = new Comments();
 }
コード例 #2
0
ファイル: BlogML.cs プロジェクト: jerrymds/Concord
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Location">Location of the XML file</param>
 public BlogML(string Location)
 {
     Location.ThrowIfNullOrEmpty("Location");
     XmlDocument Document = new XmlDocument();
     Document.Load(Location);
     foreach (XmlNode Children in Document.ChildNodes)
     {
         if (Children.Name.Equals("blog", StringComparison.CurrentCultureIgnoreCase))
         {
             DateCreated = Children.Attributes["date-created"] != null ? DateTime.Parse(Children.Attributes["date-created"].Value, CultureInfo.InvariantCulture) : DateTime.Now;
             RootURL = Children.Attributes["root-url"] != null ? Children.Attributes["root-url"].Value : "";
             foreach (XmlElement Child in Children.ChildNodes)
             {
                 if (Child.Name.Equals("title", StringComparison.CurrentCultureIgnoreCase))
                 {
                     Title = Child.InnerText;
                 }
                 else if (Child.Name.Equals("sub-title", StringComparison.CurrentCultureIgnoreCase))
                 {
                     SubTitle = Child.InnerText;
                 }
                 else if (Child.Name.Equals("authors", StringComparison.CurrentCultureIgnoreCase))
                 {
                     Authors = new Authors(Child);
                 }
                 else if (Child.Name.Equals("categories", StringComparison.CurrentCultureIgnoreCase))
                 {
                     Categories = new Categories(Child);
                 }
                 else if (Child.Name.Equals("posts", StringComparison.CurrentCultureIgnoreCase))
                 {
                     Posts = new Posts(Child);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: BlogML.cs プロジェクト: jerrymds/Concord
 /// <summary>
 /// Constructor
 /// </summary>
 public BlogML()
 {
     Authors = new Authors();
     Categories = new Categories();
     Posts = new Posts();
 }
コード例 #4
0
ファイル: Post.cs プロジェクト: jerrymds/Concord
        public Post(XmlElement Element)
        {
            Element.ThrowIfNull("Element");
            DateCreated = DateTime.Now;
            DateModified = DateTime.Now;
            ID = Element.Attributes["id"] != null ? Element.Attributes["id"].Value : "";
            PostURL = Element.Attributes["post-url"] != null ? Element.Attributes["post-url"].Value : "";
            DateCreated = Element.Attributes["date-created"] != null ? DateTime.Parse(Element.Attributes["date-created"].Value, CultureInfo.InvariantCulture) : DateTime.MinValue;
            DateModified = Element.Attributes["date-modified"] != null ? DateTime.Parse(Element.Attributes["date-modified"].Value, CultureInfo.InvariantCulture) : DateCreated;

            foreach (XmlElement Children in Element.ChildNodes)
            {
                if (Children.Name.Equals("title", StringComparison.CurrentCultureIgnoreCase))
                {
                    Title = Children.InnerText;
                }
                else if (Children.Name.Equals("content", StringComparison.CurrentCultureIgnoreCase))
                {
                    Content = Children.InnerText;
                }
                else if (Children.Name.Equals("post-name", StringComparison.CurrentCultureIgnoreCase))
                {
                    PostName = Children.InnerText;
                }
                else if (Children.Name.Equals("excerpt", StringComparison.CurrentCultureIgnoreCase))
                {
                    Excerpt = Children.InnerText;
                }
                else if (Children.Name.Equals("authors", StringComparison.CurrentCultureIgnoreCase))
                {
                    Authors = new Authors(Children);
                }
                else if (Children.Name.Equals("categories", StringComparison.CurrentCultureIgnoreCase))
                {
                    Categories = new Categories(Children);
                }
                else if (Children.Name.Equals("tags", StringComparison.CurrentCultureIgnoreCase))
                {
                    Tags = new Tags(Children);
                }
                else if (Children.Name.Equals("comments", StringComparison.CurrentCultureIgnoreCase))
                {
                    Comments = new Comments(Children);
                }
            }
        }