From bedea21200fce432461efde256100220aec92d50 Mon Sep 17 00:00:00 2001 From: kiri_feather Date: Fri, 7 May 2010 12:10:05 +0000 Subject: [PATCH] =?utf8?q?Twitter=E4=BB=A5=E5=A4=96=E3=81=A8=E3=81=AE?= =?utf8?q?=E9=80=9A=E4=BF=A1=E3=81=A7=E3=80=81CreateRequest=E6=99=82?= =?utf8?q?=E3=81=AEURL=E8=A7=A3=E6=B1=BA=E5=A4=B1=E6=95=97=E3=81=AE?= =?utf8?q?=E4=BE=8B=E5=A4=96=E3=81=8C=E3=82=AD=E3=83=A3=E3=83=83=E3=83=81?= =?utf8?q?=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3?= =?utf8?q?=E3=81=9F=E3=83=90=E3=82=B0=E4=BF=AE=E6=AD=A3=EF=BC=88MakeShortU?= =?utf8?q?rl=E3=81=AE=E4=BE=8B=E5=A4=96=E5=A0=B1=E5=91=8A=E5=AF=BE?= =?utf8?q?=E5=BF=9C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@265 e39ad16e-3079-482e-bb30-4b4d378143b6 --- Tween/Connection/HttpVarious.vb | 57 ++- Tween/Tween.resx | 1020 +++++++++++++++++++-------------------- Tween/Twitter.vb | 2 +- 3 files changed, 518 insertions(+), 561 deletions(-) diff --git a/Tween/Connection/HttpVarious.vb b/Tween/Connection/HttpVarious.vb index 51a8dd88..1365b30c 100644 --- a/Tween/Connection/HttpVarious.vb +++ b/Tween/Connection/HttpVarious.vb @@ -8,10 +8,10 @@ Public Class HttpVarious Private Const GetMethod As String = "GET" Public Function GetRedirectTo(ByVal url As String) As String - Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(url), Nothing, False) - req.Timeout = 5000 - req.AllowAutoRedirect = False Try + Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(url), Nothing, False) + req.Timeout = 5000 + req.AllowAutoRedirect = False Dim data As String = "" Dim head As New Dictionary(Of String, String) Dim ret As HttpStatusCode = GetResponse(req, data, head, False) @@ -26,9 +26,9 @@ Public Class HttpVarious End Function Public Overloads Function GetImage(ByVal url As String) As Image - Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(url), Nothing, False) - req.Timeout = 5000 Try + Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(url), Nothing, False) + req.Timeout = 5000 Dim img As Bitmap = Nothing Dim ret As HttpStatusCode = GetResponse(req, img, Nothing, False) If ret = HttpStatusCode.OK Then Return img @@ -39,10 +39,10 @@ Public Class HttpVarious End Function Public Overloads Function GetImage(ByVal url As String, ByVal referer As String) As Image - Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(url), Nothing, False) - req.Referer = referer - req.Timeout = 5000 Try + Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(url), Nothing, False) + req.Referer = referer + req.Timeout = 5000 Dim img As Bitmap = Nothing Dim ret As HttpStatusCode = GetResponse(req, img, Nothing, False) If ret = HttpStatusCode.OK Then Return img @@ -53,8 +53,8 @@ Public Class HttpVarious End Function Public Function PostData(ByVal Url As String, ByVal param As Dictionary(Of String, String)) As Boolean - Dim req As HttpWebRequest = CreateRequest(PostMethod, New Uri(Url), param, False) Try + Dim req As HttpWebRequest = CreateRequest(PostMethod, New Uri(Url), param, False) Dim res As HttpStatusCode = Me.GetResponse(req, Nothing, False) If res = HttpStatusCode.OK Then Return True Return False @@ -64,8 +64,8 @@ Public Class HttpVarious End Function Public Function PostData(ByVal Url As String, ByVal param As Dictionary(Of String, String), ByRef content As String) As Boolean - Dim req As HttpWebRequest = CreateRequest(PostMethod, New Uri(Url), param, False) Try + Dim req As HttpWebRequest = CreateRequest(PostMethod, New Uri(Url), param, False) Dim res As HttpStatusCode = Me.GetResponse(req, content, Nothing, False) If res = HttpStatusCode.OK Then Return True Return False @@ -75,8 +75,8 @@ Public Class HttpVarious End Function Public Overloads Function GetData(ByVal Url As String, ByVal param As Dictionary(Of String, String), ByRef content As String) As Boolean - Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(Url), param, False) Try + Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(Url), param, False) Dim res As HttpStatusCode = Me.GetResponse(req, content, Nothing, False) If res = HttpStatusCode.OK Then Return True Return False @@ -86,9 +86,9 @@ Public Class HttpVarious End Function Public Overloads Function GetData(ByVal Url As String, ByVal param As Dictionary(Of String, String), ByRef content As String, ByVal timeout As Integer) As Boolean - Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(Url), param, False) - req.Timeout = timeout Try + Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(Url), param, False) + req.Timeout = timeout Dim res As HttpStatusCode = Me.GetResponse(req, content, Nothing, False) If res = HttpStatusCode.OK Then Return True Return False @@ -98,24 +98,29 @@ Public Class HttpVarious End Function Public Function GetContent(ByVal method As String, ByVal Url As Uri, ByVal param As Dictionary(Of String, String), ByRef content As String, ByVal headerInfo As Dictionary(Of String, String), ByVal userAgent As String) As HttpStatusCode + 'Searchで使用。呼び出し元で例外キャッチしている。 Dim req As HttpWebRequest = CreateRequest(method, Url, param, False) req.UserAgent = userAgent Return Me.GetResponse(req, content, headerInfo, False) End Function Public Function GetDataToFile(ByVal Url As String, ByVal savePath As String) As Boolean - Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(Url), Nothing, False) - req.AutomaticDecompression = DecompressionMethods.Deflate Or DecompressionMethods.GZip - Using strm As New System.IO.FileStream(savePath, IO.FileMode.Create, IO.FileAccess.Write) - Try - Dim res As HttpStatusCode = Me.GetResponse(req, strm, Nothing, False) - strm.Close() - If res = HttpStatusCode.OK Then Return True - Return False - Catch ex As Exception - strm.Close() - Return False - End Try - End Using + Try + Dim req As HttpWebRequest = CreateRequest(GetMethod, New Uri(Url), Nothing, False) + req.AutomaticDecompression = DecompressionMethods.Deflate Or DecompressionMethods.GZip + Using strm As New System.IO.FileStream(savePath, IO.FileMode.Create, IO.FileAccess.Write) + Try + Dim res As HttpStatusCode = Me.GetResponse(req, strm, Nothing, False) + strm.Close() + If res = HttpStatusCode.OK Then Return True + Return False + Catch ex As Exception + strm.Close() + Return False + End Try + End Using + Catch ex As Exception + Return False + End Try End Function End Class diff --git a/Tween/Tween.resx b/Tween/Tween.resx index 26a7afc3..85d211f7 100644 --- a/Tween/Tween.resx +++ b/Tween/Tween.resx @@ -267,6 +267,66 @@ 411, 54 + + 196, 22 + + + タブ作成(&N)... + + + 196, 22 + + + タブ名の変更(&R) + + + 193, 6 + + + 196, 22 + + + 未読管理(&U) + + + 196, 22 + + + 新着通知表示(&Q) + + + 121, 21 + + + 再生するwavファイルを指定してください + + + 193, 6 + + + 196, 22 + + + 振り分けルール編集(&F)... + + + 193, 6 + + + 196, 22 + + + このタブの発言をクリア(&C) + + + 193, 6 + + + 196, 22 + + + タブ削除(&D) + 197, 207 @@ -342,6 +402,48 @@ 3 + + 289, 91 + + + 122, 22 + + + IconName + + + 119, 6 + + + 122, 22 + + + 保存(&I)... + + + 123, 54 + + + ContextMenuStrip3 + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Off + + + 3, 3 + + + 50, 50 + + + Zoom + + + 5 + UserPicture @@ -354,6 +456,30 @@ 0 + + Top, Bottom, Right + + + Off + + + 339, 3 + + + 3, 3, 3, 0 + + + 123, 14 + + + 1 + + + Label1 + + + MiddleRight + DateTimeLabel @@ -366,6 +492,36 @@ 1 + + True + + + Fill + + + MS UI Gothic, 9pt, style=Bold + + + Off + + + 59, 3 + + + 3, 3, 3, 0 + + + 274, 14 + + + 0 + + + LblName + + + MiddleLeft + NameLabel @@ -378,79 +534,202 @@ 2 - - PostBrowser + + 425, 17 + + + 158, 22 - - System.Windows.Forms.WebBrowser, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Google(&G) - - TableLayoutPanel1 + + 158, 22 - - 3 + + Wikipedia(&W) - - Fill + + 158, 22 - - 0, 0 + + Twitter検索(&Y) - - 2 + + 158, 22 - - 465, 105 + + Twitter Search(&S) - - 1 + + 158, 22 - - TableLayoutPanel1 + + 現在のタブ(&L) - - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 196, 22 - - SplitContainer2.Panel1 + + 選択文字列で検索(&S) - - 0 + + 193, 6 - - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="UserPicture" Row="0" RowSpan="2" Column="0" ColumnSpan="1" /><Control Name="DateTimeLabel" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="NameLabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="PostBrowser" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /></Controls><Columns Styles="Absolute,56,Percent,100,Absolute,129" /><Rows Styles="Absolute,17,Percent,100" /></TableLayoutSettings> + + 196, 22 - - SplitContainer2.Panel1 + + 選択文字列をコピー(&C) - - System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + False - - SplitContainer2 + + 196, 22 - - 0 + + URLをコピー(&U) - - 0 + + 196, 22 - - Fill + + すべて選択(&A) - - 0, 0 + + 193, 6 - - 377, 19 + + 196, 22 - - 0 + + フォローする(&F) - - StatusText + + 196, 22 - + + フォロー解除(&N) + + + 196, 22 + + + 相互フォロー状態表示(&R) + + + 193, 6 + + + 196, 22 + + + ID振分ルール作成(&I) + + + 193, 6 + + + 196, 22 + + + ハッシュタグを固定(&H) + + + 197, 226 + + + ContextMenuStrip4 + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Fill + + + 59, 20 + + + 403, 82 + + + 6 + + + PostBrowser + + + System.Windows.Forms.WebBrowser, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TableLayoutPanel1 + + + 3 + + + Fill + + + 0, 0 + + + 2 + + + 465, 105 + + + 1 + + + TableLayoutPanel1 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + SplitContainer2.Panel1 + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="UserPicture" Row="0" RowSpan="2" Column="0" ColumnSpan="1" /><Control Name="DateTimeLabel" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="NameLabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="PostBrowser" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /></Controls><Columns Styles="Absolute,56,Percent,100,Absolute,129" /><Rows Styles="Absolute,17,Percent,100" /></TableLayoutSettings> + + + SplitContainer2.Panel1 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + SplitContainer2 + + + 0 + + + 0 + + + Fill + + + 0, 0 + + + 377, 19 + + + 0 + + + StatusText + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -735,413 +1014,32 @@ 0, 0 - - ToolStripContainer1.RightToolStripPanel - - - System.Windows.Forms.ToolStripPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ToolStripContainer1 - - - 2 - - - 469, 353 - - - 0 - - - ToolStripContainer1 - - - 0, 0 - - - None - - - 0, 0 - - - 469, 24 - - - 0 - - - MenuStrip1 - - - MenuStrip1 - - - System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ToolStripContainer1.TopToolStripPanel - - - 0 - - - ToolStripContainer1.TopToolStripPanel - - - System.Windows.Forms.ToolStripPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ToolStripContainer1 - - - 3 - - - ToolStripContainer1 - - - System.Windows.Forms.ToolStripContainer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 6 - - - 196, 22 - - - タブ作成(&N)... - - - 196, 22 - - - タブ名の変更(&R) - - - 193, 6 - - - 196, 22 - - - 未読管理(&U) - - - 196, 22 - - - 新着通知表示(&Q) - - - 121, 21 - - - 再生するwavファイルを指定してください - - - 193, 6 - - - 196, 22 - - - 振り分けルール編集(&F)... - - - 193, 6 - - - 196, 22 - - - このタブの発言をクリア(&C) - - - 193, 6 - - - 196, 22 - - - タブ削除(&D) - - - 289, 91 - - - 123, 54 - - - ContextMenuStrip3 - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Off - - - 3, 3 - - - 50, 50 - - - Zoom - - - 5 - - - UserPicture - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TableLayoutPanel1 - - - 0 - - - 122, 22 - - - IconName - - - 119, 6 - - - 122, 22 - - - 保存(&I)... - - - Top, Bottom, Right - - - Off - - - 339, 3 - - - 3, 3, 3, 0 - - - 123, 14 - - - 1 - - - Label1 - - - MiddleRight - - - DateTimeLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TableLayoutPanel1 - - - 1 - - - True - - - Fill - - - MS UI Gothic, 9pt, style=Bold - - - Off - - - 59, 3 - - - 3, 3, 3, 0 - - - 274, 14 - - - 0 - - - LblName - - - MiddleLeft - - - NameLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TableLayoutPanel1 - - - 2 - - - 425, 17 - - - 197, 226 - - - ContextMenuStrip4 - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Fill - - - 59, 20 - - - 403, 82 - - - 6 - - - PostBrowser - - - System.Windows.Forms.WebBrowser, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TableLayoutPanel1 - - - 3 - - - 196, 22 - - - 選択文字列で検索(&S) - - - 158, 22 - - - Google(&G) - - - 158, 22 - - - Wikipedia(&W) - - - 158, 22 - - - Twitter検索(&Y) - - - 158, 22 - - - Twitter Search(&S) - - - 158, 22 - - - 現在のタブ(&L) - - - 193, 6 - - - 196, 22 - - - 選択文字列をコピー(&C) - - - False - - - 196, 22 - - - URLをコピー(&U) - - - 196, 22 - - - すべて選択(&A) - - - 193, 6 - - - 196, 22 - - - フォローする(&F) - - - 196, 22 - - - フォロー解除(&N) - - - 196, 22 - - - 相互フォロー状態表示(&R) - - - 193, 6 - - - 196, 22 + + ToolStripContainer1.RightToolStripPanel - - ID振分ルール作成(&I) + + System.Windows.Forms.ToolStripPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 193, 6 + + ToolStripContainer1 - - 196, 22 + + 2 - - ハッシュタグを固定(&H) + + 469, 353 - - 67, 20 + + 0 - - ファイル(&F) + + ToolStripContainer1 + + + 0, 0 + + + None 171, 22 @@ -1188,11 +1086,11 @@ 終了(&X) - - 57, 20 + + 67, 20 - - 編集(&E) + + ファイル(&F) 230, 22 @@ -1257,11 +1155,11 @@ 抽出条件入力(&Q) - - 59, 20 + + 57, 20 - - 操作(&O) + + 編集(&E) Ctrl+R @@ -1338,12 +1236,6 @@ Fav削除(&V) - - 232, 22 - - - 開く(&O) - Ctrl+H @@ -1407,11 +1299,11 @@ RTした人のホームを開く(&R) - + 232, 22 - - 振り分けルール作成(&C) + + 開く(&O) 202, 22 @@ -1425,14 +1317,14 @@ ID振り分けルール作成(&I) - - 229, 6 - - + 232, 22 - - 未読状態変更(&H) + + 振り分けルール作成(&C) + + + 229, 6 Ctrl+B @@ -1452,6 +1344,12 @@ 未読にする(&U) + + 232, 22 + + + 未読状態変更(&H) + 232, 22 @@ -1497,11 +1395,11 @@ 前データを取得(&I) - - 50, 20 + + 59, 20 - - タブ(&T) + + 操作(&O) 196, 22 @@ -1563,17 +1461,11 @@ タブ削除(&D) - - 89, 20 - - - その他機能(&C) - - - 201, 22 + + 50, 20 - - 入力欄のURLを短縮変換 + + タブ(&T) Ctrl+L @@ -1629,11 +1521,11 @@ j.mp - + 201, 22 - - 片思いユーザーリスト取得 + + 入力欄のURLを短縮変換 False @@ -1650,6 +1542,12 @@ 全て再取得 + + 201, 22 + + + 片思いユーザーリスト取得 + 198, 6 @@ -1686,11 +1584,11 @@ ユーザーのプロフィール表示 - - 63, 20 + + 89, 20 - - ヘルプ(&H) + + その他機能(&C) F1 @@ -1737,6 +1635,18 @@ Tweenについて(&A)... + + 157, 22 + + + PostClassのダンプ + + + 157, 22 + + + TraceOut出力 + 194, 22 @@ -1746,30 +1656,63 @@ False - - 157, 22 + + 63, 20 - - PostClassのダンプ + + ヘルプ(&H) - - 157, 22 + + 0, 0 - - TraceOut出力 + + 469, 24 - - 163, 54 - - - 186, 374 + + 0 - - ContextMenuStrip2 + + MenuStrip1 - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + MenuStrip1 + + + System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ToolStripContainer1.TopToolStripPanel + + + 0 + + + ToolStripContainer1.TopToolStripPanel + + + System.Windows.Forms.ToolStripPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ToolStripContainer1 + + + 3 + + + ToolStripContainer1 + + + System.Windows.Forms.ToolStripContainer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + $this + + + 6 + + + 163, 54 + 185, 22 @@ -1821,12 +1764,6 @@ Fav削除(&V) - - 185, 22 - - - 開く(&O) - 199, 22 @@ -1869,11 +1806,11 @@ RTした人のホームを開く(&R) - + 185, 22 - - 振り分けルール作成(&C) + + 開く(&O) 214, 22 @@ -1887,14 +1824,14 @@ ID振り分けルール作成... - - 182, 6 - - + 185, 22 - - 未読状態変更(&H) + + 振り分けルール作成(&C) + + + 182, 6 140, 22 @@ -1908,6 +1845,12 @@ 未読にする + + 185, 22 + + + 未読状態変更(&H) + 185, 22 @@ -1941,18 +1884,18 @@ 前データを取得(&I) - - 17, 54 - - - 172, 154 + + 186, 374 - - ContextMenuStrip1 + + ContextMenuStrip2 - + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 54 + 171, 22 @@ -2001,6 +1944,15 @@ 終了(&X) + + 172, 154 + + + ContextMenuStrip1 + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 571, 17 diff --git a/Tween/Twitter.vb b/Tween/Twitter.vb index 50e98afc..b2470433 100644 --- a/Tween/Twitter.vb +++ b/Tween/Twitter.vb @@ -3132,7 +3132,7 @@ Public Class Twitter Case UrlConverter.Bitly, UrlConverter.Jmp Dim BitlyLogin As String = "tweenapi" Dim BitlyApiKey As String = "R_c5ee0e30bdfff88723c4457cc331886b" - If _bitlyId <> "" Then + If _bitlyId <> "" AndAlso BitlyApiKey <> "" Then BitlyLogin = _bitlyId BitlyApiKey = _bitlyKey End If -- 2.11.0