Develop and Download Open Source Software

Browse Subversion Repository

Contents of /SendersWiki.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (show annotations) (download)
Wed Feb 23 12:21:31 2011 UTC (13 years, 2 months ago) by aqua877
File size: 1056 byte(s)
バージョン情報ウィンドウへのロゴ追加
設定ウィンドウのイベントおよび初期化の実装すべて完了
コメント取得時のソーティングによるパフォーマンス低下を改善
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Net;
6 using System.Text.RegularExpressions;
7
8 namespace Aqua877.WinApp.IronLivetube
9 {
10 public class SendersWiki
11 {
12 public Dictionary<string, Uri> SendersWikiList = new Dictionary<string, Uri>();
13
14 public SendersWiki()
15 {
16 var connector = new WebClient { Encoding = Encoding.UTF8 };
17 connector.DownloadStringCompleted += this.OnFinishedGetSendersWiki;
18 connector.DownloadStringAsync(new Uri("http://www30.atwiki.jp/livetube/pages/11.html"));
19 }
20
21 private void OnFinishedGetSendersWiki(object sender, DownloadStringCompletedEventArgs e)
22 {
23 if (e.Error == null)
24 {
25 var pattern = new Regex("<a href=\"(.*?)\" title=\"(.*?) \\((?:.*?)\\)\">(?:.*?)</a>");
26 this.SendersWikiList = pattern.Matches(e.Result).Cast<Match>()
27 .Select(m => new { url = m.Groups[1].Value, sender = m.Groups[2].Value })
28 .Distinct(xs => xs.sender)
29 .ToDictionary(i => i.sender, i => new Uri(i.url));
30 }
31 }
32 }
33 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26