svnno****@sourc*****
svnno****@sourc*****
2010年 11月 29日 (月) 12:55:26 JST
Revision: 1127 http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1127 Author: syo68k Date: 2010-11-29 12:55:26 +0900 (Mon, 29 Nov 2010) Log Message: ----------- UserStream停止に時間がかかっていたのを修正 Modified Paths: -------------- branches/UserStream/Tween/Twitter.vb -------------- next part -------------- Modified: branches/UserStream/Tween/Twitter.vb =================================================================== --- branches/UserStream/Tween/Twitter.vb 2010-11-29 03:40:50 UTC (rev 1126) +++ branches/UserStream/Tween/Twitter.vb 2010-11-29 03:55:26 UTC (rev 1127) @@ -2835,9 +2835,24 @@ "list_member_removed" } + Private Function ReadLine(ByVal sr As StreamReader) As String + Dim ret As New StringBuilder(8192) + Dim tmp As Integer + Do While _streamActive + tmp = sr.Peek() + If tmp <> -1 Then + If tmp = &HA Then + Return ret.ToString + Else + ret.Append(Convert.ToChar(sr.Read())) + End If + End If + Thread.Sleep(10) + Loop + Return "" + End Function - Private Sub UserStreamLoop() Dim st As Stream = Nothing Dim sr As StreamReader = Nothing @@ -2850,7 +2865,7 @@ sr = New StreamReader(st) RaiseEvent UserStreamStarted() Do While _streamActive - Dim line As String = sr.ReadLine() + Dim line As String = ReadLine(sr) If _streamBypass OrElse String.IsNullOrEmpty(line) Then Continue Do Dim idx As Integer = line.IndexOf("{""")