/// <summary>
        /// Called when we should show the content
        /// </summary>
        /// <param name="post"></param>
        public void OnPrepareContent(Post post)
        {
            string headerText = "";
            string minorText = "";

            if (post.IsSelf)
            {
                headerText = "There's no content here!";
                minorText = "Scroll down to view the discussion.";
            }
            else
            {
                m_content = MiscellaneousHelper.TryToFindRedditContentInLink(post.Url);

                switch(m_content.Type)
                {
                    case RedditContentType.Subreddit:
                        headerText = "This post links to a subreddit";
                        minorText = $"Tap anywhere to view /r/{m_content.Subreddit}";
                        break;
                    case RedditContentType.Comment:
                        headerText = "This post links to a comment thread";
                        minorText = "Tap anywhere to view it";
                        break;
                    case RedditContentType.Post:
                        headerText = "This post links to a reddit post";
                        minorText = $"Tap anywhere to view it";
                        break;
                }
            }

            ui_headerText.Text = headerText;
            ui_minorText.Text = minorText;
        }
        /// <summary>
        /// Called when we should show the content
        /// </summary>
        /// <param name="post"></param>
        public void OnPrepareContent(Post post)
        {
            string headerText = "";
            string minorText = "";

            if (post.IsSelf)
            {
                headerText = "There's no content here!";
                minorText = "Scroll down to view the discussion.";
            }
            else
            {
                m_content = MiscellaneousHelper.TryToFindRedditContentInLink(post.Url);

                switch(m_content.Type)
                {
                    case RedditContentType.Subreddit:
                        headerText = "This post links to a subreddit";
                        minorText = $"Tap anywhere to view /r/{m_content.Subreddit}";
                        break;
                    case RedditContentType.Comment:
                        headerText = "This post links to a comment thread";
                        minorText = "Tap anywhere to view it";
                        break;
                    case RedditContentType.Post:
                        headerText = "This post links to a reddit post";
                        minorText = $"Tap anywhere to view it";
                        break;
                    case RedditContentType.Website:
                        // This shouldn't happen
                        App.BaconMan.MessageMan.DebugDia("Got website back when prepare on reddit content control");
                        App.BaconMan.TelemetryMan.ReportUnExpectedEvent(this, "GotWebsiteOnPrepareRedditContent");
                        break;
                }
            }

            ui_headerText.Text = headerText;
            ui_minorText.Text = minorText;
        }
 /// <summary>
 /// Called when we should destroy the content
 /// </summary>
 public void OnDestroyContent()
 {
     m_content = null;
 }
        /// <summary>
        /// Attempts to find some reddit content in a link. A subreddit, post or comments.
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static RedditContentContainer TryToFindRedditContentInLink(string url)
        {
            string urlLower = url.ToLower();
            RedditContentContainer containter = null;

            // Try to find /r/ or r/ links
            if (urlLower.StartsWith("/r/") || urlLower.StartsWith("r/"))
            {
                // Get the display name
                int subStart = urlLower.IndexOf("r/");
                subStart += 2;

                // Try to find the next / after the subreddit if it exists
                int subEnd = urlLower.IndexOf("/", subStart);
                if (subEnd == -1)
                {
                    subEnd = urlLower.Length;
                }

                // Get the name.
                string displayName = urlLower.Substring(subStart, subEnd - subStart).Trim();

                // Make sure we don't have trailing arguments other than a /, if we do we should handle this as we content.
                string trimedLowerUrl = urlLower.TrimEnd();
                if (trimedLowerUrl.Length - subEnd > 1)
                {
                    // Make a web link for this
                    containter = new RedditContentContainer()
                    {
                        Type    = RedditContentType.Website,
                        Website = $"https://reddit.com/{url}"
                    };
                }
                else
                {
                    // We are good, make the subreddit link for this.
                    containter = new RedditContentContainer()
                    {
                        Type      = RedditContentType.Subreddit,
                        Subreddit = displayName
                    };
                }
            }
            // Try to find any other reddit link
            else if (urlLower.Contains("reddit.com/"))
            {
                // Try to find the start of the subreddit
                int startSub = urlLower.IndexOf("r/");
                if (startSub != -1)
                {
                    startSub += 2;

                    // Try to find the end of the subreddit.
                    int endSub = FindNextUrlBreak(urlLower, startSub);

                    if (endSub > startSub)
                    {
                        // We found a subreddit!
                        containter           = new RedditContentContainer();
                        containter.Subreddit = urlLower.Substring(startSub, endSub - startSub);
                        containter.Type      = RedditContentType.Subreddit;

                        // Special case! If the text after the subreddit is submit or wiki don't do anything special
                        // If we return null we will just open the website.
                        if (urlLower.IndexOf("/submit") == endSub || urlLower.IndexOf("/wiki") == endSub || urlLower.IndexOf("/w/") == endSub)
                        {
                            containter = null;
                            urlLower   = "";
                        }

                        // See if we have a post
                        int postStart = urlLower.IndexOf("comments/");
                        if (postStart != -1)
                        {
                            postStart += 9;

                            // Try to find the end
                            int postEnd = FindNextUrlBreak(urlLower, postStart);

                            if (postEnd > postStart)
                            {
                                // We found a post! Build on top of the subreddit
                                containter.Post = urlLower.Substring(postStart, postEnd - postStart);
                                containter.Type = RedditContentType.Post;

                                // Try to find a comment, for there to be a comment this should have a / after it.
                                if (urlLower.Length > postEnd && urlLower[postEnd] == '/')
                                {
                                    postEnd++;
                                    // Now try to find the / after the post title
                                    int commentStart = urlLower.IndexOf('/', postEnd);
                                    if (commentStart != -1)
                                    {
                                        commentStart++;

                                        // Try to find the end of the comment
                                        int commentEnd = FindNextUrlBreak(urlLower, commentStart);

                                        if (commentEnd > commentStart)
                                        {
                                            // We found a comment!
                                            containter.Comment = urlLower.Substring(commentStart, commentEnd - commentStart);
                                            containter.Type    = RedditContentType.Comment;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(containter);
        }
Esempio n. 5
0
        /// <summary>
        /// Shows any link globally. This will intelligently handle the link, it handle anything flip view can
        /// as well as subreddits.
        /// </summary>
        /// <param name="link"></param>
        /// <returns></returns>
        public bool ShowGlobalContent(RedditContentContainer container)
        {
            if (m_backendActionListener == null)
            {
                return false;
            }

            m_backendActionListener.ShowGlobalContent(container);
            return true;
        }
        /// <summary>
        /// Attempts to find some reddit content in a link. A subreddit, post or comments.
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static RedditContentContainer TryToFindRedditContentInLink(string url)
        {
            string urlLower = url.ToLower();
            RedditContentContainer containter = null;

            // Try to find /r/ or r/ links
            if (urlLower.StartsWith("/r/") || urlLower.StartsWith("r/"))
            {
                // Get the display name
                int subStart = urlLower.IndexOf("r/");
                subStart += 2;

                // Try to find the next / after the subreddit if it exists
                int subEnd = urlLower.IndexOf("/", subStart);
                if(subEnd == -1)
                {
                    subEnd = urlLower.Length;
                }

                // Get the name.
                string displayName = urlLower.Substring(subStart, subEnd - subStart).Trim();

                // Make sure we don't have trailing arguments other than a /, if we do we should handle this as we content.
                string trimedLowerUrl = urlLower.TrimEnd();
                if (trimedLowerUrl.Length - subEnd > 1)
                {
                    // Make a web link for this
                    containter = new RedditContentContainer()
                    {
                        Type = RedditContentType.Website,
                        Website = $"https://reddit.com/{url}"
                    };
                }
                else
                {
                    // We are good, make the subreddit link for this.
                    containter = new RedditContentContainer()
                    {
                        Type = RedditContentType.Subreddit,
                        Subreddit = displayName
                    };
                }
            }
            // Try to find any other reddit link
            else if(urlLower.Contains("reddit.com/"))
            {
                // Try to find the start of the subreddit
                int startSub = urlLower.IndexOf("r/");
                if(startSub != -1)
                {
                    startSub += 2;

                    // Try to find the end of the subreddit.
                    int endSub = FindNextUrlBreak(urlLower, startSub);

                    if (endSub > startSub)
                    {
                        // We found a subreddit!
                        containter = new RedditContentContainer();
                        containter.Subreddit = urlLower.Substring(startSub, endSub - startSub);
                        containter.Type = RedditContentType.Subreddit;

                        // Special case! If the text after the subreddit is submit or wiki don't do anything special
                        // If we return null we will just open the website.
                        if(urlLower.IndexOf("/submit") == endSub || urlLower.IndexOf("/wiki") == endSub || urlLower.IndexOf("/w/") == endSub)
                        {
                            containter = null;
                            urlLower = "";
                        }

                        // See if we have a post
                        int postStart = urlLower.IndexOf("comments/");
                        if(postStart != -1)
                        {
                            postStart += 9;

                            // Try to find the end
                            int postEnd = FindNextUrlBreak(urlLower, postStart);

                            if(postEnd > postStart)
                            {
                                // We found a post! Build on top of the subreddit
                                containter.Post = urlLower.Substring(postStart, postEnd - postStart);
                                containter.Type = RedditContentType.Post;

                                // Try to find a comment, for there to be a comment this should have a / after it.
                                if(urlLower.Length > postEnd && urlLower[postEnd] == '/')
                                {
                                    postEnd++;
                                    // Now try to find the / after the post title
                                    int commentStart = urlLower.IndexOf('/', postEnd);
                                    if(commentStart != -1)
                                    {
                                        commentStart++;

                                        // Try to find the end of the comment
                                        int commentEnd = FindNextUrlBreak(urlLower, commentStart);

                                        if(commentEnd > commentStart )
                                        {
                                            // We found a comment!
                                            containter.Comment = urlLower.Substring(commentStart, commentEnd - commentStart);
                                            containter.Type = RedditContentType.Comment;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return containter;
        }
Esempio n. 7
0
 /// <summary>
 /// Fired when someone wants to show the global content presenter
 /// </summary>
 /// <param name="link">What to show</param>
 public void ShowGlobalContent(RedditContentContainer container)
 {
     // We got reddit content, navigate to it!
     switch (container.Type)
     {
         case RedditContentType.Subreddit:
             Dictionary<string, object> args = new Dictionary<string, object>();
             args.Add(PanelManager.NAV_ARGS_SUBREDDIT_NAME, container.Subreddit);
             m_panelManager.Navigate(typeof(SubredditPanel), container.Subreddit + SortTypes.Hot, args);
             break;
         case RedditContentType.Post:
             Dictionary<string, object> postArgs = new Dictionary<string, object>();
             postArgs.Add(PanelManager.NAV_ARGS_SUBREDDIT_NAME, container.Subreddit);
             postArgs.Add(PanelManager.NAV_ARGS_FORCE_POST_ID, container.Post);
             m_panelManager.Navigate(typeof(FlipViewPanel), container.Subreddit + SortTypes.Hot + container.Post, postArgs);
             break;
         case RedditContentType.Comment:
             Dictionary<string, object> commentArgs = new Dictionary<string, object>();
             commentArgs.Add(PanelManager.NAV_ARGS_SUBREDDIT_NAME, container.Subreddit);
             commentArgs.Add(PanelManager.NAV_ARGS_FORCE_POST_ID, container.Post);
             commentArgs.Add(PanelManager.NAV_ARGS_FORCE_COMMENT_ID, container.Comment);
             m_panelManager.Navigate(typeof(FlipViewPanel), container.Subreddit + SortTypes.Hot + container.Post + container.Comment, commentArgs);
             break;
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Called by the app when the page is reactivated.
 /// </summary>
 /// <param name="arguments"></param>
 public void OnReActivated(string arguments)
 {
     if (arguments != null && arguments.StartsWith(TileManager.c_subredditOpenArgument))
     {
         string subredditDisplayName = arguments.Substring(TileManager.c_subredditOpenArgument.Length);
         RedditContentContainer content = new RedditContentContainer();
         content.Subreddit = subredditDisplayName;
         content.Type = RedditContentType.Subreddit;
         App.BaconMan.ShowGlobalContent(content);
     }
 }
Esempio n. 9
0
        /// <summary>
        /// Attempts to find some reddit content in a link. A subreddit, post or comments.
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static RedditContentContainer TryToFindRedditContentInLink(string url)
        {
            var urlLower = url.ToLower();
            RedditContentContainer container = null;

            var uri = new Uri(urlLower);

            if (uri.Host.Equals("v.redd.it"))
            {
                container = new RedditContentContainer
                {
                    Type    = RedditContentType.Website,
                    Website = urlLower
                };
            }
            // Try to find /r/ or r/ links
            else if (urlLower.StartsWith("/r/") || urlLower.StartsWith("r/"))
            {
                // Get the display name
                var subStart = urlLower.IndexOf("r/", StringComparison.Ordinal);
                subStart += 2;

                // Try to find the next / after the subreddit if it exists
                var subEnd = urlLower.IndexOf("/", subStart, StringComparison.Ordinal);
                if (subEnd == -1)
                {
                    subEnd = urlLower.Length;
                }

                // Get the name.
                var displayName = urlLower.Substring(subStart, subEnd - subStart).Trim();

                // Make sure we don't have trailing arguments other than a /, if we do we should handle this as we content.
                var trimmedLowerUrl = urlLower.TrimEnd();
                if (trimmedLowerUrl.Length - subEnd > 1)
                {
                    // Make a web link for this
                    container = new RedditContentContainer
                    {
                        Type    = RedditContentType.Website,
                        Website = $"https://reddit.com/{url}"
                    };
                }
                else
                {
                    // We are good, make the subreddit link for this.
                    container = new RedditContentContainer
                    {
                        Type      = RedditContentType.Subreddit,
                        Subreddit = displayName
                    };
                }
            }
            // Try to find /u/ or u/ links
            if (urlLower.StartsWith("/u/") || urlLower.StartsWith("u/"))
            {
                // Get the display name
                var userStart = urlLower.IndexOf("u/", StringComparison.Ordinal);
                userStart += 2;

                // Try to find the next / after the subreddit if it exists
                var subEnd = urlLower.IndexOf("/", userStart, StringComparison.Ordinal);
                if (subEnd == -1)
                {
                    subEnd = urlLower.Length;
                }

                // Get the name.
                var displayName = urlLower.Substring(userStart, subEnd - userStart).Trim();

                // Make sure we don't have trailing arguments other than a /, if we do we should handle this as we content.
                var trimmedLowerUrl = urlLower.TrimEnd();
                if (trimmedLowerUrl.Length - subEnd > 1)
                {
                    // Make a web link for this
                    container = new RedditContentContainer
                    {
                        Type    = RedditContentType.Website,
                        Website = $"https://reddit.com/{url}"
                    };
                }
                else
                {
                    // We are good, make the user link.
                    container = new RedditContentContainer
                    {
                        Type = RedditContentType.User,
                        User = displayName
                    };
                }
            }
            // Try to find any other reddit link
            else if (urlLower.Contains("reddit.com/"))
            {
                // Try to find the start of the subreddit
                var startSub = urlLower.IndexOf("r/", StringComparison.Ordinal);
                if (startSub == -1)
                {
                    return(container);
                }
                startSub += 2;

                // Try to find the end of the subreddit.
                var endSub = FindNextUrlBreak(urlLower, startSub);

                if (endSub <= startSub)
                {
                    return(container);
                }
                // We found a subreddit!
                container = new RedditContentContainer
                {
                    Subreddit = urlLower.Substring(startSub, endSub - startSub), Type = RedditContentType.Subreddit
                };

                // Special case! If the text after the subreddit is submit or wiki don't do anything special
                // If we return null we will just open the website.
                if (urlLower.IndexOf("/submit", StringComparison.Ordinal) == endSub || urlLower.IndexOf("/wiki", StringComparison.Ordinal) == endSub || urlLower.IndexOf("/w/") == endSub)
                {
                    container = null;
                    urlLower  = "";
                }

                // See if we have a post
                var postStart = urlLower.IndexOf("comments/", StringComparison.Ordinal);
                if (postStart == -1)
                {
                    return(container);
                }
                postStart += 9;

                // Try to find the end
                var postEnd = FindNextUrlBreak(urlLower, postStart);

                if (postEnd <= postStart)
                {
                    return(container);
                }

                // We found a post! Build on top of the subreddit
                container.Post = urlLower.Substring(postStart, postEnd - postStart);
                container.Type = RedditContentType.Post;

                // Try to find a comment, for there to be a comment this should have a / after it.
                if (urlLower.Length <= postEnd || urlLower[postEnd] != '/')
                {
                    return(container);
                }
                postEnd++;
                // Now try to find the / after the post title
                var commentStart = urlLower.IndexOf('/', postEnd);
                if (commentStart == -1)
                {
                    return(container);
                }
                commentStart++;

                // Try to find the end of the comment
                var commentEnd = FindNextUrlBreak(urlLower, commentStart);

                if (commentEnd <= commentStart)
                {
                    return(container);
                }
                // We found a comment!
                container.Comment = urlLower.Substring(commentStart, commentEnd - commentStart);
                container.Type    = RedditContentType.Comment;
            }

            return(container);
        }
        /// <summary>
        /// Fired when we should load the content.
        /// </summary>
        /// <param name="source"></param>
        public async void OnPrepareContent()
        {
            // Defer so we give the UI time to work.
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
            {
                string headerText = "";
                string minorText = "";

                if (m_base.Source.IsSelf)
                {
                    headerText = "There's no content here!";
                    minorText = "Scroll down to view the discussion.";
                }
                else
                {
                    m_content = MiscellaneousHelper.TryToFindRedditContentInLink(m_base.Source.Url);

                    switch (m_content.Type)
                    {
                        case RedditContentType.Subreddit:
                            headerText = "This post links to a subreddit";
                            minorText = $"Tap anywhere to view /r/{m_content.Subreddit}";
                            break;
                        case RedditContentType.Comment:
                            headerText = "This post links to a comment thread";
                            minorText = "Tap anywhere to view it";
                            break;
                        case RedditContentType.Post:
                            headerText = "This post links to a reddit post";
                            minorText = $"Tap anywhere to view it";
                            break;
                        case RedditContentType.User:
                            headerText = "This post links to a reddit user page";
                            minorText = $"Tap anywhere to view {m_content.User}";
                            break;
                        case RedditContentType.Website:
                            // This shouldn't happen
                            App.BaconMan.MessageMan.DebugDia("Got website back when prepare on reddit content control");
                            App.BaconMan.TelemetryMan.ReportUnExpectedEvent(this, "GotWebsiteOnPrepareRedditContent");
                            break;
                    }
                }

                ui_headerText.Text = headerText;
                ui_minorText.Text = minorText;

                // Hide loading
                m_base.FireOnLoading(false);
            });
        }
Esempio n. 11
0
 /// <summary>
 /// Called by the app when the page is reactivated.
 /// </summary>
 /// <param name="arguments"></param>
 public void OnReActivated(string arguments)
 {
     if (arguments != null && arguments.StartsWith(TileManager.c_subredditOpenArgument))
     {
         string subredditDisplayName = arguments.Substring(TileManager.c_subredditOpenArgument.Length);
         RedditContentContainer content = new RedditContentContainer();
         content.Subreddit = subredditDisplayName;
         content.Type = RedditContentType.Subreddit;
         App.BaconMan.ShowGlobalContent(content);
     }
     else if(arguments != null && arguments.StartsWith(BackgroundMessageUpdater.c_messageInboxOpenArgument))
     {
         m_panelManager.Navigate(typeof(MessageInbox), "MessageInbox");
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Attempts to find some reddit content in a link. A subreddit, post or comments.
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static RedditContentContainer TryToFindRedditContentInLink(string url)
        {
            string urlLower = url.ToLower();
            RedditContentContainer containter = null;

            // Try to find /r/ or r/ links
            if (urlLower.StartsWith("/r/") || urlLower.StartsWith("r/"))
            {
                // Get the display name
                int subStart = urlLower.IndexOf("r/");
                subStart += 2;

                // Make sure we don't have a trailing slash.
                int subEnd = urlLower.Length;
                if (urlLower.Length > 0 && urlLower[urlLower.Length - 1] == '/')
                {
                    subEnd--;
                }

                // Get the name.
                string displayName = urlLower.Substring(subStart, subEnd - subStart).Trim();
                containter = new RedditContentContainer()
                {
                    Type      = RedditContentType.Subreddit,
                    Subreddit = displayName
                };
            }
            // Try to find any other reddit link
            else if (urlLower.Contains("reddit.com/"))
            {
                // Try to find the start of the subreddit
                int startSub = urlLower.IndexOf("r/");
                if (startSub != -1)
                {
                    startSub += 2;

                    // Try to find the end of the subreddit.
                    int endSub = FindNextUrlBreak(urlLower, startSub);

                    if (endSub > startSub)
                    {
                        // We found a subreddit!
                        containter           = new RedditContentContainer();
                        containter.Subreddit = urlLower.Substring(startSub, endSub - startSub);
                        containter.Type      = RedditContentType.Subreddit;

                        // See if we have a post
                        int postStart = url.IndexOf("comments/");
                        if (postStart != -1)
                        {
                            postStart += 9;

                            // Try to find the end
                            int postEnd = FindNextUrlBreak(urlLower, postStart);

                            if (postEnd > postStart)
                            {
                                // We found a post! Build on top of the subreddit
                                containter.Post = urlLower.Substring(postStart, postEnd - postStart);
                                containter.Type = RedditContentType.Post;

                                // Try to find a comment, for there to be a comment this should have a / after it.
                                if (urlLower.Length > postEnd && urlLower[postEnd] == '/')
                                {
                                    postEnd++;
                                    // Now try to find the / after the post title
                                    int commentStart = urlLower.IndexOf('/', postEnd);
                                    if (commentStart != -1)
                                    {
                                        commentStart++;

                                        // Try to find the end of the comment
                                        int commentEnd = FindNextUrlBreak(urlLower, commentStart);

                                        if (commentEnd > commentStart)
                                        {
                                            // We found a comment!
                                            containter.Comment = urlLower.Substring(commentStart, commentEnd - commentStart);
                                            containter.Type    = RedditContentType.Comment;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(containter);
        }
Esempio n. 13
0
        /// <summary>
        /// Attempts to find some reddit content in a link. A subreddit, post or comments.
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static RedditContentContainer TryToFindRedditContentInLink(string url)
        {
            string urlLower = url.ToLower();
            RedditContentContainer containter = null;

            // Try to find /r/ or r/ links
            if (urlLower.StartsWith("/r/") || urlLower.StartsWith("r/"))
            {
                // Get the display name
                int subStart = urlLower.IndexOf("r/");
                subStart += 2;

                // Make sure we don't have a trailing slash.
                int subEnd = urlLower.Length;
                if (urlLower.Length > 0 && urlLower[urlLower.Length - 1] == '/')
                {
                    subEnd--;
                }

                // Get the name.
                string displayName = urlLower.Substring(subStart, subEnd - subStart).Trim();
                containter = new RedditContentContainer()
                {
                    Type = RedditContentType.Subreddit,
                    Subreddit = displayName
                };
            }
            // Try to find any other reddit link
            else if(urlLower.Contains("reddit.com/"))
            {
                // Try to find the start of the subreddit
                int startSub = urlLower.IndexOf("r/");
                if(startSub != -1)
                {
                    startSub += 2;

                    // Try to find the end of the subreddit.
                    int endSub = FindNextUrlBreak(urlLower, startSub);

                    if (endSub > startSub)
                    {
                        // We found a subreddit!
                        containter = new RedditContentContainer();
                        containter.Subreddit = urlLower.Substring(startSub, endSub - startSub);
                        containter.Type = RedditContentType.Subreddit;

                        // See if we have a post
                        int postStart = url.IndexOf("comments/");
                        if(postStart != -1)
                        {
                            postStart += 9;

                            // Try to find the end
                            int postEnd = FindNextUrlBreak(urlLower, postStart);

                            if(postEnd > postStart)
                            {
                                // We found a post! Build on top of the subreddit
                                containter.Post = urlLower.Substring(postStart, postEnd - postStart);
                                containter.Type = RedditContentType.Post;

                                // Try to find a comment, for there to be a comment this should have a / after it.
                                if(urlLower.Length > postEnd && urlLower[postEnd] == '/')
                                {
                                    postEnd++;
                                    // Now try to find the / after the post title
                                    int commentStart = urlLower.IndexOf('/', postEnd);
                                    if(commentStart != -1)
                                    {
                                        commentStart++;

                                        // Try to find the end of the comment
                                        int commentEnd = FindNextUrlBreak(urlLower, commentStart);

                                        if(commentEnd > commentStart )
                                        {
                                            // We found a comment!
                                            containter.Comment = urlLower.Substring(commentStart, commentEnd - commentStart);
                                            containter.Type = RedditContentType.Comment;
                                        }
                                    }
                                }                               
                            }
                        }
                    }
                }
            }

            return containter;
        }