1 // Copyright (C) 2013, 2014, 2015 Kazuhiro Fujieda <fujieda@users.osdn.me>
\r
3 // Licensed under the Apache License, Version 2.0 (the "License");
\r
4 // you may not use this file except in compliance with the License.
\r
5 // You may obtain a copy of the License at
\r
7 // http://www.apache.org/licenses/LICENSE-2.0
\r
9 // Unless required by applicable law or agreed to in writing, software
\r
10 // distributed under the License is distributed on an "AS IS" BASIS,
\r
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 // See the License for the specific language governing permissions and
\r
13 // limitations under the License.
\r
16 using System.Collections.Generic;
\r
17 using System.ComponentModel;
\r
18 using System.Diagnostics;
\r
19 using System.Drawing;
\r
20 using System.Globalization;
\r
24 using System.Runtime.InteropServices;
\r
26 using System.Text.RegularExpressions;
\r
27 using System.Threading;
\r
28 using System.Threading.Tasks;
\r
29 using System.Windows.Forms;
\r
30 using KancolleSniffer.Log;
\r
31 using KancolleSniffer.Model;
\r
32 using KancolleSniffer.Net;
\r
33 using KancolleSniffer.Util;
\r
34 using KancolleSniffer.View;
\r
35 using Microsoft.CSharp.RuntimeBinder;
\r
36 using Timer = System.Windows.Forms.Timer;
\r
37 using static System.Math;
\r
39 namespace KancolleSniffer
\r
41 public partial class MainForm : Form
\r
43 private readonly Sniffer _sniffer = new Sniffer();
\r
44 private readonly Config _config = new Config();
\r
45 private readonly ConfigDialog _configDialog;
\r
46 private readonly ProxyManager _proxyManager;
\r
47 private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};
\r
48 private readonly ResizableToolTip _toolTipQuest = new ResizableToolTip {ShowAlways = true, AutoPopDelay = 10000};
\r
49 private readonly ResizableToolTip _tooltipCopy = new ResizableToolTip {AutomaticDelay = 0};
\r
50 private int _currentFleet;
\r
51 private bool _combinedFleet;
\r
52 private readonly Label[] _labelCheckFleets;
\r
53 private readonly MainFormLabels _mainLabels;
\r
54 private readonly ListForm _listForm;
\r
55 private readonly NotificationManager _notificationManager;
\r
56 private bool _started;
\r
57 private bool _timerEnabled;
\r
58 private string _debugLogFile;
\r
59 private IEnumerator<string> _playLog;
\r
60 private DateTime _prev, _now;
\r
61 private bool _inSortie;
\r
63 private readonly ErrorDialog _errorDialog = new ErrorDialog();
\r
64 private readonly ErrorLog _errorLog;
\r
68 InitializeComponent();
\r
69 HttpProxy.AfterSessionComplete += HttpProxy_AfterSessionComplete;
\r
70 _configDialog = new ConfigDialog(_config, this);
\r
71 _labelCheckFleets = new[] {labelCheckFleet1, labelCheckFleet2, labelCheckFleet3, labelCheckFleet4};
\r
73 // この時点でAutoScaleDimensions == CurrentAutoScaleDimensionsなので、
\r
74 // MainForm.Designer.csのAutoScaleDimensionsの6f,12fを使う。
\r
75 ShipLabel.ScaleFactor = new SizeF(CurrentAutoScaleDimensions.Width / 6f,
\r
76 CurrentAutoScaleDimensions.Height / 12f);
\r
79 _mainLabels = new MainFormLabels();
\r
80 _mainLabels.CreateAkashiTimers(panelShipInfo);
\r
81 _mainLabels.CreateShipLabels(panelShipInfo, ShowShipOnShipList);
\r
82 _mainLabels.CreateAkashiTimers7(panel7Ships);
\r
83 _mainLabels.CreateShipLabels7(panel7Ships, ShowShipOnShipList);
\r
84 _mainLabels.CreateCombinedShipLabels(panelCombinedFleet, ShowShipOnShipList);
\r
85 _mainLabels.CreateNDockLabels(panelDock, labelNDock_Click);
\r
86 panelRepairList.CreateLabels(panelRepairList_Click);
\r
87 labelPresetAkashiTimer.BackColor = ShipLabel.ColumnColors[1];
\r
88 _listForm = new ListForm(_sniffer, _config) {Owner = this};
\r
89 _notificationManager = new NotificationManager(Alarm);
\r
91 _proxyManager = new ProxyManager(_config, this);
\r
92 _errorLog = new ErrorLog(_sniffer);
\r
93 _proxyManager.UpdatePacFile();
\r
95 _mainLabels.AdjustAkashiTimers();
\r
97 _sniffer.RepeatingTimerController = new RepeatingTimerController(_notificationManager, _config);
\r
101 /// パネルのz-orderがくるうのを避ける
\r
102 /// https://stackoverflow.com/a/5777090/1429506
\r
104 private void MainForm_Shown(object sender, EventArgs e)
\r
106 // ReSharper disable once NotAccessedVariable
\r
108 foreach (var panel in new[] {panelShipInfo, panel7Ships, panelCombinedFleet})
\r
109 // ReSharper disable once RedundantAssignment
\r
110 handle = panel.Handle;
\r
113 private readonly FileSystemWatcher _watcher = new FileSystemWatcher
\r
115 Path = AppDomain.CurrentDomain.BaseDirectory,
\r
116 NotifyFilter = NotifyFilters.LastWrite
\r
119 private readonly Timer _watcherTimer = new Timer {Interval = 1000};
\r
121 private void LoadData()
\r
124 _sniffer.LoadState();
\r
125 _watcher.SynchronizingObject = this;
\r
126 _watcherTimer.Tick += (sender, ev) =>
\r
128 _watcherTimer.Stop();
\r
132 _sniffer.LoadState();
\r
135 _sniffer.AdditionalData.LoadTpSpec();
\r
139 _watcher.Changed += (sender, ev) =>
\r
142 _watcherTimer.Stop();
\r
143 _watcherTimer.Start();
\r
145 _watcher.EnableRaisingEvents = true;
\r
148 private class RepeatingTimerController : Sniffer.IRepeatingTimerController
\r
150 private readonly NotificationManager _manager;
\r
151 private readonly Config _config;
\r
153 public RepeatingTimerController(NotificationManager manager, Config config)
\r
155 _manager = manager;
\r
159 public void Stop(string key)
\r
161 _manager.StopRepeat(key,
\r
162 (key == "入渠終了" || key == "遠征終了") &&
\r
163 (_config.Notifications[key].Flags & NotificationType.Cont) != 0);
\r
166 public void Stop(string key, int fleet) => _manager.StopRepeat(key, fleet);
\r
168 public void Suspend(string exception = null) => _manager.SuspendRepeat(exception);
\r
170 public void Resume() => _manager.ResumeRepeat();
\r
173 private void HttpProxy_AfterSessionComplete(HttpProxy.Session session)
\r
175 BeginInvoke(new Action<HttpProxy.Session>(ProcessRequest), session);
\r
178 private void ProcessRequest(HttpProxy.Session session)
\r
180 var url = session.Request.PathAndQuery;
\r
181 if (!url.Contains("kcsapi/"))
\r
183 var request = session.Request.BodyAsString;
\r
184 var response = session.Response.BodyAsString;
\r
185 if (response == null || !response.StartsWith("svdata="))
\r
187 WriteDebugLog(url, request, response);
\r
190 response = UnEscapeString(response.Remove(0, "svdata=".Length));
\r
191 WriteDebugLog(url, request, response);
\r
192 ProcessRequestMain(url, request, response);
\r
195 private void ProcessRequestMain(string url, string request, string response)
\r
199 UpdateInfo(_sniffer.Sniff(url, request, JsonParser.Parse(response)));
\r
200 _errorLog.CheckBattleApi(url, request, response);
\r
203 catch (RuntimeBinderException e)
\r
205 if (_errorDialog.ShowDialog(this,
\r
206 "艦これに仕様変更があったか、受信内容が壊れています。",
\r
207 _errorLog.GenerateErrorLog(url, request, response, e.ToString())) == DialogResult.Abort)
\r
210 catch (LogIOException e)
\r
212 // ReSharper disable once PossibleNullReferenceException
\r
213 if (_errorDialog.ShowDialog(this, e.Message, e.InnerException.ToString()) == DialogResult.Abort)
\r
216 catch (BattleResultError)
\r
218 if (_errorDialog.ShowDialog(this, "戦闘結果の計算に誤りがあります。",
\r
219 _errorLog.GenerateBattleErrorLog()) == DialogResult.Abort)
\r
222 catch (Exception e)
\r
224 if (_errorDialog.ShowDialog(this, "エラーが発生しました。",
\r
225 _errorLog.GenerateErrorLog(url, request, response, e.ToString())) == DialogResult.Abort)
\r
230 private void Exit()
\r
232 _proxyManager.Shutdown();
\r
233 Environment.Exit(1);
\r
236 private void WriteDebugLog(string url, string request, string response)
\r
238 if (_debugLogFile != null)
\r
240 File.AppendAllText(_debugLogFile,
\r
241 $"date: {DateTime.Now:g}\nurl: {url}\nrequest: {request}\nresponse: {response ?? "(null)"}\n");
\r
245 private string UnEscapeString(string s)
\r
249 var rx = new Regex(@"\\[uU]([0-9A-Fa-f]{4})");
\r
250 return rx.Replace(s,
\r
251 match => ((char)int.Parse(match.Value.Substring(2), NumberStyles.HexNumber)).ToString());
\r
253 catch (ArgumentException)
\r
259 private void UpdateInfo(Sniffer.Update update)
\r
261 if (update == Sniffer.Update.Start)
\r
263 labelLogin.Visible = false;
\r
264 linkLabelGuide.Visible = false;
\r
270 if (_now == DateTime.MinValue)
\r
271 _now = DateTime.Now;
\r
272 if ((update & Sniffer.Update.Item) != 0)
\r
274 if ((update & Sniffer.Update.Timer) != 0)
\r
276 if ((update & Sniffer.Update.NDock) != 0)
\r
277 UpdateNDocLabels();
\r
278 if ((update & Sniffer.Update.Mission) != 0)
\r
279 UpdateMissionLabels();
\r
280 if ((update & Sniffer.Update.QuestList) != 0)
\r
282 if ((update & Sniffer.Update.Ship) != 0)
\r
284 if ((update & Sniffer.Update.Battle) != 0)
\r
285 UpdateBattleInfo();
\r
286 if ((update & Sniffer.Update.Cell) != 0)
\r
290 private void MainForm_Load(object sender, EventArgs e)
\r
293 if (_config.HideOnMinimized && WindowState == FormWindowState.Minimized)
\r
294 ShowInTaskbar = false;
\r
295 if (_config.ShowHpInPercent)
\r
296 _mainLabels.ToggleHpPercent();
\r
297 if (_config.ShipList.Visible)
\r
300 ApplyDebugLogSetting();
\r
302 ApplyProxySetting();
\r
303 CheckVersionUp((current, latest) =>
\r
305 if (latest == current)
\r
307 linkLabelGuide.Text = $"バージョン{latest}があります。";
\r
308 linkLabelGuide.LinkArea = new LinkArea(0, linkLabelGuide.Text.Length);
\r
309 linkLabelGuide.Click += (obj, ev) =>
\r
311 Process.Start("https://ja.osdn.net/rel/kancollesniffer/" + latest);
\r
316 public async void CheckVersionUp(Action<string, string> action)
\r
318 var current = string.Join(".", Application.ProductVersion.Split('.').Take(2));
\r
321 var latest = (await new WebClient().DownloadStringTaskAsync("http://kancollesniffer.osdn.jp/version"))
\r
325 action(current, latest);
\r
327 catch (InvalidOperationException)
\r
331 catch (WebException)
\r
336 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
\r
338 if (!_config.ExitSilently)
\r
340 using (var dialog = new ConfirmDialog())
\r
342 if (dialog.ShowDialog(this) != DialogResult.Yes)
\r
350 _sniffer.FlashLog();
\r
351 _config.Location = (WindowState == FormWindowState.Normal ? Bounds : RestoreBounds).Location;
\r
352 _config.ShowHpInPercent = _mainLabels.ShowHpInPercent;
\r
353 _config.ShipList.Visible = _listForm.Visible && _listForm.WindowState == FormWindowState.Normal;
\r
355 _sniffer.SaveState();
\r
356 _proxyManager.Shutdown();
\r
359 private void MainForm_Resize(object sender, EventArgs e)
\r
361 ShowInTaskbar = !(_config.HideOnMinimized && WindowState == FormWindowState.Minimized);
\r
364 private void notifyIconMain_MouseDoubleClick(object sender, MouseEventArgs e)
\r
366 NotifyIconOpenToolStripMenuItem_Click(sender, e);
\r
369 private void NotifyIconOpenToolStripMenuItem_Click(object sender, EventArgs e)
\r
371 ShowInTaskbar = true;
\r
372 WindowState = FormWindowState.Normal;
\r
373 TopMost = _config.TopMost; // 最前面に表示されなくなることがあるのを回避する
\r
377 private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
\r
382 private void ConfigToolStripMenuItem_Click(object sender, EventArgs e)
\r
384 if (_configDialog.ShowDialog(this) == DialogResult.OK)
\r
388 StopRepeatingTimer(_configDialog.RepeatSettingsChanged);
\r
392 private void StopRepeatingTimer(IEnumerable<string> names)
\r
394 foreach (var name in names)
\r
395 _notificationManager.StopRepeat(name);
\r
398 private void PerformZoom()
\r
400 if (_config.Zoom == 100)
\r
402 var prev = CurrentAutoScaleDimensions;
\r
403 foreach (var control in new Control[]
\r
405 this, _listForm, labelLogin, linkLabelGuide,
\r
406 _configDialog, _configDialog.NotificationConfigDialog,
\r
407 contextMenuStripMain, _errorDialog
\r
410 control.Font = new Font(control.Font.FontFamily, control.Font.Size * _config.Zoom / 100);
\r
412 foreach (var toolTip in new[]{_toolTip, _toolTipQuest, _tooltipCopy})
\r
414 toolTip.Font = new Font(toolTip.Font.FontFamily, toolTip.Font.Size * _config.Zoom / 100);
\r
416 ShipLabel.LatinFont = new Font("Tahoma", 8f * _config.Zoom / 100);
\r
417 var cur = CurrentAutoScaleDimensions;
\r
418 ShipLabel.ScaleFactor = new SizeF(ShipLabel.ScaleFactor.Width * cur.Width / prev.Width,
\r
419 ShipLabel.ScaleFactor.Height * cur.Height / prev.Height);
\r
422 private void RestoreLocation()
\r
424 if (_config.Location.X == int.MinValue)
\r
426 if (IsTitleBarOnAnyScreen(_config.Location))
\r
427 Location = _config.Location;
\r
430 private void ApplyConfig()
\r
432 _listForm.TopMost = TopMost = _config.TopMost;
\r
433 _sniffer.ShipCounter.Margin = _config.MarginShips;
\r
434 UpdateNumOfShips();
\r
435 _sniffer.ItemCounter.Margin = _config.MarginEquips;
\r
436 UpdateNumOfEquips();
\r
437 _sniffer.Achievement.ResetHours = _config.ResetHours;
\r
438 labelAkashiRepair.Visible = labelAkashiRepairTimer.Visible =
\r
439 labelPresetAkashiTimer.Visible = _config.UsePresetAkashi;
\r
442 public void ApplyDebugLogSetting()
\r
444 _debugLogFile = _config.DebugLogging ? _config.DebugLogFile : null;
\r
447 public bool ApplyProxySetting()
\r
449 return _proxyManager.ApplyConfig();
\r
452 public void ApplyLogSetting()
\r
454 LogServer.OutputDir = _config.Log.OutputDir;
\r
455 LogServer.LogProcessor = new LogProcessor(_sniffer.Material.MaterialHistory, _sniffer.MapDictionary);
\r
456 _sniffer.EnableLog(_config.Log.On ? LogType.All : LogType.None);
\r
457 _sniffer.MaterialLogInterval = _config.Log.MaterialLogInterval;
\r
458 _sniffer.LogOutputDir = _config.Log.OutputDir;
\r
461 public static bool IsTitleBarOnAnyScreen(Point location)
\r
463 var rect = new Rectangle(
\r
464 new Point(location.X + SystemInformation.IconSize.Width + SystemInformation.HorizontalFocusThickness,
\r
465 location.Y + SystemInformation.CaptionHeight), new Size(60, 1));
\r
466 return Screen.AllScreens.Any(screen => screen.WorkingArea.Contains(rect));
\r
469 private void timerMain_Tick(object sender, EventArgs e)
\r
475 _now = DateTime.Now;
\r
480 catch (Exception ex)
\r
482 if (_errorDialog.ShowDialog(this, "エラーが発生しました。", ex.ToString()) == DialogResult.Abort)
\r
486 if (_playLog == null || _configDialog.Visible)
\r
488 labelPlayLog.Visible = false;
\r
494 public void SetPlayLog(string file)
\r
496 _playLog = File.ReadLines(file).GetEnumerator();
\r
499 private void PlayLog()
\r
501 var lines = new List<string>();
\r
502 foreach (var s in new[] {"url: ", "request: ", "response: "})
\r
506 if (!_playLog.MoveNext() || _playLog.Current == null)
\r
508 labelPlayLog.Visible = false;
\r
511 } while (!_playLog.Current.StartsWith(s));
\r
512 lines.Add(_playLog.Current.Substring(s.Length));
\r
514 labelPlayLog.Visible = !labelPlayLog.Visible;
\r
515 ProcessRequestMain(lines[0], lines[1], lines[2]);
\r
518 private void ShowShipOnShipList(object sender, EventArgs ev)
\r
520 if (!_listForm.Visible)
\r
522 var idx = (int)((Control)sender).Tag;
\r
523 var ship = (_combinedFleet
\r
524 ? _sniffer.Fleets[0].Ships.Concat(_sniffer.Fleets[1].Ships).ToArray()
\r
525 : _sniffer.Fleets[_currentFleet].Ships)[idx];
\r
527 _listForm.ShowShip(ship.Id);
\r
530 private void UpdateItemInfo()
\r
532 UpdateNumOfShips();
\r
533 UpdateNumOfEquips();
\r
534 _notificationManager.Flash();
\r
535 labelNumOfBuckets.Text = _sniffer.Material.MaterialHistory[(int)Material.Bucket].Now.ToString("D");
\r
536 UpdateBucketHistory();
\r
537 var ac = _sniffer.Achievement.Value;
\r
540 labelAchievement.Text = ac >= 1000 ? ((int)ac).ToString("D") : ac.ToString("F1");
\r
541 _toolTip.SetToolTip(labelAchievement,
\r
542 "今月 " + _sniffer.Achievement.ValueOfMonth.ToString("F1") + "\n" +
\r
543 "EO " + _sniffer.ExMap.Achievement);
\r
544 UpdateMaterialHistory();
\r
545 if (_listForm.Visible)
\r
546 _listForm.UpdateList();
\r
549 private void UpdateNumOfShips()
\r
551 var ship = _sniffer.ShipCounter;
\r
552 labelNumOfShips.Text = $"{ship.Now:D}/{ship.Max:D}";
\r
553 labelNumOfShips.ForeColor = ship.TooMany ? CUDColors.Red : Color.Black;
\r
556 var message = $"残り{ship.Rest:D}隻";
\r
557 _notificationManager.Enqueue("艦娘数超過", message);
\r
558 ship.Alarm = false;
\r
562 private void UpdateNumOfEquips()
\r
564 var item = _sniffer.ItemCounter;
\r
565 labelNumOfEquips.Text = $"{item.Now:D}/{item.Max:D}";
\r
566 labelNumOfEquips.ForeColor = item.TooMany ? CUDColors.Red : Color.Black;
\r
569 var message = $"残り{item.Rest:D}個";
\r
570 _notificationManager.Enqueue("装備数超過", message);
\r
571 item.Alarm = false;
\r
575 private void UpdateBucketHistory()
\r
577 var count = _sniffer.Material.MaterialHistory[(int)Material.Bucket];
\r
578 var day = CutOverflow(count.Now - count.BegOfDay, 999);
\r
579 var week = CutOverflow(count.Now - count.BegOfWeek, 999);
\r
580 labelBucketHistory.Text = $"{day:+#;-#;±0} 今日\n{week:+#;-#;±0} 今週";
\r
583 private void UpdateMaterialHistory()
\r
585 var labels = new[] {labelFuelHistory, labelBulletHistory, labelSteelHistory, labelBouxiteHistory};
\r
586 var text = new[] {"燃料", "弾薬", "鋼材", "ボーキ"};
\r
587 for (var i = 0; i < labels.Length; i++)
\r
589 var count = _sniffer.Material.MaterialHistory[i];
\r
590 var port = CutOverflow(count.Now - _sniffer.Material.PrevPort[i], 99999);
\r
591 var day = CutOverflow(count.Now - count.BegOfDay, 99999);
\r
592 var week = CutOverflow(count.Now - count.BegOfWeek, 99999);
\r
593 labels[i].Text = $"{text[i]}\n{port:+#;-#;±0}\n{day:+#;-#;±0}\n{week:+#;-#;±0}";
\r
597 private int CutOverflow(int value, int limit)
\r
601 if (value < -limit)
\r
606 private void UpdateShipInfo()
\r
609 UpdatePanelShipInfo();
\r
610 NotifyDamagedShip();
\r
611 UpdateChargeInfo();
\r
612 UpdateRepairList();
\r
613 UpdateMissionLabels();
\r
614 if (_listForm.Visible)
\r
615 _listForm.UpdateList();
\r
618 private void SetCurrentFleet()
\r
620 var states = _sniffer.Fleets.Select(fleet => fleet.State).ToArray();
\r
621 var inSortie = states.Any(state => state >= FleetState.Sortie);
\r
622 if (_inSortie || !inSortie)
\r
624 _inSortie = inSortie;
\r
628 if (states[0] == FleetState.Sortie && states[1] == FleetState.Sortie)
\r
630 _combinedFleet = true;
\r
635 _combinedFleet = false;
\r
636 _currentFleet = Array.FindIndex(states, state => state >= FleetState.Sortie);
\r
640 private void UpdatePanelShipInfo()
\r
642 var fleets = _sniffer.Fleets;
\r
643 var ships = fleets[_currentFleet].ActualShips;
\r
644 panel7Ships.Visible = ships.Count == 7;
\r
645 _mainLabels.SetShipLabels(ships);
\r
646 if (!_sniffer.IsCombinedFleet)
\r
647 _combinedFleet = false;
\r
648 labelFleet1.Text = _combinedFleet ? CombinedName : "第一";
\r
649 panelCombinedFleet.Visible = _combinedFleet;
\r
650 if (_combinedFleet)
\r
651 _mainLabels.SetCombinedShipLabels(fleets[0].ActualShips, fleets[1].ActualShips);
\r
652 for (var i = 0; i < _labelCheckFleets.Length; i++)
\r
653 _labelCheckFleets[i].Visible = _currentFleet == i;
\r
654 UpdateAkashiTimer();
\r
655 var battle = _sniffer.Battle;
\r
656 UpdateFighterPower(_combinedFleet && (battle.BattleState == BattleState.None || battle.EnemyIsCombined));
\r
658 UpdateCondTimers();
\r
661 private string CombinedName
\r
665 switch (_sniffer.Fleets[0].CombinedType)
\r
667 case CombinedType.Carrier:
\r
669 case CombinedType.Surface:
\r
671 case CombinedType.Transport:
\r
679 private void NotifyDamagedShip()
\r
681 if (!_sniffer.BadlyDamagedShips.Any())
\r
683 _notificationManager.StopRepeat("大破警告");
\r
684 SetNotification("大破警告", string.Join(" ", _sniffer.BadlyDamagedShips));
\r
685 _notificationManager.Flash();
\r
688 public void UpdateFighterPower(bool combined)
\r
690 var fleets = _sniffer.Fleets;
\r
692 ? fleets[0].FighterPower.Zip(fleets[1].FighterPower, (a, b) => a + b).ToArray()
\r
693 : fleets[_currentFleet].FighterPower;
\r
694 labelFighterPower.Text = fp[0].ToString("D");
\r
696 ? fleets[0].ContactTriggerRate + fleets[1].ContactTriggerRate
\r
697 : fleets[_currentFleet].ContactTriggerRate;
\r
698 var text = "制空: " + (fp[0] == fp[1] ? $"{fp[0]}" : $"{fp[0]}~{fp[1]}") +
\r
699 $" 触接: {cr * 100:f1}";
\r
700 _toolTip.SetToolTip(labelFighterPower, text);
\r
701 _toolTip.SetToolTip(labelFighterPowerCaption, text);
\r
704 private void UpdateLoS()
\r
706 var fleet = _sniffer.Fleets[_currentFleet];
\r
707 labelLoS.Text = RoundDown(fleet.GetLineOfSights(1)).ToString("F1");
\r
708 var text = $"係数3: {RoundDown(fleet.GetLineOfSights(3)):F1}\r\n" +
\r
709 $"係数4: {RoundDown(fleet.GetLineOfSights(4)):F1}";
\r
710 _toolTip.SetToolTip(labelLoS, text);
\r
711 _toolTip.SetToolTip(labelLoSCaption, text);
\r
714 private double RoundDown(double number)
\r
716 return Floor(number * 10) / 10.0;
\r
719 private void UpdateBattleInfo()
\r
722 _listForm.UpdateBattleResult();
\r
723 _listForm.UpdateAirBattleResult();
\r
724 if (_sniffer.Battle.BattleState == BattleState.None)
\r
726 panelBattleInfo.BringToFront();
\r
727 var battle = _sniffer.Battle;
\r
728 labelFormation.Text = new[] {"同航戦", "反航戦", "T字有利", "T字不利"}[battle.Formation[2] - 1];
\r
729 UpdateBattleFighterPower();
\r
730 if ((_config.Spoilers & Spoiler.ResultRank) != 0)
\r
734 private void UpdateCellInfo()
\r
736 _listForm.UpdateCellInfo();
\r
739 private void ResetBattleInfo()
\r
741 labelFormation.Text = "";
\r
742 labelEnemyFighterPower.Text = "";
\r
743 labelFighterPower.ForeColor = DefaultForeColor;
\r
744 labelResultRank.Text = "判定";
\r
745 panelBattleInfo.Visible = _sniffer.Battle.BattleState != BattleState.None;
\r
748 private void UpdateBattleFighterPower()
\r
750 var battle = _sniffer.Battle;
\r
751 var power = battle.EnemyFighterPower;
\r
752 labelEnemyFighterPower.Text = power.AirCombat + power.UnknownMark;
\r
753 if (power.AirCombat != power.Interception)
\r
755 var text = "防空: " + power.Interception + power.UnknownMark;
\r
756 _toolTip.SetToolTip(labelEnemyFighterPower, text);
\r
757 _toolTip.SetToolTip(labelEnemyFighterPowerCaption, text);
\r
761 _toolTip.SetToolTip(labelEnemyFighterPower, "");
\r
762 _toolTip.SetToolTip(labelEnemyFighterPowerCaption, "");
\r
764 UpdateFighterPower(_sniffer.IsCombinedFleet && battle.EnemyIsCombined);
\r
765 labelFighterPower.ForeColor = new[]
\r
766 {DefaultForeColor, DefaultForeColor, CUDColors.Blue, CUDColors.Green, CUDColors.Orange, CUDColors.Red}[
\r
767 battle.AirControlLevel + 1];
\r
770 private void ShowResultRank()
\r
772 var result = new[] {"完全S", "勝利S", "勝利A", "勝利B", "敗北C", "敗北D", "敗北E"};
\r
773 labelResultRank.Text = result[(int)_sniffer.Battle.ResultRank];
\r
776 private void labelResultRank_Click(object sender, EventArgs e)
\r
781 private void UpdateChargeInfo()
\r
783 var fuelSq = new[] {labelFuelSq1, labelFuelSq2, labelFuelSq3, labelFuelSq4};
\r
784 var bullSq = new[] {labelBullSq1, labelBullSq2, labelBullSq3, labelBullSq4};
\r
786 for (var i = 0; i < fuelSq.Length; i++)
\r
788 var stat = _sniffer.Fleets[i].ChargeStatus;
\r
789 fuelSq[i].ImageIndex = stat.Fuel;
\r
790 bullSq[i].ImageIndex = stat.Bull;
\r
794 private void UpdateNDocLabels()
\r
796 _mainLabels.SetNDockLabels(_sniffer.NDock);
\r
800 private void labelNDock_Click(object sender, EventArgs e)
\r
802 _config.ShowEndTime ^= TimerKind.NDock;
\r
806 private void UpdateMissionLabels()
\r
808 var nameLabels = new[] {labelMissionName1, labelMissionName2, labelMissionName3};
\r
809 var paramsLabels = new[] {labelMissionParams1, labelMissionParams2, labelMissionParams3};
\r
810 var names = _sniffer.Missions.Select(mission => mission.Name).ToArray();
\r
811 for (var i = 0; i < ShipInfo.FleetCount - 1; i++)
\r
813 paramsLabels[i].Visible = false;
\r
814 if (string.IsNullOrEmpty(names[i]))
\r
816 paramsLabels[i].Text = GenerateFleetParamsForMission(i + 1);
\r
817 paramsLabels[i].Visible = true;
\r
819 nameLabels[i].Text = names[i];
\r
823 private string GenerateFleetParamsForMission(int fleetNumber)
\r
825 var result = new List<string>();
\r
826 var fleet = _sniffer.Fleets[fleetNumber];
\r
827 var kira = fleet.Ships.Count(ship => ship.Cond > 49);
\r
828 var plus = fleet.Ships[0].Cond > 49;
\r
830 result.Add($"キラ{kira}{(plus ? "+" : "")}");
\r
831 var drums = fleet.Ships.SelectMany(ship => ship.Slot).Count(item => item.Spec.IsDrum);
\r
832 var drumShips = fleet.Ships.Count(ship => ship.Slot.Any(item => item.Spec.IsDrum));
\r
834 result.Add($"ド{drums}({drumShips}隻)");
\r
835 if (fleet.DaihatsuBonus > 0)
\r
836 result.Add($"ダ{fleet.DaihatsuBonus * 100:f1}%");
\r
837 return string.Join(" ", result);
\r
840 private void labelMission_Click(object sender, EventArgs e)
\r
842 _config.ShowEndTime ^= TimerKind.Mission;
\r
846 private void UpdateTimers()
\r
848 var mission = new[] {labelMission1, labelMission2, labelMission3};
\r
849 for (var i = 0; i < mission.Length; i++)
\r
851 var entry = _sniffer.Missions[i];
\r
852 SetTimerColor(mission[i], entry.Timer, _now);
\r
853 mission[i].Text = entry.Timer.ToString(_now, (_config.ShowEndTime & TimerKind.Mission) != 0);
\r
855 for (var i = 0; i < _sniffer.NDock.Length; i++)
\r
857 var entry = _sniffer.NDock[i];
\r
858 _mainLabels.SetNDockTimer(i, entry.Timer, _now, (_config.ShowEndTime & TimerKind.NDock) != 0);
\r
860 var kdock = new[] {labelConstruct1, labelConstruct2, labelConstruct3, labelConstruct4};
\r
861 for (var i = 0; i < kdock.Length; i++)
\r
863 var timer = _sniffer.KDock[i];
\r
864 SetTimerColor(kdock[i], timer, _now);
\r
865 kdock[i].Text = timer.ToString(_now);
\r
867 UpdateCondTimers();
\r
868 UpdateAkashiTimer();
\r
869 _timerEnabled = true;
\r
872 private void NotifyTimers()
\r
874 for (var i = 0; i < _sniffer.Missions.Length; i++)
\r
876 var entry = _sniffer.Missions[i];
\r
877 CheckAlarm("遠征終了", entry.Timer, i + 1, entry.Name);
\r
879 for (var i = 0; i < _sniffer.NDock.Length; i++)
\r
881 var entry = _sniffer.NDock[i];
\r
882 CheckAlarm("入渠終了", entry.Timer, i, entry.Name);
\r
884 for (var i = 0; i < _sniffer.KDock.Length; i++)
\r
886 var timer = _sniffer.KDock[i];
\r
887 CheckAlarm("建造完了", timer, i, "");
\r
889 NotifyCondTimers();
\r
890 NotifyAkashiTimer();
\r
891 _notificationManager.Flash();
\r
894 private void CheckAlarm(string key, AlarmTimer timer, int fleet, string subject)
\r
896 if (timer.CheckAlarm(_prev, _now))
\r
898 SetNotification(key, fleet, subject);
\r
901 var pre = TimeSpan.FromSeconds(_config.Notifications[key].PreliminaryPeriod);
\r
902 if (pre == TimeSpan.Zero)
\r
904 if (timer.CheckAlarm(_prev + pre, _now + pre))
\r
905 SetPreNotification(key, fleet, subject);
\r
908 private void SetTimerColor(Label label, AlarmTimer timer, DateTime now)
\r
910 label.ForeColor = timer.IsFinished(now) ? CUDColors.Red : Color.Black;
\r
913 private void UpdateCondTimers()
\r
916 if (_combinedFleet)
\r
918 var timer1 = _sniffer.GetConditionTimer(0);
\r
919 var timer2 = _sniffer.GetConditionTimer(1);
\r
920 timer = timer2 > timer1 ? timer2 : timer1;
\r
924 timer = _sniffer.GetConditionTimer(_currentFleet);
\r
926 if (timer == DateTime.MinValue)
\r
928 labelCondTimerTitle.Text = "";
\r
929 labelCondTimer.Text = "";
\r
932 var span = TimeSpan.FromSeconds(Ceiling((timer - _now).TotalSeconds));
\r
933 if (span >= TimeSpan.FromMinutes(9))
\r
935 labelCondTimerTitle.Text = "cond40まで";
\r
936 labelCondTimer.Text = (span - TimeSpan.FromMinutes(9)).ToString(@"mm\:ss");
\r
937 labelCondTimer.ForeColor = DefaultForeColor;
\r
941 labelCondTimerTitle.Text = "cond49まで";
\r
942 labelCondTimer.Text = (span >= TimeSpan.Zero ? span : TimeSpan.Zero).ToString(@"mm\:ss");
\r
943 labelCondTimer.ForeColor = span <= TimeSpan.Zero ? CUDColors.Red : DefaultForeColor;
\r
947 private void NotifyCondTimers()
\r
949 var notice = _sniffer.GetConditionNotice(_prev, _now);
\r
950 var pre = TimeSpan.FromSeconds(_config.Notifications["疲労回復"].PreliminaryPeriod);
\r
951 var preNotice = pre == TimeSpan.Zero
\r
952 ? new int[ShipInfo.FleetCount]
\r
953 : _sniffer.GetConditionNotice(_prev + pre, _now + pre);
\r
954 for (var i = 0; i < ShipInfo.FleetCount; i++)
\r
956 if (_config.NotifyConditions.Contains(notice[i]))
\r
958 SetNotification("疲労回復" + notice[i], i, "cond" + notice[i]);
\r
960 else if (_config.NotifyConditions.Contains(preNotice[i]))
\r
962 SetPreNotification("疲労回復" + preNotice[i], i, "cond" + notice[i]);
\r
967 private void UpdateAkashiTimer()
\r
969 if (_config.UsePresetAkashi)
\r
970 UpdatePresetAkashiTimer();
\r
971 _mainLabels.SetAkashiTimer(_sniffer.Fleets[_currentFleet].ActualShips,
\r
972 _sniffer.AkashiTimer.GetTimers(_currentFleet, _now));
\r
975 private void UpdatePresetAkashiTimer()
\r
977 var akashi = _sniffer.AkashiTimer;
\r
978 var span = akashi.GetPresetDeckTimer(_now);
\r
979 var color = span == TimeSpan.Zero && akashi.CheckPresetRepairing() ? CUDColors.Red : DefaultForeColor;
\r
980 var text = span == TimeSpan.MinValue ? "" : span.ToString(@"mm\:ss");
\r
981 labelAkashiRepairTimer.ForeColor = color;
\r
982 labelAkashiRepairTimer.Text = text;
\r
983 if (akashi.CheckPresetRepairing() && !akashi.CheckRepairing(_currentFleet, _now))
\r
985 labelPresetAkashiTimer.ForeColor = color;
\r
986 labelPresetAkashiTimer.Text = text;
\r
990 labelPresetAkashiTimer.ForeColor = DefaultForeColor;
\r
991 labelPresetAkashiTimer.Text = "";
\r
995 private void NotifyAkashiTimer()
\r
997 var akashi = _sniffer.AkashiTimer;
\r
998 var msgs = akashi.GetNotice(_prev, _now);
\r
999 if (msgs.Length == 0)
\r
1001 _notificationManager.StopRepeat("泊地修理");
\r
1004 if (!akashi.CheckRepairing(_now) && !(akashi.CheckPresetRepairing() && _config.UsePresetAkashi))
\r
1006 _notificationManager.StopRepeat("泊地修理");
\r
1009 var skipPreliminary = false;
\r
1010 if (msgs[0].Proceeded == "20分経過しました。")
\r
1012 SetNotification("泊地修理20分経過", msgs[0].Proceeded);
\r
1013 msgs[0].Proceeded = "";
\r
1014 skipPreliminary = true;
\r
1015 // 修理完了がいるかもしれないので続ける
\r
1017 for (var i = 0; i < ShipInfo.FleetCount; i++)
\r
1019 if (msgs[i].Proceeded != "")
\r
1020 SetNotification("泊地修理進行", i, msgs[i].Proceeded);
\r
1021 if (msgs[i].Completed != "")
\r
1022 SetNotification("泊地修理完了", i, msgs[i].Completed);
\r
1024 var pre = TimeSpan.FromSeconds(_config.Notifications["泊地修理20分経過"].PreliminaryPeriod);
\r
1025 if (skipPreliminary || pre == TimeSpan.Zero)
\r
1027 if ((msgs = akashi.GetNotice(_prev + pre, _now + pre))[0].Proceeded == "20分経過しました。")
\r
1028 SetPreNotification("泊地修理20分経過", 0, msgs[0].Proceeded);
\r
1031 private void SetNotification(string key, string subject)
\r
1033 SetNotification(key, 0, subject);
\r
1036 private void SetNotification(string key, int fleet, string subject)
\r
1038 var spec = _config.Notifications[_notificationManager.KeyToName(key)];
\r
1039 _notificationManager.Enqueue(key, fleet, subject,
\r
1040 (spec.Flags & _config.NotificationFlags & NotificationType.Repeat) == 0 ? 0 : spec.RepeatInterval);
\r
1043 private void SetPreNotification(string key, int fleet, string subject)
\r
1045 var spec = _config.Notifications[_notificationManager.KeyToName(key)];
\r
1046 if ((spec.Flags & NotificationType.Preliminary) != 0)
\r
1047 _notificationManager.Enqueue(key, fleet, subject, 0, true);
\r
1050 private void UpdateRepairList()
\r
1052 panelRepairList.SetRepairList(_sniffer.RepairList);
\r
1055 private void UpdateQuestList()
\r
1057 var category = new[]
\r
1059 labelQuestColor1, labelQuestColor2, labelQuestColor3, labelQuestColor4, labelQuestColor5,
\r
1062 var name = new[] {labelQuest1, labelQuest2, labelQuest3, labelQuest4, labelQuest5, labelQuest6};
\r
1065 labelQuestCount1, labelQuestCount2, labelQuestCount3, labelQuestCount4, labelQuestCount5,
\r
1068 var progress = new[]
\r
1069 {labelProgress1, labelProgress2, labelProgress3, labelProgress4, labelProgress5, labelProgress6};
\r
1070 var quests = _sniffer.Quests;
\r
1071 for (var i = 0; i < name.Length; i++)
\r
1073 if (i < quests.Length)
\r
1075 category[i].BackColor = quests[i].Color;
\r
1076 name[i].Text = quests[i].Name;
\r
1077 progress[i].Text = $"{quests[i].Progress:D}%";
\r
1078 _toolTipQuest.SetToolTip(name[i], quests[i].ToToolTip());
\r
1079 var c = quests[i].Count;
\r
1082 count[i].Text = "";
\r
1083 count[i].ForeColor = Color.Black;
\r
1084 _toolTip.SetToolTip(count[i], "");
\r
1087 count[i].Text = " " + c;
\r
1088 count[i].ForeColor = c.Cleared ? CUDColors.Green : Color.Black;
\r
1089 _toolTip.SetToolTip(count[i], c.ToToolTip());
\r
1093 category[i].BackColor = DefaultBackColor;
\r
1094 name[i].Text = count[i].Text = progress[i].Text = "";
\r
1095 _toolTipQuest.SetToolTip(name[i], "");
\r
1096 _toolTip.SetToolTip(count[i], "");
\r
1101 private void Alarm(string balloonTitle, string balloonMessage, string name)
\r
1103 var flags = _config.Notifications[name].Flags;
\r
1104 var effective = _config.NotificationFlags & _config.Notifications[name].Flags;
\r
1105 if ((effective & NotificationType.FlashWindow) != 0)
\r
1106 Win32API.FlashWindow(Handle);
\r
1107 if ((effective & NotificationType.ShowBaloonTip) != 0)
\r
1108 notifyIconMain.ShowBalloonTip(20000, balloonTitle, balloonMessage, ToolTipIcon.Info);
\r
1109 if ((effective & NotificationType.PlaySound) != 0)
\r
1110 PlaySound(_config.Sounds[name], _config.Sounds.Volume);
\r
1111 if (_config.Pushbullet.On && (flags & NotificationType.Push) != 0)
\r
1115 PushNotification.PushToPushbullet(_config.Pushbullet.Token, balloonTitle, balloonMessage);
\r
1118 if (_config.Pushover.On && (flags & NotificationType.Push) != 0)
\r
1122 PushNotification.PushToPushover(_config.Pushover.ApiKey, _config.Pushover.UserKey,
\r
1123 balloonTitle, balloonMessage);
\r
1128 [DllImport("winmm.dll")]
\r
1129 private static extern int mciSendString(String command,
\r
1130 StringBuilder buffer, int bufferSize, IntPtr hWndCallback);
\r
1132 // ReSharper disable InconsistentNaming
\r
1133 // ReSharper disable once IdentifierTypo
\r
1134 private const int MM_MCINOTIFY = 0x3B9;
\r
1136 private const int MCI_NOTIFY_SUCCESSFUL = 1;
\r
1137 // ReSharper restore InconsistentNaming
\r
1139 public void PlaySound(string file, int volume)
\r
1141 if (!File.Exists(file))
\r
1143 mciSendString("close sound", null, 0, IntPtr.Zero);
\r
1144 if (mciSendString("open \"" + file + "\" type mpegvideo alias sound", null, 0, IntPtr.Zero) != 0)
\r
1146 mciSendString("setaudio sound volume to " + volume * 10, null, 0, IntPtr.Zero);
\r
1147 mciSendString("play sound notify", null, 0, Handle);
\r
1150 protected override void WndProc(ref Message m)
\r
1152 if (m.Msg == MM_MCINOTIFY && (int)m.WParam == MCI_NOTIFY_SUCCESSFUL)
\r
1153 mciSendString("close sound", null, 0, IntPtr.Zero);
\r
1154 base.WndProc(ref m);
\r
1157 private void SetupFleetClick()
\r
1159 var labels = new[]
\r
1161 new[] {labelFleet1, labelFleet2, labelFleet3, labelFleet4},
\r
1162 new[] {labelFuelSq1, labelFuelSq2, labelFuelSq3, labelFuelSq4},
\r
1163 new[] {labelBullSq1, labelBullSq2, labelBullSq3, labelBullSq4}
\r
1165 foreach (var a in labels)
\r
1168 a[0].Click += labelFleet1_Click;
\r
1169 a[0].DoubleClick += labelFleet1_DoubleClick;
\r
1170 for (var fleet = 1; fleet < labels[0].Length; fleet++)
\r
1172 a[fleet].Tag = fleet;
\r
1173 a[fleet].Click += labelFleet_Click;
\r
1174 a[fleet].DoubleClick += labelFleet_DoubleClick;
\r
1179 private void labelFleet_Click(object sender, EventArgs e)
\r
1183 var fleet = (int)((Label)sender).Tag;
\r
1184 if (_currentFleet == fleet)
\r
1186 _combinedFleet = false;
\r
1187 _currentFleet = fleet;
\r
1188 UpdatePanelShipInfo();
\r
1191 private readonly SemaphoreSlim _clickSemaphore = new SemaphoreSlim(1);
\r
1192 private readonly SemaphoreSlim _doubleClickSemaphore = new SemaphoreSlim(0);
\r
1194 private async void labelFleet1_Click(object sender, EventArgs e)
\r
1198 if (_currentFleet != 0)
\r
1200 labelFleet_Click(sender, e);
\r
1203 if (!_clickSemaphore.Wait(0))
\r
1207 if (await _doubleClickSemaphore.WaitAsync(SystemInformation.DoubleClickTime))
\r
1212 _clickSemaphore.Release();
\r
1214 _combinedFleet = _sniffer.IsCombinedFleet && !_combinedFleet;
\r
1215 UpdatePanelShipInfo();
\r
1218 private void labelFleet1_MouseHover(object sender, EventArgs e)
\r
1220 labelFleet1.Text = _currentFleet == 0 && _sniffer.IsCombinedFleet && !_combinedFleet ? "連合" : "第一";
\r
1223 private void labelFleet1_MouseLeave(object sender, EventArgs e)
\r
1225 labelFleet1.Text = _combinedFleet ? CombinedName : "第一";
\r
1228 private void labelFleet_DoubleClick(object sender, EventArgs e)
\r
1232 var fleet = (int)((Label)sender).Tag;
\r
1233 var text = TextGenerator.GenerateFleetData(_sniffer, fleet);
\r
1234 CopyFleetText(text, (Label)sender);
\r
1237 private void labelFleet1_DoubleClick(object sender, EventArgs e)
\r
1241 _doubleClickSemaphore.Release();
\r
1242 var text = TextGenerator.GenerateFleetData(_sniffer, 0);
\r
1243 if (_combinedFleet)
\r
1244 text += TextGenerator.GenerateFleetData(_sniffer, 1);
\r
1245 CopyFleetText(text, (Label)sender);
\r
1248 private void CopyFleetText(string text, Label fleetButton)
\r
1250 if (string.IsNullOrEmpty(text))
\r
1252 Clipboard.SetText(text);
\r
1253 _tooltipCopy.Active = true;
\r
1254 _tooltipCopy.Show("コピーしました。", fleetButton);
\r
1255 Task.Run(async () =>
\r
1257 await Task.Delay(1000);
\r
1258 _tooltipCopy.Active = false;
\r
1262 private void labelBucketHistoryButton_Click(object sender, EventArgs e)
\r
1264 if (labelBucketHistory.Visible)
\r
1266 labelBucketHistory.Visible = false;
\r
1267 labelBucketHistoryButton.BackColor = DefaultBackColor;
\r
1271 labelBucketHistory.Visible = true;
\r
1272 labelBucketHistory.BringToFront();
\r
1273 labelBucketHistoryButton.BackColor = CustomColors.ActiveButtonColor;
\r
1277 private void labelBucketHistory_Click(object sender, EventArgs e)
\r
1279 labelBucketHistory.Visible = false;
\r
1280 labelBucketHistoryButton.BackColor = DefaultBackColor;
\r
1283 private void labelMaterialHistoryButton_Click(object sender, EventArgs e)
\r
1285 if (panelMaterialHistory.Visible)
\r
1287 panelMaterialHistory.Visible = false;
\r
1288 labelMaterialHistoryButton.BackColor = DefaultBackColor;
\r
1292 panelMaterialHistory.Visible = true;
\r
1293 panelMaterialHistory.BringToFront();
\r
1294 labelMaterialHistoryButton.BackColor = CustomColors.ActiveButtonColor;
\r
1298 private void panelMaterialHistory_Click(object sender, EventArgs e)
\r
1300 panelMaterialHistory.Visible = false;
\r
1301 labelMaterialHistoryButton.BackColor = DefaultBackColor;
\r
1304 public void ResetAchievement()
\r
1306 _sniffer.Achievement.Reset();
\r
1310 private void labelRepairListButton_Click(object sender, EventArgs e)
\r
1312 if (panelRepairList.Visible)
\r
1314 panelRepairList.Visible = false;
\r
1315 labelRepairListButton.BackColor = DefaultBackColor;
\r
1319 panelRepairList.Visible = true;
\r
1320 panelRepairList.BringToFront();
\r
1321 labelRepairListButton.BackColor = CustomColors.ActiveButtonColor;
\r
1325 private void panelRepairList_Click(object sender, EventArgs e)
\r
1327 panelRepairList.Visible = false;
\r
1328 labelRepairListButton.BackColor = DefaultBackColor;
\r
1331 private void ShipListToolStripMenuItem_Click(object sender, EventArgs e)
\r
1333 _listForm.UpdateList();
\r
1335 if (_listForm.WindowState == FormWindowState.Minimized)
\r
1336 _listForm.WindowState = FormWindowState.Normal;
\r
1337 _listForm.Activate();
\r
1340 private void LogToolStripMenuItem_Click(object sender, EventArgs e)
\r
1342 Process.Start("http://localhost:" + _config.Proxy.Listen + "/");
\r
1345 private void labelClearQuest_Click(object sender, EventArgs e)
\r
1347 _sniffer.ClearQuests();
\r
1348 UpdateQuestList();
\r
1351 private void labelClearQuest_MouseDown(object sender, MouseEventArgs e)
\r
1353 labelClearQuest.BackColor = CustomColors.ActiveButtonColor;
\r
1356 private void labelClearQuest_MouseUp(object sender, MouseEventArgs e)
\r
1358 labelClearQuest.BackColor = DefaultBackColor;
\r
1361 private void labelQuest_DoubleClick(object sender, EventArgs e)
\r
1363 var label = (Label)sender;
\r
1364 if (string.IsNullOrEmpty(label.Text))
\r
1366 Clipboard.SetText(label.Text);
\r
1367 _tooltipCopy.Active = true;
\r
1368 _tooltipCopy.Show("コピーしました。", label);
\r
1369 Task.Run(async () =>
\r
1371 await Task.Delay(1000);
\r
1372 _tooltipCopy.Active = false;
\r
1376 private void CaptureToolStripMenuItem_Click(object sender, EventArgs e)
\r
1380 var proc = new ProcessStartInfo("BurageSnap.exe") {WorkingDirectory = "Capture"};
\r
1381 Process.Start(proc);
\r
1383 catch (FileNotFoundException)
\r
1386 catch (Win32Exception)
\r