Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="result"></param>
        public ICollection <PrivateMessageFolderMetadata> FetchFolders()
        {
            // pull inbox html from server
            string url = string.Format("{0}/{1}?folderid={2}", CoreConstants.BASE_URL, CoreConstants.PRIVATE_MESSAGE_URI, INBOX_MESSAGE_FOLDERID);
            var    web = new AwfulWebClient();
            var    doc = web.FetchHtml(url).ToHtmlDocument();

            List <PrivateMessageFolderMetadata> folders = null;

            if (doc != null)
            {
                folders = new List <PrivateMessageFolderMetadata>();
                folders.AddRange(PrivateMessageParser.ParseFolderList(doc));
                if (folders.Count > 0)
                {
                    // let's cheat a little bit by parsing the inbox as well...
                    var messages = PrivateMessageParser.ParseMessageList(doc);
                    foreach (var message in messages)
                    {
                        folders[0].Messages.Add(message);
                    }
                }
            }

            return(folders);
        }
Esempio n. 2
0
        private IPrivateMessageRequest GetMessageRequest(string url)
        {
            var web = new AwfulWebClient();
            var doc = web.FetchHtml(url).ToHtmlDocument();

            PrivateMessageRequest request = PrivateMessageParser.ParseNewPrivateMessageFormDocument(doc);

            return(request);
        }
Esempio n. 3
0
        /// <summary>
        /// TODO : Add summary here.
        /// </summary>
        /// <param name="result"></param>
        public PrivateMessageFolderEditor BeginEditFolderRequest()
        {
            var web = new AwfulWebClient();
            var url = string.Format("{0}/{1}?action=editfolders", CoreConstants.BASE_URL, CoreConstants.PRIVATE_MESSAGE_URI);
            var doc = web.FetchHtml(url).ToHtmlDocument();
            PrivateMessageFolderEditor editor = null;

            if (doc != null)
            {
                editor = PrivateMessageParser.ParseEditFolderPage(doc);
            }

            return(editor);
        }
Esempio n. 4
0
        /// <summary>
        /// TODO: Add summary here.
        /// </summary>
        /// <param name="folderID"></param>
        /// <param name="result"></param>
        public PrivateMessageFolderMetadata FetchFolder(int folderID)
        {
            string url = string.Format("{0}/{1}?folderid={2}", CoreConstants.BASE_URL, CoreConstants.PRIVATE_MESSAGE_URI, folderID);
            var    web = new AwfulWebClient();
            var    doc = web.FetchHtml(url).ToHtmlDocument();
            PrivateMessageFolderMetadata folder = null;

            if (doc != null)
            {
                folder = PrivateMessageParser.ParsePrivateMessageFolder(doc);
            }

            return(folder);
        }
Esempio n. 5
0
        public PrivateMessageMetadata FetchMessage(int privateMessageId)
        {
            PrivateMessageMetadata message = null;
            var web = new AwfulWebClient();
            var url = string.Format("{0}/{1}?action=show&privatemessageid={2}", CoreConstants.BASE_URL,
                                    CoreConstants.PRIVATE_MESSAGE_URI,
                                    privateMessageId);

            var doc = web.FetchHtml(url).ToHtmlDocument();

            if (doc != null)
            {
                message = PrivateMessageParser.ParsePrivateMessageDocument(doc);
            }

            return(message);
        }