/// <summary> /// ログを監視する /// </summary> private void WatchLog() { // ACTが起動していない? if (ActGlobals.oFormActMain == null || !ActGlobals.oFormActMain.Visible) { Thread.Sleep(1000); return; } // 有効なスペルとテロップのリストを取得する var spellArray = SpellTimerTable.EnabledTable; var telopArray = OnePointTelopTable.Default.EnabledTable; // ログを取り出す var logLines = this.LogBuffer.GetLogLines(); // テロップとマッチングする OnePointTelopController.Match( telopArray, logLines); // スペルリストとマッチングする this.MatchSpells( spellArray, logLines); // コマンドとマッチングする TextCommandController.MatchCommand( logLines); }
/// <summary> /// ログを監視する /// </summary> private void WatchLog() { var existsLog = false; // ACTが起動していない? if (ActGlobals.oFormActMain == null) { Logger.Write("act not started."); Thread.Sleep(TimeSpan.FromSeconds(3)); return; } // 全滅によるリセットを判定する var resetTask = Task.Run(() => this.ResetCountAtRestart()); if (!this.LogBuffer.IsEmpty) { // ログを取り出す var logsTask = Task.Run(() => this.LogBuffer.GetLogLines()); // 有効なスペルとテロップのリストを取得する var spellTask = Task.Run(() => TableCompiler.Instance.SpellList); var telopTask = Task.Run(() => TableCompiler.Instance.TickerList); if (logsTask.Result.Count > 0) { // テロップとマッチングする var t1 = Task.Run(() => OnePointTelopController.Match(telopTask.Result, logsTask.Result)); // スペルリストとマッチングする var t2 = Task.Run(() => this.MatchSpells(spellTask.Result, logsTask.Result)); // コマンドとマッチングする var t3 = Task.Run(() => TextCommandController.MatchCommand(logsTask.Result)); Task.WaitAll(t1, t2, t3); existsLog = true; } } resetTask.Wait(); if (!existsLog) { Thread.Sleep((int)Settings.Default.LogPollSleepInterval); } }
/// <summary> /// ログを監視する /// </summary> private void WatchLog() { // ACTが起動していない? if (ActGlobals.oFormActMain == null) { Logger.Write("act not started."); Thread.Sleep(TimeSpan.FromSeconds(3)); return; } if (this.LogBuffer.nonEmpty()) { // 有効なスペルとテロップのリストを取得する var spellArray = Task.Run(() => SpellTimerTable.EnabledTable); var telopArray = Task.Run(() => OnePointTelopTable.Default.EnabledTable); // ログを取り出す var logLines = Task.Run(() => this.LogBuffer.GetLogLines()); if (logLines.Result.Count > 0) { // テロップとマッチングする var t1 = Task.Run(() => OnePointTelopController.Match(telopArray.Result, logLines.Result)); // スペルリストとマッチングする var t2 = Task.Run(() => this.MatchSpells(spellArray.Result, logLines.Result)); // コマンドとマッチングする var t3 = Task.Run(() => TextCommandController.MatchCommand(logLines.Result)); Task.WaitAll(t1, t2, t3); return; } } Thread.Sleep(TimeSpan.FromMilliseconds(Settings.Default.LogPollSleepInterval)); }
/// <summary> /// Windowを更新する /// </summary> private void RefreshWindow() { #if DEBUG var sw1 = Stopwatch.StartNew(); #endif // 有効なSpellリストを取得する var spellArray = SpellTimerTable.EnabledTable; // 不要なWindowを閉じる if (this.SpellTimerPanels != null) { var removeList = new List <SpellTimerListWindow>(); foreach (var panel in this.SpellTimerPanels) { // パネルの位置を保存する var setting = ( from x in PanelSettings.Default.SettingsTable where x.PanelName == panel.PanelName select x).FirstOrDefault(); if (setting == null) { setting = PanelSettings.Default.SettingsTable.NewPanelSettingsRow(); PanelSettings.Default.SettingsTable.AddPanelSettingsRow(setting); } setting.PanelName = panel.PanelName; setting.Left = panel.Left; setting.Top = panel.Top; // 毎分0秒の時保存する if (DateTime.Now.Second == 0) { PanelSettings.Default.Save(); } // スペルリストに存在しないパネルを閉じる if (!spellArray.Any(x => x.Panel == panel.PanelName)) { ActInvoker.Invoke(() => panel.Close()); removeList.Add(panel); } } foreach (var item in removeList) { this.SpellTimerPanels.Remove(item); } } #if DEBUG sw1.Stop(); Debug.WriteLine("Refresh ClosePanels ->" + sw1.ElapsedMilliseconds.ToString("N0") + "ms"); #endif // ACTが起動していない? if (ActGlobals.oFormActMain == null || !ActGlobals.oFormActMain.Visible) { this.HidePanels(); this.RefreshInterval = 1000; return; } if ((DateTime.Now - this.LastFFXIVProcessDateTime).TotalSeconds >= 5.0d) { // FF14が起動していない? if (FF14PluginHelper.GetFFXIVProcess == null) { this.RefreshInterval = 1000; if (!Settings.Default.OverlayForceVisible) { this.ClosePanels(); OnePointTelopController.CloseTelops(); return; } } this.LastFFXIVProcessDateTime = DateTime.Now; } // タイマの間隔を標準に戻す this.RefreshInterval = Settings.Default.RefreshInterval; // ログを取り出す #if DEBUG var sw2 = Stopwatch.StartNew(); #endif var logLines = this.LogBuffer.GetLogLines(); #if DEBUG sw2.Stop(); Debug.WriteLine("Refresh GetLog ->" + sw2.ElapsedMilliseconds.ToString("N0") + "ms"); #endif // テロップとマッチングする #if DEBUG var sw3 = Stopwatch.StartNew(); #endif OnePointTelopController.Match( logLines); #if DEBUG sw3.Stop(); Debug.WriteLine("Refresh MatchTelop ->" + sw3.ElapsedMilliseconds.ToString("N0") + "ms"); #endif // スペルリストとマッチングする #if DEBUG var sw4 = Stopwatch.StartNew(); #endif this.MatchSpells( spellArray, logLines); #if DEBUG sw4.Stop(); Debug.WriteLine("Refresh MatchSpell ->" + sw4.ElapsedMilliseconds.ToString("N0") + "ms"); #endif // コマンドとマッチングする TextCommandController.MatchCommand( logLines); // オーバーレイが非表示? if (!Settings.Default.OverlayVisible) { this.HidePanels(); OnePointTelopController.HideTelops(); return; } // Windowを表示する #if DEBUG var sw5 = Stopwatch.StartNew(); #endif var panelNames = spellArray.Select(x => x.Panel.Trim()).Distinct(); foreach (var name in panelNames) { var w = this.SpellTimerPanels.Where(x => x.PanelName == name).FirstOrDefault(); if (w == null) { w = new SpellTimerListWindow() { Title = "SpecialSpellTimer - " + name, PanelName = name, }; this.SpellTimerPanels.Add(w); // クリックスルー? if (Settings.Default.ClickThroughEnabled) { w.ToTransparentWindow(); } w.Show(); } w.SpellTimers = ( from x in spellArray where x.Panel.Trim() == name select x).ToArray(); // ドラッグ中じゃない? if (!w.IsDragging) { w.RefreshSpellTimer(); } } #if DEBUG sw5.Stop(); Debug.WriteLine("Refresh RefreshSpell ->" + sw5.ElapsedMilliseconds.ToString("N0") + "ms"); #endif }