Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="subredditStyle">Subreddit style.</param>
 /// <param name="cssLink">Css link.</param>
 /// <param name="name">Name of the image.</param>
 public SubredditImage(SubredditStyle subredditStyle,
                       string cssLink, string name) : base(subredditStyle?.WebAgent)
 {
     SubredditStyle = subredditStyle;
     Name           = name;
     CssLink        = cssLink;
 }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="subreddit">Subreddit style.</param>
        /// <param name="cssLink">Css link.</param>
        /// <param name="name">Name of the image.</param>
        /// <param name="url">Url of the image.</param>
        public SubredditImage(SubredditStyle subreddit,
                              string cssLink, string name, string url)
            : this(subreddit, cssLink, name)
        {
            int discarded;

            if (int.TryParse(url, out discarded))
            {
                Url = new Uri(string.Format("http://thumbs.reddit.com/{0}_{1}.png", subreddit.Subreddit.FullName, url), UriKind.Absolute);
            }
            else
            {
                Url = new Uri(url);
            }
            // Handle legacy image urls
            // http://thumbs.reddit.com/FULLNAME_NUMBER.png
        }