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.
10 // This file is part of OpenTween.
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)
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
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.
28 using System.Xml.Serialization;
29 using System.Collections.Generic;
30 using System.Windows.Forms;
31 using OpenTween.Thumbnail;
35 public class SettingCommon : SettingBase<SettingCommon>
37 #region "Settingクラス基本"
38 public static SettingCommon Load()
40 return LoadSettings();
49 public List<UserAccount> UserAccounts;
50 public string UserName = "";
53 public string Password = "";
54 public string EncryptPassword
56 get => Encrypt(Password);
57 set => Password = Decrypt(value);
60 public string Token = "";
62 public string TokenSecret = "";
63 public string EncryptTokenSecret
65 get => Encrypt(TokenSecret);
66 set => TokenSecret = Decrypt(value);
69 private string Encrypt(string password)
71 if (String.IsNullOrEmpty(password)) password = "";
72 if (password.Length > 0)
76 return MyCommon.EncryptString(password);
88 private string Decrypt(string password)
90 if (String.IsNullOrEmpty(password)) password = "";
91 if (password.Length > 0)
95 password = MyCommon.DecryptString(password);
105 public long UserId = 0;
106 public List<string> TabList;
107 public int TimelinePeriod = 90;
108 public int ReplyPeriod = 180;
109 public int DMPeriod = 600;
110 public int PubSearchPeriod = 180;
111 public int ListsPeriod = 180;
114 /// 起動時読み込み分を既読にするか。trueなら既読として処理
116 public bool Read = true;
118 public bool ListLock = false;
119 public MyCommon.IconSizes IconSize = MyCommon.IconSizes.Icon16;
120 public bool NewAllPop = true;
121 public bool EventNotifyEnabled = true;
122 public MyCommon.EVENTTYPE EventNotifyFlag = MyCommon.EVENTTYPE.All;
123 public MyCommon.EVENTTYPE IsMyEventNotifyFlag = MyCommon.EVENTTYPE.All;
124 public bool ForceEventNotify = false;
125 public bool FavEventUnread = true;
126 public string TranslateLanguage = Properties.Resources.TranslateDefaultLanguage;
127 public string EventSoundFile = "";
130 /// サウンド再生(タブ別設定より優先)
132 public bool PlaySound = false;
135 /// 未読管理。trueなら未読管理する
137 public bool UnreadManage = true;
140 /// 片思い表示。trueなら片思い表示する
142 public bool OneWayLove = true;
144 public MyCommon.NameBalloonEnum NameBalloon = MyCommon.NameBalloonEnum.NickName;
145 public bool PostCtrlEnter = false;
146 public bool PostShiftEnter = false;
147 public int CountApi = 60;
148 public int CountApiReply = 40;
149 public bool PostAndGet = true;
150 public bool DispUsername = false;
151 public bool MinimizeToTray = false;
152 public bool CloseToExit = false;
153 public MyCommon.DispTitleEnum DispLatestPost = MyCommon.DispTitleEnum.Post;
154 public bool SortOrderLock = false;
159 public bool ViewTabBottom = true;
161 public bool TinyUrlResolve = true;
162 public bool StartupVersion = true;
163 public bool StartupFollowers = true;
164 public bool RestrictFavCheck = false;
165 public bool AlwaysTop = false;
166 public string CultureCode = "";
167 public bool UrlConvertAuto = false;
168 public int SortColumn = 3;
169 public int SortOrder = 1;
170 public bool IsMonospace = false;
171 public bool ReadOldPosts = false;
172 public string Language = "OS";
173 public bool Nicoms = false;
174 public List<string> HashTags = new List<string>();
175 public string HashSelected = "";
176 public bool HashIsPermanent = false;
177 public bool HashIsHead = false;
178 public bool HashIsNotAddToAtReply = true;
179 public bool PreviewEnable = true;
180 public bool StatusAreaAtBottom = true;
182 public MyCommon.UrlConverter AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
183 public bool UseUnreadStyle = true;
184 public string DateTimeFormat = "yyyy/MM/dd H:mm:ss";
185 public int DefaultTimeOut = 20;
187 /// <summary>画像アップロードのタイムアウト設定 (秒)</summary>
188 public int UploadImageTimeout { get; set; } = 60;
190 public bool RetweetNoConfirm = false;
191 public bool LimitBalloon = false;
192 public bool TabIconDisp = true;
193 public MyCommon.REPLY_ICONSTATE ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
194 public bool WideSpaceConvert = true;
195 public bool ReadOwnPost = false;
196 public bool GetFav = true;
197 public string BilyUser = "";
198 public string BitlyPwd = "";
200 /// <summary>Bitly API アクセストークン</summary>
201 public string BitlyAccessToken { get; set; } = "";
203 public bool ShowGrid = false;
204 public bool UseAtIdSupplement = true;
205 public bool UseHashSupplement = true;
207 [XmlElement(ElementName = "TwitterUrl")]
208 public string TwitterApiHost = "api.twitter.com";
210 public bool HotkeyEnabled = false;
211 public Keys HotkeyModifier = Keys.None;
212 public Keys HotkeyKey = Keys.None;
213 public int HotkeyValue = 0;
214 public bool BlinkNewMentions = false;
215 public bool FocusLockToStatusText = false;
216 public bool UseAdditionalCount = false;
217 public int MoreCountApi = 200;
218 public int FirstCountApi = 100;
219 public int SearchCountApi = 100;
220 public int FavoritesCountApi = 40;
221 public string TrackWord = "";
222 public bool AllAtReply = false;
223 public bool UserstreamStartup = true;
224 public int UserstreamPeriod = 0;
225 public int UserTimelineCountApi = 20;
226 public int UserTimelinePeriod = 600;
227 public bool OpenUserTimeline = true;
228 public int ListCountApi = 100;
229 public int UseImageService = 0;
230 public string UseImageServiceName = "";
231 public int ListDoubleClickAction = 0;
232 public string UserAppointUrl = "";
233 public bool HideDuplicatedRetweets = false;
234 public bool EnableImgAzyobuziNet = true;
235 public bool ImgAzyobuziNetDisabledInDM = true;
236 public int MapThumbnailHeight = 200;
237 public int MapThumbnailWidth = 200;
238 public int MapThumbnailZoom = 15;
239 public MapProvider MapThumbnailProvider = MapProvider.OpenStreetMap;
240 public bool IsListsIncludeRts = false;
241 public bool TabMouseLock = false;
242 public bool IsRemoveSameEvent = false;
243 public bool IsUseNotifyGrowl = false;
244 public bool ForceIPv4 = false;
245 public bool ErrorReportAnonymous = true;
247 /// <summary>pic.twitter.com への画像アップロード時に JPEG への変換を回避する</summary>
248 public bool AlphaPNGWorkaround { get; set; } = false;
251 public class UserAccount
253 public string Username = "";
254 public long UserId = 0;
255 public string Token = "";
257 public string TokenSecret = "";
258 public string EncryptTokenSecret
260 get => Encrypt(TokenSecret);
261 set => TokenSecret = Decrypt(value);
263 private string Encrypt(string password)
265 if (String.IsNullOrEmpty(password)) password = "";
266 if (password.Length > 0)
270 return MyCommon.EncryptString(password);
282 private string Decrypt(string password)
284 if (String.IsNullOrEmpty(password)) password = "";
285 if (password.Length > 0)
289 password = MyCommon.DecryptString(password);
298 public override string ToString()
300 return this.Username;