OSDN Git Service

選択中のタブの名前を変更するとSelectedTabのgetterがエラーになる不具合を修正
[opentween/open-tween.git] / OpenTween / UserInfo.cs
1 // OpenTween - Client of Twitter
2 // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 //           (c) 2008-2011 Moz (@syo68k)
4 //           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 //           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 //           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 //           (c) 2011      Egtra (@egtra) <http://dev.activebasic.com/egtra/>
8 // All rights reserved.
9 // 
10 // This file is part of OpenTween.
11 // 
12 // This program is free software; you can redistribute it and/or modify it
13 // under the terms of the GNU General Public License as published by the Free
14 // Software Foundation; either version 3 of the License, or (at your option)
15 // any later version.
16 // 
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 // for more details. 
21 // 
22 // You should have received a copy of the GNU General Public License along
23 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
24 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25 // Boston, MA 02110-1301, USA.
26
27 #nullable enable
28
29 using System;
30 using System.Net;
31 using OpenTween.Api.DataModel;
32
33 namespace OpenTween
34 {
35     public class UserInfo
36     {
37         public UserInfo()
38         {
39         }
40
41         public UserInfo(TwitterUser user)
42         {
43             this.Id = user.Id;
44             this.Name = WebUtility.HtmlDecode(user.Name).Trim();
45             this.ScreenName = user.ScreenName;
46             this.Location = WebUtility.HtmlDecode(user.Location);
47             this.Description = WebUtility.HtmlDecode(user.Description);
48             try
49             {
50                 this.ImageUrl = new Uri(user.ProfileImageUrlHttps);
51             }
52             catch (Exception)
53             {
54                 this.ImageUrl = null;
55             }
56             this.Url = user.Url ?? "";
57             this.Protect = user.Protected;
58             this.FriendsCount = user.FriendsCount;
59             this.FollowersCount = user.FollowersCount;
60             this.CreatedAt = MyCommon.DateTimeParse(user.CreatedAt);
61             this.StatusesCount = user.StatusesCount;
62             this.Verified = user.Verified;
63             if (user.Status != null)
64             {
65                 this.RecentPost = user.Status.FullText;
66                 this.PostCreatedAt = MyCommon.DateTimeParse(user.Status.CreatedAt);
67                 this.PostSource = user.Status.Source;
68             }
69         }
70         public long Id = 0;
71         public string Name = "";
72         public string ScreenName = "";
73         public string Location = "";
74         public string Description = "";
75         public Uri? ImageUrl = null;
76         public string Url = "";
77         public bool Protect = false;
78         public int FriendsCount = 0;
79         public int FollowersCount = 0;
80         public int FavoriteCount = 0;
81         public DateTimeUtc CreatedAt;
82         public int StatusesCount = 0;
83         public bool Verified = false;
84         public string RecentPost = "";
85         public DateTimeUtc PostCreatedAt;
86         public string PostSource = "";        // html形式 "<a href="http://sourceforge.jp/projects/tween/wiki/FrontPage" rel="nofollow">Tween</a>"
87         public bool isFollowing = false;
88         public bool isFollowed = false;
89
90         public override string ToString()
91             => this.ScreenName + " / " + this.Name;
92     }
93 }