OSDN Git Service

短縮URL展開に関する余分な処理を除去, メソッド名を変更
authorKimura Youichi <kim.upsilon@bucyou.net>
Mon, 28 Apr 2014 16:54:31 +0000 (01:54 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Tue, 29 Apr 2014 23:30:18 +0000 (08:30 +0900)
OpenTween/ShowUserInfo.cs

index 9748346..6c6a9c9 100644 (file)
@@ -166,18 +166,15 @@ namespace OpenTween
             }
         }
 
-        private async Task SetLinklabelWebAsync(string data)
+        private async Task SetLinkLabelWebAsync(string uri)
         {
-            if (data != null)
+            if (uri != null)
             {
-                string webtext;
-                string jumpto;
-                webtext = this.Twitter.PreProcessUrl("<a href=\"" + data + "\">Dummy</a>");
-                webtext = await ShortUrl.Instance.ExpandUrlHtmlAsync(webtext);
-                jumpto = Regex.Match(webtext, @"<a href=""(?<url>.*?)""").Groups["url"].Value;
-                ToolTip1.SetToolTip(LinkLabelWeb, jumpto);
-                LinkLabelWeb.Tag = jumpto;
-                LinkLabelWeb.Text = data;
+                var expandedUrl = await ShortUrl.Instance.ExpandUrlStrAsync(uri);
+
+                this.LinkLabelWeb.Text = uri;
+                this.LinkLabelWeb.Tag = expandedUrl;
+                this.ToolTip1.SetToolTip(this.LinkLabelWeb, expandedUrl);
             }
             else
             {
@@ -309,7 +306,7 @@ namespace OpenTween
             {
                 this.SetDescriptionAsync(_info.Description),
                 this.SetRecentStatusAsync(userInfo.Status),
-                this.SetLinklabelWebAsync(_info.Url),
+                this.SetLinkLabelWebAsync(_info.Url),
                 this.SetUserImageAsync(_info.ImageUrl.OriginalString),
                 this.LoadFriendshipAsync(_info.ScreenName),
             });
@@ -681,7 +678,7 @@ namespace OpenTween
 
                 await Task.WhenAll(new[]
                 {
-                    this.SetLinklabelWebAsync(this.TextBoxWeb.Text),
+                    this.SetLinkLabelWebAsync(this.TextBoxWeb.Text),
                     this.SetDescriptionAsync(this.TextBoxDescription.Text),
                 });
             }