Changeset 25955
- Timestamp:
- 12/05/08 17:06:51 (4 years ago)
- Location:
- lang/vb2005/Tween/Tween
- Files:
-
- 4 modified
-
MySocket.vb (modified) (3 diffs)
-
TwConfig.vb (modified) (2 diffs)
-
Tween.vb (modified) (16 diffs)
-
Twitter.vb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/vb2005/Tween/Tween/MySocket.vb
r25202 r25955 88 88 Optional ByVal timeout As Integer = 15000) As Object 89 89 Dim webReq As HttpWebRequest 90 Dim dataB As Byte()91 Dim strm As Stream92 90 Dim cpolicy As System.Net.Cache.HttpRequestCachePolicy = New Cache.HttpRequestCachePolicy(Cache.HttpRequestCacheLevel.NoCacheNoStore) 93 91 … … 120 118 webReq.Method = "POST" 121 119 webReq.Timeout = timeout 122 dataB= Encoding.ASCII.GetBytes(data)120 Dim dataB As Byte() = Encoding.ASCII.GetBytes(data) 123 121 webReq.ContentLength = dataB.Length 124 122 Select Case reqType … … 195 193 End If 196 194 resStatus = webRes.StatusCode.ToString() + " " + webRes.ResponseUri.AbsoluteUri 197 strm = webRes.GetResponseStream() 198 199 Select Case reqType 200 Case REQ_TYPE.ReqGET, REQ_TYPE.ReqPOST, REQ_TYPE.ReqPOSTEncode, REQ_TYPE.ReqPOSTEncodeProtoVer1, REQ_TYPE.ReqPOSTEncodeProtoVer2, REQ_TYPE.ReqPOSTEncodeProtoVer3, REQ_TYPE.ReqGetNoCache, REQ_TYPE.ReqPOSTAPI, REQ_TYPE.ReqGetAPI 201 Dim rtStr As String 202 Using sr As New StreamReader(strm, _enc) 203 rtStr = sr.ReadToEnd() 204 End Using 205 strm.Close() 206 strm.Dispose() 207 webRes.Close() 208 Return rtStr 209 Case REQ_TYPE.ReqGETBinary 210 Dim readData(1023) As Byte 211 Dim readSize As Integer = 0 212 Dim img As Image 213 Using mem As New MemoryStream 214 While True 215 readSize = strm.Read(readData, 0, readData.Length) 216 If readSize = 0 Then 217 Exit While 218 End If 219 mem.Write(readData, 0, readSize) 220 End While 221 img = Image.FromStream(mem, True) 222 strm.Close() 223 strm.Dispose() 224 webRes.Close() 225 End Using 226 Return img 227 Case REQ_TYPE.ReqGETFile 228 Dim fs As New System.IO.FileStream(My.Application.Info.DirectoryPath + "\TweenNew.exe", FileMode.Create, FileAccess.Write) 229 Dim b As Integer 230 Using fs 231 While True 232 b = strm.ReadByte() 233 If b = -1 Then Exit While 234 fs.WriteByte(Convert.ToByte(b)) 235 End While 236 End Using 237 strm.Close() 238 strm.Dispose() 239 webRes.Close() 240 Case REQ_TYPE.ReqGETFileUp 241 Dim fs As New System.IO.FileStream(My.Application.Info.DirectoryPath + "\TweenUp.exe", FileMode.Create, FileAccess.Write) 242 Dim b As Integer 243 Using fs 244 While True 245 b = strm.ReadByte() 246 If b = -1 Then Exit While 247 fs.WriteByte(Convert.ToByte(b)) 248 End While 249 End Using 250 strm.Close() 251 strm.Dispose() 252 webRes.Close() 253 Case REQ_TYPE.ReqGETFileRes 254 If Directory.Exists(My.Application.Info.DirectoryPath + "\en") = False Then 255 Directory.CreateDirectory(My.Application.Info.DirectoryPath + "\en") 256 End If 257 Dim fs As New System.IO.FileStream(My.Application.Info.DirectoryPath + "\en\Tween.resourcesNew.dll", FileMode.Create, FileAccess.Write) 258 Dim b As Integer 259 Using fs 260 While True 261 b = strm.ReadByte() 262 If b = -1 Then Exit While 263 fs.WriteByte(Convert.ToByte(b)) 264 End While 265 End Using 266 strm.Close() 267 strm.Dispose() 268 webRes.Close() 269 Case REQ_TYPE.ReqGETForwardTo 270 strm.Close() 271 strm.Dispose() 272 Dim rtStr As String = "" 273 If webRes.StatusCode = HttpStatusCode.Moved OrElse _ 274 webRes.StatusCode = HttpStatusCode.Found Then 275 rtStr = webRes.Headers.GetValues("Location")(0) 195 196 Using strm As Stream = webRes.GetResponseStream() 197 Select Case reqType 198 Case REQ_TYPE.ReqGET, REQ_TYPE.ReqPOST, REQ_TYPE.ReqPOSTEncode, REQ_TYPE.ReqPOSTEncodeProtoVer1, REQ_TYPE.ReqPOSTEncodeProtoVer2, REQ_TYPE.ReqPOSTEncodeProtoVer3, REQ_TYPE.ReqGetNoCache, REQ_TYPE.ReqPOSTAPI, REQ_TYPE.ReqGetAPI 199 Dim rtStr As String 200 Using sr As New StreamReader(strm, _enc) 201 rtStr = sr.ReadToEnd() 202 End Using 276 203 Return rtStr 277 End If 278 webRes.Close() 279 End Select 204 Case REQ_TYPE.ReqGETBinary 205 Dim readData(1023) As Byte 206 Dim readSize As Integer = 0 207 Dim img As Image 208 Using mem As New MemoryStream 209 While True 210 readSize = strm.Read(readData, 0, readData.Length) 211 If readSize = 0 Then 212 Exit While 213 End If 214 mem.Write(readData, 0, readSize) 215 End While 216 img = Image.FromStream(mem, True) 217 End Using 218 Return img 219 Case REQ_TYPE.ReqGETFile 220 Dim fs As New System.IO.FileStream(My.Application.Info.DirectoryPath + "\TweenNew.exe", FileMode.Create, FileAccess.Write) 221 Dim b As Integer 222 Using fs 223 While True 224 b = strm.ReadByte() 225 If b = -1 Then Exit While 226 fs.WriteByte(Convert.ToByte(b)) 227 End While 228 End Using 229 Case REQ_TYPE.ReqGETFileUp 230 Dim fs As New System.IO.FileStream(My.Application.Info.DirectoryPath + "\TweenUp.exe", FileMode.Create, FileAccess.Write) 231 Dim b As Integer 232 Using fs 233 While True 234 b = strm.ReadByte() 235 If b = -1 Then Exit While 236 fs.WriteByte(Convert.ToByte(b)) 237 End While 238 End Using 239 Case REQ_TYPE.ReqGETFileRes 240 If Directory.Exists(My.Application.Info.DirectoryPath + "\en") = False Then 241 Directory.CreateDirectory(My.Application.Info.DirectoryPath + "\en") 242 End If 243 Dim fs As New System.IO.FileStream(My.Application.Info.DirectoryPath + "\en\Tween.resourcesNew.dll", FileMode.Create, FileAccess.Write) 244 Dim b As Integer 245 Using fs 246 While True 247 b = strm.ReadByte() 248 If b = -1 Then Exit While 249 fs.WriteByte(Convert.ToByte(b)) 250 End While 251 End Using 252 Case REQ_TYPE.ReqGETForwardTo 253 Dim rtStr As String = "" 254 If webRes.StatusCode = HttpStatusCode.Moved OrElse _ 255 webRes.StatusCode = HttpStatusCode.Found Then 256 rtStr = webRes.Headers.GetValues("Location")(0) 257 Return rtStr 258 End If 259 End Select 260 End Using 280 261 End Using 281 282 262 Catch ex As System.Net.WebException 283 263 If ex.Status = WebExceptionStatus.ProtocolError Then -
lang/vb2005/Tween/Tween/TwConfig.vb
r25852 r25955 1196 1196 End Property 1197 1197 1198 Private Function EncryptString(ByVal str As String) As String1198 Private Shared Function EncryptString(ByVal str As String) As String 1199 1199 '文字列をバイト型配列にする 1200 1200 Dim bytesIn As Byte() = System.Text.Encoding.UTF8.GetBytes(str) … … 1237 1237 End Function 1238 1238 1239 Private Function DecryptString(ByVal str As String) As String1239 Private Shared Function DecryptString(ByVal str As String) As String 1240 1240 'DESCryptoServiceProviderオブジェクトの作成 1241 1241 Dim des As New System.Security.Cryptography.DESCryptoServiceProvider -
lang/vb2005/Tween/Tween/Tween.vb
r25915 r25955 63 63 Private _clAtTarget As Color '選択発言中の返信先用背景色 64 64 Private _clAtFromTarget As Color '選択発言者への返信発言用背景色 65 Private _postCounter As Integer '取得発言数カウンタ(カウントしているが未使用。タブ別カウンタに変更&未読数カウントとして未読アイコン表示パフォーマンスUPできるように改善したい)66 65 Private TIconList As ImageList '発言詳細部用アイコン画像リスト 67 66 Private TIconSmallList As ImageList 'リスト表示用アイコン画像リスト … … 94 93 Private _tlCount As Integer 95 94 Private ReadOnly _syncObject As New Object() 'ロック用 96 Private _StatusSelectionStart As Integer ' 一時退避用97 Private _StatusSelectionLength As Integer ' 一時退避用98 95 99 96 ' 以下DrawItem関連 … … 167 164 Public tName As String 'Fav追加・削除時のタブ名 168 165 End Structure 166 167 Private Sub TweenMain_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed 168 '後始末 169 SettingDialog.Dispose() 170 TabDialog.Dispose() 171 SearchDialog.Dispose() 172 fDialog.Dispose() 173 UrlDialog.Dispose() 174 If TIconList IsNot Nothing Then TIconList.Dispose() 175 If TIconSmallList IsNot Nothing Then TIconSmallList.Dispose() 176 If NIconAt IsNot Nothing Then NIconAt.Dispose() 177 If NIconAtRed IsNot Nothing Then NIconAtRed.Dispose() 178 If NIconAtSmoke IsNot Nothing Then NIconAtSmoke.Dispose() 179 If NIconRefresh(0) IsNot Nothing Then NIconRefresh(0).Dispose() 180 If NIconRefresh(1) IsNot Nothing Then NIconRefresh(1).Dispose() 181 If NIconRefresh(2) IsNot Nothing Then NIconRefresh(2).Dispose() 182 If NIconRefresh(3) IsNot Nothing Then NIconRefresh(3).Dispose() 183 If TabIcon IsNot Nothing Then TabIcon.Dispose() 184 If MainIcon IsNot Nothing Then MainIcon.Dispose() 185 _brsHighLight.Dispose() 186 _brsHighLightText.Dispose() 187 If _brsForeColorUnread IsNot Nothing Then _brsForeColorUnread.Dispose() 188 If _brsForeColorReaded IsNot Nothing Then _brsForeColorReaded.Dispose() 189 If _brsForeColorFav IsNot Nothing Then _brsForeColorFav.Dispose() 190 If _brsForeColorOWL IsNot Nothing Then _brsForeColorOWL.Dispose() 191 If _brsBackColorMine IsNot Nothing Then _brsBackColorMine.Dispose() 192 If _brsBackColorAt IsNot Nothing Then _brsBackColorAt.Dispose() 193 If _brsBackColorYou IsNot Nothing Then _brsBackColorYou.Dispose() 194 If _brsBackColorAtYou IsNot Nothing Then _brsBackColorAtYou.Dispose() 195 If _brsBackColorAtTo IsNot Nothing Then _brsBackColorAtTo.Dispose() 196 If _brsBackColorNone IsNot Nothing Then _brsBackColorNone.Dispose() 197 sf.Dispose() 198 End Sub 169 199 170 200 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load … … 1989 2019 1990 2020 Private Sub FavRemoveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FavRemoveToolStripMenuItem.Click 1991 1992 2021 Dim cnt As Integer = 0 1993 Dim rtn As String = ""1994 Dim msg As String = ""1995 Dim cnt2 As Integer = 01996 2022 Dim MyList As DetailsListView = DirectCast(ListTab.SelectedTab.Controls(0), DetailsListView) 1997 Dim MyList2 As DetailsListView = Nothing1998 Dim cnt3 As Integer = 01999 Dim tabName As String = ListTab.SelectedTab.Text2000 Dim idx As Integer = 02001 Dim flw As Boolean = False2002 2023 2003 2024 If ListTab.SelectedTab.Text = "Direct" OrElse MyList.SelectedItems.Count = 0 Then Exit Sub … … 2119 2140 Dim lItem As Twitter.MyListItem 2120 2141 Dim cnt As Integer = 0 2121 Dim unread As Integer = 02122 2142 Dim newCnt As Integer = 0 2123 2143 Dim _pop As String = "" … … 2620 2640 2621 2641 Private Sub RefreshStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshStripMenuItem.Click 2622 Dim MyList As DetailsListView = DirectCast(ListTab.SelectedTab.Controls(0), DetailsListView)2623 2624 2642 NotifyIcon1.Icon = NIconRefresh(0) 2625 2643 _refreshIconCnt = 0 … … 3145 3163 Private Sub ListTab_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListTab.MouseMove 3146 3164 Dim cpos As New Point(e.X, e.Y) 3147 Dim spos As Point = ListTab.PointToClient(cpos)3148 3165 3149 3166 If e.Button = Windows.Forms.MouseButtons.Left And _tabDrag Then … … 3839 3856 Dim toIdx As Integer 3840 3857 Dim stp As Integer = 1 3841 Dim tabIdx As Integer = 03842 3858 3843 3859 myList.Focus() … … 3996 4012 g.DrawImage(TIconList.Images(key), 0, 0, sz, sz) 3997 4013 TIconSmallList.Images.Add(key, img2) 3998 g.Dispose()3999 img2.Dispose()4000 4014 End Using 4001 4015 End Using … … 4010 4024 Private Sub CheckNewVersion(Optional ByVal startup As Boolean = False) 4011 4025 Dim retMsg As String 4012 Dim resStatus As String = ""4013 4026 Dim strVer As String 4014 4027 Dim forceUpdate As Boolean = My.Computer.Keyboard.ShiftKeyDown … … 4289 4302 If MyList.SelectedItems.Count = 0 Then Exit Sub 4290 4303 4291 Dim user As String = MyList.SelectedItems(0).SubItems(4).Text4292 4304 Dim fIdx As Integer = MyList.SelectedItems(0).Index + 1 4293 4305 If fIdx > MyList.Items.Count - 1 Then Exit Sub … … 4313 4325 If MyList.SelectedItems.Count = 0 Then Exit Sub 4314 4326 4315 Dim user As String = MyList.SelectedItems(0).SubItems(4).Text4316 4327 Dim fIdx As Integer = MyList.SelectedItems(0).Index - 1 4317 4328 If fIdx < 0 Then Exit Sub … … 4843 4854 Private Sub Tabs_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListTab.MouseDown 4844 4855 Dim cpos As New Point(e.X, e.Y) 4845 Dim spos As Point = ListTab.PointToClient(cpos)4846 4856 If e.Button = Windows.Forms.MouseButtons.Left Then 4847 4857 For i As Integer = 0 To ListTab.TabPages.Count - 1 … … 5610 5620 For Each itm As ListViewItem In ts2.listCustom.Items 5611 5621 Dim mv As Boolean = False 5612 Dim nf As Boolean = False5613 5622 Dim mk As Boolean = False 5614 5623 Dim lItem As New Twitter.MyListItem() … … 5715 5724 For Each itm As ListViewItem In itms 5716 5725 Dim mv As Boolean = False 5717 Dim nf As Boolean = False5718 5726 Dim mk As Boolean = False 5719 5727 Dim lItem As New Twitter.MyListItem() … … 6132 6140 "*)?(?:#(?:[-_.!~*'()a-zA-Z0-9;/?:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*)?") 6133 6141 6134 Dim src As String = ""6135 6142 6136 6143 If StatusText.SelectionLength > 0 Then -
lang/vb2005/Tween/Tween/Twitter.vb
r25905 r25955 432 432 Return "GetTimeline -> Err: Can't get body." 433 433 End Try 434 orgData = Regex.Replace(orgData, "<a href=""https://twitter\.com/" + lItem.Name + "/status/[0-9]+"">\.\.\.</a>$", "") 434 435 orgData = orgData.Replace("<3", "♡") 435 436 End If … … 612 613 Dim retMsg As String = "" 613 614 Dim resStatus As String = "" 614 Dim moreRead As Boolean = True615 Dim oldID As String = ""616 Dim oldName As String = ""617 615 618 616 endPage = page … … 779 777 orgData = strPost.Substring(pos1 + _parseDM11.Length, pos2 - pos1 - _parseDM11.Length).Trim() 780 778 End If 779 orgData = Regex.Replace(orgData, "<a href=""https://twitter\.com/" + lItem.Name + "/status/[0-9]+"">\.\.\.</a>$", "") 781 780 orgData = orgData.Replace("<3", "♡") 782 781 Catch ex As Exception … … 923 922 Dim resStatus As String = "" 924 923 Dim img As Image = Nothing 925 Dim cnt As Integer = 1926 924 927 925 img = DirectCast(_mySock.GetWebResponse(pathUrl, resStatus, MySocket.REQ_TYPE.ReqGETBinary), System.Drawing.Image)
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)