コード例 #1
0
 protected internal virtual Tuple<string, Userpic> CreateUserpicTuple(EntryBase e)
 {
     if(e.PosterUserpic != null && !String.IsNullOrWhiteSpace(e.PosterUserpic.Url))
         return Tuple.Create(e.Poster.Username, e.PosterUserpic);
     else
         return null;
 }
コード例 #2
0
        public bool UpdateWith(EntryBase target, EntryBase source)
        {
            if(source == null || target == null)
                throw new ArgumentNullException();

            if(target.Id != 0 && target.Id != source.Id)
                throw new ArgumentException("Ids should match.");

            bool updated = false;

            updated |= UpdateStringProperty(source.Text, target.Text, s => target.Text = s);
            updated |= UpdateStringProperty(source.Subject, target.Subject, s => target.Subject = s);
            updated |= UpdateStringProperty(source.Url, target.Url, s => target.Url = s);

            if(String.IsNullOrEmpty(target.Poster.Username) && source.Poster != null && !String.IsNullOrEmpty(source.Poster.Username))
            {
                target.Poster = source.Poster;
                updated = true;
            }

            if(!target.PosterUserpicSpecified && source.PosterUserpicSpecified)
            {
                target.PosterUserpic = source.PosterUserpic;
                updated = true;
            }

            if(target.Date == null && source.Date != null)
            {
                target.Date = source.Date;
                updated = true;
            }

            return updated;
        }
コード例 #3
0
        protected internal virtual IEnumerable<string> EnumerateFiles(EntryBase e)
        {
            if (e.Text == null)
                yield break;

            string[] urls;

            urls = _fileExtractor.GetImagesURLs(e.Text);
            foreach(string url in urls)
                yield return url;
        }