OSDN Git Service

Port UserInfo.vb to C#
authorEgtra <yusuke.ichinohe@gmail.com>
Tue, 29 Nov 2011 16:40:04 +0000 (01:40 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Wed, 22 Feb 2012 10:47:44 +0000 (19:47 +0900)
Tween/Tween.vbproj
Tween/UserInfo.vb [deleted file]
TweenCS/TweenCS.csproj
TweenCS/UserInfo.cs [new file with mode: 0644]

index cd51aa8..72b1c15 100644 (file)
     </Compile>
     <Compile Include="FavoriteQueue.vb" />
     <Compile Include="Twitter.vb" />
-    <Compile Include="UserInfo.vb" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="AppendSettingDialog.en.resx">
diff --git a/Tween/UserInfo.vb b/Tween/UserInfo.vb
deleted file mode 100644 (file)
index 66bc974..0000000
+++ /dev/null
@@ -1,80 +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.
-
-Public Class UserInfo
-    Public Sub New()
-
-    End Sub
-
-    Public Sub New(ByVal user As TwitterDataModel.User)
-        Me.Id = user.Id
-        Me.Name = user.Name.Trim()
-        Me.ScreenName = user.ScreenName
-        Me.Location = user.Location
-        Me.Description = user.Description
-        Try
-            Me.ImageUrl = New Uri(user.ProfileImageUrl)
-        Catch ex As Exception
-            Me.ImageUrl = Nothing
-        End Try
-        Me.Url = user.Url
-        Me.Protect = user.Protected
-        Me.FriendsCount = user.FriendsCount
-        Me.FollowersCount = user.FollowersCount
-        Me.CreatedAt = DateTimeParse(user.CreatedAt)
-        Me.StatusesCount = user.StatusesCount
-        Me.Verified = user.Verified
-        Me.isFollowing = Me.isFollowing
-        If user.Status IsNot Nothing Then
-            Me.RecentPost = user.Status.Text
-            Me.PostCreatedAt = DateTimeParse(user.Status.CreatedAt)
-            Me.PostSource = user.Status.Source
-        End If
-    End Sub
-
-    Public Id As Int64 = 0
-    Public Name As String = ""
-    Public ScreenName As String = ""
-    Public Location As String = ""
-    Public Description As String = ""
-    Public ImageUrl As Uri = Nothing
-    Public Url As String = ""
-    Public Protect As Boolean = False
-    Public FriendsCount As Integer = 0
-    Public FollowersCount As Integer = 0
-    Public FavoriteCount As Integer = 0
-    Public CreatedAt As New DateTime
-    Public StatusesCount As Integer = 0
-    Public Verified As Boolean = False
-    Public RecentPost As String = ""
-    Public PostCreatedAt As New DateTime
-    Public PostSource As String = ""        ' html形式 "<a href="http://sourceforge.jp/projects/tween/wiki/FrontPage" rel="nofollow">Tween</a>"
-    Public isFollowing As Boolean = False
-    Public isFollowed As Boolean = False
-
-    Public Overrides Function ToString() As String
-        Return Me.ScreenName + " / " + Me.Name
-    End Function
-End Class
\ No newline at end of file
index c257a9b..b3c7bf7 100644 (file)
@@ -80,6 +80,7 @@
     <Compile Include="ToolStripLabelHistory.cs">
       <SubType>Component</SubType>
     </Compile>
+    <Compile Include="UserInfo.cs" />
     <Compile Include="WebBrowserController.cs" />
     <Compile Include="Win32Api.cs" />
   </ItemGroup>
diff --git a/TweenCS/UserInfo.cs b/TweenCS/UserInfo.cs
new file mode 100644 (file)
index 0000000..5ffe68d
--- /dev/null
@@ -0,0 +1,92 @@
+// 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>
+//           (c) 2011      Egtra (@egtra) <http://dev.activebasic.com/egtra/>
+// 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.
+
+using System;
+
+namespace Tween
+{
+    public class UserInfo
+    {
+        public UserInfo()
+        {
+        }
+
+        public UserInfo(TwitterDataModel.User user)
+        {
+            this.Id = user.Id;
+            this.Name = user.Name.Trim();
+            this.ScreenName = user.ScreenName;
+            this.Location = user.Location;
+            this.Description = user.Description;
+            try
+            {
+                this.ImageUrl = new Uri(user.ProfileImageUrl);
+            }
+            catch (Exception)
+            {
+                this.ImageUrl = null;
+            }
+            this.Url = user.Url;
+            this.Protect = user.Protected;
+            this.FriendsCount = user.FriendsCount;
+            this.FollowersCount = user.FollowersCount;
+            this.CreatedAt = MyCommon.DateTimeParse(user.CreatedAt);
+            this.StatusesCount = user.StatusesCount;
+            this.Verified = user.Verified;
+            this.isFollowing = this.isFollowing; // egtra: 元(VB.NET)のコードの時点でこのように自己から自己への代入であった
+            if (user.Status != null)
+            {
+                this.RecentPost = user.Status.Text;
+                this.PostCreatedAt = MyCommon.DateTimeParse(user.Status.CreatedAt);
+                this.PostSource = user.Status.Source;
+            }
+        }
+        public Int64 Id = 0;
+        public string Name = "";
+        public string ScreenName = "";
+        public string Location = "";
+        public string Description = "";
+        public Uri ImageUrl = null;
+        public string Url = "";
+        public bool Protect = false;
+        public int FriendsCount = 0;
+        public int FollowersCount = 0;
+        public int FavoriteCount = 0;
+        public DateTime CreatedAt = new DateTime();
+        public int StatusesCount = 0;
+        public bool Verified = false;
+        public string RecentPost = "";
+        public DateTime PostCreatedAt = new DateTime();
+        public string PostSource = "";        // html形式 "<a href="http://sourceforge.jp/projects/tween/wiki/FrontPage" rel="nofollow">Tween</a>"
+        public bool isFollowing = false;
+        public bool isFollowed = false;
+
+        public override string ToString()
+        {
+            return this.ScreenName + " / " + this.Name;
+        }
+    }
+}