OSDN Git Service

Port Connection/yfrog.vb to C#, and modify items about Connection/TwitterPhoto.cs...
authorspinor <spinor2109@gmail.com>
Tue, 29 Nov 2011 07:14:27 +0000 (16:14 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Wed, 22 Feb 2012 10:50:52 +0000 (19:50 +0900)
Tween/Connection/yfrog.vb [deleted file]
Tween/Tween.vbproj
TweenCS/Connection/TwitVideo.cs
TweenCS/Connection/TwitterPhoto.cs
TweenCS/Connection/yfrog.cs [new file with mode: 0644]
TweenCS/TweenCS.csproj

diff --git a/Tween/Connection/yfrog.vb b/Tween/Connection/yfrog.vb
deleted file mode 100644 (file)
index dc3e532..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-' Tween - Client of Twitter
-' Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
-'           (c) 2008-2011 Moz (@syo68k)
-'           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
-'           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
-'           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
-' All rights reserved.
-' 
-' This file is part of Tween.
-' 
-' This program is free software; you can redistribute it and/or modify it
-' under the terms of the GNU General Public License as published by the Free
-' Software Foundation; either version 3 of the License, or (at your option)
-' any later version.
-' 
-' This program is distributed in the hope that it will be useful, but
-' WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-' or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-' for more details. 
-' 
-' You should have received a copy of the GNU General Public License along
-' with this program. If not, see <http://www.gnu.org/licenses/>, or write to
-' the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
-' Boston, MA 02110-1301, USA.
-
-Imports System.IO
-Imports System.Net
-Imports System.Xml
-
-Public Class yfrog
-    Inherits HttpConnectionOAuthEcho
-    Implements IMultimediaShareService
-
-    'OAuth関連
-    '''<summary>
-    '''OAuthのコンシューマー鍵
-    '''</summary>
-    Private Const ConsumerKey As String = "ST6eAABKDRKTqbN7pPo2A"
-
-    '''<summary>
-    '''OAuthの署名作成用秘密コンシューマーデータ
-    '''</summary>
-    Private Const ConsumerSecretKey As String = "BJMEiivrXlqGESzdb8D0bvLfNYf3fifXRDMFjMogXg"
-
-    Private Const ApiKey As String = "HIDP42ZO6314ee2218e2995662bad5ae320c32f1"
-    Private pictureExt() As String = {".jpg", _
-                                    ".jpeg", _
-                                    ".gif", _
-                                    ".png"}
-
-    Private Const MaxFileSize As Long = 5 * 1024 * 1024
-
-    Private tw As Twitter
-
-    Public Function Upload(ByRef filePath As String,
-                           ByRef message As String,
-                           ByVal reply_to As Long) As String Implements IMultimediaShareService.Upload
-        If String.IsNullOrEmpty(filePath) Then Return "Err:File isn't exists."
-        If String.IsNullOrEmpty(message) Then message = ""
-        'FileInfo作成
-        Dim mediaFile As FileInfo
-        Try
-            mediaFile = New FileInfo(filePath)
-        Catch ex As NotSupportedException
-            Return "Err:" + ex.Message
-        End Try
-        If mediaFile Is Nothing OrElse Not mediaFile.Exists Then Return "Err:File isn't exists."
-
-        Dim content As String = ""
-        Dim ret As HttpStatusCode
-        'yfrogへの投稿
-        Try
-            ret = UploadFile(mediaFile, message, content)
-        Catch ex As Exception
-            Return "Err:" + ex.Message
-        End Try
-        Dim url As String = ""
-        If ret = HttpStatusCode.OK Then
-            Dim xd As XmlDocument = New XmlDocument()
-            Try
-                xd.LoadXml(content)
-                'URLの取得
-                url = xd.SelectSingleNode("/rsp/mediaurl").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
-
-        If String.IsNullOrEmpty(url) Then url = ""
-        'アップロードまでは成功
-        filePath = ""
-        'Twitterへの投稿
-        '投稿メッセージの再構成
-        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
-        Return tw.PostStatus(message, 0)
-    End Function
-
-    Private Function UploadFile(ByVal mediaFile As FileInfo, _
-                       ByVal message As String, _
-                       ByRef content As String) As HttpStatusCode
-        'Message必須
-        If String.IsNullOrEmpty(message) Then message = ""
-        'Check filetype and size(Max 5MB)
-        If Not Me.CheckValidExtension(mediaFile.Extension) Then Throw New ArgumentException("Service don't support this filetype.")
-        If Not Me.CheckValidFilesize(mediaFile.Extension, mediaFile.Length) Then Throw New ArgumentException("File is too large.")
-
-        Dim param As New Dictionary(Of String, String)
-        param.Add("key", ApiKey)
-        param.Add("message", message)
-        Dim binary As New List(Of KeyValuePair(Of String, FileInfo))
-        binary.Add(New KeyValuePair(Of String, FileInfo)("media", mediaFile))
-        Me.InstanceTimeout = 60000 'タイムアウト60秒
-
-        Return GetContent(PostMethod, _
-                          New Uri("http://yfrog.com/api/xauth_upload"), _
-                          param, _
-                          binary, _
-                          content, _
-                          Nothing, _
-                          Nothing)
-    End Function
-
-    Public Function CheckValidExtension(ByVal ext As String) As Boolean Implements IMultimediaShareService.CheckValidExtension
-        If Array.IndexOf(pictureExt, ext.ToLower) > -1 Then
-            Return True
-        End If
-        Return False
-    End Function
-
-    Public Function GetFileOpenDialogFilter() As String Implements IMultimediaShareService.GetFileOpenDialogFilter
-        Return "Image Files(*.gif;*.jpg;*.jpeg;*.png)|*.gif;*.jpg;*.jpeg;*.png"
-    End Function
-
-    Public Function GetFileType(ByVal ext As String) As UploadFileType Implements IMultimediaShareService.GetFileType
-        If Me.CheckValidExtension(ext) Then
-            Return UploadFileType.Picture
-        End If
-        Return UploadFileType.Invalid
-    End Function
-
-    Public Function IsSupportedFileType(ByVal type As UploadFileType) As Boolean Implements IMultimediaShareService.IsSupportedFileType
-        Return type.Equals(UploadFileType.Picture)
-    End Function
-
-    Public Function CheckValidFilesize(ByVal ext As String, ByVal fileSize As Long) As Boolean Implements IMultimediaShareService.CheckValidFilesize
-        If Me.CheckValidExtension(ext) Then
-            Return fileSize <= MaxFileSize
-        End If
-        Return False
-    End Function
-
-    Public Sub New(ByVal twitter As Twitter)
-        MyBase.New(New Uri("http://api.twitter.com/"), _
-                   New Uri("https://api.twitter.com/1/account/verify_credentials.xml"))
-        tw = twitter
-        Initialize(ConsumerKey, ConsumerSecretKey, tw.AccessToken, tw.AccessTokenSecret, "", "")
-    End Sub
-
-    Public Function Configuration(key As String, value As Object) As Boolean Implements IMultimediaShareService.Configuration
-        Return True
-    End Function
-End Class
index 1fa30cb..8b8ec74 100644 (file)
     <Compile Include="Connection\Plixi.vb" />
     <Compile Include="Connection\TwitPic.vb" />
     <Compile Include="Connection\imgly.vb" />
-    <Compile Include="Connection\yfrog.vb" />
     <Compile Include="DataModel.vb" />
     <Compile Include="DetailsListView.vb">
       <SubType>Component</SubType>
     <PostBuildEvent>
     </PostBuildEvent>
   </PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
index 756707c..7fcd9cb 100644 (file)
@@ -24,6 +24,7 @@
 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
 // Boston, MA 02110-1301, USA.
 
+using HttpConnection = Tween.HttpConnection;
 using HttpStatusCode = System.Net.HttpStatusCode;
 using FileInfo = System.IO.FileInfo;
 using ArgumentException = System.ArgumentException;
@@ -33,106 +34,109 @@ using BitConverter = System.BitConverter;
 using System.Collections.Generic; // for Dictionary<TKey, TValue>, List<T>, KeyValuePair<TKey, TValue>
 using HttpWebRequest = System.Net.HttpWebRequest;
 using Uri = System.Uri;
-using UploadFileType = MyCommon.UploadFileType;
+using UploadFileType = Tween.MyCommon.UploadFileType;
 
-public class TwitVideo : HttpConnection
+namespace Tween
 {
-       private const string ConsumerKey = "7c4dc004a88e821b02c87a0cde2fa85c";
-
-       private string[] multimediaExt = new string[] { ".avi", ".wmv", ".flv", ".m4v", ".mov", ".mp4", ".rm", ".mpeg", ".mpg", ".3gp", ".3g2" };
+       public class TwitVideo : HttpConnection
+       {
+               private const string ConsumerKey = "7c4dc004a88e821b02c87a0cde2fa85c";
 
-       private string[] pictureExt = new string[] { ".jpg", ".jpeg", ".gif", ".png" };
+               private string[] multimediaExt = new string[] { ".avi", ".wmv", ".flv", ".m4v", ".mov", ".mp4", ".rm", ".mpeg", ".mpg", ".3gp", ".3g2" };
 
-       private const long MaxPictureFileSize = 10 * 1024 * 1024;
+               private string[] pictureExt = new string[] { ".jpg", ".jpeg", ".gif", ".png" };
 
-       private const long MaxMultiMediaFileSize = 20 * 1024 * 1024;
+               private const long MaxPictureFileSize = 10 * 1024 * 1024;
 
-       public HttpStatusCode Upload( FileInfo mediaFile, string message, string keyword, string username, string twitter_id, ref string content )
-       {
-               // Message必須
-               if ( string.IsNullOrEmpty( message ) )
-                       throw new ArgumentException( "'Message' is required." );
+               private const long MaxMultiMediaFileSize = 20 * 1024 * 1024;
 
-               // Check filetype and size
-               if ( Array.IndexOf( multimediaExt, mediaFile.Extension.ToLower ) > -1 )
-               {
-                       if ( mediaFile.Length > this.MaxMultiMediaFileSize )
-                               throw new ArgumentException( "File is too large." );
-               }
-               else if ( Array.IndexOf( pictureExt, mediaFile.Extension.ToLower ) > -1 )
-               {
-                       if ( mediaFile.Length > this.MaxPictureFileSize )
-                               throw new ArgumentException( "File is too large." );
-               }
-               else
+               public HttpStatusCode Upload( FileInfo mediaFile, string message, string keyword, string username, string twitter_id, ref string content )
                {
-                       throw new ArgumentException( "Service don't support this filetype." );
+                       // Message必須
+                       if ( string.IsNullOrEmpty( message ) )
+                               throw new ArgumentException( "'Message' is required." );
+
+                       // Check filetype and size
+                       if ( Array.IndexOf( multimediaExt, mediaFile.Extension.ToLower ) > -1 )
+                       {
+                               if ( mediaFile.Length > this.MaxMultiMediaFileSize )
+                                       throw new ArgumentException( "File is too large." );
+                       }
+                       else if ( Array.IndexOf( pictureExt, mediaFile.Extension.ToLower ) > -1 )
+                       {
+                               if ( mediaFile.Length > this.MaxPictureFileSize )
+                                       throw new ArgumentException( "File is too large." );
+                       }
+                       else
+                       {
+                               throw new ArgumentException( "Service don't support this filetype." );
+                       }
+
+                       // Endpoint(URI+Token)
+                       const string URLBASE = "http://api.twitvideo.jp/oauth/upload/";
+                       byte[] data = Encoding.ASCII.GetBytes( this.ConsumerKey.Substring( 0, 9 ) + username );
+                       byte[] dHash = ( new System.Security.Cryptography.MD5CryptoServiceProvider() ).ComputeHash( data );
+                       string url = URLBASE + BitConverter.ToString( bHash ).ToLower.Replace( "-", "" );
+
+                       // Parameters
+                       Dictionary< string, string > param = new Dictionary< string, string >();
+                       param.Add( "username", username );
+                       if ( !string.IsNullOrEmpty( twitter_id ) )
+                               param.Add( "twitter_id", twitter_id );
+                       if ( !string.IsNullOrEmpty( keyword ) )
+                               param.Add( "keyword", keyword );
+                       param.Add( "type", "xml" );
+                       param.Add( "message", message );
+                       List< KeyValuePair< string, FileInfo > > binary = new List< KeyValuePair< string, FileInfo > >();
+                       binary.Add( new KeyValuePair< string, FileInfo >( "media", mediaFile ) );
+                       this.InstanceTimeout = 60000; // タイムアウト60秒
+
+                       HttpWebRequest req = this.CreateRequest( HttpConnection.PostMethod, new Uri( url ), param, binary, false );
+                       return this.GetResponse( req, ref content, null, false );
                }
 
-               // Endpoint(URI+Token)
-               const string URLBASE = "http://api.twitvideo.jp/oauth/upload/";
-               byte[] data = Encoding.ASCII.GetBytes( this.ConsumerKey.Substring( 0, 9 ) + username );
-               byte[] dHash = ( new System.Security.Cryptography.MD5CryptoServiceProvider() ).ComputeHash( data );
-               string url = URLBASE + BitConverter.ToString( bHash ).ToLower.Replace( "-", "" );
-
-               // Parameters
-               Dictionary< string, string > param = new Dictionary< string, string >();
-               param.Add( "username", username );
-               if ( !string.IsNullOrEmpty( twitter_id ) )
-                       param.Add( "twitter_id", twitter_id );
-               if ( !string.IsNullOrEmpty( keyword ) )
-                       param.Add( "keyword", keyword );
-        param.Add( "type", "xml" );
-        param.Add( "message", message );
-               List< KeyValuePair< string, FileInfo > > binary = new List< KeyValuePair< string, FileInfo > >();
-               binary.Add( new KeyValuePair< string, FileInfo >( "media", mediaFile ) );
-               this.InstanceTimeout = 60000; // タイムアウト60秒
-
-               HttpWebRequest req = this.CreateRequest( HttpConnection.PostMethod, new Uri( url ), param, binary, false );
-               return this.GetResponse( req, ref content, null, false )
-       }
-
-       public bool CheckValidExtension( string ext )
-       {
-               if ( Array.IndexOf( this.pictureExt, ext.ToLower ) > -1 )
-                       return true;
+               public bool CheckValidExtension( string ext )
+               {
+                       if ( Array.IndexOf( this.pictureExt, ext.ToLower ) > -1 )
+                               return true;
 
-               if ( Array.IndexOf( this.multimediaExt, ext.ToLower ) > -1 )
-                       return true;
+                       if ( Array.IndexOf( this.multimediaExt, ext.ToLower ) > -1 )
+                               return true;
 
-               return false;
-       }
+                       return false;
+               }
 
-       UploadFileType GetFileType( string ext )
-       {
-               if ( Array.IndexOf( this.pictureExt, ext.ToLower ) > -1 )
-                       return UploadFileType.Picture;
+               UploadFileType GetFileType( string ext )
+               {
+                       if ( Array.IndexOf( this.pictureExt, ext.ToLower ) > -1 )
+                               return UploadFileType.Picture;
 
-               if ( Array.IndexOf( this.multimediaExt, ext.ToLower ) > -1 )
-                       return UploadFileType.MultiMedia;
+                       if ( Array.IndexOf( this.multimediaExt, ext.ToLower ) > -1 )
+                               return UploadFileType.MultiMedia;
 
-               return UploadFileType.Invalid;
-       }
+                       return UploadFileType.Invalid;
+               }
 
-       bool IsSupportedFileType( UploadFileType type )
-       {
-               return type.Equals( UploadFileType.Picture ) || type.Equals( UploadFileType.MultiMedia );
-       }
+               bool IsSupportedFileType( UploadFileType type )
+               {
+                       return type.Equals( UploadFileType.Picture ) || type.Equals( UploadFileType.MultiMedia );
+               }
 
-       long GetMaxFileSize( string ext )
-       {
-               if ( Array.IndexOf( this.pictureExt, ext.ToLower ) > -1 )
-                       return this.MaxPictureFileSize;
+               long GetMaxFileSize( string ext )
+               {
+                       if ( Array.IndexOf( this.pictureExt, ext.ToLower ) > -1 )
+                               return this.MaxPictureFileSize;
 
-               if ( Array.IndexOf( this.multimediaExt, ext.ToLower ) > -1 )
-                       return this.MaxMultiMediaFileSize;
+                       if ( Array.IndexOf( this.multimediaExt, ext.ToLower ) > -1 )
+                               return this.MaxMultiMediaFileSize;
 
-               return -1;
-       }
+                       return -1;
+               }
 
-       string GetFileOpenDialogFilter()
-       {
-               return "Image Files(*.gif;*.jpg;*.jpeg;*.png)|*.gif;*.jpg;*.jpeg;*.png|"
+               string GetFileOpenDialogFilter()
+               {
+                       return "Image Files(*.gif;*.jpg;*.jpeg;*.png)|*.gif;*.jpg;*.jpeg;*.png|"
                        + "Movie Files(*.avi;*.wmv;*.flv;*.m4v;*.mov;*.mp4;*.rm;*.mpeg;*.mpg;*.3gp;*.3g2)|*.avi;*.wmv;*.flv;*.m4v;*.mov;*.mp4;*.rm;*.mpeg;*.mpg;*.3gp;*.3g2";
+               }
        }
 }
index 7e256ba..e6d58f5 100644 (file)
 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
 // Boston, MA 02110-1301, USA.
 
+using IMultimediaShareService = Tween.IMultimediaShareService;
 using Array = System.Array;
 using Convert = System.Convert;
+using UploadFileType = Tween.MyCommon.UploadFileType;
+using MyCommon = Tween.MyCommon;
 using FileInfo = System.IO.FileInfo;
 
-public class TwitterPhoto : IMultimediaShareService
+namespace Tween
 {
-       private string[] pictureExt = new string[] { ".jpg", ".jpeg", ".gif", ".png" };
+       public class TwitterPhoto : IMultimediaShareService
+       {
+               private string[] pictureExt = new string[] { ".jpg", ".jpeg", ".gif", ".png" };
 
-       private const long MaxfilesizeDefault = 3145728;
+               private const long MaxfilesizeDefault = 3145728;
 
-       // help/configurationにより取得されコンストラクタへ渡される
-       private long _MaxFileSize = 3145728;
+               // help/configurationにより取得されコンストラクタへ渡される
+               private long _MaxFileSize = 3145728;
 
-       private Twitter tw;
+               private Twitter tw;
 
-       public bool CheckValidExtension( string ext )
-       {
-               if ( Array.IndexOf( this.pictureExt, ext.ToLower() ) > -1 )
-                       return true;
+               public bool CheckValidExtension( string ext )
+               {
+                       if ( Array.IndexOf( this.pictureExt, ext.ToLower() ) > -1 )
+                               return true;
 
-               return false;
-       }
+                       return false;
+               }
 
-       public bool CheckValidFilesize( string ext, long fileSize )
-       {
-               if ( this.CheckValidExtension( ext ) )
-                       return fileSize <= this._MaxFileSize;
+               public bool CheckValidFilesize( string ext, long fileSize )
+               {
+                       if ( this.CheckValidExtension( ext ) )
+                               return fileSize <= this._MaxFileSize;
 
-               return false;
-       }
+                       return false;
+               }
 
-       public bool Configuration( string key, object value )
-       {
-               if ( key == "MaxUploadFilesize" )
+               public bool Configuration( string key, object value )
                {
-                       long val;
-                       try
+                       if ( key == "MaxUploadFilesize" )
                        {
-                               val = Convert.ToInt64( value );
-                               if ( val > 0 )
-                                       this._MaxFileSize = val;
-                               else
+                               long val;
+                               try
+                               {
+                                       val = Convert.ToInt64( value );
+                                       if ( val > 0 )
+                                               this._MaxFileSize = val;
+                                       else
                                        this._MaxFileSize = this.MaxfilesizeDefault;
+                               }
+                               catch ( Exception ex )
+                               {
+                                       this._MaxFileSize = this.MaxfilesizeDefault;
+                                       return false; // error
+                               }
+                               return true; // 正常に設定終了
                        }
-                       catch ( Exception ex )
-                       {
-                               this._MaxFileSize = this.MaxfilesizeDefault;
-                               return false; // error
-                       }
-                       return true; // 正常に設定終了
+                       return true; // 設定項目がない場合はとりあえずエラー扱いにしない
                }
-               return true; // 設定項目がない場合はとりあえずエラー扱いにしない
-       }
-
-       public string GetFileOpenDialogFilter()
-       {
-               return "Image Files(*.gif;*.jpg;*.jpeg;*.png)|*.gif;*.jpg;*.jpeg;*.png";
-       }
-
-       public MyCommon.UploadFileType GetFileType( string ext )
-       {
-               if ( this.CheckValidExtension( ext ) )
-                       return UploadFileType.Picture;
-
-               return UploadFileType.Invalid;
-       }
 
-       public bool IsSupportedFileType( MyCommon.UploadFileType type )
-       {
-               return type.Equals( UploadFileType.Picture );
-       }
+               public string GetFileOpenDialogFilter()
+               {
+                       return "Image Files(*.gif;*.jpg;*.jpeg;*.png)|*.gif;*.jpg;*.jpeg;*.png";
+               }
 
-       public string Upload( ref string filePath, ref string message, long reply_to )
-       {
-               if ( string.IsNullOrEmpty( filePath ) )
-                       return "Err:File isn't specified.";
+               public UploadFileType GetFileType( string ext )
+               {
+                       if ( this.CheckValidExtension( ext ) )
+                               return UploadFileType.Picture;
 
-               if ( string.IsNullOrEmpty( message ) )
-                       message =  "";
+                       return UploadFileType.Invalid;
+               }
 
-               FileInfo mediaFile;
-               try
+               public bool IsSupportedFileType( UploadFileType type )
                {
-                       mediaFile = new FileInfo( filePath );
+                       return type.Equals( UploadFileType.Picture );
                }
-               catch ( NotSupportedException ex )
+
+               public string Upload( ref string filePath, ref string message, long reply_to )
                {
-                       return "Err:" + ex.Message;
-               }
+                       if ( string.IsNullOrEmpty( filePath ) )
+                               return "Err:File isn't specified.";
 
-               if ( !mediaFile.Exists )
-                       return "Err:File isn't exists.";
+                       if ( string.IsNullOrEmpty( message ) )
+                               message =  "";
 
-               if ( MyCommon.IsAnimatedGif( filePath ) )
-                       return "Err:Don't support animatedGIF.";
+                       FileInfo mediaFile;
+                       try
+                       {
+                               mediaFile = new FileInfo( filePath );
+                       }
+                       catch ( NotSupportedException ex )
+                       {
+                               return "Err:" + ex.Message;
+                       }
 
-               return tw.PostStatusWithMedia( message, reply_to, mediaFile );
-       }
+                       if ( !mediaFile.Exists )
+                               return "Err:File isn't exists.";
 
-       public void New( Twitter twitter )
-       {
-               this.tw = twitter;
+                       if ( MyCommon.IsAnimatedGif( filePath ) )
+                               return "Err:Don't support animatedGIF.";
+
+                       return tw.PostStatusWithMedia( message, reply_to, mediaFile );
+               }
+
+               public TwitterPhoto( Twitter twitter )
+               {
+                       this.tw = twitter;
+               }
        }
 }
diff --git a/TweenCS/Connection/yfrog.cs b/TweenCS/Connection/yfrog.cs
new file mode 100644 (file)
index 0000000..c31266b
--- /dev/null
@@ -0,0 +1,200 @@
+// OpenTween - Client of Twitter\r
+// Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>\r
+//           (c) 2008-2011 Moz (@syo68k)\r
+//           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>\r
+//           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>\r
+//           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>\r
+//           (c) 2011      spinor (@tplantd) <http://d.hatena.ne.jp/spinor/>\r
+// All rights reserved.\r
+// \r
+// This file is part of OpenTween.\r
+// \r
+// This program is free software; you can redistribute it and/or modify it\r
+// under the terms of the GNU General Public License as published by the Free\r
+// Software Foundation; either version 3 of the License, or (at your option)\r
+// any later version.\r
+// \r
+// This program is distributed in the hope that it will be useful, but\r
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\r
+// for more details. \r
+// \r
+// You should have received a copy of the GNU General Public License along\r
+// with this program. If not, see <http://www.gnu.org/licenses/>, or write to\r
+// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,\r
+// Boston, MA 02110-1301, USA.\r
+\r
+using HttpConnectionOAuthEcho = Tween.HttpConnectionOAuthEcho;\r
+using IMultimediaShareService = Tween.IMultimediaShareService;\r
+using FileInfo = System.IO.FileInfo;\r
+using NotSupportedException = System.NotSupportedException;\r
+using HttpStatusCode = System.Net.HttpStatusCode;\r
+using Exception = System.Exception;\r
+using XmlDocument = System.Xml.XmlDocument;\r
+using XmlException = System.Xml.XmlException;\r
+using ArgumentException = System.ArgumentException;\r
+using System.Collections.Generic; // for Dictionary<TKey, TValue>, List<T>, KeyValuePair<TKey, TValue>\r
+using Uri = System.Uri;\r
+using Array = System.Array;\r
+using UploadFileType = Tween.MyCommon.UploadFileType;\r
+\r
+namespace Tween\r
+{\r
+       public class yfrog : HttpConnectionOAuthEcho, IMultimediaShareService\r
+       {\r
+               // OAuth\8aÖ\98A\r
+\r
+               /// <summary>\r
+               /// OAuth\82Ì\83R\83\93\83V\83\85\81[\83}\81[\8c®\r
+               /// </summary>\r
+               private const string ConsumerKey = "ST6eAABKDRKTqbN7pPo2A";\r
+\r
+               /// <summary>\r
+               /// OAuth\82Ì\8f\90\96¼\8dì\90¬\97p\94é\96§\83R\83\93\83V\83\85\81[\83}\81[\83f\81[\83^\r
+               /// </summary><summary>\r
+               private const string ConsumerSecretKey = "BJMEiivrXlqGESzdb8D0bvLfNYf3fifXRDMFjMogXg";\r
+\r
+               private const string ApiKey = "HIDP42ZO6314ee2218e2995662bad5ae320c32f1";\r
+\r
+               private string[] pictureExt = new string[] { ".jpg", ".jpeg", ".gif", ".png" };\r
+\r
+               private const long MaxFileSize = 5 * 1024 * 1024;\r
+\r
+               private Twitter tw;\r
+\r
+               public string Upload( ref string filePath, ref string message, long reply_to )\r
+               {\r
+                       if ( string.IsNullOrEmpty( filePath ) )\r
+                               return "Err:File isn't exists.";\r
+                       if ( string.IsNullOrEmpty( message ) )\r
+                               message = "";\r
+\r
+                       // FileInfo\8dì\90¬\r
+                       FileInfo mediaFile;\r
+                       try\r
+                       {\r
+                               mediaFile = new FileInfo( filePath );\r
+                       }\r
+                       catch ( NotSupportedException ex )\r
+                       {\r
+                               return "Err:" + ex.Message;\r
+                       }\r
+                       if ( mediaFile == null || !mediaFile.Exists )\r
+                               return "Err:File isn't exists.";\r
+\r
+                       string content = "";\r
+                       HttpStatusCode ret;\r
+                       // yfrog\82Ö\82Ì\93\8a\8de\r
+                       try\r
+                       {\r
+                               ret = this.UploadFile( mediaFile, message, ref content );\r
+                       }\r
+                       catch ( Exception ex )\r
+                       {\r
+                               return "Err:" + ex.Message;\r
+                       }\r
+                       string url = "";\r
+                       if ( ret == HttpStatusCode.OK )\r
+                       {\r
+                               XmlDocument xd = new XmlDocument();\r
+                               try\r
+                               {\r
+                                       xd.LoadXml( content );\r
+                                       // URL\82Ì\8eæ\93¾\r
+                                       url = xd.SelectSingleNode( "/rsp/mediaurl" ).InnerText\r
+                                       }\r
+                               catch ( XmlException ex )\r
+                               {\r
+                                       return "Err:" + ex.Message;\r
+                               }\r
+                               catch ( Exception ex )\r
+                               {\r
+                                       return "Err:" + ex.Message;\r
+                               }\r
+                       }\r
+                       else\r
+                       return "Err:" + ret.ToString;\r
+\r
+                       if ( string.IsNullOrEmpty( url ) )\r
+                               url = "";\r
+                       // \83A\83b\83v\83\8d\81[\83h\82Ü\82Å\82Í\90¬\8c÷\r
+                       filePath = "";\r
+                       // Twitter\82Ö\82Ì\93\8a\8de\r
+                       // \93\8a\8de\83\81\83b\83Z\81[\83W\82Ì\8dÄ\8d\\90¬\r
+                       if ( string.IsNullOrEmpty( message ) )\r
+                               message = "";\r
+                       if ( message.Length + AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia + 1 > 140 )\r
+                               message = message.Substring(0, 140 - AppendSettingDialog.Instance.TwitterConfiguration.CharactersReservedPerMedia - 1) + " " + url;\r
+                       else\r
+                       message += " " + url;\r
+                       return this.tw.PostStatus( message, 0 );\r
+               }\r
+\r
+               private HttpStatusCode UploadFile( FileInfo mediaFile, string message, ref string content )\r
+               {\r
+                       // Message\95K\90{\r
+                       if ( string.IsNullOrEmpty( message ) )\r
+                               message = "";\r
+                       // Check filetype and size(Max 5MB)\r
+                       if ( !this.CheckValidExtension( mediaFile.Extension ) )\r
+                               throw new ArgumentException( "Service don't support this filetype." );\r
+                       if ( !this.CheckValidFilesize( mediaFile.Extension, mediaFile.Length ) )\r
+                               throw new ArgumentException( "File is too large." );\r
+\r
+                       Dictionary< string, string > param = new Dictionary< string, string >();\r
+                       param.Add( "key", this.ApiKey );\r
+                       param.Add( "message", message );\r
+                       List< KeyValuePair< string, FileInfo > > binary = List< KeyValuePair< string, FileInfo > >();\r
+                       binary.Add( new KeyValuePair< string, FileInfo >( "media", mediaFile ) );\r
+                       this.InstanceTimeout = 60000; // \83^\83C\83\80\83A\83E\83g60\95b\r
+\r
+                       return this.GetContent( HttpConnection.PostMethod, new Uri( "http://yfrog.com/api/xauth_upload" ), param, binary, content, null, null );\r
+               }\r
+\r
+               public bool CheckValidExtension( string ext )\r
+               {\r
+                       if ( Array.IndexOf( this.pictureExt, ext.ToLower ) > -1 )\r
+                               return true;\r
+\r
+                       return false;\r
+               }\r
+\r
+               public string GetFileOpenDialogFilter()\r
+               {\r
+                       return "Image Files(*.gif;*.jpg;*.jpeg;*.png)|*.gif;*.jpg;*.jpeg;*.png";\r
+               }\r
+\r
+               public UploadFileType GetFileType( string ext )\r
+               {\r
+                       if ( this.CheckValidExtension( ext ) )\r
+                               return UploadFileType.Picture;\r
+\r
+                       return UploadFileType.Invalid;\r
+               }\r
+\r
+               public bool IsSupportedFileType( UploadFileType type )\r
+               {\r
+                       return type.Equals( UploadFileType.Picture );\r
+               }\r
+\r
+               public bool CheckValidFilesize( string ext, long fileSize )\r
+               {\r
+                       if ( this.CheckValidExtension( ext ) )\r
+                               return fileSize <= this.MaxFileSize;\r
+\r
+                       return false;\r
+               }\r
+\r
+               public yfrog( Twitter twitter )\r
+                       : base( new Uri( "http://api.twitter.com/" ), new Uri( "https://api.twitter.com/1/account/verify_credentials.xml" ) )\r
+               {\r
+                       this.tw = twitter;\r
+                       this.Initialize( this.ConsumerKey, this.ConsumerSecretKey, this.tw.AccessToken, this.tw.AccessTokenSecret, "", "");\r
+               }\r
+\r
+               public bool Configuration( string key, object value )\r
+               {\r
+                       return true;\r
+               }\r
+       }\r
+}\r
index 4361790..a48816d 100644 (file)
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.30703</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{3D8995C7-BDF3-4273-9F9D-DDD902F6A101}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Tween</RootNamespace>
-    <AssemblyName>TweenCS</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="Microsoft.VisualBasic" />
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="System.Runtime.Serialization" />
-    <Reference Include="System.Web" />
-    <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="ApiInformation.cs" />
-    <Compile Include="Connection\IHttpConnection.cs" />
-    <Compile Include="Connection\IMultimediaShareService.cs" />
-    <Compile Include="Connection\TwitterPhoto.cs" />
-    <Compile Include="Connection\TwitVideo.cs" />
-    <Compile Include="MyCommon.cs" />
-    <Compile Include="OpenURL.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="OpenURL.Designer.cs">
-      <DependentUpon>OpenURL.cs</DependentUpon>
-    </Compile>
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Properties\Resources.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DesignTime>True</DesignTime>
-      <DependentUpon>Resources.resx</DependentUpon>
-    </Compile>
-    <Compile Include="SearchWord.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="SearchWord.Designer.cs">
-      <DependentUpon>SearchWord.cs</DependentUpon>
-    </Compile>
-    <Compile Include="ToolStripAPIGauge.cs">
-      <SubType>Component</SubType>
-    </Compile>
-    <Compile Include="TweenAboutBox.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="TweenAboutBox.Designer.cs">
-      <DependentUpon>TweenAboutBox.cs</DependentUpon>
-    </Compile>
-    <Compile Include="ToolStripLabelHistory.cs">
-      <SubType>Component</SubType>
-    </Compile>
-    <Compile Include="WebBrowserController.cs" />
-    <Compile Include="Win32Api.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Connection\HttpConnection.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <EmbeddedResource Include="OpenURL.en.resx">
-      <DependentUpon>OpenURL.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="OpenURL.resx">
-      <DependentUpon>OpenURL.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="OpenURL.zh-CHS.resx">
-      <DependentUpon>OpenURL.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Properties\Resources.resx">
-      <Generator>ResXFileCodeGenerator</Generator>
-      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Properties\Resources.en.resx" />
-    <EmbeddedResource Include="Properties\Resources.zh-CHS.resx" />
-    <EmbeddedResource Include="SearchWord.en.resx">
-      <DependentUpon>SearchWord.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="SearchWord.resx">
-      <DependentUpon>SearchWord.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="SearchWord.zh-CHS.resx">
-      <DependentUpon>SearchWord.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="TweenAboutBox.en.resx">
-      <DependentUpon>TweenAboutBox.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="TweenAboutBox.resx">
-      <DependentUpon>TweenAboutBox.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="TweenAboutBox.zh-CHS.resx">
-      <DependentUpon>TweenAboutBox.cs</DependentUpon>
-    </EmbeddedResource>
-  </ItemGroup>
-  <ItemGroup />
-  <ItemGroup>
-    <Content Include="Resources\5g.ico" />
-    <Content Include="Resources\6g.ico" />
-    <Content Include="Resources\ads.txt" />
-    <Content Include="Resources\ChangeLog.txt" />
-    <Content Include="Resources\Description.txt" />
-    <Content Include="Resources\S0.ico" />
-    <Content Include="Resources\S1.ico" />
-    <Content Include="Resources\S10.ico" />
-    <Content Include="Resources\S11.ico" />
-    <Content Include="Resources\S12.ico" />
-    <Content Include="Resources\S13.ico" />
-    <Content Include="Resources\S14.ico" />
-    <Content Include="Resources\S2.ico" />
-    <Content Include="Resources\S3.ico" />
-    <Content Include="Resources\S4.ico" />
-    <Content Include="Resources\S5.ico" />
-    <Content Include="Resources\S6.ico" />
-    <Content Include="Resources\S7.ico" />
-    <Content Include="Resources\S8.ico" />
-    <Content Include="Resources\S9.ico" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>8.0.30703</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{3D8995C7-BDF3-4273-9F9D-DDD902F6A101}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>Tween</RootNamespace>\r
+    <AssemblyName>TweenCS</AssemblyName>\r
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <Optimize>false</Optimize>\r
+    <OutputPath>bin\Debug\</OutputPath>\r
+    <DefineConstants>DEBUG;TRACE</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <Optimize>true</Optimize>\r
+    <OutputPath>bin\Release\</OutputPath>\r
+    <DefineConstants>TRACE</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <Reference Include="Microsoft.VisualBasic" />\r
+    <Reference Include="System" />\r
+    <Reference Include="System.Core" />\r
+    <Reference Include="System.Drawing" />\r
+    <Reference Include="System.Runtime.Serialization" />\r
+    <Reference Include="System.Web" />\r
+    <Reference Include="System.Windows.Forms" />\r
+    <Reference Include="System.Xml.Linq" />\r
+    <Reference Include="System.Data.DataSetExtensions" />\r
+    <Reference Include="Microsoft.CSharp" />\r
+    <Reference Include="System.Data" />\r
+    <Reference Include="System.Xml" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Compile Include="ApiInformation.cs" />\r
+    <Compile Include="Connection\IHttpConnection.cs" />\r
+    <Compile Include="Connection\IMultimediaShareService.cs" />\r
+    <Compile Include="Connection\TwitterPhoto.cs" />\r
+    <Compile Include="Connection\TwitVideo.cs" />\r
+    <Compile Include="Connection\yfrog.cs" />\r
+    <Compile Include="MyCommon.cs" />\r
+    <Compile Include="OpenURL.cs">\r
+      <SubType>Form</SubType>\r
+    </Compile>\r
+    <Compile Include="OpenURL.Designer.cs">\r
+      <DependentUpon>OpenURL.cs</DependentUpon>\r
+    </Compile>\r
+    <Compile Include="Properties\AssemblyInfo.cs" />\r
+    <Compile Include="Properties\Resources.Designer.cs">\r
+      <AutoGen>True</AutoGen>\r
+      <DesignTime>True</DesignTime>\r
+      <DependentUpon>Resources.resx</DependentUpon>\r
+    </Compile>\r
+    <Compile Include="SearchWord.cs">\r
+      <SubType>Form</SubType>\r
+    </Compile>\r
+    <Compile Include="SearchWord.Designer.cs">\r
+      <DependentUpon>SearchWord.cs</DependentUpon>\r
+    </Compile>\r
+    <Compile Include="ToolStripAPIGauge.cs">\r
+      <SubType>Component</SubType>\r
+    </Compile>\r
+    <Compile Include="TweenAboutBox.cs">\r
+      <SubType>Form</SubType>\r
+    </Compile>\r
+    <Compile Include="TweenAboutBox.Designer.cs">\r
+      <DependentUpon>TweenAboutBox.cs</DependentUpon>\r
+    </Compile>\r
+    <Compile Include="ToolStripLabelHistory.cs">\r
+      <SubType>Component</SubType>\r
+    </Compile>\r
+    <Compile Include="WebBrowserController.cs" />\r
+    <Compile Include="Win32Api.cs" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Compile Include="Connection\HttpConnection.cs" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <EmbeddedResource Include="OpenURL.en.resx">\r
+      <DependentUpon>OpenURL.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="OpenURL.resx">\r
+      <DependentUpon>OpenURL.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="OpenURL.zh-CHS.resx">\r
+      <DependentUpon>OpenURL.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="Properties\Resources.resx">\r
+      <Generator>ResXFileCodeGenerator</Generator>\r
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="Properties\Resources.en.resx" />\r
+    <EmbeddedResource Include="Properties\Resources.zh-CHS.resx" />\r
+    <EmbeddedResource Include="SearchWord.en.resx">\r
+      <DependentUpon>SearchWord.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="SearchWord.resx">\r
+      <DependentUpon>SearchWord.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="SearchWord.zh-CHS.resx">\r
+      <DependentUpon>SearchWord.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="TweenAboutBox.en.resx">\r
+      <DependentUpon>TweenAboutBox.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="TweenAboutBox.resx">\r
+      <DependentUpon>TweenAboutBox.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+    <EmbeddedResource Include="TweenAboutBox.zh-CHS.resx">\r
+      <DependentUpon>TweenAboutBox.cs</DependentUpon>\r
+    </EmbeddedResource>\r
+  </ItemGroup>\r
+  <ItemGroup />\r
+  <ItemGroup>\r
+    <Content Include="Resources\5g.ico" />\r
+    <Content Include="Resources\6g.ico" />\r
+    <Content Include="Resources\ads.txt" />\r
+    <Content Include="Resources\ChangeLog.txt" />\r
+    <Content Include="Resources\Description.txt" />\r
+    <Content Include="Resources\S0.ico" />\r
+    <Content Include="Resources\S1.ico" />\r
+    <Content Include="Resources\S10.ico" />\r
+    <Content Include="Resources\S11.ico" />\r
+    <Content Include="Resources\S12.ico" />\r
+    <Content Include="Resources\S13.ico" />\r
+    <Content Include="Resources\S14.ico" />\r
+    <Content Include="Resources\S2.ico" />\r
+    <Content Include="Resources\S3.ico" />\r
+    <Content Include="Resources\S4.ico" />\r
+    <Content Include="Resources\S5.ico" />\r
+    <Content Include="Resources\S6.ico" />\r
+    <Content Include="Resources\S7.ico" />\r
+    <Content Include="Resources\S8.ico" />\r
+    <Content Include="Resources\S9.ico" />\r
+  </ItemGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
   </Target>
   <Target Name="AfterBuild">
   </Target>
-  -->
+  -->\r
 </Project>
\ No newline at end of file