OSDN Git Service

簡易アカウント切り替え
[opentween/open-tween.git] / Tween / Setting / SettingCommon.vb
1 ' Tween - 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 ' All rights reserved.
8
9 ' This file is part of Tween.
10
11 ' This program is free software; you can redistribute it and/or modify it
12 ' under the terms of the GNU General Public License as published by the Free
13 ' Software Foundation; either version 3 of the License, or (at your option)
14 ' any later version.
15
16 ' This program is distributed in the hope that it will be useful, but
17 ' WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 ' or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 ' for more details. 
20
21 ' You should have received a copy of the GNU General Public License along
22 ' with this program. If not, see <http://www.gnu.org/licenses/>, or write to
23 ' the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
24 ' Boston, MA 02110-1301, USA.
25
26 <Serializable()> _
27 Public Class SettingCommon
28     Inherits SettingBase(Of SettingCommon)
29
30 #Region "Settingクラス基本"
31     Public Shared Function Load() As SettingCommon
32         Return LoadSettings()
33     End Function
34
35     Public Sub Save()
36         SaveSettings(Me)
37     End Sub
38 #End Region
39
40     Public UserAccounts As List(Of UserAccount)
41     Public UserName As String = ""
42
43     <Xml.Serialization.XmlIgnore()> _
44     Public Password As String = ""
45     Public Property EncryptPassword() As String
46         Get
47             Return Encrypt(Password)
48         End Get
49         Set(ByVal value As String)
50             Password = Decrypt(value)
51         End Set
52     End Property
53
54     Public Token As String = ""
55     <Xml.Serialization.XmlIgnore()> _
56     Public TokenSecret As String = ""
57     Public Property EncryptTokenSecret() As String
58         Get
59             Return Encrypt(TokenSecret)
60         End Get
61         Set(ByVal value As String)
62             TokenSecret = Decrypt(value)
63         End Set
64     End Property
65
66     Private Function Encrypt(ByVal password As String) As String
67         If String.IsNullOrEmpty(password) Then password = ""
68         If password.Length > 0 Then
69             Try
70                 Return EncryptString(password)
71             Catch ex As Exception
72                 Return ""
73             End Try
74         Else
75             Return ""
76         End If
77     End Function
78     Private Function Decrypt(ByVal password As String) As String
79         If String.IsNullOrEmpty(password) Then password = ""
80         If password.Length > 0 Then
81             Try
82                 password = DecryptString(password)
83             Catch ex As Exception
84                 password = ""
85             End Try
86         End If
87         Return password
88     End Function
89
90     Public UserId As Long = 0
91     Public TabList As New List(Of String)
92     Public TimelinePeriod As Integer = 90
93     Public ReplyPeriod As Integer = 180
94     Public DMPeriod As Integer = 600
95     Public PubSearchPeriod As Integer = 180
96     Public ListsPeriod As Integer = 180
97     Public Read As Boolean = True
98     Public ListLock As Boolean = False
99     Public IconSize As IconSizes = IconSizes.Icon16
100     Public NewAllPop As Boolean = True
101     Public EventNotifyEnabled As Boolean = True
102     Public EventNotifyFlag As EVENTTYPE = EVENTTYPE.All
103     Public IsMyEventNotifyFlag As EVENTTYPE = EVENTTYPE.All
104     Public ForceEventNotify As Boolean = False
105     Public FavEventUnread As Boolean = True
106     Public TranslateLanguage As String = My.Resources.TranslateDefaultLanguage
107     Public EventSoundFile As String = ""
108     Public PlaySound As Boolean = False
109     Public UnreadManage As Boolean = True
110     Public OneWayLove As Boolean = True
111     Public NameBalloon As NameBalloonEnum = NameBalloonEnum.NickName
112     Public PostCtrlEnter As Boolean = False
113     Public PostShiftEnter As Boolean = False
114     Public CountApi As Integer = 60
115     Public CountApiReply As Integer = 40
116     Public PostAndGet As Boolean = True
117     Public DispUsername As Boolean = False
118     Public MinimizeToTray As Boolean = False
119     Public CloseToExit As Boolean = False
120     Public DispLatestPost As DispTitleEnum = DispTitleEnum.Post
121     Public SortOrderLock As Boolean = False
122     Public TinyUrlResolve As Boolean = True
123     Public ShortUrlForceResolve As Boolean = False
124     Public PeriodAdjust As Boolean = True
125     Public StartupVersion As Boolean = True
126     Public StartupFollowers As Boolean = True
127     Public RestrictFavCheck As Boolean = False
128     Public AlwaysTop As Boolean = False
129     Public CultureCode As String = ""
130     Public UrlConvertAuto As Boolean = False
131     Public Outputz As Boolean = False
132     Public SortColumn As Integer = 3
133     Public SortOrder As Integer = 1
134     Public IsMonospace As Boolean = False
135     Public ReadOldPosts As Boolean = False
136     Public UseSsl As Boolean = True
137     Public Language As String = "OS"
138     Public Nicoms As Boolean = False
139     Public HashTags As New List(Of String)
140     Public HashSelected As String = ""
141     Public HashIsPermanent As Boolean = False
142     Public HashIsHead As Boolean = False
143     Public PreviewEnable As Boolean = True
144
145     <Xml.Serialization.XmlIgnore()> _
146     Public OutputzKey As String = ""
147     Public Property EncryptOutputzKey() As String
148         Get
149             Return Encrypt(OutputzKey)
150         End Get
151         Set(ByVal value As String)
152             OutputzKey = Decrypt(value)
153         End Set
154     End Property
155
156     Public OutputzUrlMode As OutputzUrlmode = MyCommon.OutputzUrlmode.twittercom
157     Public AutoShortUrlFirst As UrlConverter = UrlConverter.Bitly
158     Public UseUnreadStyle As Boolean = True
159     Public DateTimeFormat As String = "yyyy/MM/dd H:mm:ss"
160     Public DefaultTimeOut As Integer = 20
161     Public RetweetNoConfirm As Boolean = False
162     Public LimitBalloon As Boolean = False
163     Public TabIconDisp As Boolean = True
164     Public ReplyIconState As REPLY_ICONSTATE = REPLY_ICONSTATE.StaticIcon
165     Public WideSpaceConvert As Boolean = True
166     Public ReadOwnPost As Boolean = False
167     Public GetFav As Boolean = True
168     Public BilyUser As String = ""
169     Public BitlyPwd As String = ""
170     Public ShowGrid As Boolean = False
171     Public UseAtIdSupplement As Boolean = True
172     Public UseHashSupplement As Boolean = True
173     Public TwitterUrl As String = "api.twitter.com"
174     Public TwitterSearchUrl As String = "search.twitter.com"
175     Public HotkeyEnabled As Boolean = False
176     Public HotkeyModifier As Keys = Keys.None
177     Public HotkeyKey As Keys = Keys.None
178     Public HotkeyValue As Integer = 0
179     Public BlinkNewMentions As Boolean = False
180     Public FocusLockToStatusText As Boolean = False
181     Public UseAdditionalCount As Boolean = False
182     Public MoreCountApi As Integer = 200
183     Public FirstCountApi As Integer = 100
184     Public SearchCountApi As Integer = 100
185     Public FavoritesCountApi As Integer = 40
186     Public TrackWord As String = ""
187     Public AllAtReply As Boolean = False
188     Public UserstreamStartup As Boolean = True
189     Public UserstreamPeriod As Integer = 0
190     Public UserTimelineCountApi As Integer = 20
191     Public UserTimelinePeriod As Integer = 600
192     Public OpenUserTimeline As Boolean = True
193     Public ListCountApi As Integer = 100
194     Public UseImageService As Integer = 0
195     Public ListDoubleClickAction As Integer = 0
196     Public UserAppointUrl As String = ""
197     Public HideDuplicatedRetweets As Boolean = False
198     Public IsPreviewFoursquare As Boolean = False
199     Public FoursquarePreviewHeight As Integer = 300
200     Public FoursquarePreviewWidth As Integer = 300
201     Public FoursquarePreviewZoom As Integer = 15
202     Public IsListsIncludeRts As Boolean = False
203     Public GAFirst As Long = 0
204     Public GALast As Long = 0
205 End Class
206
207 Public Class UserAccount
208     Public Username As String = ""
209     Public UserId As Long = 0
210     Public Token As String = ""
211     <Xml.Serialization.XmlIgnore()> _
212     Public TokenSecret As String = ""
213     Public Property EncryptTokenSecret() As String
214         Get
215             Return Encrypt(TokenSecret)
216         End Get
217         Set(ByVal value As String)
218             TokenSecret = Decrypt(value)
219         End Set
220     End Property
221     Private Function Encrypt(ByVal password As String) As String
222         If String.IsNullOrEmpty(password) Then password = ""
223         If password.Length > 0 Then
224             Try
225                 Return EncryptString(password)
226             Catch ex As Exception
227                 Return ""
228             End Try
229         Else
230             Return ""
231         End If
232     End Function
233     Private Function Decrypt(ByVal password As String) As String
234         If String.IsNullOrEmpty(password) Then password = ""
235         If password.Length > 0 Then
236             Try
237                 password = DecryptString(password)
238             Catch ex As Exception
239                 password = ""
240             End Try
241         End If
242         Return password
243     End Function
244     Public Overrides Function ToString() As String
245         Return Me.Username
246     End Function
247 End Class