Exemplo n.º 1
0
 private void fetchText(BMYClient client)
 {
     if (artText != null) {
         return;
     }
     var url = string.Format ("{0}{1}{2}", BMYClient.firstURL, client.bbsToken, artToken);
     var page = client.Client.GetSrc (url, "GBK");
     var match = Regex.Match (page, @"(发信人:.+)本文链接", RegexOptions.Multiline);
     if (match.Success) {
         var text = match.Groups [1].Value;
         text = text.Replace ("<br>", "\n");
         text = Regex.Replace (text, @"<[^>]+>", "");
         artText = text;
     }
 }
Exemplo n.º 2
0
        public bool reply(BMYClient client, string text, string title = null, string qmd = "---\nFrom Mono C# Client")
        {
            if (title == null) {
                if (artTitle.Substring (0, 3) != "Re:") {
                    title = "Re: " + artTitle;
                } else {
                    title = artTitle;
                }
            }
            var url = string.Format ("{0}{1}bbssnd?board={2}&th={3}&ref={4}",
                                     BMYClient.firstURL,
                                     client.bbsToken,
                                     artTopic.boardID,
                                     artTopic.topicID,
                                     artRef);
            Console.WriteLine (url);
            var data = string.Format ("title={0}&text={1}", title, text + "\n" + qmd);
            var rsp = client.Client.PostData (url, data, "GBK", "GBK");
            Console.WriteLine ("Response:");
            Console.WriteLine (rsp);

            return true;
        }
Exemplo n.º 3
0
 private string getBoardPage(BMYClient client)
 {
     var url = string.Format ("{0}{1}tdoc?B={2}", BMYClient.firstURL, client.bbsToken, boardHandle.boardID);
     var page = client.Client.GetSrc (url);
     return page;
 }
Exemplo n.º 4
0
 private void fetchList(BMYClient client)
 {
     var page = getBoardPage (client);
     Console.WriteLine (page);
     var matchs = Regex.Matches (page, "<a href=[^>]*&th=([^>\"]+)>([^<]+)</a>", RegexOptions.Multiline);
     foreach (Match m in matchs) {
         topicList.Add (new Topic (boardHandle, m.Groups [1].Value, m.Groups [2].Value));
     }
 }
Exemplo n.º 5
0
        public void Refresh(BMYClient client)
        {
            if (topicList.Count != 0) {
                topicList.Clear ();
            }

            fetchList (client);
        }
Exemplo n.º 6
0
 private void fetchArticles(BMYClient client)
 {
     var url = string.Format ("{0}{1}tfind?B={2}&th={3}", BMYClient.firstURL, client.bbsToken, boardID, topicID);
     var page = client.Client.GetSrc (url);
     Console.WriteLine (page);
     var matchs = Regex.Matches (page, @"<a href=(con\?B=[^>]+)>([^<]+)</a>", RegexOptions.Multiline);
     foreach (Match m in matchs) {
         articleList.Add (new Article (this, m.Groups [1].Value, m.Groups [2].Value));
     }
 }
Exemplo n.º 7
0
        public void Refresh(BMYClient client)
        {
            if (articleList.Count != 0) {
                articleList.Clear ();

            }
            fetchArticles (client);
        }
Exemplo n.º 8
0
 public bool post(BMYClient client, string title, string text, string qmd = "---\nFrom Mono C#\n")
 {
     var url = string.Format ("{0}{1}bbssnd?board={2}&th=-1", BMYClient.firstURL, client.bbsToken, boardID);
     var data = string.Format ("title={0}&text=\n{1}", title, text + "\n" + qmd);
     var rsp = client.Client.PostData (url, data, "GBK", "GBK");
     Console.WriteLine (rsp);
     return true;
 }