OSDN Git Service

デフォルトの地図サムネイル表示をOpenStreetMapに変更
[opentween/open-tween.git] / OpenTween / Setting / SettingCommon.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      kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
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 using System;
28 using System.Xml.Serialization;
29 using System.Collections.Generic;
30 using System.Windows.Forms;
31 using OpenTween.Thumbnail;
32
33 namespace OpenTween
34 {
35     [Serializable]
36     public class SettingCommon : SettingBase<SettingCommon>
37     {
38
39         #region "Settingクラス基本"
40         public static SettingCommon Load()
41         {
42             return LoadSettings();
43         }
44
45         public void Save()
46         {
47             SaveSettings(this);
48         }
49         #endregion
50
51         public List<UserAccount> UserAccounts;
52         public string UserName = "";
53
54         [XmlIgnore]
55         public string Password = "";
56         public string EncryptPassword
57         {
58             get { return Encrypt(Password); }
59             set { Password = Decrypt(value); }
60         }
61
62         public string Token = "";
63         [XmlIgnore]
64         public string TokenSecret = "";
65         public string EncryptTokenSecret
66         {
67             get { return Encrypt(TokenSecret); }
68             set { TokenSecret = Decrypt(value); }
69         }
70
71         private string Encrypt(string password)
72         {
73             if (String.IsNullOrEmpty(password)) password = "";
74             if (password.Length > 0)
75             {
76                 try
77                 {
78                     return MyCommon.EncryptString(password);
79                 }
80                 catch (Exception)
81                 {
82                     return "";
83                 }
84             }
85             else
86             {
87                 return "";
88             }
89         }
90         private string Decrypt(string password)
91         {
92             if (String.IsNullOrEmpty(password)) password = "";
93             if (password.Length > 0)
94             {
95                 try
96                 {
97                     password = MyCommon.DecryptString(password);
98                 }
99                 catch (Exception)
100                 {
101                     password = "";
102                 }
103             }
104             return password;
105         }
106
107         public long UserId = 0;
108         public List<string> TabList;
109         public int TimelinePeriod = 90;
110         public int ReplyPeriod = 180;
111         public int DMPeriod = 600;
112         public int PubSearchPeriod = 180;
113         public int ListsPeriod = 180;
114         public bool Read = true;
115         public bool ListLock = false;
116         public MyCommon.IconSizes IconSize = MyCommon.IconSizes.Icon16;
117         public bool NewAllPop = true;
118         public bool EventNotifyEnabled = true;
119         public MyCommon.EVENTTYPE EventNotifyFlag = MyCommon.EVENTTYPE.All;
120         public MyCommon.EVENTTYPE IsMyEventNotifyFlag = MyCommon.EVENTTYPE.All;
121         public bool ForceEventNotify = false;
122         public bool FavEventUnread = true;
123         public string TranslateLanguage = Properties.Resources.TranslateDefaultLanguage;
124         public string EventSoundFile = "";
125         public bool PlaySound = false;
126         public bool UnreadManage = true;
127         public bool OneWayLove = true;
128         public MyCommon.NameBalloonEnum NameBalloon = MyCommon.NameBalloonEnum.NickName;
129         public bool PostCtrlEnter = false;
130         public bool PostShiftEnter = false;
131         public int CountApi = 60;
132         public int CountApiReply = 40;
133         public bool PostAndGet = true;
134         public bool DispUsername = false;
135         public bool MinimizeToTray = false;
136         public bool CloseToExit = false;
137         public MyCommon.DispTitleEnum DispLatestPost = MyCommon.DispTitleEnum.Post;
138         public bool SortOrderLock = false;
139         public bool TinyUrlResolve = true;
140         public bool ShortUrlForceResolve = false;
141         public bool PeriodAdjust = true;
142         public bool StartupVersion = true;
143         public bool StartupFollowers = true;
144         public bool RestrictFavCheck = false;
145         public bool AlwaysTop = false;
146         public string CultureCode = "";
147         public bool UrlConvertAuto = false;
148         public bool Outputz = false;
149         public int SortColumn = 3;
150         public int SortOrder = 1;
151         public bool IsMonospace = false;
152         public bool ReadOldPosts = false;
153         public bool UseSsl = true;
154         public string Language = "OS";
155         public bool Nicoms = false;
156         public List<string> HashTags = new List<string>();
157         public string HashSelected = "";
158         public bool HashIsPermanent = false;
159         public bool HashIsHead = false;
160         public bool HashIsNotAddToAtReply = true;
161         public bool PreviewEnable = true;
162
163         [XmlIgnore]
164         public string OutputzKey = "";
165         public string EncryptOutputzKey
166         {
167             get { return Encrypt(OutputzKey); }
168             set { OutputzKey = Decrypt(value); }
169         }
170
171         public MyCommon.OutputzUrlmode OutputzUrlMode = MyCommon.OutputzUrlmode.twittercom;
172         public MyCommon.UrlConverter AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
173         public bool UseUnreadStyle = true;
174         public string DateTimeFormat = "yyyy/MM/dd H:mm:ss";
175         public int DefaultTimeOut = 20;
176         public bool RetweetNoConfirm = false;
177         public bool LimitBalloon = false;
178         public bool TabIconDisp = true;
179         public MyCommon.REPLY_ICONSTATE ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
180         public bool WideSpaceConvert = true;
181         public bool ReadOwnPost = false;
182         public bool GetFav = true;
183         public string BilyUser = "";
184         public string BitlyPwd = "";
185         public bool ShowGrid = false;
186         public bool UseAtIdSupplement = true;
187         public bool UseHashSupplement = true;
188         public string TwitterUrl = "api.twitter.com";
189         public string TwitterSearchUrl = "search.twitter.com";
190         public bool HotkeyEnabled = false;
191         public Keys HotkeyModifier = Keys.None;
192         public Keys HotkeyKey = Keys.None;
193         public int HotkeyValue = 0;
194         public bool BlinkNewMentions = false;
195         public bool FocusLockToStatusText = false;
196         public bool UseAdditionalCount = false;
197         public int MoreCountApi = 200;
198         public int FirstCountApi = 100;
199         public int SearchCountApi = 100;
200         public int FavoritesCountApi = 40;
201         public string TrackWord = "";
202         public bool AllAtReply = false;
203         public bool UserstreamStartup = true;
204         public int UserstreamPeriod = 0;
205         public int UserTimelineCountApi = 20;
206         public int UserTimelinePeriod = 600;
207         public bool OpenUserTimeline = true;
208         public int ListCountApi = 100;
209         public int UseImageService = 0;
210         public int ListDoubleClickAction = 0;
211         public string UserAppointUrl = "";
212         public bool HideDuplicatedRetweets = false;
213         public bool IsPreviewFoursquare = false;
214         public int MapThumbnailHeight = 200;
215         public int MapThumbnailWidth = 200;
216         public int MapThumbnailZoom = 15;
217         public MapProvider MapThumbnailProvider = MapProvider.OpenStreetMap;
218         public bool IsListsIncludeRts = false;
219         public long GAFirst = 0;
220         public long GALast = 0;
221         public bool TabMouseLock = false;
222         public bool IsRemoveSameEvent = false;
223         public bool IsUseNotifyGrowl = false;
224     }
225
226     public class UserAccount
227     {
228         public string Username = "";
229         public long UserId = 0;
230         public long GAFirst = 0;
231         public long GALast = 0;
232         public string Token = "";
233         [XmlIgnore]
234         public string TokenSecret = "";
235         public string EncryptTokenSecret
236         {
237             get { return Encrypt(TokenSecret); }
238             set { TokenSecret = Decrypt(value); }
239         }
240         private string Encrypt(string password)
241         {
242             if (String.IsNullOrEmpty(password)) password = "";
243             if (password.Length > 0)
244             {
245                 try
246                 {
247                     return MyCommon.EncryptString(password);
248                 }
249                 catch (Exception)
250                 {
251                     return "";
252                 }
253             }
254             else
255             {
256                 return "";
257             }
258         }
259         private string Decrypt(string password)
260         {
261             if (String.IsNullOrEmpty(password)) password = "";
262             if (password.Length > 0)
263             {
264                 try
265                 {
266                     password = MyCommon.DecryptString(password);
267                 }
268                 catch (Exception)
269                 {
270                     password = "";
271                 }
272             }
273             return password;
274         }
275         public override string ToString()
276         {
277             return this.Username;
278         }
279     }
280 }