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.
30 using System.Xml.Serialization;
31 using System.Collections.Generic;
32 using System.Windows.Forms;
33 using OpenTween.Thumbnail;
37 public class SettingCommon : SettingBase<SettingCommon>
39 #region "Settingクラス基本"
40 public static SettingCommon Load()
44 => SaveSettings(this);
47 public List<UserAccount> UserAccounts = new List<UserAccount>();
48 public string UserName = "";
51 public string Password = "";
52 public string EncryptPassword
54 get => Encrypt(Password);
55 set => Password = Decrypt(value);
58 public string Token = "";
60 public string TokenSecret = "";
61 public string EncryptTokenSecret
63 get => Encrypt(TokenSecret);
64 set => TokenSecret = Decrypt(value);
67 private string Encrypt(string password)
69 if (string.IsNullOrEmpty(password)) password = "";
70 if (password.Length > 0)
74 return MyCommon.EncryptString(password);
86 private string Decrypt(string password)
88 if (string.IsNullOrEmpty(password)) password = "";
89 if (password.Length > 0)
93 password = MyCommon.DecryptString(password);
103 public long UserId = 0;
104 public List<string> TabList = new List<string>();
105 public int TimelinePeriod = 90;
106 public int ReplyPeriod = 180;
107 public int DMPeriod = 600;
108 public int PubSearchPeriod = 180;
109 public int ListsPeriod = 180;
112 /// 起動時読み込み分を既読にするか。trueなら既読として処理
114 public bool Read = true;
116 public bool ListLock = false;
117 public MyCommon.IconSizes IconSize = MyCommon.IconSizes.Icon16;
118 public bool NewAllPop = true;
119 public bool EventNotifyEnabled = true;
120 public MyCommon.EVENTTYPE EventNotifyFlag = MyCommon.EVENTTYPE.All;
121 public MyCommon.EVENTTYPE IsMyEventNotifyFlag = MyCommon.EVENTTYPE.All;
122 public bool ForceEventNotify = false;
123 public bool FavEventUnread = true;
124 public string TranslateLanguage = Properties.Resources.TranslateDefaultLanguage;
125 public string EventSoundFile = "";
128 /// サウンド再生(タブ別設定より優先)
130 public bool PlaySound = false;
133 /// 未読管理。trueなら未読管理する
135 public bool UnreadManage = true;
138 /// 片思い表示。trueなら片思い表示する
140 public bool OneWayLove = true;
142 public MyCommon.NameBalloonEnum NameBalloon = MyCommon.NameBalloonEnum.NickName;
143 public bool PostCtrlEnter = false;
144 public bool PostShiftEnter = false;
145 public int CountApi = 60;
146 public int CountApiReply = 40;
147 public bool PostAndGet = true;
148 public bool DispUsername = false;
149 public bool MinimizeToTray = false;
150 public bool CloseToExit = false;
151 public MyCommon.DispTitleEnum DispLatestPost = MyCommon.DispTitleEnum.Post;
152 public bool SortOrderLock = false;
157 public bool ViewTabBottom = true;
159 public bool TinyUrlResolve = true;
160 public bool StartupVersion = true;
161 public bool StartupFollowers = true;
162 public bool RestrictFavCheck = false;
163 public bool AlwaysTop = false;
164 public string CultureCode = "";
165 public bool UrlConvertAuto = false;
166 public int SortColumn = 3;
167 public int SortOrder = 1;
168 public bool IsMonospace = false;
169 public bool ReadOldPosts = false;
170 public string Language = "OS";
171 public bool Nicoms = false;
172 public List<string> HashTags = new List<string>();
173 public string HashSelected = "";
174 public bool HashIsPermanent = false;
175 public bool HashIsHead = false;
176 public bool HashIsNotAddToAtReply = true;
177 public bool PreviewEnable = true;
178 public bool StatusAreaAtBottom = true;
180 public MyCommon.UrlConverter AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
181 public bool UseUnreadStyle = true;
182 public string DateTimeFormat = "yyyy/MM/dd H:mm:ss";
183 public int DefaultTimeOut = 20;
185 /// <summary>画像アップロードのタイムアウト設定 (秒)</summary>
186 public int UploadImageTimeout { get; set; } = 60;
188 public bool RetweetNoConfirm = false;
189 public bool LimitBalloon = false;
190 public bool TabIconDisp = true;
191 public MyCommon.REPLY_ICONSTATE ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
192 public bool WideSpaceConvert = true;
193 public bool ReadOwnPost = false;
194 public bool GetFav = true;
195 public string BilyUser = "";
196 public string BitlyPwd = "";
198 /// <summary>Bitly API アクセストークン</summary>
199 public string BitlyAccessToken { get; set; } = "";
201 public bool ShowGrid = false;
202 public bool UseAtIdSupplement = true;
203 public bool UseHashSupplement = true;
205 [XmlElement(ElementName = "TwitterUrl")]
206 public string TwitterApiHost = "api.twitter.com";
208 public bool HotkeyEnabled = false;
209 public Keys HotkeyModifier = Keys.None;
210 public Keys HotkeyKey = Keys.None;
211 public int HotkeyValue = 0;
212 public bool BlinkNewMentions = false;
213 public bool FocusLockToStatusText = false;
214 public bool UseAdditionalCount = false;
215 public int MoreCountApi = 200;
216 public int FirstCountApi = 100;
217 public int SearchCountApi = 100;
218 public int FavoritesCountApi = 40;
219 public string TrackWord = "";
220 public bool AllAtReply = false;
221 public bool UserstreamStartup = true;
222 public int UserstreamPeriod = 0;
223 public int UserTimelineCountApi = 20;
224 public int UserTimelinePeriod = 600;
225 public bool OpenUserTimeline = true;
226 public int ListCountApi = 100;
227 public int UseImageService = 0;
228 public string UseImageServiceName = "";
229 public int ListDoubleClickAction = 0;
230 public string UserAppointUrl = "";
231 public bool HideDuplicatedRetweets = false;
232 public bool EnableImgAzyobuziNet = true;
233 public bool ImgAzyobuziNetDisabledInDM = true;
234 public int MapThumbnailHeight = 200;
235 public int MapThumbnailWidth = 200;
236 public int MapThumbnailZoom = 15;
237 public MapProvider MapThumbnailProvider = MapProvider.OpenStreetMap;
238 public bool IsListsIncludeRts = false;
239 public bool TabMouseLock = false;
240 public bool IsRemoveSameEvent = false;
241 public bool IsUseNotifyGrowl = false;
242 public bool ForceIPv4 = false;
243 public bool ErrorReportAnonymous = true;
245 /// <summary>pic.twitter.com への画像アップロード時に JPEG への変換を回避する</summary>
246 public bool AlphaPNGWorkaround { get; set; } = false;
248 /// <summary>アップデート通知を無視するバージョン番号</summary>
250 public Version? SkipUpdateVersion
252 get => string.IsNullOrEmpty(this.SkipUpdateVersionStr) ? null : Version.Parse(this.SkipUpdateVersionStr);
253 set => this.SkipUpdateVersionStr = value == null ? "" : value.ToString();
256 [XmlElement(ElementName = nameof(SkipUpdateVersion))]
257 public string SkipUpdateVersionStr { get; set; } = "";
260 public class UserAccount
262 public string Username = "";
263 public long UserId = 0;
264 public string Token = "";
266 public string TokenSecret = "";
267 public string EncryptTokenSecret
269 get => Encrypt(TokenSecret);
270 set => TokenSecret = Decrypt(value);
272 private string Encrypt(string password)
274 if (string.IsNullOrEmpty(password)) password = "";
275 if (password.Length > 0)
279 return MyCommon.EncryptString(password);
291 private string Decrypt(string password)
293 if (string.IsNullOrEmpty(password)) password = "";
294 if (password.Length > 0)
298 password = MyCommon.DecryptString(password);
308 public override string ToString()