• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Syndication.SyndicationLink类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.ServiceModel.Syndication.SyndicationLink的典型用法代码示例。如果您正苦于以下问题:C# SyndicationLink类的具体用法?C# SyndicationLink怎么用?C# SyndicationLink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SyndicationLink类属于System.ServiceModel.Syndication命名空间,在下文中一共展示了SyndicationLink类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetService

        public async Task<IHttpActionResult> GetService(string id)
        {
            Service service = await db.Services.FindAsync(id);
            if (service == null)
            {
                return NotFound();
            }

            var ServiceFeed = new SyndicationFeed();
            ServiceFeed.Id = service.Id;
            ServiceFeed.LastUpdatedTime = service.Updated;
            ServiceFeed.Title = new TextSyndicationContent(service.Title);
            ServiceFeed.Description = new TextSyndicationContent(service.Summary);

            ServiceFeed.Categories.Add(new SyndicationCategory(service.ServiceCategoryId.ToString(), null, service.Category.Name));

            var SelfLink = new SyndicationLink();
            SelfLink.RelationshipType = "self";
            SelfLink.Uri = new Uri(Url.Content("~/Service/" + service.Id));
            SelfLink.MediaType = "application/atom+xml";
            ServiceFeed.Links.Add(SelfLink);

            var HtmlLink = new SyndicationLink();
            HtmlLink.RelationshipType = "self";
            HtmlLink.Uri = new Uri("http://surreyhillsdc.azurewebsites.net/");
            HtmlLink.MediaType = "text/html";
            ServiceFeed.Links.Add(HtmlLink);

            return Ok(ServiceFeed.GetAtom10Formatter());
        }
开发者ID:BforBen,项目名称:OpenGovApi,代码行数:30,代码来源:ServiceController.cs


示例2: GetPostFeed

        public static SyndicationFeed GetPostFeed()
        {
            SyndicationFeed postfeed = Feeds.GetFeed();
            postfeed.Title = new TextSyndicationContent("Key Mapper Developer Blog");
            postfeed.Description = new TextSyndicationContent("Post feed for the Key Mapper Developer Blog");

            Collection<Post> posts = Post.GetAllPosts(CommentType.Approved);
            List<SyndicationItem> items = new List<SyndicationItem>();

            foreach (Post p in posts)
            {
                SyndicationItem item = new SyndicationItem();
                item.Id = p.Id.ToString();
                item.Title = new TextSyndicationContent(p.Title);
                item.Content = new TextSyndicationContent(p.Body);

                SyndicationLink itemlink = new SyndicationLink();
                itemlink.Title = "Key Mapper Blog";
                itemlink.Uri = new Uri("http://justkeepswimming.net/keymapper/default.aspx?p="
                    + p.Id.ToString() + ".aspx");
                item.Links.Add(itemlink);

                SyndicationPerson person = new SyndicationPerson();
                person.Name = "Stuart Dunkeld";
                person.Email = "[email protected]";
                item.Authors.Add(person);

                items.Add(item);
            }

            postfeed.Items = items;
            return postfeed;
        }
开发者ID:tmzu,项目名称:keymapper,代码行数:33,代码来源:feeds.cs


示例3: Rss

        public ActionResult Rss(string domain="")
        {
            var news = NewsProvider.GetSeason(2014, domain).OrderByDescending(n=>n.Date).Take(10);

            var feedItems = new List<SyndicationItem>();
            foreach (var news_item in news)
            {
                var item = new SyndicationItem()
                {
                    Title = TextSyndicationContent.CreatePlaintextContent(news_item.Title),
                    PublishDate = new DateTimeOffset(news_item.Date),
                    Summary = TextSyndicationContent.CreateHtmlContent(CombineBriefWithImage(news_item)),
                };
                string url = "http://afspb.org.ru/news/" + news_item.Slug;

                var link = new SyndicationLink(new Uri(url));
                link.Title = "Перейти к новости";
                item.Links.Add(link);
                feedItems.Add(item);
            }

            var feed = new SyndicationFeed(
                    "Новости сайта Автомобильной Федерации Санкт-Петербурга и Ленинградской области",
                    "",
                    new Uri("http://afspb.org.ru/news/Rss"),
                    feedItems);

            return new RssResult()
            {
                Feed = feed
            };
        }
开发者ID:rallysportphoto,项目名称:Portal,代码行数:32,代码来源:NewsController.cs


示例4: GetBlogInformation

    private static SyndicationFeed GetBlogInformation(string pbaseUrl) {
        var feed = new SyndicationFeed();

        // Add basic blog information
        feed.Id = pbaseUrl;
        feed.Title = new TextSyndicationContent("Kestrel Blackmore Blog");
        feed.Description = new TextSyndicationContent("Hi, I'm Kestrel. I've been a software developer now for 10+ years and I love it!");
        feed.Copyright = new TextSyndicationContent("KestrelBlackmore.com");
        feed.LastUpdatedTime = new DateTimeOffset(DateTime.Now);
        feed.Generator = "BlogMatrix 1.0";
        feed.ImageUrl = new Uri(pbaseUrl + "/assets/img/blackmore_logo.png");

        // Add the URL that will link to your published feed when it's done
        SyndicationLink link = new SyndicationLink(new Uri(pbaseUrl + "/feed.xml"));
        link.RelationshipType = "self";
        link.MediaType = "text/html";
        link.Title = "Kestrel Blackmore Feed";
        feed.Links.Add(link);

        // Add your site link
        link = new SyndicationLink(new Uri(pbaseUrl));
        link.MediaType = "text/html";
        link.Title = "Kestrel Blackmore Blog";
        feed.Links.Add(link);

        return feed;
    }
开发者ID:Preferencesoft,项目名称:BlogMatrix,代码行数:27,代码来源:RssSyndicator.cs


示例5: TestUri

		public void TestUri ()
		{
			SyndicationLink link = new SyndicationLink (new Uri ("empty.xml", UriKind.Relative));
			link.Uri = null;
			Assert.IsNull (link.Uri, "#1");
			Assert.IsNull (link.GetAbsoluteUri (), "#2");
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:SyndicationLinkTest.cs


示例6: GetXmlContents

        private Action<Stream> GetXmlContents(IEnumerable<Post> model)
        {
            var items = new List<SyndicationItem>();

            foreach (var post in model)
            {
                // Replace all relative urls with full urls.
                var contentHtml = Regex.Replace(post.Content, UrlRegex, m => siteUrl.TrimEnd('/') + "/" + m.Value.TrimStart('/'));
                var excerptHtml = Regex.Replace(post.ContentExcerpt, UrlRegex, m => siteUrl.TrimEnd('/') + "/" + m.Value.TrimStart('/'));

                var item = new SyndicationItem(
                    post.Title,
                    contentHtml,
                    new Uri(siteUrl + post.Url)
                    )
                {
                    Id = siteUrl + post.Url,
                    LastUpdatedTime = post.Date.ToUniversalTime(),
                    PublishDate = post.Date.ToUniversalTime(),
                    Content = new TextSyndicationContent(contentHtml, TextSyndicationContentKind.Html),
                    Summary = new TextSyndicationContent(excerptHtml, TextSyndicationContentKind.Html),
                };

                items.Add(item);
            }

            var feed = new SyndicationFeed(
                AtomTitle,
                AtomTitle, /* Using Title also as Description */
                new Uri(siteUrl + "/" + feedfileName),
                items)
                {
                    Id = siteUrl + "/",
                    LastUpdatedTime = new DateTimeOffset(DateTime.Now),
                    Generator = "Sandra.Snow Atom Generator"
                };
            feed.Authors.Add(new SyndicationPerson(authorEmail, author, siteUrl));

            var link = new SyndicationLink(new Uri(siteUrl + "/" + feedfileName))
            {
                RelationshipType = "self",
                MediaType = "text/html",
                Title = AtomTitle
            };
            feed.Links.Add(link);


            var formatter = new Atom10FeedFormatter(feed);

            return stream =>
            {
                var encoding = new UTF8Encoding(false);
                var streamWrapper = new UnclosableStreamWrapper(stream);

                using (var writer = new XmlTextWriter(streamWrapper, encoding))
                {
                    formatter.WriteTo(writer);
                }
            };
        }
开发者ID:horsdal,项目名称:Sandra.Snow,代码行数:60,代码来源:AtomResponse.cs


示例7: GetBlogInformation

        private static SyndicationFeed GetBlogInformation(string pbaseUrl) {
            var feed = new SyndicationFeed();

            // Add basic blog information
            feed.Id = pbaseUrl;
            feed.Title = new TextSyndicationContent("제이키의 ASP.NET MVC 이야기");
            feed.Description = new TextSyndicationContent("ASP.NET MVC를 공부하면서 테스트 가능한 웹 애플리케이션을 만들어 봅시다. 테스트를 염두에 두면 유연한 아키텍쳐가 필요하고 좋은 아키텍쳐는 코드 재사용성을 높이고 유지보수를 쉽게 해줍니다.");
            feed.Copyright = new TextSyndicationContent("류지형 (Jake Ryu)");
            feed.LastUpdatedTime = new DateTimeOffset(DateTime.Now);
            feed.Generator = "JakeyMVC.com";
            feed.ImageUrl = new Uri(pbaseUrl + "/assets/img/logo_white.gif");

            // Add the URL that will link to your published feed when it's done
            SyndicationLink link = new SyndicationLink(new Uri(pbaseUrl + "/feed"));
            link.RelationshipType = "self";
            link.MediaType = "text/html";
            link.Title = "Jakey MVC Feed";
            
            feed.Links.Add(link);

            // Add your site link
            link = new SyndicationLink(new Uri(pbaseUrl));
            link.MediaType = "text/html";
            link.Title = "JakeyMVC.com";
            feed.Links.Add(link);

            return feed;
        }
开发者ID:JakeRyu,项目名称:jakey.mvc,代码行数:28,代码来源:RssSyndicator.cs


示例8: CreateFeed

        public SyndicationFeedFormatter CreateFeed()
        {
            string serverUrl = ConfigurationManager.AppSettings["CatMyVideoUrl"];
            // Create a new Syndication Feed.
            SyndicationFeed feed = new SyndicationFeed();

            feed.Id = "#CatMyVideo URL";

            List<SyndicationItem> items = new List<SyndicationItem>();

            feed.Title = new TextSyndicationContent("Last trends on CatMyVideo");
            feed.Description = new TextSyndicationContent(String.Format("Todays' top {0} hottest videos on CatMyVideo", MAXVIDEO));
            feed.Copyright = new TextSyndicationContent("Copy/Paste rights CatMyVideo");
            feed.Generator = "CatMyVideo RSS Feeder 1.0";
            feed.Authors.Add(new SyndicationPerson("[email protected]"));

            feed.LastUpdatedTime = new DateTimeOffset(DateTime.Now);

            var trendingVideos = Engine.BusinessManagement.Video.ListVideos(Engine.Dbo.Video.Order.UploadDate, false, MAXVIDEO, 0, true);
            for (int i = 0; i < trendingVideos.Count; i++)
            {
                SyndicationItem item = new SyndicationItem();

                string itemUrl = serverUrl + "/Video/Display/" + trendingVideos[i].Id;
                item.Id = itemUrl;

                var itemLink = new SyndicationLink(new Uri(itemUrl));
                itemLink.MediaType = "text/html";
                itemLink.Title = "Watch me !";
                item.Links.Add(itemLink);

                string htmlContent = String.Format("<!DOCTYPE html><html><head></head><body><h1>{0}</h1><p>{1}</p><a href=\"{2}\">Check this out !</a></body></html>",
                                                    trendingVideos[i].Title,
                                                    trendingVideos[i].Description,
                                                    itemUrl);
                TextSyndicationContent content = new TextSyndicationContent(htmlContent, TextSyndicationContentKind.Html);

                // Fill some properties for the item
                item.Title = new TextSyndicationContent("#" + (i + 1));
                item.LastUpdatedTime = DateTime.Now;
                item.PublishDate = trendingVideos[i].UploadDate;

                item.Content = content;
                items.Add(item);
            }
            feed.Items = items;

            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
开发者ID:Flasheur111,项目名称:CatMyVideo,代码行数:60,代码来源:CatMyVideoFeeder.cs


示例9: fload

 public void fload(string namefile)
 {
         var lines = System.IO.File.ReadAllLines(namefile);
         feed.Title = new TextSyndicationContent(lines[1]);
         feed.Copyright = new TextSyndicationContent(lines[2]);
         feed.Description = new TextSyndicationContent(lines[3]);
         feed.Generator = lines[4];
         SyndicationLink link = new SyndicationLink();
         link.Uri = new Uri(lines[5]);
         feed.Links.Add(link);
         feed.Items = txtgotolv("feedinfo.txt");
         Response.Clear();
         Response.ContentEncoding = System.Text.Encoding.UTF8;
         Response.ContentType = "text/xml";
         XmlWriter Writer = XmlWriter.Create
         (Response.Output);
         if (lines[0] == "rss")
         {
             Rss20FeedFormatter Formatter = new Rss20FeedFormatter(feed);
             Formatter.WriteTo(Writer);
         }
         else
         {
             if (lines[0] == "atom")
             {
                 Atom10FeedFormatter Formatter = new Atom10FeedFormatter(feed);
                 Formatter.WriteTo(Writer);
             }
         }
         Writer.Close();
         Response.End();
 }
开发者ID:1342MPA,项目名称:CourseProject,代码行数:32,代码来源:Default.aspx.cs


示例10: ToSyndicationLink

        public static SyndicationLink ToSyndicationLink(this Link link)
        {
            var syndicationLink = new SyndicationLink(new Uri(link.Url));
            link.Rel.IfNotNull(x => syndicationLink.RelationshipType = x);
            link.Title.IfNotNull(x => syndicationLink.Title = x);
            link.ContentType.IfNotNull(x => syndicationLink.MediaType = x);

            return syndicationLink;
        }
开发者ID:ahjohannessen,项目名称:FubuMVC.Media,代码行数:9,代码来源:SyndicationExtensions.cs


示例11: SyndicationLink

 protected SyndicationLink(SyndicationLink source)
 {
     if (source == null)
         throw new ArgumentNullException ("source");
     base_uri = source.base_uri;
     href = source.href;
     length = source.length;
     rel = source.rel;
     title = source.title;
     type = source.type;
     extensions = source.extensions.Clone ();
 }
开发者ID:andresmoschini,项目名称:SharpPodder,代码行数:12,代码来源:SyndicationLink.cs


示例12: JsonSyndicationLink

 public JsonSyndicationLink(SyndicationLink link)
 {
     if (link != null)
     {
         this.Length = link.Length;
         this.MediaType = link.MediaType;
         this.RelationshipType = link.RelationshipType;
         this.Title = link.Title;
         this.Uri = link.BaseUri;
         this.Uri = link.Uri;
     }
 }
开发者ID:ssickles,项目名称:archive,代码行数:12,代码来源:JsonSyndicationLink.cs


示例13: Constructor

		public void Constructor ()
		{
			// null Uri is allowed
			SyndicationLink link = new SyndicationLink (null);

			link = new SyndicationLink (new Uri ("empty.xml", UriKind.Relative));
			Assert.AreEqual ("empty.xml", link.Uri.ToString (), "#1-1");
			Assert.AreEqual (null, link.BaseUri, "#1-2");
			Assert.AreEqual (0, link.Length, "#1-3");
			Assert.AreEqual (null, link.MediaType, "#1-4");

			link = new SyndicationLink (null, null, null, null, 0);
		}
开发者ID:nickchal,项目名称:pash,代码行数:13,代码来源:SyndicationLinkTest.cs


示例14: AddMoreResultsLink

        public FeedBuilder AddMoreResultsLink(Uri baseUri, string key, int? page)
        {
            var moreresultsuri = string.Format("{0}?key={1}&page={2}", "search", key, page);

            //TODO: Fix this uri

            this.moreResultsLink = new SyndicationLink(new Uri(baseUri, moreresultsuri))
                {
                    RelationshipType = "next-results"
                };

            return this;
        }
开发者ID:RWE-Nexus,项目名称:EnergyTrading-MDM,代码行数:13,代码来源:FeedBuilder.cs


示例15: GetFeed

        public static SyndicationFeed GetFeed()
        {
            SyndicationFeed feed = new SyndicationFeed();

            feed.Copyright = new TextSyndicationContent("Copyright (C) Stuart Dunkeld 2008. All rights reserved.");
            feed.Generator = "ASP.Net 3.5 Syndication classes";

            SyndicationLink link = new SyndicationLink();
            link.Title = "Key Mapper Home";
            link.Uri = new Uri("http://justkeepswimming.net/keymapper");
            feed.Links.Add(link);

            return feed;
        }
开发者ID:tmzu,项目名称:keymapper,代码行数:14,代码来源:feeds.cs


示例16: SyndicationLink

 protected SyndicationLink(SyndicationLink source)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     this.length = source.length;
     this.mediaType = source.mediaType;
     this.relationshipType = source.relationshipType;
     this.title = source.title;
     this.baseUri = source.baseUri;
     this.uri = source.uri;
     this.extensions = source.extensions.Clone();
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:SyndicationLink.cs


示例17: CanGetAtomLinkFromSyndicationLink

        public void CanGetAtomLinkFromSyndicationLink()
        {
            // Act
              SyndicationLink slink = new SyndicationLink(new Uri("http://edit"), "edit", "Edit feed", "text/html", 0);
              AtomLink link = slink.Link();

              // Assert
              Assert.IsNotNull(link);

              Assert.AreEqual("http://edit/", link.HRef.AbsoluteUri);
              Assert.AreEqual("Edit feed", link.Title);
              Assert.AreEqual("edit", link.RelationType);
              Assert.AreEqual("text/html", (string)link.MediaType);
        }
开发者ID:prearrangedchaos,项目名称:Ramone,代码行数:14,代码来源:AtomLinkTests.cs


示例18: GetCollectionFeed

        public Atom10FeedFormatter GetCollectionFeed(string collectionId)
        {
            var collectionProvider = ConfigurationReader.Configuration.CollectionProviders.Where(cp => cp.Name.Equals(collectionId)).FirstOrDefault();
            if (collectionProvider == null) return null;

            IList<SyndicationItem> feedItems = new List<SyndicationItem>();

            // create snapshotfeed link            
            var item = new SyndicationItem
            {
                Title = new TextSyndicationContent("Snapshot feed for " + collectionId),
                Id = Guid.NewGuid().ToString(),
                LastUpdatedTime = DateTime.UtcNow
            };

            var sl = new SyndicationLink(new Uri(collectionId + "/snapshots", UriKind.Relative))
            {
                RelationshipType = SdShareNamespace + "snapshotsfeed",
                MediaType = "application/atom+xml"
            };
            item.Links.Add(sl);
            item.Links.Add(new SyndicationLink(new Uri(collectionId + "/snapshots", UriKind.Relative)) { RelationshipType = "alternate", MediaType = "application/atom+xml" });
            feedItems.Add(item);

            // create fragments link
            item = new SyndicationItem
            {
                Title = new TextSyndicationContent("Fragments feed for " + collectionId),
                Id = Guid.NewGuid().ToString(),
                LastUpdatedTime = DateTime.UtcNow
            };

            var fl = new SyndicationLink(new Uri(collectionId + "/fragments", UriKind.Relative))
            {
                RelationshipType = SdShareNamespace + "fragmentsfeed",
                MediaType = "application/atom+xml"
            };
            item.Links.Add(fl);
            item.Links.Add(new SyndicationLink(new Uri(collectionId + "/fragments", UriKind.Relative)) { RelationshipType = "alternate", MediaType = "application/atom+xml" });
            feedItems.Add(item);

            var feed = new SyndicationFeed(feedItems)
            {
                Title = new TextSyndicationContent(collectionId + " Feed"),
                LastUpdatedTime = DateTime.UtcNow
            };

            return new Atom10FeedFormatter(feed);            
        }
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:49,代码来源:ServerCore.cs


示例19: TestBaseUri

		public void TestBaseUri ()
		{
			// relative
			SyndicationLink link = new SyndicationLink (new Uri ("empty.xml", UriKind.Relative));
			Assert.IsNull (link.BaseUri, "#1");

			// absolute
			link = new SyndicationLink (new Uri ("http://mono-project.com/index.rss"));
			Assert.IsNull (link.BaseUri, "#2");

			// absolute #2
			link = new SyndicationLink ();
			link.Uri = new Uri ("http://mono-project.com/index.rss");
			Assert.IsNull (link.BaseUri, "#3");
		}
开发者ID:nickchal,项目名称:pash,代码行数:15,代码来源:SyndicationLinkTest.cs


示例20: LoadLinks

 protected void LoadLinks(Collection<SyndicationLink> collection, EntitySet<Link> entitySet)
 {
   foreach (Link entity in entitySet)
   {
     SyndicationLink s = new SyndicationLink()
     {
       BaseUri = !string.IsNullOrEmpty(entity.BaseUri) ? null : new Uri(entity.BaseUri),
       Length = entity.Length.Value,
       MediaType = entity.MediaType,
       RelationshipType = entity.RelationshipType,
       Title = entity.Title,
       Uri = !string.IsNullOrEmpty(entity.Uri) ? null : new Uri(entity.Uri)
     };
     LoadAttributes(s.AttributeExtensions, entity.Attributes);
     LoadElements(s.ElementExtensions, entity.Elements);
   }
 }
开发者ID:erikzaadi,项目名称:atomsitethemes.erikzaadi.com,代码行数:17,代码来源:DlinqBaseRepository.cs



注:本文中的System.ServiceModel.Syndication.SyndicationLink类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Web.WebServiceHost类代码示例发布时间:2022-05-26
下一篇:
C# Syndication.SyndicationItem类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap