OSDN Git Service

自動プロパティを使用する (IDE0032)
authorKimura Youichi <kim.upsilon@bucyou.net>
Tue, 29 May 2018 01:54:39 +0000 (10:54 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Tue, 29 May 2018 02:33:17 +0000 (11:33 +0900)
14 files changed:
OpenTween/AtIdSupplement.cs
OpenTween/Connection/Networking.cs
OpenTween/Growl.cs
OpenTween/HashtagManage.cs
OpenTween/HookGlobalHotkey.cs
OpenTween/ListAvailable.cs
OpenTween/ListElement.cs
OpenTween/ListManage.cs
OpenTween/MediaItem.cs
OpenTween/MemoryImage.cs
OpenTween/Models/TabInformations.cs
OpenTween/ShortcutCommand.cs
OpenTween/Twitter.cs
OpenTween/WebBrowserController.cs

index 01db67a..552e444 100644 (file)
@@ -37,12 +37,11 @@ namespace OpenTween
 {
     public partial class AtIdSupplement : OTBaseForm
     {
+        public string StartsWith { get; set; } = "";
+
         public string inputText = "";
         public bool isBack = false;
         private string startChar = "";
-        //    private bool tabkeyFix = false;
-
-        private string _StartsWith = "";
 
         public void AddItem(string id)
         {
@@ -130,9 +129,9 @@ namespace OpenTween
         private void AtIdSupplement_Shown(object sender, EventArgs e) /*Handles this.Shown*/
         {
             TextId.Text = startChar;
-            if (!string.IsNullOrEmpty(_StartsWith))
+            if (!string.IsNullOrEmpty(this.StartsWith))
             {
-                TextId.Text += _StartsWith.Substring(0, _StartsWith.Length);
+                TextId.Text += this.StartsWith.Substring(0, this.StartsWith.Length);
             }
             TextId.SelectionStart = TextId.Text.Length;
             TextId.Focus();
@@ -164,21 +163,9 @@ namespace OpenTween
             }
         }
 
-        public string StartsWith
-        {
-            get
-            {
-                return _StartsWith;
-            }
-            set
-            {
-                _StartsWith = value;
-            }
-        }
-
         private void AtIdSupplement_FormClosed(object sender, FormClosedEventArgs e) /*Handles MyBase.FormClosed*/
         {
-            _StartsWith = "";
+            this.StartsWith = "";
             if (isBack)
             {
                 this.DialogResult = DialogResult.Cancel;
index a60a77d..878a3b7 100644 (file)
@@ -40,18 +40,12 @@ namespace OpenTween.Connection
         /// <summary>
         /// 通信に使用するプロキシの種類
         /// </summary>
-        public static ProxyType ProxyType
-        {
-            get { return proxyType; }
-        }
+        public static ProxyType ProxyType { get; private set; } = ProxyType.IE;
 
         /// <summary>
         /// 通信に使用するプロキシ
         /// </summary>
-        public static IWebProxy Proxy
-        {
-            get { return proxy; }
-        }
+        public static IWebProxy Proxy { get; private set; } = null;
 
         /// <summary>
         /// OpenTween 内で共通して使用する HttpClient インスタンス
@@ -86,8 +80,6 @@ namespace OpenTween.Connection
 
         private static bool initialized = false;
         private static HttpClient globalHttpClient;
-        private static ProxyType proxyType = ProxyType.IE;
-        private static IWebProxy proxy = null;
         private static bool forceIPv4 = false;
 
         [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")]
@@ -132,8 +124,8 @@ namespace OpenTween.Connection
                     break;
             }
 
-            Networking.proxyType = proxyType;
-            Networking.proxy = proxy;
+            Networking.ProxyType = proxyType;
+            Networking.Proxy = proxy;
 
             NativeMethods.SetProxy(proxyType, proxyAddress, proxyPort, proxyUser, proxyPassword);
 
index a0e2b8d..88feca0 100644 (file)
@@ -51,8 +51,6 @@ namespace OpenTween
         private object _growlApp;
 
         private object _targetConnector;
-
-        private string _appName = "";
         bool _initialized = false;
 
         public class NotifyCallbackEventArgs : EventArgs
@@ -71,10 +69,7 @@ namespace OpenTween
 
         public event EventHandler<NotifyCallbackEventArgs> NotifyClicked;
 
-        public string AppName
-        {
-            get { return _appName; }
-        }
+        public string AppName { get; }
 
         public enum NotifyType
         {
@@ -85,9 +80,7 @@ namespace OpenTween
         }
 
         public GrowlHelper(string appName)
-        {
-            _appName = appName;
-        }
+            => this.AppName = appName;
 
         public bool IsAvailable
         {
@@ -175,7 +168,7 @@ namespace OpenTween
                 _targetConnector.GetType().InvokeMember("EncryptionAlgorithm", BindingFlags.SetProperty, null, _targetConnector, new object[] { encryptType }, CultureInfo.InvariantCulture);
 
                 _growlApp = _connector.CreateInstance(
-                    "Growl.Connector.Application", false, BindingFlags.Default, null, new object[] { _appName }, null, null);
+                    "Growl.Connector.Application", false, BindingFlags.Default, null, new object[] { AppName }, null, null);
 
 
                 if (File.Exists(Path.Combine(Application.StartupPath, "Icons\\Tween.png")))
@@ -315,7 +308,7 @@ namespace OpenTween
                         BindingFlags.CreateInstance,
                         null,
                         _connector,
-                        new object[] {_appName,
+                        new object[] {AppName,
                                       notificationName,
                                       id,
                                       title,
@@ -333,7 +326,7 @@ namespace OpenTween
                         BindingFlags.CreateInstance,
                         null,
                         _connector,
-                        new object[] {_appName,
+                        new object[] {AppName,
                                       notificationName,
                                       id,
                                       title,
index 8822349..c7787f0 100644 (file)
@@ -38,6 +38,11 @@ namespace OpenTween
 {
     public partial class HashtagManage : OTBaseForm
     {
+        public string UseHash { get; private set; } = "";
+        public bool IsPermanent { get; private set; } = false;
+        public bool IsHead { get; private set; } = false;
+        public bool IsNotAddToAtReply { get; private set; } = true;
+
         /// <summary>
         /// エラー時にダイアログを表示させない (ユニットテストなどで使用)
         /// </summary>
@@ -45,11 +50,7 @@ namespace OpenTween
 
         //入力補助画面
         private AtIdSupplement _hashSupl;
-        //I/F用
-        private string _useHash = "";
-        private bool _isPermanent = false;
-        private bool _isHead = false;
-        private bool _isNotAddToAtReply = true;
+
         //編集モード
         private bool _isAdd = false;
 
@@ -150,7 +151,7 @@ namespace OpenTween
             hash = hash.Trim();
             if (!string.IsNullOrEmpty(hash))
             {
-                if (isIgnorePermanent || !_isPermanent)
+                if (isIgnorePermanent || !this.IsPermanent)
                 {
                     //無条件に先頭に挿入
                     int idx = GetIndexOf(HistoryHashList.Items, hash);
@@ -162,7 +163,7 @@ namespace OpenTween
                 {
                     //固定されていたら2行目に挿入
                     int idx = GetIndexOf(HistoryHashList.Items, hash);
-                    if (_isPermanent)
+                    if (this.IsPermanent)
                     {
                         if (idx > 0)
                         {
@@ -192,13 +193,13 @@ namespace OpenTween
         private void HashtagManage_Shown(object sender, EventArgs e)
         {
             //オプション
-            this.CheckPermanent.Checked = this._isPermanent;
-            this.RadioHead.Checked = this._isHead;
-            this.RadioLast.Checked = !this._isHead;
+            this.CheckPermanent.Checked = this.IsPermanent;
+            this.RadioHead.Checked = this.IsHead;
+            this.RadioLast.Checked = !this.IsHead;
             //リスト選択
-            if (this.HistoryHashList.Items.Contains(this._useHash))
+            if (this.HistoryHashList.Items.Contains(this.UseHash))
             {
-                this.HistoryHashList.SelectedItem = this._useHash;
+                this.HistoryHashList.SelectedItem = this.UseHash;
             }
             else
             {
@@ -217,10 +218,10 @@ namespace OpenTween
 
             _hashSupl = hashSuplForm;
             HistoryHashList.Items.AddRange(history);
-            _useHash = permanentHash;
-            _isPermanent = IsPermanent;
-            _isHead = IsHead;
-            _isNotAddToAtReply = IsNotAddToAtReply;
+            this.UseHash = permanentHash;
+            this.IsPermanent = IsPermanent;
+            this.IsHead = IsHead;
+            this.IsNotAddToAtReply = IsNotAddToAtReply;
         }
 
         private void UseHashText_KeyPress(object sender, KeyPressEventArgs e)
@@ -255,14 +256,14 @@ namespace OpenTween
 
         public void ToggleHash()
         {
-            if (string.IsNullOrEmpty(this._useHash))
+            if (string.IsNullOrEmpty(this.UseHash))
             {
                 if (this.HistoryHashList.Items.Count > 0)
-                    this._useHash = this.HistoryHashList.Items[0].ToString();
+                    this.UseHash = this.HistoryHashList.Items[0].ToString();
             }
             else
             {
-                this._useHash = "";
+                this.UseHash = "";
             }
         }
 
@@ -279,37 +280,17 @@ namespace OpenTween
             }
         }
 
-        public string UseHash
-        {
-            get { return _useHash; }
-        }
-
         public void ClearHashtag()
         {
-            this._useHash = "";
+            this.UseHash = "";
         }
 
         public void SetPermanentHash(string hash)
         {
             //固定ハッシュタグの変更
-            _useHash = hash.Trim();
-            this.AddHashToHistory(_useHash, false);
-            this._isPermanent = true;
-        }
-
-        public bool IsPermanent
-        {
-            get { return _isPermanent; }
-        }
-
-        public bool IsHead
-        {
-            get { return _isHead; }
-        }
-
-        public bool IsNotAddToAtReply
-        {
-            get { return _isNotAddToAtReply; }
+            this.UseHash = hash.Trim();
+            this.AddHashToHistory(UseHash, false);
+            this.IsPermanent = true;
         }
 
         private void PermOK_Button_Click(object sender, EventArgs e)
@@ -407,15 +388,15 @@ namespace OpenTween
             if (!string.IsNullOrEmpty(hash))
             {
                 this.AddHashToHistory(hash, true);
-                this._isPermanent = this.CheckPermanent.Checked;
+                this.IsPermanent = this.CheckPermanent.Checked;
             }
             else
             {
                 //使用ハッシュが未選択ならば、固定オプション外す
-                this._isPermanent = false;
+                this.IsPermanent = false;
             }
-            this._isHead = this.RadioHead.Checked;
-            this._useHash = hash;
+            this.IsHead = this.RadioHead.Checked;
+            this.UseHash = hash;
 
             this.DialogResult = DialogResult.OK;
             this.Close();
@@ -443,7 +424,7 @@ namespace OpenTween
 
         private void CheckNotAddToAtReply_CheckedChanged(object sender, EventArgs e)
         {
-            _isNotAddToAtReply = CheckNotAddToAtReply.Checked;
+            this.IsNotAddToAtReply = CheckNotAddToAtReply.Checked;
         }
     }
 }
index eaca710..cc4e5b0 100644 (file)
@@ -37,28 +37,13 @@ namespace OpenTween
         private Form _targetForm;
         private class KeyEventValue
         {
-            KeyEventArgs _keyEvent;
-            int _value;
+            public KeyEventArgs KeyEvent { get; }
+            public int Value { get; }
 
             public KeyEventValue(KeyEventArgs keyEvent, int Value)
             {
-                _keyEvent = keyEvent;
-                _value = Value;
-            }
-
-            public KeyEventArgs KeyEvent
-            {
-                get
-                {
-                    return _keyEvent;
-                }
-            }
-            public int Value
-            {
-                get
-                {
-                    return _value;
-                }
+                this.KeyEvent = keyEvent;
+                this.Value = Value;
             }
         }
 
index b9878b9..e6ca0ac 100644 (file)
@@ -38,14 +38,7 @@ namespace OpenTween
 {
     public partial class ListAvailable : OTBaseForm
     {
-        private ListElement _selectedList = null;
-        public ListElement SelectedList
-        {
-            get
-            {
-                return _selectedList;
-            }
-        }
+        public ListElement SelectedList { get; private set; }
 
         public ListAvailable()
         {
@@ -55,7 +48,7 @@ namespace OpenTween
         private void OK_Button_Click(object sender, EventArgs e)
         {
             if (this.ListsList.SelectedIndex > -1) {
-                _selectedList = (ListElement)this.ListsList.SelectedItem;
+                this.SelectedList = (ListElement)this.ListsList.SelectedItem;
                 this.DialogResult = System.Windows.Forms.DialogResult.OK;
                 this.Close();
             }
@@ -63,7 +56,7 @@ namespace OpenTween
 
         private void Cancel_Button_Click(object sender, EventArgs e)
         {
-            _selectedList = null;
+            this.SelectedList = null;
             this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
             this.Close();
         }
index 4467c93..380225d 100644 (file)
@@ -47,7 +47,9 @@ namespace OpenTween
         protected Twitter _tw;
 
         private List<UserInfo> _members = null;
-        private long _cursor = -1;
+
+        [XmlIgnore]
+        public long Cursor { get; private set; } = -1;
 
         public ListElement()
         {
@@ -96,26 +98,17 @@ namespace OpenTween
             }
         }
 
-        [XmlIgnore]
-        public long Cursor
-        {
-            get
-            {
-                return _cursor;
-            }
-        }
-
         public async Task RefreshMembers()
         {
             var users = new List<UserInfo>();
-            this._cursor = await this._tw.GetListMembers(this.Id, users, cursor: -1)
+            this.Cursor = await this._tw.GetListMembers(this.Id, users, cursor: -1)
                 .ConfigureAwait(false);
             this._members = users;
         }
 
         public async Task GetMoreMembers()
         {
-            this._cursor = await this._tw.GetListMembers(this.Id, this._members, this._cursor)
+            this.Cursor = await this._tw.GetListMembers(this.Id, this._members, this.Cursor)
                 .ConfigureAwait(false);
         }
 
index 626e42c..e9a9a14 100644 (file)
@@ -418,7 +418,7 @@ namespace OpenTween
 
         private class NewListElement : ListElement
         {
-            private bool _isCreated = false;
+            public bool IsCreated { get; private set; } = false;
 
             public NewListElement(Twitter tw)
             {
@@ -436,15 +436,10 @@ namespace OpenTween
                     await this._tw.CreateListApi(this.Name, !this.IsPublic, this.Description)
                         .ConfigureAwait(false);
 
-                    this._isCreated = true;
+                    this.IsCreated = true;
                 }
             }
 
-            public bool IsCreated
-            {
-                get { return this._isCreated; }
-            }
-
             public override string ToString()
             {
                 if (IsCreated)
index 7b8a400..5eb4299 100644 (file)
@@ -187,11 +187,10 @@ namespace OpenTween
     {
         public const string PathPrefix = "<>MemoryImage://";
         private static int _fileNumber = 0;
-
-        private bool _disposed = false;
-
         private readonly MemoryImage _image;
 
+        public bool IsDisposed { get; private set; } = false;
+
         public MemoryImageMediaItem(MemoryImage image)
         {
             this._image = image ?? throw new ArgumentNullException(nameof(image));
@@ -228,11 +227,6 @@ namespace OpenTween
             get { return true; }
         }
 
-        public bool IsDisposed
-        {
-            get { return this._disposed; }
-        }
-
         public MemoryImage CreateImage()
         {
             return this._image.Clone();
@@ -265,14 +259,14 @@ namespace OpenTween
 
         protected virtual void Dispose(bool disposing)
         {
-            if (this._disposed) return;
+            if (this.IsDisposed) return;
 
             if (disposing)
             {
                 this._image.Dispose();
             }
 
-            this._disposed = true;
+            this.IsDisposed = true;
         }
 
         public void Dispose()
index 55dae22..51292e8 100644 (file)
@@ -42,11 +42,8 @@ namespace OpenTween
     /// </remarks>
     public class MemoryImage : ICloneable, IDisposable, IEquatable<MemoryImage>
     {
-        private readonly MemoryStream stream;
         private readonly Image image;
 
-        protected bool disposed = false;
-
         /// <exception cref="InvalidImageException">
         /// ストリームから読みだされる画像データが不正な場合にスローされる
         /// </exception>
@@ -79,7 +76,7 @@ namespace OpenTween
                 throw;
             }
 
-            this.stream = stream;
+            this.Stream = stream;
         }
 
         /// <summary>
@@ -99,19 +96,12 @@ namespace OpenTween
         /// <summary>
         /// MemoryImage が保持している画像のストリーム
         /// </summary>
-        public MemoryStream Stream
-        {
-            // MemoryStream は破棄されていても一部のメソッドが使用可能なためここでは例外を投げない
-            get { return this.stream; }
-        }
+        public MemoryStream Stream { get; }
 
         /// <summary>
         /// MemoryImage が破棄されているか否か
         /// </summary>
-        public bool IsDisposed
-        {
-            get { return this.disposed; }
-        }
+        public bool IsDisposed { get; private set; } = false;
 
         /// <summary>
         /// MemoryImage が保持している画像のフォーマット
@@ -235,7 +225,7 @@ namespace OpenTween
 
         protected virtual void Dispose(bool disposing)
         {
-            if (this.disposed) return;
+            if (this.IsDisposed) return;
 
             if (disposing)
             {
@@ -243,7 +233,7 @@ namespace OpenTween
                 this.Stream.Dispose();
             }
 
-            this.disposed = true;
+            this.IsDisposed = true;
         }
 
         public void Dispose()
index 723c362..f5b8b37 100644 (file)
@@ -40,14 +40,16 @@ namespace OpenTween.Models
     public sealed class TabInformations
     {
         //個別タブの情報をDictionaryで保持
-        private Dictionary<string, TabModel> _tabs = new Dictionary<string, TabModel>();
-        private ConcurrentDictionary<long, PostClass> _statuses = new ConcurrentDictionary<long, PostClass>();
+        public Dictionary<string, TabModel> Tabs { get; } = new Dictionary<string, TabModel>();
+        public ConcurrentDictionary<long, PostClass> Posts { get; } = new ConcurrentDictionary<long, PostClass>();
+
         private Dictionary<long, PostClass> _quotes = new Dictionary<long, PostClass>();
-        private Stack<TabModel> _removedTab = new Stack<TabModel>();
         private ConcurrentDictionary<long, int> retweetsCount = new ConcurrentDictionary<long, int>();
 
-        public ISet<long> BlockIds = new HashSet<long>();
-        public ISet<long> MuteUserIds = new HashSet<long>();
+        public Stack<TabModel> RemovedTab { get; } = new Stack<TabModel>();
+
+        public ISet<long> BlockIds { get; set; } = new HashSet<long>();
+        public ISet<long> MuteUserIds { get; set; } = new HashSet<long>();
 
         //発言の追加
         //AddPost(複数回) -> DistributePosts          -> SubmitUpdate
@@ -111,10 +113,10 @@ namespace OpenTween.Models
         {
             lock (this.LockObj)
             {
-                if (this._tabs.ContainsKey(tab.TabName))
+                if (this.Tabs.ContainsKey(tab.TabName))
                     return false;
 
-                this._tabs.Add(tab.TabName, tab);
+                this.Tabs.Add(tab.TabName, tab);
                 tab.SetSortMode(this.SortMode, this.SortOrder);
 
                 return true;
@@ -143,7 +145,7 @@ namespace OpenTween.Models
                         var exist = false;
                         var Id = tb.GetStatusIdAt(idx);
                         if (Id < 0) continue;
-                        foreach (var tab in _tabs.Values)
+                        foreach (var tab in this.Tabs.Values)
                         {
                             if (tab != tb && tab != dmTab)
                             {
@@ -154,27 +156,22 @@ namespace OpenTween.Models
                                 }
                             }
                         }
-                        if (!exist) homeTab.AddPostImmediately(Id, _statuses[Id].IsRead);
+                        if (!exist) homeTab.AddPostImmediately(Id, this.Posts[Id].IsRead);
                     }
                 }
-                _removedTab.Push(tb);
-                _tabs.Remove(TabName);
+                this.RemovedTab.Push(tb);
+                this.Tabs.Remove(TabName);
             }
         }
 
-        public Stack<TabModel> RemovedTab
-        {
-            get { return _removedTab; }
-        }
-
         public bool ContainsTab(string TabText)
         {
-            return _tabs.ContainsKey(TabText);
+            return this.Tabs.ContainsKey(TabText);
         }
 
         public bool ContainsTab(TabModel ts)
         {
-            return _tabs.ContainsValue(ts);
+            return this.Tabs.ContainsValue(ts);
         }
 
         /// <summary>
@@ -213,23 +210,11 @@ namespace OpenTween.Models
             throw new TabException(message);
         }
 
-        public Dictionary<string, TabModel> Tabs
-        {
-            get
-            {
-                return _tabs;
-            }
-            set
-            {
-                _tabs = value;
-            }
-        }
-
         public Dictionary<string, TabModel>.KeyCollection KeysTab
         {
             get
             {
-                return _tabs.Keys;
+                return this.Tabs.Keys;
             }
         }
 
@@ -242,7 +227,7 @@ namespace OpenTween.Models
             this.SortMode = mode;
             this.SortOrder = sortOrder;
 
-            foreach (var tab in this._tabs.Values)
+            foreach (var tab in this.Tabs.Values)
                 tab.SetSortMode(mode, sortOrder);
         }
 
@@ -283,7 +268,7 @@ namespace OpenTween.Models
         //    }
         public PostClass RetweetSource(long Id)
         {
-            return this._statuses.TryGetValue(Id, out var status)
+            return this.Posts.TryGetValue(Id, out var status)
                 ? status
                 : null;
         }
@@ -301,7 +286,7 @@ namespace OpenTween.Models
         {
             lock (LockObj)
             {
-                var userPosts = from post in this._statuses.Values
+                var userPosts = from post in this.Posts.Values
                                 where post.UserId == userId && post.UserId <= upToStatusId
                                 select post;
 
@@ -331,7 +316,7 @@ namespace OpenTween.Models
 
             if (setIsDeleted)
             {
-                if (this._statuses.TryGetValue(statusId, out var post))
+                if (this.Posts.TryGetValue(statusId, out var post))
                     post.IsDeleted = true;
             }
         }
@@ -359,7 +344,7 @@ namespace OpenTween.Models
 
                 var currentNotifyPriority = -1;
 
-                foreach (var tab in this._tabs.Values)
+                foreach (var tab in this.Tabs.Values)
                 {
                     // 振分確定 (各タブに反映)
                     var addedIds = tab.AddSubmit();
@@ -424,7 +409,7 @@ namespace OpenTween.Models
 
                     // 全てのタブから表示されなくなった発言は this._statuses からも削除する
                     if (orphaned)
-                        this._statuses.TryRemove(removedId, out var removedPost);
+                        this.Posts.TryRemove(removedId, out var removedPost);
                 }
 
                 return addedCountTotal;
@@ -446,7 +431,7 @@ namespace OpenTween.Models
 
                 while (this.addQueue.TryDequeue(out var statusId))
                 {
-                    if (!this._statuses.TryGetValue(statusId, out var post))
+                    if (!this.Posts.TryGetValue(statusId, out var post))
                         continue;
 
                     var filterHit = false; // フィルタにヒットしたタブがあるか
@@ -511,7 +496,7 @@ namespace OpenTween.Models
                 if (this.IsMuted(Item, isHomeTimeline: true))
                     return;
 
-                if (_statuses.TryGetValue(Item.StatusId, out var status))
+                if (Posts.TryGetValue(Item.StatusId, out var status))
                 {
                     if (Item.IsFav)
                     {
@@ -545,7 +530,7 @@ namespace OpenTween.Models
                     if (BlockIds.Contains(Item.UserId))
                         return;
 
-                    _statuses.TryAdd(Item.StatusId, Item);
+                    Posts.TryAdd(Item.StatusId, Item);
                 }
                 if (Item.IsFav && this.retweetsCount.ContainsKey(Item.StatusId))
                 {
@@ -610,7 +595,7 @@ namespace OpenTween.Models
         {
             lock (LockObj)
             {
-                foreach (var tab in this._tabs.Values)
+                foreach (var tab in this.Tabs.Values)
                 {
                     if (!tab.Contains(statusId))
                         continue;
@@ -653,7 +638,7 @@ namespace OpenTween.Models
         {
             get
             {
-                if (this._statuses.TryGetValue(ID, out var status))
+                if (this.Posts.TryGetValue(ID, out var status))
                     return status;
 
                 if (this._quotes.TryGetValue(ID, out status))
@@ -670,7 +655,7 @@ namespace OpenTween.Models
             //DM,公式検索は非対応
             lock (LockObj)
             {
-                return _statuses.ContainsKey(Id);
+                return Posts.ContainsKey(Id);
             }
         }
 
@@ -678,10 +663,10 @@ namespace OpenTween.Models
         {
             lock (this.LockObj)
             {
-                var tb = _tabs[Original];
-                _tabs.Remove(Original);
+                var tb = this.Tabs[Original];
+                this.Tabs.Remove(Original);
                 tb.TabName = NewName;
-                _tabs.Add(NewName, tb);
+                this.Tabs.Add(NewName, tb);
             }
         }
 
@@ -692,7 +677,7 @@ namespace OpenTween.Models
                 var homeTab = GetTabByType(MyCommon.TabUsageType.Home);
                 var detachedIdsAll = Enumerable.Empty<long>();
 
-                foreach (var tab in _tabs.Values.OfType<FilterTabModel>().ToArray())
+                foreach (var tab in this.Tabs.Values.OfType<FilterTabModel>().ToArray())
                 {
                     if (tab.TabType == MyCommon.TabUsageType.Mute)
                         continue;
@@ -707,7 +692,7 @@ namespace OpenTween.Models
                     var orgIds = tab.StatusIds;
                     tab.ClearIDs();
 
-                    foreach (var post in _statuses.Values)
+                    foreach (var post in Posts.Values)
                     {
                         var filterHit = false; // フィルタにヒットしたタブがあるか
                         var mark = false; // フィルタによってマーク付けされたか
@@ -761,7 +746,7 @@ namespace OpenTween.Models
                 foreach (var id in detachedIdsAll)
                 {
                     var hit = false;
-                    foreach (var tbTemp in _tabs.Values.ToArray())
+                    foreach (var tbTemp in this.Tabs.Values.ToArray())
                     {
                         if (!tbTemp.IsDistributableTabType)
                             continue;
@@ -775,7 +760,7 @@ namespace OpenTween.Models
 
                     if (!hit)
                     {
-                        if (this._statuses.TryGetValue(id, out var post))
+                        if (this.Posts.TryGetValue(id, out var post))
                             homeTab.AddPostImmediately(post.StatusId, post.IsRead);
                     }
                 }
@@ -787,13 +772,13 @@ namespace OpenTween.Models
             //不要なPostを削除
             lock (LockObj)
             {
-                var tb = _tabs[TabName];
+                var tb = this.Tabs[TabName];
                 if (!tb.IsInnerStorageTabType)
                 {
                     foreach (var Id in tb.StatusIds)
                     {
                         var Hit = false;
-                        foreach (var tab in _tabs.Values)
+                        foreach (var tab in this.Tabs.Values)
                         {
                             if (tab.Contains(Id))
                             {
@@ -802,7 +787,7 @@ namespace OpenTween.Models
                             }
                         }
                         if (!Hit)
-                            _statuses.TryRemove(Id, out var removedPost);
+                            Posts.TryRemove(Id, out var removedPost);
                     }
                 }
 
@@ -817,7 +802,7 @@ namespace OpenTween.Models
             {
                 if (follower.Count > 0)
                 {
-                    foreach (var post in _statuses.Values)
+                    foreach (var post in Posts.Values)
                     {
                         //if (post.UserId = 0 || post.IsDm) Continue For
                         if (post.IsMe)
@@ -832,7 +817,7 @@ namespace OpenTween.Models
                 }
                 else
                 {
-                    foreach (var post in _statuses.Values)
+                    foreach (var post in Posts.Values)
                     {
                         post.IsOwl = false;
                     }
@@ -847,7 +832,7 @@ namespace OpenTween.Models
             //合致しなければnullを返す
             lock (LockObj)
             {
-                return this._tabs.Values
+                return this.Tabs.Values
                     .FirstOrDefault(x => x.TabType.HasFlag(tabType));
             }
         }
@@ -855,14 +840,14 @@ namespace OpenTween.Models
         public T GetTabByType<T>() where T : TabModel
         {
             lock (this.LockObj)
-                return this._tabs.Values.OfType<T>().FirstOrDefault();
+                return this.Tabs.Values.OfType<T>().FirstOrDefault();
         }
 
         public TabModel[] GetTabsByType(MyCommon.TabUsageType tabType)
         {
             lock (LockObj)
             {
-                return this._tabs.Values
+                return this.Tabs.Values
                     .Where(x => x.TabType.HasFlag(tabType))
                     .ToArray();
             }
@@ -871,14 +856,14 @@ namespace OpenTween.Models
         public T[] GetTabsByType<T>() where T : TabModel
         {
             lock (this.LockObj)
-                return this._tabs.Values.OfType<T>().ToArray();
+                return this.Tabs.Values.OfType<T>().ToArray();
         }
 
         public TabModel[] GetTabsInnerStorageType()
         {
             lock (LockObj)
             {
-                return this._tabs.Values
+                return this.Tabs.Values
                     .Where(x => x.IsInnerStorageTabType)
                     .ToArray();
             }
@@ -888,13 +873,10 @@ namespace OpenTween.Models
         {
             lock (LockObj)
             {
-                return _tabs.TryGetValue(tabName, out var tab)
+                return this.Tabs.TryGetValue(tabName, out var tab)
                     ? tab
                     : null;
             }
         }
-
-        public ConcurrentDictionary<long, PostClass> Posts
-            => this._statuses;
     }
 }
index 8806011..ec08499 100644 (file)
@@ -41,53 +41,37 @@ namespace OpenTween
     /// </summary>
     public class ShortcutCommand
     {
-        private Keys[] shortcuts;
-        private FocusedControl focusedOn;
-        private FocusedControl notFocusedOn;
         private Func<bool> onlyWhen;
         private Func<Task> command;
-        private bool preventDefault;
 
         /// <summary>
         /// ショートカットキーが動作する条件となるキー入力
         /// </summary>
-        public Keys[] Shortcuts
-        {
-            get { return this.shortcuts; }
-        }
+        public Keys[] Shortcuts { get; private set; }
 
         /// <summary>
         /// ショートカットキーが動作する条件となるフォーカス状態
         /// </summary>
-        public FocusedControl FocusedOn
-        {
-            get { return this.focusedOn; }
-        }
+        public FocusedControl FocusedOn { get; private set; }
 
         /// <summary>
         /// ショートカットキーが動作する否定条件となるフォーカス状態
         /// </summary>
-        public FocusedControl NotFocusedOn
-        {
-            get { return this.notFocusedOn; }
-        }
+        public FocusedControl NotFocusedOn { get; private set; }
 
         /// <summary>
         /// コマンドを実行した後、コントロール既定の動作を無効化するか否か (デフォルトは true)
         /// </summary>
-        public bool PreventDefault
-        {
-            get { return this.preventDefault; }
-        }
+        public bool PreventDefault { get; private set; }
 
         private ShortcutCommand()
         {
-            this.shortcuts = new Keys[0];
+            this.Shortcuts = new Keys[0];
             this.command = () => Task.FromResult(0);
             this.onlyWhen = () => true;
-            this.focusedOn = FocusedControl.None;
-            this.notFocusedOn = FocusedControl.None;
-            this.preventDefault = true;
+            this.FocusedOn = FocusedControl.None;
+            this.NotFocusedOn = FocusedControl.None;
+            this.PreventDefault = true;
         }
 
         /// <summary>
@@ -140,7 +124,7 @@ namespace OpenTween
             /// </summary>
             public Builder Keys(params Keys[] shortcuts)
             {
-                this.instance.shortcuts = shortcuts;
+                this.instance.Shortcuts = shortcuts;
                 return this;
             }
 
@@ -149,7 +133,7 @@ namespace OpenTween
             /// </summary>
             public Builder FocusedOn(FocusedControl focusedOn)
             {
-                this.instance.focusedOn = focusedOn;
+                this.instance.FocusedOn = focusedOn;
                 return this;
             }
 
@@ -158,7 +142,7 @@ namespace OpenTween
             /// </summary>
             public Builder NotFocusedOn(FocusedControl notFocusedOn)
             {
-                this.instance.notFocusedOn = notFocusedOn;
+                this.instance.NotFocusedOn = notFocusedOn;
                 return this;
             }
 
@@ -185,7 +169,7 @@ namespace OpenTween
             public ShortcutCommand Do(Func<Task> action, bool preventDefault = true)
             {
                 this.instance.command = action;
-                this.instance.preventDefault = preventDefault;
+                this.instance.PreventDefault = preventDefault;
 
                 return this.instance;
             }
index b4bd625..7c095b5 100644 (file)
@@ -160,17 +160,16 @@ namespace OpenTween
         public TwitterConfiguration Configuration { get; private set; }
         public TwitterTextConfiguration TextConfiguration { get; private set; }
 
+        public bool GetFollowersSuccess { get; private set; } = false;
+        public bool GetNoRetweetSuccess { get; private set; } = false;
+
         delegate void GetIconImageDelegate(PostClass post);
         private readonly object LockObj = new object();
         private ISet<long> followerId = new HashSet<long>();
-        private bool _GetFollowerResult = false;
         private long[] noRTId = new long[0];
-        private bool _GetNoRetweetResult = false;
 
         //プロパティからアクセスされる共通情報
         private string _uname;
-
-        private bool _readOwnPost;
         private List<string> _hashList = new List<string>();
 
         //max_idで古い発言を取得するために保持(lists分は個別タブで管理)
@@ -438,7 +437,7 @@ namespace OpenTween
 
             post.IsRead = read;
             post.IsOwl = false;
-            if (_readOwnPost) post.IsRead = true;
+            if (this.ReadOwnPost) post.IsRead = true;
             post.IsDm = false;
 
             TabInformations.GetInstance().AddPost(post);
@@ -450,32 +449,9 @@ namespace OpenTween
         public long UserId
             => this.Api.CurrentUserId;
 
-        private static MyCommon.ACCOUNT_STATE _accountState = MyCommon.ACCOUNT_STATE.Valid;
-        public static MyCommon.ACCOUNT_STATE AccountState
-        {
-            get
-            {
-                return _accountState;
-            }
-            set
-            {
-                _accountState = value;
-            }
-        }
-
+        public static MyCommon.ACCOUNT_STATE AccountState { get; set; } = MyCommon.ACCOUNT_STATE.Valid;
         public bool RestrictFavCheck { get; set; }
-
-        public bool ReadOwnPost
-        {
-            get
-            {
-                return _readOwnPost;
-            }
-            set
-            {
-                _readOwnPost = value;
-            }
-        }
+        public bool ReadOwnPost { get; set; }
 
         public int FollowersCount { get; private set; }
         public int FriendsCount { get; private set; }
@@ -685,7 +661,7 @@ namespace OpenTween
             var item = CreatePostsFromStatusData(status);
 
             item.IsRead = read;
-            if (item.IsMe && !read && _readOwnPost) item.IsRead = true;
+            if (item.IsMe && !read && this.ReadOwnPost) item.IsRead = true;
 
             return item;
         }
@@ -933,7 +909,7 @@ namespace OpenTween
                 var post = CreatePostsFromStatusData(status);
 
                 post.IsRead = read;
-                if (post.IsMe && !read && _readOwnPost) post.IsRead = true;
+                if (post.IsMe && !read && this.ReadOwnPost) post.IsRead = true;
 
                 if (tab != null && tab.IsInnerStorageTabType)
                     tab.AddPostQueue(post);
@@ -963,7 +939,7 @@ namespace OpenTween
                 var post = CreatePostsFromStatusData(status);
 
                 post.IsRead = read;
-                if ((post.IsMe && !read) && this._readOwnPost) post.IsRead = true;
+                if ((post.IsMe && !read) && this.ReadOwnPost) post.IsRead = true;
 
                 tab.AddPostQueue(post);
             }
@@ -1122,7 +1098,7 @@ namespace OpenTween
 
             relPosts.Values.ToList().ForEach(p =>
             {
-                if (p.IsMe && !read && this._readOwnPost)
+                if (p.IsMe && !read && this.ReadOwnPost)
                     p.IsRead = true;
                 else
                     p.IsRead = read;
@@ -1268,7 +1244,7 @@ namespace OpenTween
                 }
 
                 post.IsRead = read;
-                if (post.IsMe && !read && _readOwnPost) post.IsRead = true;
+                if (post.IsMe && !read && this.ReadOwnPost) post.IsRead = true;
                 post.IsReply = false;
                 post.IsExcludeReply = false;
                 post.IsDm = true;
@@ -1440,15 +1416,7 @@ namespace OpenTween
             this.followerId = newFollowerIds;
             TabInformations.GetInstance().RefreshOwl(this.followerId);
 
-            this._GetFollowerResult = true;
-        }
-
-        public bool GetFollowersSuccess
-        {
-            get
-            {
-                return _GetFollowerResult;
-            }
+            this.GetFollowersSuccess = true;
         }
 
         /// <summary>
@@ -1462,15 +1430,7 @@ namespace OpenTween
             this.noRTId = await this.Api.NoRetweetIds()
                 .ConfigureAwait(false);
 
-            this._GetNoRetweetResult = true;
-        }
-
-        public bool GetNoRetweetSuccess
-        {
-            get
-            {
-                return _GetNoRetweetResult;
-            }
+            this.GetNoRetweetSuccess = true;
         }
 
         /// <summary>
@@ -1837,30 +1797,8 @@ namespace OpenTween
 
 
 #region "UserStream"
-        private string trackWord_ = "";
-        public string TrackWord
-        {
-            get
-            {
-                return trackWord_;
-            }
-            set
-            {
-                trackWord_ = value;
-            }
-        }
-        private bool allAtReply_ = false;
-        public bool AllAtReply
-        {
-            get
-            {
-                return allAtReply_;
-            }
-            set
-            {
-                allAtReply_ = value;
-            }
-        }
+        public string TrackWord { get; set; } = "";
+        public bool AllAtReply { get; set; } = false;
 
         public event EventHandler NewPostFromStream;
         public event EventHandler UserStreamStarted;
@@ -1881,18 +1819,7 @@ namespace OpenTween
             public bool IsMe { get; set; }
         }
 
-        public List<FormattedEvent> storedEvent_ = new List<FormattedEvent>();
-        public List<FormattedEvent> StoredEvent
-        {
-            get
-            {
-                return storedEvent_;
-            }
-            set
-            {
-                storedEvent_ = value;
-            }
-        }
+        public List<FormattedEvent> StoredEvent { get; } = new List<FormattedEvent>();
 
         private readonly IReadOnlyDictionary<string, MyCommon.EVENTTYPE> eventTable = new Dictionary<string, MyCommon.EVENTTYPE>
         {
index 2df6853..a26a4d2 100644 (file)
@@ -285,7 +285,7 @@ namespace OpenTween
         private IntPtr profferServicePtr = new IntPtr();
         private WebBrowserAPI.IProfferService profferService;
 
-        private POLICY _Policy = 0; // DefaultですべてDisAllow
+        public POLICY SecurityPolicy { get; set; } = 0;
 
         public InternetSecurityManager(WebBrowser _WebBrowser)
         {
@@ -406,7 +406,7 @@ namespace OpenTween
                 dwAction <= WebBrowserAPI.URLACTION_SCRIPT_MAX)
             {
                 // スクリプト実行状態
-                if ((_Policy & POLICY.ALLOW_SCRIPT) == POLICY.ALLOW_SCRIPT)
+                if ((this.SecurityPolicy & POLICY.ALLOW_SCRIPT) == POLICY.ALLOW_SCRIPT)
                 {
                     pPolicy = WebBrowserAPI.URLPOLICY_ALLOW;
                 }
@@ -422,7 +422,7 @@ namespace OpenTween
                 dwAction <= WebBrowserAPI.URLACTION_ACTIVEX_MAX)
             {
                 // ActiveX実行状態
-                if ((_Policy & POLICY.ALLOW_ACTIVEX) == POLICY.ALLOW_ACTIVEX)
+                if ((this.SecurityPolicy & POLICY.ALLOW_ACTIVEX) == POLICY.ALLOW_ACTIVEX)
                 {
                     pPolicy = WebBrowserAPI.URLPOLICY_ALLOW;
                 }
@@ -450,18 +450,5 @@ namespace OpenTween
         {
             return WebBrowserAPI.INET_E_DEFAULT_ACTION;
         }
-
-
-        public POLICY SecurityPolicy
-        {
-            get
-            {
-                return _Policy;
-            }
-            set
-            {
-                _Policy = value;
-            }
-        }
     }
 }