utc.ToDateTimeUnsafe());
}
- public static TheoryData<string, DateTimeUtc> Parse_Test_Fixtures = new TheoryData<string, DateTimeUtc>
+ public static readonly TheoryData<string, DateTimeUtc> Parse_Test_Fixtures = new TheoryData<string, DateTimeUtc>
{
{ "2018-05-06T11:22:33.111", new DateTimeUtc(2018, 5, 6, 11, 22, 33, 111) },
{ "2018-05-06T11:22:33.111+00:00", new DateTimeUtc(2018, 5, 6, 11, 22, 33, 111) },
public void Parse_ErrorTest()
=> Assert.Throws<FormatException>(() => DateTimeUtc.Parse("### INVALID ###", DateTimeFormatInfo.InvariantInfo));
- public static TheoryData<string, bool, DateTimeUtc> TryParse_Test_Fixtures = new TheoryData<string, bool, DateTimeUtc>
+ public static readonly TheoryData<string, bool, DateTimeUtc> TryParse_Test_Fixtures = new TheoryData<string, bool, DateTimeUtc>
{
{ "2018-05-06T11:22:33.111", true, new DateTimeUtc(2018, 5, 6, 11, 22, 33, 111) },
{ "2018-05-06T11:22:33.111+00:00", true, new DateTimeUtc(2018, 5, 6, 11, 22, 33, 111) },
Assert.Equal(expectedResult, result);
}
- public static TheoryData<string, string, bool, DateTimeUtc> TryParseExact_Test_Fixtures = new TheoryData<string, string, bool, DateTimeUtc>
+ public static readonly TheoryData<string, string, bool, DateTimeUtc> TryParseExact_Test_Fixtures = new TheoryData<string, string, bool, DateTimeUtc>
{
{ "2018-05-06 11:22:33.111", "yyyy-MM-dd HH:mm:ss.fff", true, new DateTimeUtc(2018, 5, 6, 11, 22, 33, 111) },
{ "2018-05-06 11:22:33.111 +00:00", "yyyy-MM-dd HH:mm:ss.fff zzz", true, new DateTimeUtc(2018, 5, 6, 11, 22, 33, 111) },
{
public class LRUCacheDictionaryTest
{
- private static AnyOrderComparer<string> collComparer = AnyOrderComparer<string>.Instance;
+ private static readonly AnyOrderComparer<string> collComparer = AnyOrderComparer<string>.Instance;
[Fact]
public void InnerListTest()
{
public class TabInformationTest
{
- private TabInformations tabinfo;
+ private readonly TabInformations tabinfo;
public TabInformationTest()
{
Assert.Equal(expected, MyCommon.IsAnimatedGif(filename));
}
- public static TheoryData<string, DateTimeUtc> DateTimeParse_TestCase = new TheoryData<string, DateTimeUtc>
+ public static readonly TheoryData<string, DateTimeUtc> DateTimeParse_TestCase = new TheoryData<string, DateTimeUtc>
{
{ "Sun Nov 25 06:10:00 +00:00 2012", new DateTimeUtc(2012, 11, 25, 6, 10, 0) },
{ "Sun, 25 Nov 2012 06:10:00 +00:00", new DateTimeUtc(2012, 11, 25, 6, 10, 0) },
{
public class TabsDialogTest
{
- private TabInformations tabinfo;
+ private readonly TabInformations tabinfo;
public TabsDialogTest()
{
{
public TwitterApiStatus Owner { get; }
- private ConcurrentDictionary<string, ApiLimit> innerDict = new ConcurrentDictionary<string, ApiLimit>();
+ private readonly ConcurrentDictionary<string, ApiLimit> innerDict
+ = new ConcurrentDictionary<string, ApiLimit>();
public EndpointLimits(TwitterApiStatus owner)
=> this.Owner = owner;
public string inputText = "";
public bool isBack = false;
- private string startChar = "";
+ private readonly string startChar = "";
public void AddItem(string id)
{
private EDITMODE _mode;
private bool _directAdd;
private MultiSelectionState _multiSelState = MultiSelectionState.None;
- private TabInformations _sts;
+ private readonly TabInformations _sts;
private List<TabModel> tabs = new List<TabModel>();
private int selectedTabIndex = -1;
- private List<string> idlist = new List<string>();
+ private readonly List<string> idlist = new List<string>();
private enum EDITMODE
{
public bool RunSilent { get; set; }
//入力補助画面
- private AtIdSupplement _hashSupl;
+ private readonly AtIdSupplement _hashSupl;
//編集モード
private bool _isAdd = false;
{
public class HookGlobalHotkey : NativeWindow, IDisposable
{
- private Form _targetForm;
+ private readonly Form _targetForm;
private class KeyEventValue
{
public KeyEventArgs KeyEvent { get; }
}
}
- private Dictionary<int, KeyEventValue> _hotkeyID;
+ private readonly Dictionary<int, KeyEventValue> _hotkeyID;
[Flags]
public enum ModKeys
/// <summary>
/// innerDictionary の排他制御のためのロックオブジェクト
/// </summary>
- private object lockObject = new object();
+ private readonly object lockObject = new object();
/// <summary>
/// オブジェクトが破棄された否か
/// </remarks>
public int StateIndex { get; set; }
- private WeakReference imageReference = new WeakReference(null);
+ private readonly WeakReference imageReference = new WeakReference(null);
private Task imageTask = null;
public event EventHandler ImageDownloaded;
{
public partial class ListManage : OTBaseForm
{
- private Twitter tw;
+ private readonly Twitter tw;
public ListManage(Twitter tw)
{
public bool FilterModified { get; set; }
- private List<PostFilterRule> _filters = new List<PostFilterRule>();
- private object lockObjFilters = new object();
+ private readonly List<PostFilterRule> _filters = new List<PostFilterRule>();
+ private readonly object lockObjFilters = new object();
public FilterTabModel(string tabName) : base(tabName)
{
// 流速計測用
private int tweetsPerHour = 0;
- private ConcurrentDictionary<DateTimeUtc, int> tweetsTimestamps = new ConcurrentDictionary<DateTimeUtc, int>();
+ private readonly ConcurrentDictionary<DateTimeUtc, int> tweetsTimestamps = new ConcurrentDictionary<DateTimeUtc, int>();
public HomeTabModel() : this(MyCommon.DEFAULTTAB.RECENT)
{
public ConcurrentDictionary<long, PostClass> Posts { get; } = new ConcurrentDictionary<long, PostClass>();
- private Dictionary<long, PostClass> _quotes = new Dictionary<long, PostClass>();
- private ConcurrentDictionary<long, int> retweetsCount = new ConcurrentDictionary<long, int>();
+ private readonly Dictionary<long, PostClass> _quotes = new Dictionary<long, PostClass>();
+ private readonly ConcurrentDictionary<long, int> retweetsCount = new ConcurrentDictionary<long, int>();
public Stack<TabModel> RemovedTab { get; } = new Stack<TabModel>();
//AddPost(複数回) -> DistributePosts -> SubmitUpdate
private readonly TabCollection tabs = new TabCollection();
- private ConcurrentQueue<long> addQueue = new ConcurrentQueue<long>();
+ private readonly ConcurrentQueue<long> addQueue = new ConcurrentQueue<long>();
/// <summary>通知サウンドを再生する優先順位</summary>
- private Dictionary<MyCommon.TabUsageType, int> notifyPriorityByTabType = new Dictionary<MyCommon.TabUsageType, int>
+ private readonly Dictionary<MyCommon.TabUsageType, int> notifyPriorityByTabType = new Dictionary<MyCommon.TabUsageType, int>
{
[MyCommon.TabUsageType.DirectMessage] = 100,
[MyCommon.TabUsageType.Mentions] = 90,
//トランザクション用
private readonly object LockObj = new object();
- private static TabInformations _instance = new TabInformations();
+ private static readonly TabInformations _instance = new TabInformations();
//List
private List<ListElement> _lists = new List<ListElement>();
private IndexedSortedSet<long> _ids = new IndexedSortedSet<long>();
private ConcurrentQueue<TemporaryId> addQueue = new ConcurrentQueue<TemporaryId>();
- private ConcurrentQueue<long> removeQueue = new ConcurrentQueue<long>();
+ private readonly ConcurrentQueue<long> removeQueue = new ConcurrentQueue<long>();
private SortedSet<long> unreadIds = new SortedSet<long>();
private List<long> selectedStatusIds = new List<long>();
public class OpenUrlItem
{
- private string _linkText;
+ private readonly string _linkText;
public OpenUrlItem(string linkText, string url, string href)
{
[XmlAnyElement]
public XmlElement[] ExtraElements;
- private static object lockObj = new object();
+ private static readonly object lockObj = new object();
protected static T LoadSettings(string FileId)
{
public bool UseTwemoji = true;
[XmlIgnore]
- private FontConverter fontConverter = new FontConverter();
+ private readonly FontConverter fontConverter = new FontConverter();
protected string FontToString(Font font)
=> font != null ? this.fontConverter.ConvertToString(font) : null;
=> str != null ? (Font)this.fontConverter.ConvertFromString(str) : null;
[XmlIgnore]
- private ColorConverter colorConverter = new ColorConverter();
+ private readonly ColorConverter colorConverter = new ColorConverter();
protected string ColorToString(Color color)
=> this.colorConverter.ConvertToString(color);
/// </summary>
public class ShortUrl
{
- private static Lazy<ShortUrl> _instance;
+ private static readonly Lazy<ShortUrl> _instance;
/// <summary>
/// ShortUrl のインスタンスを取得します
public string BitlyKey { get; set; }
private HttpClient http;
- private ConcurrentDictionary<Uri, Uri> urlCache = new ConcurrentDictionary<Uri, Uri>();
+ private readonly ConcurrentDictionary<Uri, Uri> urlCache = new ConcurrentDictionary<Uri, Uri>();
private static readonly Regex HtmlLinkPattern = new Regex(@"(<a href="")(.+?)("")");
private readonly HttpClient localHttpClient;
- private object LockObj = new object();
+ private readonly object LockObj = new object();
public ImgAzyobuziNet(bool autoupdate)
: this(null, autoupdate)
=> Timestamp.ToLocalTime().ToString("T") + ": " + Summary;
}
- LinkedList<LogEntry> _logs;
+ readonly LinkedList<LogEntry> _logs;
const int MAXCNT = 20;
private FormWindowState _formWindowState = FormWindowState.Normal; // フォームの状態保存用 通知領域からアイコンをクリックして復帰した際に使用する
//twitter解析部
- private TwitterApi twitterApi = new TwitterApi();
+ private readonly TwitterApi twitterApi = new TwitterApi();
private Twitter tw;
//Growl呼び出し部
- private GrowlHelper gh = new GrowlHelper(ApplicationSettings.ApplicationName);
+ private readonly GrowlHelper gh = new GrowlHelper(ApplicationSettings.ApplicationName);
//サブ画面インスタンス
internal SearchWordDialog SearchDialog = new SearchWordDialog(); //検索画面インスタンス
- private OpenURL UrlDialog = new OpenURL();
+ private readonly OpenURL UrlDialog = new OpenURL();
public AtIdSupplement AtIdSupl; //@id補助
public AtIdSupplement HashSupl; //Hashtag補助
public HashtagManage HashMgr;
private Color _clFav; //Fav用文字色
private Color _clOWL; //片思い用文字色
private Color _clRetweet; //Retweet用文字色
- private Color _clHighLight = Color.FromKnownColor(KnownColor.HighlightText); //選択中の行用文字色
+ private readonly Color _clHighLight = Color.FromKnownColor(KnownColor.HighlightText); //選択中の行用文字色
private Font _fntDetail; //発言詳細部用フォント
private Color _clDetail; //発言詳細部用色
private Color _clDetailLink; //発言詳細部用リンク文字色
private Icon ReplyIcon; //5g
private Icon ReplyIconBlink; //6g
- private ImageList _listViewImageList = new ImageList(); //ListViewItemの高さ変更用
+ private readonly ImageList _listViewImageList = new ImageList(); //ListViewItemの高さ変更用
private PostClass _anchorPost;
private bool _anchorFlag; //true:関連発言移動中(関連移動以外のオペレーションをするとfalseへ。trueだとリスト背景色をアンカー発言選択中として描画)
- private List<StatusTextHistory> _history = new List<StatusTextHistory>(); //発言履歴
+ private readonly List<StatusTextHistory> _history = new List<StatusTextHistory>(); //発言履歴
private int _hisIdx; //発言履歴カレントインデックス
//発言投稿時のAPI引数(発言編集時に設定。手書きreplyでは設定されない)
private (long StatusId, string ScreenName)? inReplyTo = null; // リプライ先のステータスID・スクリーン名
//時速表示用
- private List<DateTimeUtc> _postTimestamps = new List<DateTimeUtc>();
- private List<DateTimeUtc> _favTimestamps = new List<DateTimeUtc>();
+ private readonly List<DateTimeUtc> _postTimestamps = new List<DateTimeUtc>();
+ private readonly List<DateTimeUtc> _favTimestamps = new List<DateTimeUtc>();
// 以下DrawItem関連
- private SolidBrush _brsHighLight = new SolidBrush(Color.FromKnownColor(KnownColor.Highlight));
+ private readonly SolidBrush _brsHighLight = new SolidBrush(Color.FromKnownColor(KnownColor.Highlight));
private SolidBrush _brsBackColorMine;
private SolidBrush _brsBackColorAt;
private SolidBrush _brsBackColorYou;
private SolidBrush _brsBackColorAtFromTarget;
private SolidBrush _brsBackColorAtTo;
private SolidBrush _brsBackColorNone;
- private SolidBrush _brsDeactiveSelection = new SolidBrush(Color.FromKnownColor(KnownColor.ButtonFace)); //Listにフォーカスないときの選択行の背景色
- private StringFormat sfTab = new StringFormat();
+ private readonly SolidBrush _brsDeactiveSelection = new SolidBrush(Color.FromKnownColor(KnownColor.ButtonFace)); //Listにフォーカスないときの選択行の背景色
+ private readonly StringFormat sfTab = new StringFormat();
//////////////////////////////////////////////////////////////////////////////////////////////////////////
private TabInformations _statuses;
private bool _isColumnChanged = false;
private const int MAX_WORKER_THREADS = 20;
- private SemaphoreSlim workerSemaphore = new SemaphoreSlim(MAX_WORKER_THREADS);
- private CancellationTokenSource workerCts = new CancellationTokenSource();
- private IProgress<string> workerProgress;
+ private readonly SemaphoreSlim workerSemaphore = new SemaphoreSlim(MAX_WORKER_THREADS);
+ private readonly CancellationTokenSource workerCts = new CancellationTokenSource();
+ private readonly IProgress<string> workerProgress;
private int UnreadCounter = -1;
private int UnreadAtCounter = -1;
- private string[] ColumnOrgText = new string[9];
- private string[] ColumnText = new string[9];
+ private readonly string[] ColumnOrgText = new string[9];
+ private readonly string[] ColumnText = new string[9];
private bool _DoFavRetweetFlags = false;
}
private Stack<ReplyChain> replyChains; //[, ]でのリプライ移動の履歴
- private Stack<(TabModel, PostClass)> selectPostChains = new Stack<(TabModel, PostClass)>(); //ポスト選択履歴
+ private readonly Stack<(TabModel, PostClass)> selectPostChains = new Stack<(TabModel, PostClass)>(); //ポスト選択履歴
public TabModel CurrentTab
=> this._statuses.SelectedTab;
MessageBox.Show(status.RetweetCount + Properties.Resources.RtCountText1);
}
- private HookGlobalHotkey _hookGlobalHotkey;
+ private readonly HookGlobalHotkey _hookGlobalHotkey;
public TweenMain()
{
_hookGlobalHotkey = new HookGlobalHotkey(this);
}
// 長いのでエイリアスとして e(...), eu(...), t(...) でエスケープできるようにする
- private static Func<string, string> e = EscapeHtml;
- private static Func<string, string> eu = Uri.EscapeDataString;
- private static Func<string, string> t = FilterText;
+ private static readonly Func<string, string> e = EscapeHtml;
+ private static readonly Func<string, string> eu = Uri.EscapeDataString;
+ private static readonly Func<string, string> t = FilterText;
private static string EscapeHtml(string text)
{
private long[] noRTId = Array.Empty<long>();
//プロパティからアクセスされる共通情報
- private List<string> _hashList = new List<string>();
+ private readonly List<string> _hashList = new List<string>();
private string nextCursorDirectMessage = null;
ALLOW_SCRIPT = 0x2,
}
- private object ocx = new object();
- private WebBrowserAPI.IServiceProvider ocxServiceProvider;
- private IntPtr profferServicePtr = new IntPtr();
- private WebBrowserAPI.IProfferService profferService;
+ private readonly object ocx = new object();
+ private readonly WebBrowserAPI.IServiceProvider ocxServiceProvider;
+ private readonly IntPtr profferServicePtr = new IntPtr();
+ private readonly WebBrowserAPI.IProfferService profferService;
public POLICY SecurityPolicy { get; set; } = 0;
{
public static class nicoms
{
- private static string[] _nicovideo =
+ private static readonly string[] _nicovideo =
{
"www.nicovideo.jp/watch/",
"live.nicovideo.jp/watch/",