/// <summary> /// 終了する /// </summary> public void End() { // 戦闘分析を開放する CombatAnalyzer.Default.Denitialize(); // ログバッファを開放する if (this.LogBuffer != null) { this.LogBuffer.Dispose(); this.LogBuffer = null; } lock (lockObject) { // 監視を開放する if (this.RefreshTimer != null) { this.RefreshTimer.Stop(); this.RefreshTimer.Dispose(); this.RefreshTimer = null; } } // 全てのPanelを閉じる this.ClosePanels(); OnePointTelopController.CloseTelops(); // 設定を保存する Settings.Default.Save(); SpellTimerTable.Save(); OnePointTelopTable.Default.Save(); // instanceを初期化する instance = null; }
/// <summary> /// エクスポート Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void ExportButton_Click(object sender, EventArgs e) { this.SaveFileDialog.FileName = "ACT.SpecialSpellTimer.Spells.xml"; if (this.SaveFileDialog.ShowDialog(this) != DialogResult.Cancel) { SpellTimerTable.Save( this.SaveFileDialog.FileName); } }
/// <summary> /// 終了する /// </summary> public void End() { this.running = false; // 戦闘分析を開放する CombatAnalyzer.Default.Denitialize(); // ログバッファを開放する if (this.LogBuffer != null) { this.LogBuffer.Dispose(); this.LogBuffer = null; } // 監視を開放する if (this.RefreshWindowTimer != null) { this.RefreshWindowTimer.Stop(); this.RefreshWindowTimer = null; } if (this.logPoller != null) { if (this.logPoller.IsAlive) { try { if (!this.logPoller.Join(TimeSpan.FromSeconds(5))) { this.logPoller.Abort(); } } catch { } this.logPoller = null; } } // 全てのPanelを閉じる this.ClosePanels(); OnePointTelopController.CloseTelops(); // 設定を保存する Settings.Default.Save(); SpellTimerTable.Save(); OnePointTelopTable.Default.Save(); // instanceを初期化する instance = null; }
/// <summary> /// 終了する /// </summary> public void End() { this.running = false; // 戦闘分析を開放する CombatAnalyzer.Default.Denitialize(); // ログバッファを開放する if (this.LogBuffer != null) { this.LogBuffer.Dispose(); this.LogBuffer = null; } // Viewの描画を開放する if (this.refreshWindowTimer != null) { this.refreshWindowTimer.Stop(); this.refreshWindowTimer = null; } // 監視を開放する if (this.logPoller != null) { this.logPoller.Join(TimeSpan.FromSeconds(5)); if (this.logPoller.IsAlive) { this.logPoller.Abort(); } this.logPoller = null; } // 全てのPanelを閉じる this.ClosePanels(); OnePointTelopController.CloseTelops(); // 設定を保存する Settings.Default.Save(); SpellTimerTable.Save(); OnePointTelopTable.Default.Save(); // テーブルコンパイラを停止する TableCompiler.Instance.End(); // FFXIVのスキャンを停止する FFXIV.Instance.End(); // instanceを初期化する instance = null; }
/// <summary> /// 削除 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void DeleteButton_Click(object sender, EventArgs e) { this.EditSpellsTableBlock(() => { lock (SpellTimerTable.Table) { var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { SpellTimerTable.Table.Remove(src); TableCompiler.Instance.RecompileSpells(); SpellTimerTable.RemoveAllInstanceSpells(); SpellTimerTable.Save(); this.DetailGroupBox.Visible = false; this.DetailPanelGroupBox.Visible = false; } } }); // 今の選択ノードを取り出す var targetNode = this.SpellTimerTreeView.SelectedNode; if (targetNode != null) { // 1個前のノードを取り出しておく var prevNode = targetNode.PrevNode; if (targetNode.Parent != null && targetNode.Parent.Nodes.Count > 1) { targetNode.Remove(); if (prevNode != null) { this.SpellTimerTreeView.SelectedNode = prevNode; } } else { targetNode.Parent.Remove(); } } // 標準のスペルタイマーへ変更を反映する SpellTimerCore.Default.ApplyToNormalSpellTimer(); }
/// <summary> /// 削除 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void DeleteButton_Click(object sender, EventArgs e) { lock (SpellTimerTable.Table) { var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { SpellTimerTable.Table.Remove(src); SpellTimerTable.Save(); this.DetailGroupBox.Visible = false; this.DetailPanelGroupBox.Visible = false; } } // 今の選択ノードを取り出す var targetNode = this.SpellTimerTreeView.SelectedNode; if (targetNode != null) { // 1個前のノードを取り出しておく var prevNode = targetNode.PrevNode; if (targetNode.Parent != null && targetNode.Parent.Nodes.Count > 1) { targetNode.Remove(); if (prevNode != null) { this.SpellTimerTreeView.SelectedNode = prevNode; } } else { targetNode.Parent.Remove(); } } }
private void VisualSettingControl_Load(object sender, EventArgs e) { var colorSetDirectory = this.GetColorSetDirectory; if (Directory.Exists(colorSetDirectory)) { this.OpenFileDialog.InitialDirectory = colorSetDirectory; this.SaveFileDialog.InitialDirectory = colorSetDirectory; } this.WidthNumericUpDown.Value = this.BarSize.Width; this.HeightNumericUpDown.Value = this.BarSize.Height; this.RefreshSampleImage(); this.ChangeFontItem.Click += (s1, e1) => { var f = new FontDialogWindow(); f.SetOwner(this.ParentForm); f.FontInfo = this.GetFontInfo(); if (f.ShowDialog().Value) { this.SetFontInfo(f.FontInfo); this.RefreshSampleImage(); } }; this.ChangeFontColorItem.Click += (s1, e1) => { this.ColorDialog.Color = this.FontColor; if (this.ColorDialog.ShowDialog(this) != DialogResult.Cancel) { this.FontColor = this.ColorDialog.Color; this.RefreshSampleImage(); } }; this.ChangeFontOutlineColorItem.Click += (s1, e1) => { this.ColorDialog.Color = this.FontOutlineColor; if (this.ColorDialog.ShowDialog(this) != DialogResult.Cancel) { this.FontOutlineColor = this.ColorDialog.Color; this.RefreshSampleImage(); } }; this.ChangeBarColorItem.Click += (s1, e1) => { this.ColorDialog.Color = this.BarColor; if (this.ColorDialog.ShowDialog(this) != DialogResult.Cancel) { this.BarColor = this.ColorDialog.Color; this.RefreshSampleImage(); } }; this.ChangeBarOutlineColorItem.Click += (s1, e1) => { this.ColorDialog.Color = this.BarOutlineColor; if (this.ColorDialog.ShowDialog(this) != DialogResult.Cancel) { this.BarOutlineColor = this.ColorDialog.Color; this.RefreshSampleImage(); } }; this.ChangeBackgoundColorItem.Click += (s1, e1) => { this.ColorDialog.Color = this.backgroundColor; if (this.ColorDialog.ShowDialog(this) != DialogResult.Cancel) { this.backgroundColor = Color.FromArgb( this.alphaDialog.Alpha, this.ColorDialog.Color); this.RefreshSampleImage(); } }; this.ChangeBackgroundAlphaItem.Click += (s1, e1) => { this.alphaDialog.Alpha = this.backgroundColor.A; if (this.alphaDialog.ShowDialog(this) != DialogResult.Cancel) { this.backgroundColor = Color.FromArgb( this.alphaDialog.Alpha, this.backgroundColor); this.RefreshSampleImage(); } }; this.LoadColorSetItem.Click += (s1, e1) => { if (this.OpenFileDialog.ShowDialog(this) != DialogResult.Cancel) { using (var sr = new StreamReader(this.OpenFileDialog.FileName, new UTF8Encoding(false))) { var xs = new XmlSerializer(typeof(ColorSet)); var colorSet = xs.Deserialize(sr) as ColorSet; if (colorSet != null) { this.FontColor = colorSet.FontColor.FromHTML(); this.FontOutlineColor = colorSet.FontOutlineColor.FromHTML(); this.BarColor = colorSet.BarColor.FromHTML(); this.BarOutlineColor = colorSet.BarOutlineColor.FromHTML(); this.backgroundColor = string.IsNullOrWhiteSpace(colorSet.BackgroundColor) ? Color.Transparent : Color.FromArgb(colorSet.BackgroundAlpha, colorSet.BackgroundColor.FromHTML()); this.RefreshSampleImage(); // カラーパレットに登録する this.ColorDialog.CustomColors = new int[] { ColorTranslator.ToOle(colorSet.FontColor.FromHTML()), ColorTranslator.ToOle(colorSet.FontOutlineColor.FromHTML()), ColorTranslator.ToOle(colorSet.BarColor.FromHTML()), ColorTranslator.ToOle(colorSet.BarOutlineColor.FromHTML()), }; } } } }; this.SaveColorSetItem.Click += (s1, e1) => { if (string.IsNullOrWhiteSpace(this.SaveFileDialog.FileName)) { this.SaveFileDialog.FileName = "スペスペ配色セット.xml"; } if (this.SaveFileDialog.ShowDialog(this) != DialogResult.Cancel) { var colorSet = new ColorSet() { FontColor = this.FontColor.ToHTML(), FontOutlineColor = this.FontOutlineColor.ToHTML(), BarColor = this.BarColor.ToHTML(), BarOutlineColor = this.BarOutlineColor.ToHTML(), BackgroundColor = this.backgroundColor.ToHTML(), BackgroundAlpha = this.backgroundColor.A, }; using (var sw = new StreamWriter(this.SaveFileDialog.FileName, false, new UTF8Encoding(false))) { var xs = new XmlSerializer(typeof(ColorSet)); xs.Serialize(sw, colorSet); } } }; this.WidthNumericUpDown.ValueChanged += (s1, e1) => { this.RefreshSampleImage(); }; this.HeightNumericUpDown.ValueChanged += (s1, e1) => { this.RefreshSampleImage(); }; this.ResetSpellFontItem.Click += (s1, e1) => { foreach (var s in SpellTimerTable.Table) { s.Font = this.GetFontInfo(); } SpellTimerCore.Default.ClosePanels(); SpellTimerTable.Save(); }; this.ResetSpellBarSizeItem.Click += (s1, e1) => { foreach (var s in SpellTimerTable.Table) { s.BarWidth = this.BarSize.Width; s.BarHeight = this.BarSize.Height; } SpellTimerCore.Default.ClosePanels(); SpellTimerTable.Save(); }; this.ResetSpellColorItem.Click += (s1, e1) => { foreach (var s in SpellTimerTable.Table) { s.FontColor = this.FontColor.ToHTML(); s.FontOutlineColor = this.FontOutlineColor.ToHTML(); s.BarColor = this.BarColor.ToHTML(); s.BarOutlineColor = this.BarOutlineColor.ToHTML(); s.BackgroundColor = this.backgroundColor.ToHTML(); s.BackgroundAlpha = this.backgroundColor.A; } SpellTimerCore.Default.ClosePanels(); SpellTimerTable.Save(); }; this.ResetTelopFontItem.Click += (s1, e1) => { foreach (var s in OnePointTelopTable.Default.Table) { s.Font = this.GetFontInfo(); } OnePointTelopController.CloseTelops(); OnePointTelopTable.Default.Save(); }; this.ResetTelopColorItem.Click += (s1, e1) => { foreach (var s in OnePointTelopTable.Default.Table) { s.FontColor = this.FontColor.ToHTML(); s.FontOutlineColor = this.FontOutlineColor.ToHTML(); s.BackgroundColor = this.backgroundColor.ToHTML(); s.BackgroundAlpha = this.backgroundColor.A; } OnePointTelopController.CloseTelops(); OnePointTelopTable.Default.Save(); }; }
/// <summary> /// 更新 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void UpdateButton_Click(object sender, EventArgs e) { lock (SpellTimerTable.Table) { if (string.IsNullOrWhiteSpace(this.PanelNameTextBox.Text)) { MessageBox.Show( this, Translate.Get("UpdateSpellPanelTitle"), "ACT.SpecialSpellTimer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (string.IsNullOrWhiteSpace(this.SpellTitleTextBox.Text)) { MessageBox.Show( this, Translate.Get("UpdateSpellNameTitle"), "ACT.SpecialSpellTimer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { src.Panel = this.PanelNameTextBox.Text; src.SpellTitle = this.SpellTitleTextBox.Text; src.SpellIcon = (string)this.SpellIconComboBox.SelectedValue ?? string.Empty; src.SpellIconSize = (int)this.SpellIconSizeUpDown.Value; src.DisplayNo = (int)this.DisplayNoNumericUpDown.Value; src.Keyword = this.KeywordTextBox.Text; src.RegexEnabled = this.RegexEnabledCheckBox.Checked; src.RecastTime = (long)this.RecastTimeNumericUpDown.Value; src.RepeatEnabled = this.RepeatCheckBox.Checked; src.ProgressBarVisible = this.ShowProgressBarCheckBox.Checked; src.KeywordForExtend1 = this.KeywordToExpand1TextBox.Text; src.RecastTimeExtending1 = (long)this.ExpandSecounds1NumericUpDown.Value; src.KeywordForExtend2 = this.KeywordToExpand2TextBox.Text; src.RecastTimeExtending2 = (long)this.ExpandSecounds2NumericUpDown.Value; src.ExtendBeyondOriginalRecastTime = this.ExtendBeyondOriginalRecastTimeCheckBox.Checked; src.UpperLimitOfExtension = (long)this.UpperLimitOfExtensionNumericUpDown.Value; src.MatchSound = (string)this.MatchSoundComboBox.SelectedValue ?? string.Empty; src.MatchTextToSpeak = this.MatchTextToSpeakTextBox.Text; src.OverSound = (string)this.OverSoundComboBox.SelectedValue ?? string.Empty; src.OverTextToSpeak = this.OverTextToSpeakTextBox.Text; src.OverTime = (int)this.OverTimeNumericUpDown.Value; src.BeforeSound = (string)this.BeforeSoundComboBox.SelectedValue ?? string.Empty; src.BeforeTextToSpeak = this.BeforeTextToSpeakTextBox.Text; src.BeforeTime = (int)this.BeforeTimeNumericUpDown.Value; src.TimeupSound = (string)this.TimeupSoundComboBox.SelectedValue ?? string.Empty; src.TimeupTextToSpeak = this.TimeupTextToSpeakTextBox.Text; src.IsReverse = this.IsReverseCheckBox.Checked; src.DontHide = this.DontHideCheckBox.Checked; src.HideSpellName = this.HideSpellNameCheckBox.Checked; src.OverlapRecastTime = this.OverlapRecastTimeCheckBox.Checked; src.ReduceIconBrightness = this.ReduceIconBrightnessCheckBox.Checked; src.ToInstance = this.ToInstanceCheckBox.Checked; src.Font = this.SpellVisualSetting.GetFontInfo(); src.FontColor = this.SpellVisualSetting.FontColor.ToHTML(); src.FontOutlineColor = this.SpellVisualSetting.FontOutlineColor.ToHTML(); src.BarColor = this.SpellVisualSetting.BarColor.ToHTML(); src.BarOutlineColor = this.SpellVisualSetting.BarOutlineColor.ToHTML(); src.BarWidth = this.SpellVisualSetting.BarSize.Width; src.BarHeight = this.SpellVisualSetting.BarSize.Height; src.BackgroundColor = this.SpellVisualSetting.BackgroundColor.ToHTML(); src.BackgroundAlpha = this.SpellVisualSetting.BackgroundColor.A; var panel = SpellTimerTable.Table.Where(x => x.Panel == src.Panel); foreach (var s in panel) { s.BackgroundColor = src.BackgroundColor; } SpellTimerTable.ClearReplacedKeywords(); SpellTimerTable.RemoveAllInstanceSpells(); SpellTimerTable.Save(); this.LoadSpellTimerTable(); // 一度全てのパネルを閉じる SpellTimerCore.Default.ClosePanels(); foreach (TreeNode root in this.SpellTimerTreeView.Nodes) { if (root.Nodes != null) { foreach (TreeNode node in root.Nodes) { var ds = node.Tag as SpellTimer; if (ds != null) { if (ds.ID == src.ID) { this.SpellTimerTreeView.SelectedNode = node; break; } } } } } } } }
/// <summary> /// 追加 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void AddButton_Click(object sender, EventArgs e) { lock (SpellTimerTable.Table) { var nr = new SpellTimer(); nr.ID = SpellTimerTable.Table.Any() ? SpellTimerTable.Table.Max(x => x.ID) + 1 : 1; nr.guid = Guid.NewGuid(); nr.Panel = "General"; nr.SpellTitle = "New Spell"; nr.SpellIcon = string.Empty; nr.SpellIconSize = 24; nr.ProgressBarVisible = true; nr.FontColor = Settings.Default.FontColor.ToHTML(); nr.FontOutlineColor = Settings.Default.FontOutlineColor.ToHTML(); nr.BarColor = Settings.Default.ProgressBarColor.ToHTML(); nr.BarOutlineColor = Settings.Default.ProgressBarOutlineColor.ToHTML(); nr.FontFamily = Settings.Default.Font.Name; nr.FontSize = Settings.Default.Font.Size; nr.FontStyle = (int)Settings.Default.Font.Style; nr.BarWidth = Settings.Default.ProgressBarSize.Width; nr.BarHeight = Settings.Default.ProgressBarSize.Height; nr.BackgroundColor = Settings.Default.BackgroundColor.ToHTML(); nr.JobFilter = string.Empty; nr.ZoneFilter = string.Empty; nr.TimersMustRunningForStart = new Guid[0]; nr.TimersMustStoppingForStart = new Guid[0]; // 現在選択しているノードの情報を一部コピーする if (this.SpellTimerTreeView.SelectedNode != null) { var baseRow = this.SpellTimerTreeView.SelectedNode.Tag != null ? this.SpellTimerTreeView.SelectedNode.Tag as SpellTimer : this.SpellTimerTreeView.SelectedNode.Nodes[0].Tag as SpellTimer; if (baseRow != null) { nr.Panel = baseRow.Panel; nr.SpellTitle = baseRow.SpellTitle + " New"; nr.SpellIcon = baseRow.SpellIcon; nr.SpellIconSize = baseRow.SpellIconSize; nr.Keyword = baseRow.Keyword; nr.RegexEnabled = baseRow.RegexEnabled; nr.RecastTime = baseRow.RecastTime; nr.KeywordForExtend1 = baseRow.KeywordForExtend1; nr.RecastTimeExtending1 = baseRow.RecastTimeExtending1; nr.KeywordForExtend2 = baseRow.KeywordForExtend2; nr.RecastTimeExtending2 = baseRow.RecastTimeExtending2; nr.ExtendBeyondOriginalRecastTime = baseRow.ExtendBeyondOriginalRecastTime; nr.UpperLimitOfExtension = baseRow.UpperLimitOfExtension; nr.RepeatEnabled = baseRow.RepeatEnabled; nr.ProgressBarVisible = baseRow.ProgressBarVisible; nr.IsReverse = baseRow.IsReverse; nr.FontColor = baseRow.FontColor; nr.FontOutlineColor = baseRow.FontOutlineColor; nr.BarColor = baseRow.BarColor; nr.BarOutlineColor = baseRow.BarOutlineColor; nr.DontHide = baseRow.DontHide; nr.HideSpellName = baseRow.HideSpellName; nr.OverlapRecastTime = baseRow.OverlapRecastTime; nr.ReduceIconBrightness = baseRow.ReduceIconBrightness; nr.FontFamily = baseRow.FontFamily; nr.FontSize = baseRow.FontSize; nr.FontStyle = baseRow.FontStyle; nr.Font = baseRow.Font; nr.BarWidth = baseRow.BarWidth; nr.BarHeight = baseRow.BarHeight; nr.BackgroundColor = baseRow.BackgroundColor; nr.BackgroundAlpha = baseRow.BackgroundAlpha; nr.JobFilter = baseRow.JobFilter; nr.ZoneFilter = baseRow.ZoneFilter; nr.TimersMustRunningForStart = baseRow.TimersMustRunningForStart; nr.TimersMustStoppingForStart = baseRow.TimersMustStoppingForStart; nr.ToInstance = baseRow.ToInstance; } } nr.MatchDateTime = DateTime.MinValue; nr.UpdateDone = false; nr.Enabled = true; nr.DisplayNo = SpellTimerTable.Table.Any() ? SpellTimerTable.Table.Max(x => x.DisplayNo) + 1 : 50; nr.Regex = null; nr.RegexPattern = string.Empty; SpellTimerTable.Table.Add(nr); SpellTimerTable.ClearReplacedKeywords(); SpellTimerTable.RemoveAllInstanceSpells(); SpellTimerTable.Save(); // 新しいノードを生成する var node = new TreeNode(nr.SpellTitle) { Tag = nr, ToolTipText = nr.Keyword, Checked = nr.Enabled }; // 親ノードがあれば追加する foreach (TreeNode item in this.SpellTimerTreeView.Nodes) { if (item.Text == nr.Panel) { item.Nodes.Add(node); this.SpellTimerTreeView.SelectedNode = node; break; } } // 親ノードがなかった if (this.SpellTimerTreeView.SelectedNode != node) { var parentNode = new TreeNode(nr.Panel, new TreeNode[] { node }) { Checked = true }; this.SpellTimerTreeView.Nodes.Add(parentNode); this.SpellTimerTreeView.SelectedNode = node; } // ゾーン限定ボタンの色を変える(未設定:黒、設定有:青) this.SelectZoneButton.ForeColor = nr.ZoneFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; // ジョブ限定ボタンの色を変える(未設定:黒、設定有:青) this.SelectJobButton.ForeColor = nr.JobFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; // 条件設定ボタンの色を変える(未設定:黒、設定有:青) this.SetConditionButton.ForeColor = (nr.TimersMustRunningForStart.Length != 0 || nr.TimersMustStoppingForStart.Length != 0) ? Color.Blue : Button.DefaultForeColor; } // 標準のスペルタイマーへ変更を反映する SpellTimerCore.Default.applyToNormalSpellTimer(); }
/// <summary> /// 更新 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void UpdateButton_Click(object sender, EventArgs e) { lock (SpellTimerTable.Table) { if (string.IsNullOrWhiteSpace(this.PanelNameTextBox.Text)) { MessageBox.Show( this, Translate.Get("UpdateSpellPanelTitle"), "ACT.SpecialSpellTimer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (string.IsNullOrWhiteSpace(this.SpellTitleTextBox.Text)) { MessageBox.Show( this, Translate.Get("UpdateSpellNameTitle"), "ACT.SpecialSpellTimer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { src.Panel = this.PanelNameTextBox.Text; src.SpellTitle = this.SpellTitleTextBox.Text; src.DisplayNo = (int)this.DisplayNoNumericUpDown.Value; src.Keyword = this.KeywordTextBox.Text; src.RegexEnabled = this.RegexEnabledCheckBox.Checked; src.RecastTime = (int)this.RecastTimeNumericUpDown.Value; src.RepeatEnabled = this.RepeatCheckBox.Checked; src.ProgressBarVisible = this.ShowProgressBarCheckBox.Checked; src.MatchSound = (string)this.MatchSoundComboBox.SelectedValue ?? string.Empty; src.MatchTextToSpeak = this.MatchTextToSpeakTextBox.Text; src.OverSound = (string)this.OverSoundComboBox.SelectedValue ?? string.Empty; src.OverTextToSpeak = this.OverTextToSpeakTextBox.Text; src.OverTime = (int)this.OverTimeNumericUpDown.Value; src.TimeupSound = (string)this.TimeupSoundComboBox.SelectedValue ?? string.Empty; src.TimeupTextToSpeak = this.TimeupTextToSpeakTextBox.Text; src.IsReverse = this.IsReverseCheckBox.Checked; src.DontHide = this.DontHideCheckBox.Checked; src.FontFamily = this.SpellVisualSetting.TextFont.Name; src.FontSize = this.SpellVisualSetting.TextFont.Size; src.FontStyle = (int)this.SpellVisualSetting.TextFont.Style; src.FontColor = this.SpellVisualSetting.FontColor.ToHTML(); src.FontOutlineColor = this.SpellVisualSetting.FontOutlineColor.ToHTML(); src.BarColor = this.SpellVisualSetting.BarColor.ToHTML(); src.BarOutlineColor = this.SpellVisualSetting.BarOutlineColor.ToHTML(); src.BarWidth = this.SpellVisualSetting.BarSize.Width; src.BarHeight = this.SpellVisualSetting.BarSize.Height; src.BackgroundColor = this.SpellVisualSetting.BackgroundColor.ToHTML(); src.BackgroundAlpha = this.SpellVisualSetting.BackgroundColor.A; var panel = SpellTimerTable.Table.Where(x => x.Panel == src.Panel); foreach (var s in panel) { s.BackgroundColor = src.BackgroundColor; } SpellTimerTable.Save(); this.LoadSpellTimerTable(); // 一度全てのパネルを閉じる SpellTimerCore.Default.ClosePanels(); foreach (TreeNode root in this.SpellTimerTreeView.Nodes) { if (root.Nodes != null) { foreach (TreeNode node in root.Nodes) { var ds = node.Tag as SpellTimer; if (ds != null) { if (ds.ID == src.ID) { this.SpellTimerTreeView.SelectedNode = node; break; } } } } } } } }
/// <summary> /// 追加 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void AddButton_Click(object sender, EventArgs e) { lock (SpellTimerTable.Table) { var nr = new SpellTimer(); nr.ID = SpellTimerTable.Table.Any() ? SpellTimerTable.Table.Max(x => x.ID) + 1 : 1; nr.Panel = "General"; nr.SpellTitle = "New Spell"; nr.ProgressBarVisible = true; nr.FontColor = Settings.Default.FontColor.ToHTML(); nr.FontOutlineColor = Settings.Default.FontOutlineColor.ToHTML(); nr.BarColor = Settings.Default.ProgressBarColor.ToHTML(); nr.BarOutlineColor = Settings.Default.ProgressBarOutlineColor.ToHTML(); nr.FontFamily = Settings.Default.Font.Name; nr.FontSize = Settings.Default.Font.Size; nr.FontStyle = (int)Settings.Default.Font.Style; nr.BarWidth = Settings.Default.ProgressBarSize.Width; nr.BarHeight = Settings.Default.ProgressBarSize.Height; nr.BackgroundColor = Settings.Default.BackgroundColor.ToHTML(); nr.JobFilter = string.Empty; // 現在選択しているノードの情報を一部コピーする if (this.SpellTimerTreeView.SelectedNode != null) { var baseRow = this.SpellTimerTreeView.SelectedNode.Tag != null ? this.SpellTimerTreeView.SelectedNode.Tag as SpellTimer : this.SpellTimerTreeView.SelectedNode.Nodes[0].Tag as SpellTimer; if (baseRow != null) { nr.Panel = baseRow.Panel; nr.SpellTitle = baseRow.SpellTitle + " New"; nr.Keyword = baseRow.Keyword; nr.RegexEnabled = baseRow.RegexEnabled; nr.RecastTime = baseRow.RecastTime; nr.RepeatEnabled = baseRow.RepeatEnabled; nr.ProgressBarVisible = baseRow.ProgressBarVisible; nr.IsReverse = baseRow.IsReverse; nr.FontColor = baseRow.FontColor; nr.FontOutlineColor = baseRow.FontOutlineColor; nr.BarColor = baseRow.BarColor; nr.BarOutlineColor = baseRow.BarOutlineColor; nr.DontHide = baseRow.DontHide; nr.FontFamily = baseRow.FontFamily; nr.FontSize = baseRow.FontSize; nr.FontStyle = baseRow.FontStyle; nr.BarWidth = baseRow.BarWidth; nr.BarHeight = baseRow.BarHeight; nr.BackgroundColor = baseRow.BackgroundColor; nr.BackgroundAlpha = baseRow.BackgroundAlpha; nr.JobFilter = baseRow.JobFilter; } } nr.MatchDateTime = DateTime.MinValue; nr.Enabled = true; nr.DisplayNo = SpellTimerTable.Table.Any() ? SpellTimerTable.Table.Max(x => x.DisplayNo) + 1 : 50; nr.Regex = null; nr.RegexPattern = string.Empty; SpellTimerTable.Table.Add(nr); SpellTimerTable.Save(); // 新しいノードを生成する var node = new TreeNode(nr.SpellTitle) { Tag = nr, ToolTipText = nr.Keyword, Checked = nr.Enabled }; // 親ノードがあれば追加する foreach (TreeNode item in this.SpellTimerTreeView.Nodes) { if (item.Text == nr.Panel) { item.Nodes.Add(node); this.SpellTimerTreeView.SelectedNode = node; break; } } // 親ノードがなかった if (this.SpellTimerTreeView.SelectedNode != node) { var parentNode = new TreeNode(nr.Panel, new TreeNode[] { node }) { Checked = true }; this.SpellTimerTreeView.Nodes.Add(parentNode); this.SpellTimerTreeView.SelectedNode = node; } } }