[Tween-svn] [1632] 画像投稿でNullRef例外出る場合があったので対応

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 10月 17日 (月) 00:36:23 JST


Revision: 1632
          http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1632
Author:   kiri_feather
Date:     2011-10-17 00:36:18 +0900 (Mon, 17 Oct 2011)

Log Message:
-----------
画像投稿でNullRef例外出る場合があったので対応
画像投稿時の残り文字数をt.co考慮した長さにするよう対応
GrowlのDLLをExeと同じパスへ配置する旨、Changelogへ追記
Fav取得時に、一部発言のfavフラグが正しくないので、fav取得時は強制的にFav済みとして扱うよう修正

Modified Paths:
--------------
    trunk/Tween/Connection/Plixi.vb
    trunk/Tween/Connection/TwitPic.vb
    trunk/Tween/Connection/imgly.vb
    trunk/Tween/Connection/yfrog.vb
    trunk/Tween/Resources/ChangeLog.txt
    trunk/Tween/Tween.vb
    trunk/Tween/Twitter.vb


-------------- next part --------------
Modified: trunk/Tween/Connection/Plixi.vb
===================================================================
--- trunk/Tween/Connection/Plixi.vb	2011-10-15 13:51:32 UTC (rev 1631)
+++ trunk/Tween/Connection/Plixi.vb	2011-10-16 15:36:18 UTC (rev 1632)
@@ -82,6 +82,8 @@
                 url = xd.ChildNodes().Item(0).ChildNodes(2).InnerText
             Catch ex As XmlException
                 Return "Err:" + ex.Message
+            Catch Ex As Exception
+                Return "Err:" + Ex.Message
             End Try
         Else
             Return "Err:" + ret.ToString
@@ -89,10 +91,11 @@
         'アップロードまでは成功
         filePath = ""
         If String.IsNullOrEmpty(url) Then url = ""
+        If String.IsNullOrEmpty(message) Then message = ""
         'Twitterへの投稿
         '投稿メッセージの再構成
-        If message.Length + url.Length + 1 > 140 Then
-            message = message.Substring(0, 140 - url.Length - 1) + " " + url
+        If message.Length + AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia + 1 > 140 Then
+            message = message.Substring(0, 140 - AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia - 1) + " " + url
         Else
             message += " " + url
         End If

Modified: trunk/Tween/Connection/TwitPic.vb
===================================================================
--- trunk/Tween/Connection/TwitPic.vb	2011-10-15 13:51:32 UTC (rev 1631)
+++ trunk/Tween/Connection/TwitPic.vb	2011-10-16 15:36:18 UTC (rev 1632)
@@ -95,17 +95,20 @@
                 url = xd.SelectSingleNode("/image/url").InnerText
             Catch ex As XmlException
                 Return "Err:" + ex.Message
+            Catch Ex As Exception
+                Return "Err:" + Ex.Message
             End Try
         Else
             Return "Err:" + ret.ToString
         End If
         'アップロードまでは成功
         filePath = ""
+        If String.IsNullOrEmpty(message) Then message = ""
         If String.IsNullOrEmpty(url) Then url = ""
         'Twitterへの投稿
         '投稿メッセージの再構成
-        If message.Length + url.Length + 1 > 140 Then
-            message = message.Substring(0, 140 - url.Length - 1) + " " + url
+        If message.Length + AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia + 1 > 140 Then
+            message = message.Substring(0, 140 - AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia - 1) + " " + url
         Else
             message += " " + url
         End If

Modified: trunk/Tween/Connection/imgly.vb
===================================================================
--- trunk/Tween/Connection/imgly.vb	2011-10-15 13:51:32 UTC (rev 1631)
+++ trunk/Tween/Connection/imgly.vb	2011-10-16 15:36:18 UTC (rev 1632)
@@ -81,6 +81,8 @@
                 url = xd.SelectSingleNode("/image/url").InnerText
             Catch ex As XmlException
                 Return "Err:" + ex.Message
+            Catch ex As Exception
+                Return "Err:" + ex.Message
             End Try
         Else
             Return "Err:" + ret.ToString
@@ -90,8 +92,9 @@
         If String.IsNullOrEmpty(url) Then url = ""
         'Twitterへの投稿
         '投稿メッセージの再構成
-        If message.Length + url.Length + 1 > 140 Then
-            message = message.Substring(0, 140 - url.Length - 1) + " " + url
+        If String.IsNullOrEmpty(message) Then message = ""
+        If message.Length + AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia + 1 > 140 Then
+            message = message.Substring(0, 140 - AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia - 1) + " " + url
         Else
             message += " " + url
         End If

Modified: trunk/Tween/Connection/yfrog.vb
===================================================================
--- trunk/Tween/Connection/yfrog.vb	2011-10-15 13:51:32 UTC (rev 1631)
+++ trunk/Tween/Connection/yfrog.vb	2011-10-16 15:36:18 UTC (rev 1632)
@@ -83,8 +83,8 @@
                 url = xd.SelectSingleNode("/rsp/mediaurl").InnerText
             Catch ex As XmlException
                 Return "Err:" + ex.Message
-            Catch ex As NullReferenceException
-                Return "Err:Responce is null."
+            Catch ex As Exception
+                Return "Err:" + ex.Message
             End Try
         Else
             Return "Err:" + ret.ToString
@@ -95,8 +95,9 @@
         filePath = ""
         'Twitterへの投稿
         '投稿メッセージの再構成
-        If message.Length + url.Length + 1 > 140 Then
-            message = message.Substring(0, 140 - url.Length - 1) + " " + url
+        If String.IsNullOrEmpty(message) Then message = ""
+        If message.Length + AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia + 1 > 140 Then
+            message = message.Substring(0, 140 - AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia - 1) + " " + url
         Else
             message += " " + url
         End If

Modified: trunk/Tween/Resources/ChangeLog.txt
===================================================================
--- trunk/Tween/Resources/ChangeLog.txt	2011-10-15 13:51:32 UTC (rev 1631)
+++ trunk/Tween/Resources/ChangeLog.txt	2011-10-16 15:36:18 UTC (rev 1632)
@@ -2,7 +2,7 @@
 
 ==== Ver 1.1.0.0(2011/**/**)
  * NEW: 詳細表示のSource部分を右クリックしたときにSource、URLをコピーできるように
- * NEW: Growl対応 Growl for WindowsとC#/VB.NET用SDKに同梱されているGrowl.Connector.dll,Growl.CoreLibrary.dllが必要。
+ * NEW: Growl対応 Growl for WindowsとC#/VB.NET用SDKに同梱されているGrowl.Connector.dll,Growl.CoreLibrary.dllをTween.exeと同じフォルダに置く必要があります。
  * NEW: Favしていない発言がFavされていたり、またはその逆になっていることがあるTwitterのバグに対処。Favタブに発言が存在しない場合はFav扱いとしません。
  * CHG: Favタブでの「前データの取得」を機能するように
  * CHG: OS復帰時、または6時間ごとにTwitterから設定を取得するように

Modified: trunk/Tween/Tween.vb
===================================================================
--- trunk/Tween/Tween.vb	2011-10-15 13:51:32 UTC (rev 1631)
+++ trunk/Tween/Tween.vb	2011-10-16 15:36:18 UTC (rev 1632)
@@ -4217,9 +4217,10 @@
         '    pLen += m.Length - SettingDialog.TwitterConfiguration.ShortUrlLength
         'Next
         For Each m As Match In Regex.Matches(StatusText.Text, Twitter.rgUrl, RegexOptions.IgnoreCase)
-            If m.Result("${url}").Length > SettingDialog.TwitterConfiguration.ShortUrlLength Then
-                pLen += m.Result("${url}").Length - SettingDialog.TwitterConfiguration.ShortUrlLength
-            End If
+            pLen += m.Result("${url}").Length - SettingDialog.TwitterConfiguration.ShortUrlLength
+            'If m.Result("${url}").Length > SettingDialog.TwitterConfiguration.ShortUrlLength Then
+            '    pLen += m.Result("${url}").Length - SettingDialog.TwitterConfiguration.ShortUrlLength
+            'End If
         Next
         If ImageSelectionPanel.Visible AndAlso ImageSelectedPicture.Tag IsNot Nothing AndAlso Not String.IsNullOrEmpty(Me.ImageService) Then
             pLen -= SettingDialog.TwitterConfiguration.CharactersReservedPerMedia

Modified: trunk/Tween/Twitter.vb
===================================================================
--- trunk/Tween/Twitter.vb	2011-10-15 13:51:32 UTC (rev 1631)
+++ trunk/Tween/Twitter.vb	2011-10-16 15:36:18 UTC (rev 1632)
@@ -2462,7 +2462,7 @@
                     Long.TryParse(retweeted.InReplyToStatusId, post.InReplyToStatusId)
                     post.InReplyToUser = retweeted.InReplyToScreenName
                     Long.TryParse(retweeted.InReplyToUserId, post.InReplyToUserId)
-                    post.IsFav = retweeted.Favorited
+                    post.IsFav = True
 
                     '以下、ユーザー情報
                     Dim user As TwitterDataModel.User = retweeted.User
@@ -2487,7 +2487,7 @@
                     post.InReplyToUser = status.InReplyToScreenName
                     Long.TryParse(status.InReplyToUserId, post.InReplyToUserId)
 
-                    post.IsFav = status.Favorited
+                    post.IsFav = True
 
                     '以下、ユーザー情報
                     Dim user As TwitterDataModel.User = status.User



Tween-svn メーリングリストの案内
Back to archive index