• R/O
  • HTTP
  • SSH
  • HTTPS

open-tween: Commit

開発に使用するリポジトリ


Commit MetaInfo

Revision69d5cc6b9e64c894e4245ebc06fc8bef0c42aeed (tree)
Time2019-09-01 05:46:00
AuthorKimura Youichi <kim.upsilon@bucy...>
CommiterKimura Youichi

Log Message

ID/Source振り分けルール作成でKeyNotFoundExceptionが発生する不具合を修正

Fixes: 91c59331 ("TabInformations.MuteTabプロパティを追加しTabsからミュートタブを除外")

Change Summary

Incremental Difference

--- a/OpenTween/TabsDialog.cs
+++ b/OpenTween/TabsDialog.cs
@@ -46,7 +46,7 @@ namespace OpenTween
4646
4747 protected internal class TabListItem
4848 {
49- public TabModel? Tab { get; set; }
49+ public FilterTabModel? Tab { get; set; }
5050 public string Label { get; set; } = "";
5151
5252 public override string ToString()
@@ -82,10 +82,8 @@ namespace OpenTween
8282
8383 var tabs = this.TabInfo.Tabs.Append(this.TabInfo.MuteTab);
8484
85- foreach (var tab in tabs)
85+ foreach (var tab in tabs.OfType<FilterTabModel>())
8686 {
87- if (!tab.IsDistributableTabType) continue;
88-
8987 this.TabList.Items.Add(new TabListItem
9088 {
9189 Label = tab.TabName,
@@ -110,14 +108,14 @@ namespace OpenTween
110108 this.OK_Button.Enabled = true;
111109 }
112110
113- public TabModel? SelectedTab
111+ public FilterTabModel? SelectedTab
114112 => this.TabList.SelectedItem is TabListItem item ? item.Tab : null;
115113
116- public TabModel[] SelectedTabs
114+ public FilterTabModel[] SelectedTabs
117115 => this.TabList.SelectedItems
118116 .Cast<TabListItem>()
119117 .Select(x => x.Tab)
120- .OfType<TabModel>()
118+ .OfType<FilterTabModel>()
121119 .ToArray();
122120 }
123121 }
--- a/OpenTween/Tween.cs
+++ b/OpenTween/Tween.cs
@@ -8091,9 +8091,9 @@ namespace OpenTween
80918091 foreach (var post in this.CurrentTab.SelectedPosts)
80928092 {
80938093 //タブ選択(or追加)
8094- if (!SelectTab(out var tabName)) return;
8094+ if (!SelectTab(out var tab)) return;
80958095
8096- fltDialog.SetCurrent(tabName);
8096+ fltDialog.SetCurrent(tab.TabName);
80978097
80988098 if (post.RetweetedBy == null)
80998099 {
@@ -8251,9 +8251,7 @@ namespace OpenTween
82518251 public void AddFilterRuleByScreenName(params string[] screenNameArray)
82528252 {
82538253 //タブ選択(or追加)
8254- if (!SelectTab(out var tabName)) return;
8255-
8256- var tab = (FilterTabModel)this._statuses.Tabs[tabName];
8254+ if (!SelectTab(out var tab)) return;
82578255
82588256 bool mv;
82598257 bool mk;
@@ -8288,11 +8286,9 @@ namespace OpenTween
82888286 public void AddFilterRuleBySource(params string[] sourceArray)
82898287 {
82908288 // タブ選択ダイアログを表示(or追加)
8291- if (!this.SelectTab(out var tabName))
8289+ if (!this.SelectTab(out var filterTab))
82928290 return;
82938291
8294- var filterTab = (FilterTabModel)this._statuses.Tabs[tabName];
8295-
82968292 bool mv;
82978293 bool mk;
82988294 if (filterTab.TabType != MyCommon.TabUsageType.Mute)
@@ -8324,24 +8320,25 @@ namespace OpenTween
83248320 this.SaveConfigsTabs();
83258321 }
83268322
8327- private bool SelectTab([NotNullWhen(true)] out string? tabName)
8323+ private bool SelectTab([NotNullWhen(true)] out FilterTabModel? tab)
83288324 {
83298325 do
83308326 {
8331- tabName = null;
8327+ tab = null;
83328328
83338329 //振り分け先タブ選択
83348330 using (var dialog = new TabsDialog(_statuses))
83358331 {
83368332 if (dialog.ShowDialog(this) == DialogResult.Cancel) return false;
83378333
8338- tabName = dialog.SelectedTab?.TabName;
8334+ tab = dialog.SelectedTab;
83398335 }
83408336
83418337 this.CurrentTabPage.Focus();
83428338 //新規タブを選択→タブ作成
8343- if (tabName == null)
8339+ if (tab == null)
83448340 {
8341+ string tabName;
83458342 using (var inputName = new InputTabName())
83468343 {
83478344 inputName.TabName = _statuses.MakeTabName("MyTab");
@@ -8352,8 +8349,8 @@ namespace OpenTween
83528349 this.TopMost = SettingManager.Common.AlwaysTop;
83538350 if (!string.IsNullOrEmpty(tabName))
83548351 {
8355- var tab = new FilterTabModel(tabName);
8356- if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false))
8352+ var newTab = new FilterTabModel(tabName);
8353+ if (!_statuses.AddTab(newTab) || !AddNewTab(newTab, startup: false))
83578354 {
83588355 var tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText2, tabName);
83598356 MessageBox.Show(tmp, Properties.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
@@ -8361,6 +8358,7 @@ namespace OpenTween
83618358 }
83628359 else
83638360 {
8361+ tab = newTab;
83648362 return true;
83658363 }
83668364 }
Show on old repository browser