コード例 #1
0
ファイル: LinkList.cs プロジェクト: linyacool2/blogengine
        public LinkItem GetLinkById(string id)
        {
            var item  = new LinkItem();
            var doc   = Doc();
            var links = doc.SelectSingleNode("links");

            if (links == null)
            {
                return(item);
            }
            var node = doc.SelectSingleNode(string.Format("links/link[@id='{0}']", id));

            if (node != null)
            {
                item.Id     = node.Attributes["id"].Value;
                item.Url    = node.Attributes["url"].Value;
                item.Target = node.Attributes["target"].Value;
                item.Title  = node.InnerText;
            }
            return(item);
        }
コード例 #2
0
 public List<LinkItem> GetLinks()
 {
     var items = new List<LinkItem>();
     var doc = Doc();
     var links = doc.SelectSingleNode("links");
     if (links != null)
     {
         if(links.ChildNodes != null && links.ChildNodes.Count > 0)
         {
             foreach (var node in links.ChildNodes)
             {
                 var item = new LinkItem();
                 var x = (XmlNode)node;
                 item.Id = x.Attributes["id"].Value;
                 item.Url = x.Attributes["url"].Value;
                 item.Target = x.Attributes["target"].Value;
                 item.Title = x.InnerText;
                 items.Add(item);
             }
         }
     }
     return items;
 }
コード例 #3
0
ファイル: LinkList.cs プロジェクト: linyacool2/blogengine
        public List <LinkItem> GetLinks()
        {
            var items = new List <LinkItem>();
            var doc   = Doc();
            var links = doc.SelectSingleNode("links");

            if (links != null)
            {
                if (links.ChildNodes != null && links.ChildNodes.Count > 0)
                {
                    foreach (var node in links.ChildNodes)
                    {
                        var item = new LinkItem();
                        var x    = (XmlNode)node;
                        item.Id     = x.Attributes["id"].Value;
                        item.Url    = x.Attributes["url"].Value;
                        item.Target = x.Attributes["target"].Value;
                        item.Title  = x.InnerText;
                        items.Add(item);
                    }
                }
            }
            return(items);
        }
コード例 #4
0
 public LinkItem GetLinkById(string id)
 {
     var item = new LinkItem();
     var doc = Doc();
     var links = doc.SelectSingleNode("links");
     if (links == null)
     {
         return item;
     }
     var node = doc.SelectSingleNode(string.Format("links/link[@id='{0}']", id));
     if (node != null)
     {
         item.Id = node.Attributes["id"].Value;
         item.Url = node.Attributes["url"].Value;
         item.Target = node.Attributes["target"].Value;
         item.Title = node.InnerText;
     }
     return item;
 }