Changeset 28691
- Timestamp:
- 01/20/09 13:09:18 (4 years ago)
- Location:
- lang/vb2005/Tween/Tween
- Files:
-
- 2 modified
-
Tween.vb (modified) (1 diff)
-
Twitter.vb (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/vb2005/Tween/Tween/Tween.vb
r28688 r28691 2159 2159 Me.ResumeLayout(False) 2160 2160 Me.PerformLayout() 2161 Diagnostics.Debug.WriteLine("inz")2162 2161 Return True 2163 2162 End Function -
lang/vb2005/Tween/Tween/Twitter.vb
r28659 r28691 28 28 29 29 Partial Public Class Twitter 30 Delegate Sub GetIconImageDelegate(ByVal post As PostClass, ByVal imgs As Dictionary(Of String, Image), ByVal imgsS As ImageList) 31 Private iconLock As New Object 32 30 33 Public links As New List(Of Long) 31 34 … … 279 282 Dim intCnt As Integer = 0 280 283 Dim listCnt As Integer = links.Count 284 Dim dlgt(20) As GetIconImageDelegate 285 Dim ar(20) As IAsyncResult 286 Dim arIdx As Integer = -1 281 287 282 288 For Each strPost As String In posts … … 525 531 End If 526 532 527 post.ImageIndex = GetIconImage(post.ImageUrl, imgs, imgsS) 533 arIdx += 1 534 dlgt(arIdx) = New GetIconImageDelegate(AddressOf GetIconImage) 535 ar(arIdx) = dlgt(arIdx).BeginInvoke(post, imgs, imgsS, Nothing, Nothing) 528 536 529 537 If _endingFlag Then Return "" … … 543 551 544 552 'テスト実装:DMカウント取得 545 If intCnt = posts.Length And gType = GetTypes.GET_TIMELINE Andpage = 1 Then553 If intCnt = posts.Length AndAlso gType = GetTypes.GET_TIMELINE AndAlso page = 1 Then 546 554 pos1 = strPost.IndexOf(_parseDMcountFrom, pos2, StringComparison.Ordinal) 547 555 If pos1 > -1 Then … … 559 567 getDM = _getDm 560 568 End If 569 Next 570 571 For i As Integer = 0 To arIdx 572 dlgt(i).EndInvoke(ar(i)) 561 573 Next 562 574 … … 662 674 Dim intCnt As Integer = 0 'カウンタ 663 675 Dim listCnt As Integer = links.Count 676 Dim dlgt(20) As GetIconImageDelegate 677 Dim ar(20) As IAsyncResult 678 Dim arIdx As Integer = -1 664 679 665 680 For Each strPost As String In posts … … 784 799 785 800 'Imageの取得 786 post.ImageIndex = GetIconImage(post.ImageUrl, imgs, imgsS) 801 arIdx += 1 802 dlgt(arIdx) = New GetIconImageDelegate(AddressOf GetIconImage) 803 ar(arIdx) = dlgt(arIdx).BeginInvoke(post, imgs, imgsS, Nothing, Nothing) 787 804 788 805 If _endingFlag Then Return "" … … 804 821 End If 805 822 End If 823 Next 824 825 For i As Integer = 0 To arIdx 826 dlgt(i).EndInvoke(ar(i)) 806 827 Next 807 828 … … 895 916 End Function 896 917 897 Private Function GetIconImage(ByVal pathUrl As String, ByVal imgs As Dictionary(Of String, Image), ByVal imgsS As ImageList) As Integer 898 If _endingFlag OrElse Not _getIcon Then Return -1 899 If imgsS.Images.ContainsKey(pathUrl) Then Return imgsS.Images.IndexOfKey(pathUrl) 900 918 Private Sub GetIconImage(ByVal post As PostClass, ByVal imgs As Dictionary(Of String, Image), ByVal imgsS As ImageList) 919 If _endingFlag OrElse Not _getIcon Then 920 post.ImageIndex = -1 921 Exit Sub 922 End If 923 If imgsS.Images.ContainsKey(post.ImageUrl) Then 924 post.ImageIndex = imgsS.Images.IndexOfKey(post.ImageUrl) 925 Exit Sub 926 End If 927 928 Dim sock As New MySocket("UTF-8", _uid, _pwd, _proxyType, _proxyAddress, _proxyPort, _proxyUser, _proxyPassword) 901 929 Dim resStatus As String = "" 902 Dim img As Image = DirectCast(_mySock.GetWebResponse(pathUrl, resStatus, MySocket.REQ_TYPE.ReqGETBinary), System.Drawing.Image) 903 If img Is Nothing Then Return -1 904 905 imgs.Add(pathUrl, img) '詳細表示用ディクショナリに追加 930 Dim img As Image = DirectCast(sock.GetWebResponse(post.ImageUrl, resStatus, MySocket.REQ_TYPE.ReqGETBinary), System.Drawing.Image) 931 If img Is Nothing Then 932 post.ImageIndex = -1 933 Exit Sub 934 End If 906 935 907 936 Dim bmp2 As New Bitmap(_iconSz, _iconSz) … … 910 939 g.DrawImage(img, 0, 0, _iconSz, _iconSz) 911 940 End Using 912 imgsS.Images.Add(pathUrl, bmp2) 913 Return imgsS.Images.IndexOfKey(pathUrl) 914 End Function 941 942 SyncLock iconLock 943 If imgsS.Images.ContainsKey(post.ImageUrl) Then 944 post.ImageIndex = imgsS.Images.IndexOfKey(post.ImageUrl) 945 Exit Sub 946 End If 947 imgs.Add(post.ImageUrl, img) '詳細表示用ディクショナリに追加 948 imgsS.Images.Add(post.ImageUrl, bmp2) 949 post.ImageIndex = imgsS.Images.IndexOfKey(post.ImageUrl) 950 End SyncLock 951 End Sub 915 952 916 953 Private Function GetAuthKey(ByVal resMsg As String) As Integer … … 1196 1233 Dim resMsg As String = "" 1197 1234 1198 resMsg = DirectCast(_mySock.GetWebResponse(wedataUrl, resStatus, time out:=10 * 1000), String) 'タイムアウト時間を10秒に設定1235 resMsg = DirectCast(_mySock.GetWebResponse(wedataUrl, resStatus, timeOut:=10 * 1000), String) 'タイムアウト時間を10秒に設定 1199 1236 If resMsg.Length = 0 Then Exit Sub 1200 1237
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)