예제 #1
0
        /// <summary>
        /// 番組のクローンを返す
        /// </summary>
        /// <param name="parentHeadline">親ヘッドライン</param>
        /// <returns>番組のクローン</returns>
        public virtual IChannel Clone(IHeadline parentHeadline)
        {
            Channel channel = new Channel((Headline)parentHeadline);

            channel.Title = (string)(Title.Clone());
            if (GetWebsiteUrl() != null)
            {
                channel.Link = new Uri(GetWebsiteUrl().ToString());
            }
            else
            {
                channel.Link = null;
            }
            channel.Description = (string)(channel.Description.Clone());
            channel.SetDate(
                Date.ToString("ddd, d MMM yyyy HH':'mm':'ss zzz",
                              System.Globalization.DateTimeFormatInfo.InvariantInfo));
            channel.Category = (string)(Category.Clone());
            channel.Author   = (string)(Author.Clone());
            if (GetPlayUrl() != null)
            {
                channel.Url = new Uri(GetPlayUrl().ToString());
            }
            else
            {
                channel.Url = null;
            }
            channel.Length = (string)(Length.Clone());
            channel.Type   = (string)(Type.Clone());
            channel.check  = false;

            return(channel);
        }
예제 #2
0
        /// <summary>
        /// 作品エクスポート
        /// </summary>
        /// <param name="author"></param>
        /// <param name="titles"></param>
        /// <param name="outPath"></param>
        /// <returns></returns>
        protected override bool ExportExecute(Author author, List <Title> titles, string outPath)
        {
            var exAuth = author.Clone();

            exAuth.Titles.RemoveAll(t => titles.Find(x => x.ID == t.ID) == null);
            exAuth.Save(outPath);
            return(true);
        }
예제 #3
0
        /// <summary>
        /// Updates information of chozen author.
        /// </summary>
        /// <param name="id">The identifier of author.</param>
        /// <param name="author">The author.</param>
        /// <returns>
        /// Updated writer
        /// </returns>
        public Author UpdateAuthor(long id, Author author)
        {
            Author authorToUpdate = _authors.Find((oldauthor) => oldauthor.Id == id);

            if (authorToUpdate != null)
            {
                authorToUpdate.Clone(author);
            }

            return(authorToUpdate);
        }
예제 #4
0
        /// <summary>
        /// Updating author with id using data from author object from params
        /// </summary>
        /// <param name="id">Id of author for update</param>
        /// <param name="author">New info</param>
        /// <returns>True if successfull updated</returns>
        public bool UpdateAuthor(int id, Author author)
        {
            Author authorToUpdate = this.authors.FirstOrDefault(AUTHOR => AUTHOR.AuthorID == id);
            bool   result         = false;

            if (authorToUpdate != null)
            {
                result = true;
                authorToUpdate.Clone(author);
            }

            return(result);
        }
        public void A_Clone_Should_Have_Identital_Values()
        {
            var author = new Author()
            {
                Id        = 12,
                FirstName = "Bruce",
                LastName  = "Wayne"
            };
            var clone = author.Clone();

            Assert.AreEqual(12, clone.Id);
            Assert.AreEqual("Bruce", clone.FirstName);
            Assert.AreEqual("Wayne", clone.LastName);
        }
예제 #6
0
        private SyndicationItem TransformPost(PostEntry entry)
        {
            entry = RenderEntry(entry);
            SyndicationItem item = new SyndicationItem();

            item.Id      = entry.Name;
            item.Title   = SyndicationContent.CreatePlaintextContent(entry.Title);
            item.Content = SyndicationContent.CreateHtmlContent(Transformer.Transform(entry.Content));
            item.AddPermalink(new Uri("http://otakustay.com/" + entry.Name + "/"));
            item.PublishDate     = new DateTimeOffset(entry.PostDate);
            item.LastUpdatedTime = new DateTimeOffset(entry.UpdateDate);
            item.Authors.Add(Author.Clone());
            return(item);
        }
        public void A_Clone_Should_Have_Identital_Values()
        {
            var author = new Author()
                             {
                                 Id = 12,
                                 FirstName = "Bruce",
                                 LastName = "Wayne"
                             };
            var clone = new Author();
            author.Clone(clone);

            Assert.AreEqual(12, clone.Id);
            Assert.AreEqual("Bruce", clone.FirstName);
            Assert.AreEqual("Wayne", clone.LastName);
        }
예제 #8
0
        public object Clone()
        {
            Channel channel = new Channel();

            channel.Title = (string)(Title.Clone());
            if (PlayUrl != null)
            {
                channel.PlayUrl = new Uri(PlayUrl.ToString());
            }
            else
            {
                channel.PlayUrl = null;
            }
            if (WebSiteUrl != null)
            {
                channel.WebSiteUrl = new Uri(WebSiteUrl.ToString());
            }
            else
            {
                channel.WebSiteUrl = null;
            }
            if (Description != null)
            {
                channel.Description = (string)(Description.Clone());
            }
            channel.Date = Date;
            if (Category != null)
            {
                channel.Category = (string)(Category.Clone());
            }
            if (Author != null)
            {
                channel.Author = (string)(Author.Clone());
            }
            if (Length != null)
            {
                channel.Length = (string)(Length.Clone());
            }
            if (Type != null)
            {
                channel.Type = (string)(Type.Clone());
            }

            return(channel);
        }
        public void The_Original_Should_Be_Modified_Without_Changing_The_Clone()
        {
            var author = new Author()
            {
                Id        = 12,
                FirstName = "Bruce",
                LastName  = "Wayne"
            };
            var clone = author.Clone();

            author.Id        = 13;
            author.FirstName = "Dick";
            author.LastName  = "Grayson";

            Assert.AreEqual(12, clone.Id);
            Assert.AreEqual("Bruce", clone.FirstName);
            Assert.AreEqual("Wayne", clone.LastName);
        }
        public void The_Original_Should_Be_Modified_Without_Changing_The_Clone()
        {
            var author = new Author()
            {
                Id = 12,
                FirstName = "Bruce",
                LastName = "Wayne"
            };
            var clone = new Author();
            author.Clone(clone);

            author.Id = 13;
            author.FirstName = "Dick";
            author.LastName = "Grayson";

            Assert.AreEqual(12, clone.Id);
            Assert.AreEqual("Bruce", clone.FirstName);
            Assert.AreEqual("Wayne", clone.LastName);
        }
예제 #11
0
        public ActionResult Feed()
        {
            IList <PostEntry> entries = DbSession.QueryOver <PostEntry>()
                                        .OrderBy(p => p.PostDate).Desc
                                        .Take(PageSize)
                                        .List();

            SyndicationFeed feed = new SyndicationFeed(
                "宅居",
                "宅并技术着",
                new Uri("http://otakustay.com/"),
                "otakustay-feed",
                new DateTimeOffset(entries[0].PostDate),
                entries.Select(TransformPost)
                );

            feed.Authors.Add(Author.Clone());

            return(new Rss20ActionResult(feed));
        }