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;
32 using OpenTween.Setting;
36 public class SettingCommon : SettingBase<SettingCommon>
38 public static SettingCommon Instance => SettingManager.Common;
40 #region "Settingクラス基本"
41 public static SettingCommon Load()
43 return LoadSettings();
52 public List<UserAccount> UserAccounts;
53 public string UserName = "";
56 public string Password = "";
57 public string EncryptPassword
59 get { return Encrypt(Password); }
60 set { Password = Decrypt(value); }
63 public string Token = "";
65 public string TokenSecret = "";
66 public string EncryptTokenSecret
68 get { return Encrypt(TokenSecret); }
69 set { TokenSecret = Decrypt(value); }
72 private string Encrypt(string password)
74 if (String.IsNullOrEmpty(password)) password = "";
75 if (password.Length > 0)
79 return MyCommon.EncryptString(password);
91 private string Decrypt(string password)
93 if (String.IsNullOrEmpty(password)) password = "";
94 if (password.Length > 0)
98 password = MyCommon.DecryptString(password);
108 public long UserId = 0;
109 public List<string> TabList;
110 public int TimelinePeriod = 90;
111 public int ReplyPeriod = 180;
112 public int DMPeriod = 600;
113 public int PubSearchPeriod = 180;
114 public int ListsPeriod = 180;
117 /// 起動時読み込み分を既読にするか。trueなら既読として処理
119 public bool Read = true;
121 public bool ListLock = false;
122 public MyCommon.IconSizes IconSize = MyCommon.IconSizes.Icon16;
123 public bool NewAllPop = true;
124 public bool EventNotifyEnabled = true;
125 public MyCommon.EVENTTYPE EventNotifyFlag = MyCommon.EVENTTYPE.All;
126 public MyCommon.EVENTTYPE IsMyEventNotifyFlag = MyCommon.EVENTTYPE.All;
127 public bool ForceEventNotify = false;
128 public bool FavEventUnread = true;
129 public string TranslateLanguage = Properties.Resources.TranslateDefaultLanguage;
130 public string EventSoundFile = "";
133 /// サウンド再生(タブ別設定より優先)
135 public bool PlaySound = false;
138 /// 未読管理。trueなら未読管理する
140 public bool UnreadManage = true;
143 /// 片思い表示。trueなら片思い表示する
145 public bool OneWayLove = true;
147 public MyCommon.NameBalloonEnum NameBalloon = MyCommon.NameBalloonEnum.NickName;
148 public bool PostCtrlEnter = false;
149 public bool PostShiftEnter = false;
150 public int CountApi = 60;
151 public int CountApiReply = 40;
152 public bool PostAndGet = true;
153 public bool DispUsername = false;
154 public bool MinimizeToTray = false;
155 public bool CloseToExit = false;
156 public MyCommon.DispTitleEnum DispLatestPost = MyCommon.DispTitleEnum.Post;
157 public bool SortOrderLock = false;
162 public bool ViewTabBottom = true;
164 public bool TinyUrlResolve = true;
165 public bool StartupVersion = true;
166 public bool StartupFollowers = true;
167 public bool RestrictFavCheck = false;
168 public bool AlwaysTop = false;
169 public string CultureCode = "";
170 public bool UrlConvertAuto = false;
171 public int SortColumn = 3;
172 public int SortOrder = 1;
173 public bool IsMonospace = false;
174 public bool ReadOldPosts = false;
175 public string Language = "OS";
176 public bool Nicoms = false;
177 public List<string> HashTags = new List<string>();
178 public string HashSelected = "";
179 public bool HashIsPermanent = false;
180 public bool HashIsHead = false;
181 public bool HashIsNotAddToAtReply = true;
182 public bool PreviewEnable = true;
183 public bool StatusAreaAtBottom = true;
185 public MyCommon.UrlConverter AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
186 public bool UseUnreadStyle = true;
187 public string DateTimeFormat = "yyyy/MM/dd H:mm:ss";
188 public int DefaultTimeOut = 20;
190 /// <summary>画像アップロードのタイムアウト設定 (秒)</summary>
191 public int UploadImageTimeout { get; set; } = 60;
193 public bool RetweetNoConfirm = false;
194 public bool LimitBalloon = false;
195 public bool TabIconDisp = true;
196 public MyCommon.REPLY_ICONSTATE ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
197 public bool WideSpaceConvert = true;
198 public bool ReadOwnPost = false;
199 public bool GetFav = true;
200 public string BilyUser = "";
201 public string BitlyPwd = "";
202 public bool ShowGrid = false;
203 public bool UseAtIdSupplement = true;
204 public bool UseHashSupplement = true;
206 [XmlElement(ElementName = "TwitterUrl")]
207 public string TwitterApiHost = "api.twitter.com";
209 public bool HotkeyEnabled = false;
210 public Keys HotkeyModifier = Keys.None;
211 public Keys HotkeyKey = Keys.None;
212 public int HotkeyValue = 0;
213 public bool BlinkNewMentions = false;
214 public bool FocusLockToStatusText = false;
215 public bool UseAdditionalCount = false;
216 public int MoreCountApi = 200;
217 public int FirstCountApi = 100;
218 public int SearchCountApi = 100;
219 public int FavoritesCountApi = 40;
220 public string TrackWord = "";
221 public bool AllAtReply = false;
222 public bool UserstreamStartup = true;
223 public int UserstreamPeriod = 0;
224 public int UserTimelineCountApi = 20;
225 public int UserTimelinePeriod = 600;
226 public bool OpenUserTimeline = true;
227 public int ListCountApi = 100;
228 public int UseImageService = 0;
229 public string UseImageServiceName = "";
230 public int ListDoubleClickAction = 0;
231 public string UserAppointUrl = "";
232 public bool HideDuplicatedRetweets = false;
233 public bool EnableImgAzyobuziNet = true;
234 public bool ImgAzyobuziNetDisabledInDM = true;
235 public int MapThumbnailHeight = 200;
236 public int MapThumbnailWidth = 200;
237 public int MapThumbnailZoom = 15;
238 public MapProvider MapThumbnailProvider = MapProvider.OpenStreetMap;
239 public bool IsListsIncludeRts = false;
240 public bool TabMouseLock = false;
241 public bool IsRemoveSameEvent = false;
242 public bool IsUseNotifyGrowl = false;
243 public bool ForceIPv4 = false;
244 public bool ErrorReportAnonymous = true;
246 /// <summary>pic.twitter.com への画像アップロード時に JPEG への変換を回避する</summary>
247 public bool AlphaPNGWorkaround { get; set; } = false;
250 public class UserAccount
252 public string Username = "";
253 public long UserId = 0;
254 public string Token = "";
256 public string TokenSecret = "";
257 public string EncryptTokenSecret
259 get { return Encrypt(TokenSecret); }
260 set { TokenSecret = Decrypt(value); }
262 private string Encrypt(string password)
264 if (String.IsNullOrEmpty(password)) password = "";
265 if (password.Length > 0)
269 return MyCommon.EncryptString(password);
281 private string Decrypt(string password)
283 if (String.IsNullOrEmpty(password)) password = "";
284 if (password.Length > 0)
288 password = MyCommon.DecryptString(password);
297 public override string ToString()
299 return this.Username;