["key3"] = "value3",
};
- string value;
- var ret = dict.TryGetValue("key1", out value);
+ var ret = dict.TryGetValue("key1", out var value);
Assert.True(ret);
Assert.Equal("value1", value);
// この時点ではまだ削除されない
Assert.Equal(1, homeTab.AllCount);
- string soundFile;
- PostClass[] notifyPosts;
- bool newMentionOrDm, isDeletePost;
- this.tabinfo.SubmitUpdate(out soundFile, out notifyPosts, out newMentionOrDm, out isDeletePost);
+ this.tabinfo.SubmitUpdate(out var soundFile, out var notifyPosts,
+ out var newMentionOrDm, out var isDeletePost);
Assert.True(isDeletePost);
Assert.Equal(0, homeTab.AllCount);
Assert.Equal(1, homeTab.AllCount);
Assert.Equal(1, favTab.AllCount);
- string soundFile;
- PostClass[] notifyPosts;
- bool newMentionOrDm, isDeletePost;
- this.tabinfo.SubmitUpdate(out soundFile, out notifyPosts, out newMentionOrDm, out isDeletePost);
+ this.tabinfo.SubmitUpdate(out var soundFile, out var notifyPosts,
+ out var newMentionOrDm, out var isDeletePost);
Assert.True(isDeletePost);
Assert.Equal(1, homeTab.AllCount);
this.tabinfo.DistributePosts();
- string soundFile;
- PostClass[] notifyPosts;
- bool newMentionOrDm, isDeletePost;
- this.tabinfo.SubmitUpdate(out soundFile, out notifyPosts, out newMentionOrDm, out isDeletePost);
+ this.tabinfo.SubmitUpdate(out var soundFile, out var notifyPosts,
+ out var newMentionOrDm, out var isDeletePost);
// DM が最も優先度が高いため DM の通知音が再生される
Assert.Equal("dm.wav", soundFile);
this.tabinfo.DistributePosts();
- string soundFile;
- PostClass[] notifyPosts;
- bool newMentionOrDm, isDeletePost;
- this.tabinfo.SubmitUpdate(out soundFile, out notifyPosts, out newMentionOrDm, out isDeletePost);
+ this.tabinfo.SubmitUpdate(out var soundFile, out var notifyPosts,
+ out var newMentionOrDm, out var isDeletePost);
// リプライの方が通知音の優先度が高いが、replyTab.SoundFile が空文字列なので次点の Recent の通知音を鳴らす
Assert.Equal("home.wav", soundFile);
{
if (!dict.ContainsKey(key)) continue;
- long result;
- if (long.TryParse(dict[key], out result))
+ if (long.TryParse(dict[key], out var result))
return result;
}
{
get
{
- ApiLimit limit;
- return this.innerDict.TryGetValue(endpoint, out limit)
+ return this.innerDict.TryGetValue(endpoint, out var limit)
? limit
: null;
}
private static bool SetConfigDirectoryPath()
{
- string configDir;
- if (StartupOptions.TryGetValue("configDir", out configDir) && !string.IsNullOrEmpty(configDir))
+ if (StartupOptions.TryGetValue("configDir", out var configDir) && !string.IsNullOrEmpty(configDir))
{
// 起動オプション /configDir で設定ファイルの参照先を変更できます
if (!Directory.Exists(configDir))
private void ButtonOK_Click(object sender, EventArgs e)
{
- bool isBlankMatch = false;
- bool isBlankExclude = false;
-
//入力チェック
- if (!CheckMatchRule(out isBlankMatch) || !CheckExcludeRule(out isBlankExclude))
+ if (!CheckMatchRule(out var isBlankMatch) || !CheckExcludeRule(out var isBlankExclude))
{
return;
}
int idx = ListTabs.SelectedIndex;
var origTabName = (string)this.ListTabs.SelectedItem;
- string newTabName;
- if (((TweenMain)this.Owner).TabRename(origTabName, out newTabName))
+ if (((TweenMain)this.Owner).TabRename(origTabName, out var newTabName))
{
ListTabs.Items.RemoveAt(idx);
ListTabs.Items.Insert(idx, newTabName);
return Task.Run(() =>
{
- Task<MemoryImage> cachedImageTask = null;
lock (this.lockObject)
{
- innerDictionary.TryGetValue(address, out cachedImageTask);
+ innerDictionary.TryGetValue(address, out var cachedImageTask);
if (cachedImageTask != null)
{
{
lock (this.lockObject)
{
- Task<MemoryImage> imageTask;
- if (!this.innerDictionary.TryGetValue(address, out imageTask) ||
+ if (!this.innerDictionary.TryGetValue(address, out var imageTask) ||
imageTask.Status != TaskStatus.RanToCompletion)
return null;
public bool Contains(KeyValuePair<TKey, TValue> item)
{
- LinkedListNode<KeyValuePair<TKey, TValue>> node;
- if (!this.innerDict.TryGetValue(item.Key, out node)) return false;
+ if (!this.innerDict.TryGetValue(item.Key, out var node)) return false;
return node.Value.Value.Equals(item.Value);
}
public bool Remove(TKey key)
{
- LinkedListNode<KeyValuePair<TKey, TValue>> node;
- if (!this.innerDict.TryGetValue(key, out node)) return false;
+ if (!this.innerDict.TryGetValue(key, out var node)) return false;
this.innerList.Remove(node);
public bool Remove(KeyValuePair<TKey, TValue> item)
{
- LinkedListNode<KeyValuePair<TKey, TValue>> node;
- if (!this.innerDict.TryGetValue(item.Key, out node)) return false;
+ if (!this.innerDict.TryGetValue(item.Key, out var node)) return false;
if (!node.Value.Value.Equals(item.Value)) return false;
public bool TryGetValue(TKey key, out TValue value)
{
- LinkedListNode<KeyValuePair<TKey, TValue>> node;
-
- var ret = this.innerDict.TryGetValue(key, out node);
+ var ret = this.innerDict.TryGetValue(key, out var node);
if (!ret)
{
}
set
{
- LinkedListNode<KeyValuePair<TKey, TValue>> node;
-
var pair = new KeyValuePair<TKey, TValue>(key, value);
- if (this.innerDict.TryGetValue(key, out node))
+ if (this.innerDict.TryGetValue(key, out var node))
{
this.innerList.Remove(node);
node.Value = pair;
if (string.IsNullOrEmpty(serviceName))
return null;
- IMediaUploadService service;
- return this.pictureService.TryGetValue(serviceName, out service) ? service : null;
+ return this.pictureService.TryGetValue(serviceName, out var service)
+ ? service : null;
}
}
/// </summary>
public IMediaUploadService GetService(string serviceName)
{
- IMediaUploadService service;
- this.pictureService.TryGetValue(serviceName, out service);
+ this.pictureService.TryGetValue(serviceName, out var service);
return service;
}
}
Interlocked.Exchange(ref this.tweetsPerHour, tweetsInWindow);
- int _;
foreach (var key in removeKeys)
- this.tweetsTimestamps.TryRemove(key, out _);
+ this.tweetsTimestamps.TryRemove(key, out var _);
}
}
}
if (setIsDeleted)
{
- PostClass post;
- if (this.internalPosts.TryGetValue(statusId, out post))
+ if (this.internalPosts.TryGetValue(statusId, out var post))
post.IsDeleted = true;
}
}
if (!base.RemovePostImmediately(statusId))
return false;
- PostClass removedPost;
- this.internalPosts.TryRemove(statusId, out removedPost);
+ this.internalPosts.TryRemove(statusId, out var removedPost);
return true;
}
// }
public PostClass RetweetSource(long Id)
{
- PostClass status;
- return this._statuses.TryGetValue(Id, out status)
+ return this._statuses.TryGetValue(Id, out var status)
? status
: null;
}
if (setIsDeleted)
{
- PostClass post;
- if (this._statuses.TryGetValue(statusId, out post))
+ if (this._statuses.TryGetValue(statusId, out var post))
post.IsDeleted = true;
}
}
public int SubmitUpdate()
{
- string soundFile;
- PostClass[] notifyPosts;
- bool newMentionOrDm, isDeletePost;
-
- return this.SubmitUpdate(out soundFile, out notifyPosts, out newMentionOrDm,
- out isDeletePost);
+ return this.SubmitUpdate(out var soundFile, out var notifyPosts,
+ out var newMentionOrDm, out var isDeletePost);
}
public int SubmitUpdate(out string soundFile, out PostClass[] notifyPosts,
// 通知対象のリストに追加
foreach (var statusId in addedIds)
{
- PostClass post;
- if (tab.Posts.TryGetValue(statusId, out post))
+ if (tab.Posts.TryGetValue(statusId, out var post))
notifyPostsList.Add(post);
}
}
// SettingCommon.PlaySound が false であれば TweenMain 側で無効化される
if (!string.IsNullOrEmpty(tab.SoundFile))
{
- int notifyPriority;
- if (!this.notifyPriorityByTabType.TryGetValue(tab.TabType, out notifyPriority))
+ if (!this.notifyPriorityByTabType.TryGetValue(tab.TabType, out var notifyPriority))
notifyPriority = 0;
if (notifyPriority > currentNotifyPriority)
// 全てのタブから表示されなくなった発言は this._statuses からも削除する
if (orphaned)
- {
- PostClass removedPost;
- this._statuses.TryRemove(removedId, out removedPost);
- }
+ this._statuses.TryRemove(removedId, out var removedPost);
}
return addedCountTotal;
var adddedCount = 0;
- long statusId;
- while (this.addQueue.TryDequeue(out statusId))
+ while (this.addQueue.TryDequeue(out var statusId))
{
- PostClass post;
- if (!this._statuses.TryGetValue(statusId, out post))
+ if (!this._statuses.TryGetValue(statusId, out var post))
continue;
var filterHit = false; // フィルタにヒットしたタブがあるか
if (this.IsMuted(Item, isHomeTimeline: true))
return;
- PostClass status;
- if (_statuses.TryGetValue(Item.StatusId, out status))
+ if (_statuses.TryGetValue(Item.StatusId, out var status))
{
if (Item.IsFav)
{
}
// TabInformations自身が保持しているツイートであればここで IsRead を変化させる
- PostClass post;
- if (this.Posts.TryGetValue(statusId, out post))
+ if (this.Posts.TryGetValue(statusId, out var post))
post.IsRead = read;
return true;
{
foreach (var statusId in homeTab.GetUnreadIds())
{
- PostClass post;
- if (!this.Posts.TryGetValue(statusId, out post))
+ if (!this.Posts.TryGetValue(statusId, out var post))
continue;
if (post.IsReply || post.FilterHit)
{
get
{
- PostClass status;
- if (this._statuses.TryGetValue(ID, out status))
+ if (this._statuses.TryGetValue(ID, out var status))
return status;
if (this._quotes.TryGetValue(ID, out status))
if (!hit)
{
- PostClass post;
- if (this._statuses.TryGetValue(id, out post))
+ if (this._statuses.TryGetValue(id, out var post))
homeTab.AddPostImmediately(post.StatusId, post.IsRead);
}
}
}
}
if (!Hit)
- {
- PostClass removedPost;
- _statuses.TryRemove(Id, out removedPost);
- }
+ _statuses.TryRemove(Id, out var removedPost);
}
}
{
lock (LockObj)
{
- TabModel tab;
- return _tabs.TryGetValue(tabName, out tab)
+ return _tabs.TryGetValue(tabName, out var tab)
? tab
: null;
}
{
var addedIds = new List<long>();
- TemporaryId tId;
- while (this.addQueue.TryDequeue(out tId))
+ while (this.addQueue.TryDequeue(out var tId))
{
if (this.AddPostImmediately(tId.StatusId, tId.Read))
addedIds.Add(tId.StatusId);
{
var removedIds = new List<long>();
- long statusId;
- while (this.removeQueue.TryDequeue(out statusId))
+ while (this.removeQueue.TryDequeue(out var statusId))
{
if (this.RemovePostImmediately(statusId))
removedIds.Add(statusId);
comparison = (x, y) =>
{
- PostClass xPost, yPost;
- this.Posts.TryGetValue(x, out xPost);
- this.Posts.TryGetValue(y, out yPost);
+ this.Posts.TryGetValue(x, out var xPost);
+ this.Posts.TryGetValue(y, out var yPost);
var compare = sign * postComparison(xPost, yPost);
if (compare != 0)
{
get
{
- PostClass post;
- if (!this.Posts.TryGetValue(this.GetStatusIdAt(index), out post))
+ if (!this.Posts.TryGetValue(this.GetStatusIdAt(index), out var post))
throw new ArgumentOutOfRangeException(nameof(index), "Post not exists");
return post;
foreach (var index in searchIndices)
{
- PostClass post;
- if (!this.Posts.TryGetValue(this.GetStatusIdAt(index), out post))
+ if (!this.Posts.TryGetValue(this.GetStatusIdAt(index), out var post))
continue;
if (stringComparer(post.Nickname) || stringComparer(post.TextFromApi) || stringComparer(post.ScreenName))
public static DateTime DateTimeParse(string input)
{
- DateTime rslt;
string[] format = {
"ddd MMM dd HH:mm:ss zzzz yyyy",
"ddd, d MMM yyyy HH:mm:ss zzzz",
fmt,
DateTimeFormatInfo.InvariantInfo,
DateTimeStyles.None,
- out rslt))
+ out var rslt))
{
return rslt;
}
EnumWindows((hWnd, lParam) =>
{
- uint procId;
- GetWindowThreadProcessId(hWnd, out procId);
+ GetWindowThreadProcessId(hWnd, out var procId);
if (procId == pid)
{
private void TextProxyPort_Validating(object sender, CancelEventArgs e)
{
- int port;
if (string.IsNullOrWhiteSpace(TextProxyPort.Text)) TextProxyPort.Text = "0";
- if (int.TryParse(TextProxyPort.Text.Trim(), out port) == false)
+ if (int.TryParse(TextProxyPort.Text.Trim(), out var port) == false)
{
MessageBox.Show(Properties.Resources.TextProxyPort_ValidatingText1);
e.Cancel = true;
if (!ShortUrlHosts.Contains(uri.Host) && !IsIrregularShortUrl(uri))
return uri;
- Uri expanded;
- if (this.urlCache.TryGetValue(uri, out expanded))
+ if (this.urlCache.TryGetValue(uri, out var expanded))
return expanded;
if (this.urlCache.Count > this.PurgeCount)
}
var firstRetrieveElement = thumbElement.Element("first_retrieve");
- DateTime firstRetrieveDate;
- if (firstRetrieveElement != null && DateTime.TryParse(firstRetrieveElement.Value, out firstRetrieveDate))
+ if (firstRetrieveElement != null && DateTime.TryParse(firstRetrieveElement.Value, out var firstRetrieveDate))
{
tooltip.Append(Properties.Resources.NiconicoInfoText3);
tooltip.Append(firstRetrieveDate.ToString());
var listSelections = this.SaveListViewSelection();
//更新確定
- PostClass[] notifyPosts;
- string soundFile;
int addCount;
- bool newMentionOrDm;
- bool isDelete;
- addCount = _statuses.SubmitUpdate(out soundFile, out notifyPosts, out newMentionOrDm, out isDelete);
+ addCount = _statuses.SubmitUpdate(out var soundFile, out var notifyPosts,
+ out var newMentionOrDm, out var isDelete);
if (MyCommon._endingFlag) return;
return;
// キャッシュに含まれていないアイテムは対象外
- ListViewItem itm;
- PostClass post;
- if (!listCache.TryGetValue(Index, out itm, out post))
+ if (!listCache.TryGetValue(Index, out var itm, out var post))
return;
ChangeItemStyleRead(Read, itm, post, ((DetailsListView)_curTab.Tag));
if (!CheckAccountValid())
throw new WebApiException("Auth error. Check your account");
- PostClass post;
- if (!tab.Posts.TryGetValue(statusId, out post))
+ if (!tab.Posts.TryGetValue(statusId, out var post))
return;
if (post.IsFav)
private async Task FavoriteChange(bool FavAdd, bool multiFavoriteChangeDialogEnable = true)
{
- TabModel tab;
- if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out tab))
+ if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out var tab))
return;
//trueでFavAdd,falseでFavRemove
var listCache = this._listItemCache;
if (listCache != null)
{
- ListViewItem item;
- PostClass post;
- if (listCache.TryGetValue(Index, out item, out post))
+ if (listCache.TryGetValue(Index, out var item, out var post))
return post;
}
{
if (_curTab != null)
{
- TabModel tab;
- if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out tab))
+ if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out var tab))
return;
switch (tab)
//ページ指定をマイナス1に
if (_curTab != null)
{
- TabModel tab;
- if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out tab))
+ if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out var tab))
return;
switch (tab)
var listCache = this._listItemCache;
if (listCache?.TargetList == sender)
{
- ListViewItem item;
- PostClass cacheItemPost;
- if (listCache.TryGetValue(e.ItemIndex, out item, out cacheItemPost))
+ if (listCache.TryGetValue(e.ItemIndex, out var item, out var cacheItemPost))
{
e.Item = item;
return;
rct.Height -= fontHeight;
}
- int heightDiff;
- int drawLineCount = Math.Max(1, Math.DivRem((int)rct.Height, fontHeight, out heightDiff));
+ int drawLineCount = Math.Max(1, Math.DivRem((int)rct.Height, fontHeight, out var heightDiff));
//if (heightDiff > fontHeight * 0.7)
//{
if (e.Control || e.Shift || e.Alt)
this._anchorFlag = false;
- Task asyncTask;
- if (CommonKeyDown(e.KeyData, FocusedControl.ListTab, out asyncTask))
+ if (CommonKeyDown(e.KeyData, FocusedControl.ListTab, out var asyncTask))
{
e.Handled = true;
e.SuppressKeyPress = true;
private async void StatusText_KeyDown(object sender, KeyEventArgs e)
{
- Task asyncTask;
- if (CommonKeyDown(e.KeyData, FocusedControl.StatusText, out asyncTask))
+ if (CommonKeyDown(e.KeyData, FocusedControl.StatusText, out var asyncTask))
{
e.Handled = true;
e.SuppressKeyPress = true;
private async void OpenURLFileMenuItem_Click(object sender, EventArgs e)
{
- string inputText;
- var ret = InputDialog.Show(this, Properties.Resources.OpenURL_InputText, Properties.Resources.OpenURL_Caption, out inputText);
+ var ret = InputDialog.Show(this, Properties.Resources.OpenURL_InputText, Properties.Resources.OpenURL_Caption, out var inputText);
if (ret != DialogResult.OK)
return;
private void ListTab_DoubleClick(object sender, MouseEventArgs e)
{
- string _;
- TabRename(this.ListTab.SelectedTab.Text, out _);
+ TabRename(this.ListTab.SelectedTab.Text, out var _);
}
private void ListTab_MouseDown(object sender, MouseEventArgs e)
if (_statuses == null) return;
if (_statuses.Tabs == null) return;
- TabModel tb;
- if (!this._statuses.Tabs.TryGetValue(this._rclickTabName, out tb))
+ if (!this._statuses.Tabs.TryGetValue(this._rclickTabName, out var tb))
return;
NotifyDispMenuItem.Checked = tb.Notify;
//選択発言を元にフィルタ追加
foreach (int idx in _curList.SelectedIndices)
{
- string tabName;
//タブ選択(or追加)
- if (!SelectTab(out tabName)) return;
+ if (!SelectTab(out var tabName)) return;
fltDialog.SetCurrent(tabName);
if (_statuses.Tabs[_curTab.Text][idx].RetweetedId == null)
public void AddFilterRuleByScreenName(params string[] screenNameArray)
{
//タブ選択(or追加)
- string tabName;
- if (!SelectTab(out tabName)) return;
+ if (!SelectTab(out var tabName)) return;
var tab = (FilterTabModel)this._statuses.Tabs[tabName];
public void AddFilterRuleBySource(params string[] sourceArray)
{
// タブ選択ダイアログを表示(or追加)
- string tabName;
- if (!this.SelectTab(out tabName))
+ if (!this.SelectTab(out var tabName))
return;
var filterTab = (FilterTabModel)this._statuses.Tabs[tabName];
{
if (string.IsNullOrEmpty(_rclickTabName)) return;
- string _;
- TabRename(_rclickTabName, out _);
+ TabRename(_rclickTabName, out var _);
}
private async void BitlyToolStripMenuItem_Click(object sender, EventArgs e)
using (var origImage = item.CreateImage())
{
- MemoryImage newImage;
- if (alphaPNGWorkaround && this.AddAlphaChannelIfNeeded(origImage.Image, out newImage))
+ if (alphaPNGWorkaround && this.AddAlphaChannelIfNeeded(origImage.Image, out var newImage))
{
using (var newMediaItem = new MemoryImageMediaItem(newImage))
{
var match = Twitter.StatusUrlRegex.Match(url);
if (match.Success)
{
- long statusId;
- if (long.TryParse(match.Groups["StatusId"].Value, out statusId))
+ if (long.TryParse(match.Groups["StatusId"].Value, out var statusId))
yield return statusId;
}
}
.Concat(Twitter.ThirdPartyStatusUrlRegex.Matches(text).Cast<Match>());
foreach (var _match in ma)
{
- Int64 _statusId;
- if (Int64.TryParse(_match.Groups["StatusId"].Value, out _statusId))
+ if (Int64.TryParse(_match.Groups["StatusId"].Value, out var _statusId))
{
if (relPosts.ContainsKey(_statusId))
continue;
evt.Username = eventData.Source.ScreenName;
evt.IsMe = evt.Username.ToLowerInvariant().Equals(this.Username.ToLowerInvariant());
- MyCommon.EVENTTYPE eventType;
- eventTable.TryGetValue(eventData.Event, out eventType);
+ eventTable.TryGetValue(eventData.Event, out var eventType);
evt.Eventtype = eventType;
TwitterStreamEvent<TwitterStatusCompat> tweetEvent;
var tabinfo = TabInformations.GetInstance();
- PostClass post;
var statusId = tweet.Id;
- if (!tabinfo.Posts.TryGetValue(statusId, out post))
+ if (!tabinfo.Posts.TryGetValue(statusId, out var post))
break;
if (eventData.Event == "favorite")
// 自分を IInternetSecurityManager として提供
try
{
- int cookie = 0;
profferService.ProfferService(
- ref WebBrowserAPI.IID_IInternetSecurityManager, this, out cookie);
+ ref WebBrowserAPI.IID_IInternetSecurityManager, this, out var cookie);
}
catch (SEHException ex)
{