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 static System.Math;
\r
37 using Timer = System.Windows.Forms.Timer;
\r
39 namespace KancolleSniffer
\r
41 public partial class MainForm : Form
\r
43 private readonly ConfigDialog _configDialog;
\r
44 private readonly ProxyManager _proxyManager;
\r
45 private readonly ResizableToolTip _toolTip = new ResizableToolTip();
\r
46 private readonly ResizableToolTip _tooltipCopy = new ResizableToolTip {ShowAlways = false, AutomaticDelay = 0};
\r
47 private int _currentFleet;
\r
48 private bool _combinedFleet;
\r
49 private readonly Label[] _labelCheckFleets;
\r
50 private MainFormLabels _mainLabels;
\r
51 private NumberAndHistory _numberAndHistory;
\r
52 private readonly ListForm _listForm;
\r
53 private readonly NotificationManager _notificationManager;
\r
54 private bool _started;
\r
55 private bool _timerEnabled;
\r
56 private string _debugLogFile;
\r
57 private IEnumerator<string> _playLog;
\r
58 private DateTime _prev, _now;
\r
60 private readonly ErrorDialog _errorDialog = new ErrorDialog();
\r
61 private readonly ErrorLog _errorLog;
\r
63 public Sniffer Sniffer { get; } = new Sniffer();
\r
64 public Config Config { get; } = new Config();
\r
68 InitializeComponent();
\r
69 HttpProxy.AfterSessionComplete += HttpProxy_AfterSessionComplete;
\r
70 _configDialog = new ConfigDialog(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 panelRepairList.CreateLabels(panelRepairList_Click);
\r
80 questPanel.NameLabelDoubleClick += labelQuest_DoubleClick;
\r
81 labelPresetAkashiTimer.BackColor = ShipLabel.ColumnColors[1];
\r
82 _listForm = new ListForm(this);
\r
83 _notificationManager = new NotificationManager(Alarm);
\r
84 CreateNumberAndHistory();
\r
86 _proxyManager = new ProxyManager(this);
\r
87 _errorLog = new ErrorLog(Sniffer);
\r
88 _proxyManager.UpdatePacFile();
\r
90 _mainLabels.AdjustAkashiTimers();
\r
92 Sniffer.RepeatingTimerController = new RepeatingTimerController(this);
\r
95 private void CreateMainLabels()
\r
97 _mainLabels = new MainFormLabels(new MainFormPanels
\r
99 PanelShipInfo = panelShipInfo,
\r
100 Panel7Ships = panel7Ships,
\r
101 PanelCombinedFleet = panelCombinedFleet,
\r
102 PanelNDock = panelDock
\r
104 _mainLabels.CreateAllShipLabels(ShowShipOnShipList);
\r
105 _mainLabels.CreateNDockLabels(labelNDock_Click);
\r
108 private void CreateNumberAndHistory()
\r
110 _numberAndHistory = new NumberAndHistory(new NumberAndHistoryLabels
\r
112 NumOfShips = labelNumOfShips,
\r
113 NumOfEquips = labelNumOfEquips,
\r
114 NumOfBuckets = labelNumOfBuckets,
\r
115 BucketHistory = labelBucketHistory,
\r
116 Achievement = labelAchievement,
\r
117 FuelHistory = labelFuelHistory,
\r
118 BulletHistory = labelBulletHistory,
\r
119 SteelHistory = labelSteelHistory,
\r
120 BauxiteHistory = labelBouxiteHistory,
\r
122 }, Sniffer, new NotifySubmitter(_notificationManager));
\r
125 private class NotifySubmitter : INotifySubmitter
\r
127 private readonly NotificationManager _manager;
\r
129 public NotifySubmitter(NotificationManager manager)
\r
131 _manager = manager;
\r
134 public void Flash()
\r
139 public void Enqueue(string key, string subject)
\r
141 _manager.Enqueue(key, subject);
\r
146 /// パネルのz-orderがくるうのを避ける
\r
147 /// https://stackoverflow.com/a/5777090/1429506
\r
149 private void MainForm_Shown(object sender, EventArgs e)
\r
151 // ReSharper disable once NotAccessedVariable
\r
153 foreach (var panel in new[] {panelShipInfo, panel7Ships, panelCombinedFleet})
\r
154 // ReSharper disable once RedundantAssignment
\r
155 handle = panel.Handle;
\r
158 private readonly FileSystemWatcher _watcher = new FileSystemWatcher
\r
160 Path = AppDomain.CurrentDomain.BaseDirectory,
\r
161 NotifyFilter = NotifyFilters.LastWrite
\r
164 private readonly Timer _watcherTimer = new Timer {Interval = 1000};
\r
166 private void LoadData()
\r
169 Sniffer.LoadState();
\r
170 _watcher.SynchronizingObject = this;
\r
171 _watcherTimer.Tick += (sender, ev) =>
\r
173 _watcherTimer.Stop();
\r
177 Sniffer.LoadState();
\r
180 Sniffer.AdditionalData.LoadTpSpec();
\r
184 _watcher.Changed += (sender, ev) =>
\r
187 _watcherTimer.Stop();
\r
188 _watcherTimer.Start();
\r
190 _watcher.EnableRaisingEvents = true;
\r
193 private class RepeatingTimerController : Sniffer.IRepeatingTimerController
\r
195 private readonly NotificationManager _manager;
\r
196 private readonly Config _config;
\r
198 public RepeatingTimerController(MainForm main)
\r
200 _manager = main._notificationManager;
\r
201 _config = main.Config;
\r
204 public void Stop(string key)
\r
206 _manager.StopRepeat(key,
\r
207 (key == "入渠終了" || key == "遠征終了") &&
\r
208 (_config.Notifications[key].Flags & NotificationType.Cont) != 0);
\r
211 public void Stop(string key, int fleet) => _manager.StopRepeat(key, fleet);
\r
213 public void Suspend(string exception = null) => _manager.SuspendRepeat(exception);
\r
215 public void Resume() => _manager.ResumeRepeat();
\r
218 private void HttpProxy_AfterSessionComplete(HttpProxy.Session session)
\r
220 BeginInvoke(new Action<HttpProxy.Session>(ProcessRequest), session);
\r
223 private void ProcessRequest(HttpProxy.Session session)
\r
225 var url = session.Request.PathAndQuery;
\r
226 if (!url.Contains("kcsapi/"))
\r
228 var request = session.Request.BodyAsString;
\r
229 var response = session.Response.BodyAsString;
\r
230 Privacy.Remove(ref url, ref request, ref response);
\r
231 if (response == null || !response.StartsWith("svdata="))
\r
233 WriteDebugLog(url, request, response);
\r
236 response = UnEscapeString(response.Remove(0, "svdata=".Length));
\r
237 WriteDebugLog(url, request, response);
\r
238 ProcessRequestMain(url, request, response);
\r
241 private void ProcessRequestMain(string url, string request, string response)
\r
245 UpdateInfo(Sniffer.Sniff(url, request, JsonParser.Parse(response)));
\r
246 _errorLog.CheckBattleApi(url, request, response);
\r
249 catch (RuntimeBinderException e)
\r
251 if (_errorDialog.ShowDialog(this,
\r
252 "艦これに仕様変更があったか、受信内容が壊れています。",
\r
253 _errorLog.GenerateErrorLog(url, request, response, e.ToString())) == DialogResult.Abort)
\r
256 catch (LogIOException e)
\r
258 // ReSharper disable once PossibleNullReferenceException
\r
259 if (_errorDialog.ShowDialog(this, e.Message, e.InnerException.ToString()) == DialogResult.Abort)
\r
262 catch (BattleResultError)
\r
264 if (_errorDialog.ShowDialog(this, "戦闘結果の計算に誤りがあります。",
\r
265 _errorLog.GenerateBattleErrorLog()) == DialogResult.Abort)
\r
268 catch (Exception e)
\r
270 if (_errorDialog.ShowDialog(this, "エラーが発生しました。",
\r
271 _errorLog.GenerateErrorLog(url, request, response, e.ToString())) == DialogResult.Abort)
\r
276 private void Exit()
\r
278 _proxyManager.Shutdown();
\r
279 Environment.Exit(1);
\r
282 private void WriteDebugLog(string url, string request, string response)
\r
284 if (_debugLogFile != null)
\r
286 File.AppendAllText(_debugLogFile,
\r
287 $"date: {DateTime.Now:g}\nurl: {url}\nrequest: {request}\nresponse: {response ?? "(null)"}\n");
\r
291 private string UnEscapeString(string s)
\r
295 var rx = new Regex(@"\\[uU]([0-9A-Fa-f]{4})");
\r
296 return rx.Replace(s,
\r
297 match => ((char)int.Parse(match.Value.Substring(2), NumberStyles.HexNumber)).ToString());
\r
299 catch (ArgumentException)
\r
305 private void UpdateInfo(Sniffer.Update update)
\r
307 if (update == Sniffer.Update.Start)
\r
309 labelLogin.Visible = false;
\r
310 linkLabelGuide.Visible = false;
\r
312 _notificationManager.StopAllRepeat();
\r
317 if (_now == DateTime.MinValue)
\r
318 _now = DateTime.Now;
\r
319 if ((update & Sniffer.Update.Item) != 0)
\r
321 if ((update & Sniffer.Update.Timer) != 0)
\r
323 if ((update & Sniffer.Update.NDock) != 0)
\r
324 UpdateNDocLabels();
\r
325 if ((update & Sniffer.Update.Mission) != 0)
\r
326 UpdateMissionLabels();
\r
327 if ((update & Sniffer.Update.QuestList) != 0)
\r
329 if ((update & Sniffer.Update.Ship) != 0)
\r
331 if ((update & Sniffer.Update.Battle) != 0)
\r
332 UpdateBattleInfo();
\r
333 if ((update & Sniffer.Update.Cell) != 0)
\r
337 private void MainForm_Load(object sender, EventArgs e)
\r
339 SuppressActivate.Start();
\r
341 if (Config.HideOnMinimized && WindowState == FormWindowState.Minimized)
\r
342 ShowInTaskbar = false;
\r
343 if (Config.ShowHpInPercent)
\r
344 _mainLabels.ToggleHpPercent();
\r
345 if (Config.ShipList.Visible)
\r
348 ApplyDebugLogSetting();
\r
350 ApplyProxySetting();
\r
351 CheckVersionUp((current, latest) =>
\r
353 if (latest == current)
\r
355 linkLabelGuide.Text = $"バージョン{latest}があります。";
\r
356 linkLabelGuide.LinkArea = new LinkArea(0, linkLabelGuide.Text.Length);
\r
357 linkLabelGuide.Click += (obj, ev) =>
\r
359 Process.Start("https://ja.osdn.net/rel/kancollesniffer/" + latest);
\r
364 public async void CheckVersionUp(Action<string, string> action)
\r
366 var current = string.Join(".", Application.ProductVersion.Split('.').Take(2));
\r
369 var latest = (await new WebClient().DownloadStringTaskAsync("http://kancollesniffer.osdn.jp/version"))
\r
373 action(current, latest);
\r
375 catch (InvalidOperationException)
\r
379 catch (WebException)
\r
384 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
\r
386 if (!Config.ExitSilently)
\r
388 using (var dialog = new ConfirmDialog())
\r
390 if (dialog.ShowDialog(this) != DialogResult.Yes)
\r
398 Sniffer.FlashLog();
\r
399 Config.Location = (WindowState == FormWindowState.Normal ? Bounds : RestoreBounds).Location;
\r
400 Config.ShowHpInPercent = _mainLabels.ShowHpInPercent;
\r
402 Sniffer.SaveState();
\r
403 _proxyManager.Shutdown();
\r
406 private void MainForm_Resize(object sender, EventArgs e)
\r
408 if (_listForm == null) // DPIが100%でないときにInitializeComponentから呼ばれるので
\r
410 SuppressActivate.Start();
\r
411 if (WindowState == FormWindowState.Minimized)
\r
413 _listForm.WindowState = FormWindowState.Minimized;
\r
414 if (Config.HideOnMinimized)
\r
415 _listForm.ShowInTaskbar = ShowInTaskbar = false;
\r
417 else if (_listForm.WindowState == FormWindowState.Minimized)
\r
420 _listForm.ShowInTaskbar = true;
\r
421 _listForm.WindowState = FormWindowState.Normal;
\r
425 private void DoPaint()
\r
427 Application.DoEvents();
\r
430 public TimeOutChecker SuppressActivate = new TimeOutChecker();
\r
432 private void MainForm_Activated(object sender, EventArgs e)
\r
434 if (SuppressActivate.Check())
\r
436 if (WindowState == FormWindowState.Minimized)
\r
438 _listForm.Owner = null;
\r
444 public class TimeOutChecker
\r
446 private DateTime _lastCheck;
\r
447 private readonly TimeSpan _timeout = TimeSpan.FromMilliseconds(500);
\r
449 public void Start()
\r
451 _lastCheck = DateTime.Now;
\r
454 public bool Check()
\r
456 var now = DateTime.Now;
\r
457 var last = _lastCheck;
\r
459 return now - last < _timeout;
\r
463 private void notifyIconMain_MouseDoubleClick(object sender, MouseEventArgs e)
\r
465 NotifyIconOpenToolStripMenuItem_Click(sender, e);
\r
468 private void NotifyIconOpenToolStripMenuItem_Click(object sender, EventArgs e)
\r
470 ShowInTaskbar = true;
\r
471 WindowState = FormWindowState.Normal;
\r
472 TopMost = _listForm.TopMost = Config.TopMost; // 最前面に表示されなくなることがあるのを回避する
\r
475 private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
\r
480 private void ConfigToolStripMenuItem_Click(object sender, EventArgs e)
\r
482 if (_configDialog.ShowDialog(this) == DialogResult.OK)
\r
486 StopRepeatingTimer(_configDialog.RepeatSettingsChanged);
\r
490 private void StopRepeatingTimer(IEnumerable<string> names)
\r
492 foreach (var name in names)
\r
493 _notificationManager.StopRepeat(name);
\r
496 private void PerformZoom()
\r
498 if (Config.Zoom == 100)
\r
500 var prev = CurrentAutoScaleDimensions;
\r
501 foreach (var control in new Control[]
\r
503 this, _listForm, labelLogin, linkLabelGuide,
\r
504 _configDialog, _configDialog.NotificationConfigDialog,
\r
505 contextMenuStripMain, _errorDialog
\r
508 control.Font = new Font(control.Font.FontFamily, control.Font.Size * Config.Zoom / 100);
\r
510 foreach (var toolTip in new[] {_toolTip, _tooltipCopy})
\r
512 toolTip.Font = new Font(toolTip.Font.FontFamily, toolTip.Font.Size * Config.Zoom / 100);
\r
514 ShipLabel.LatinFont = new Font("Tahoma", 8f * Config.Zoom / 100);
\r
515 var cur = CurrentAutoScaleDimensions;
\r
516 ShipLabel.ScaleFactor = new SizeF(ShipLabel.ScaleFactor.Width * cur.Width / prev.Width,
\r
517 ShipLabel.ScaleFactor.Height * cur.Height / prev.Height);
\r
520 private void RestoreLocation()
\r
522 if (Config.Location.X == int.MinValue)
\r
524 if (IsTitleBarOnAnyScreen(Config.Location))
\r
525 Location = Config.Location;
\r
528 private void ApplyConfig()
\r
530 if (TopMost != Config.TopMost)
\r
531 TopMost = _listForm.TopMost = Config.TopMost;
\r
532 Sniffer.ShipCounter.Margin = Config.MarginShips;
\r
533 _numberAndHistory.UpdateNumOfShips();
\r
534 Sniffer.ItemCounter.Margin = Config.MarginEquips;
\r
535 _numberAndHistory.UpdateNumOfEquips();
\r
536 Sniffer.Achievement.ResetHours = Config.ResetHours;
\r
537 labelAkashiRepair.Visible = labelAkashiRepairTimer.Visible =
\r
538 labelPresetAkashiTimer.Visible = Config.UsePresetAkashi;
\r
541 public void ApplyDebugLogSetting()
\r
543 _debugLogFile = Config.DebugLogging ? Config.DebugLogFile : null;
\r
546 public bool ApplyProxySetting()
\r
548 return _proxyManager.ApplyConfig();
\r
551 public void ApplyLogSetting()
\r
553 LogServer.OutputDir = Config.Log.OutputDir;
\r
554 LogServer.LogProcessor = new LogProcessor(Sniffer.Material.MaterialHistory, Sniffer.MapDictionary);
\r
555 Sniffer.EnableLog(Config.Log.On ? LogType.All : LogType.None);
\r
556 Sniffer.MaterialLogInterval = Config.Log.MaterialLogInterval;
\r
557 Sniffer.LogOutputDir = Config.Log.OutputDir;
\r
560 public static bool IsTitleBarOnAnyScreen(Point location)
\r
562 var rect = new Rectangle(
\r
563 new Point(location.X + SystemInformation.IconSize.Width + SystemInformation.HorizontalFocusThickness,
\r
564 location.Y + SystemInformation.CaptionHeight), new Size(60, 1));
\r
565 return Screen.AllScreens.Any(screen => screen.WorkingArea.Contains(rect));
\r
568 private void timerMain_Tick(object sender, EventArgs e)
\r
574 _now = DateTime.Now;
\r
579 catch (Exception ex)
\r
581 if (_errorDialog.ShowDialog(this, "エラーが発生しました。", ex.ToString()) == DialogResult.Abort)
\r
585 if (_playLog == null || _configDialog.Visible)
\r
587 labelPlayLog.Visible = false;
\r
593 public void SetPlayLog(string file)
\r
595 _playLog = File.ReadLines(file).GetEnumerator();
\r
598 private void PlayLog()
\r
600 var lines = new List<string>();
\r
601 foreach (var s in new[] {"url: ", "request: ", "response: "})
\r
605 if (!_playLog.MoveNext() || _playLog.Current == null)
\r
607 labelPlayLog.Visible = false;
\r
610 } while (!_playLog.Current.StartsWith(s));
\r
611 lines.Add(_playLog.Current.Substring(s.Length));
\r
613 labelPlayLog.Visible = !labelPlayLog.Visible;
\r
614 ProcessRequestMain(lines[0], lines[1], lines[2]);
\r
617 private void ShowShipOnShipList(object sender, EventArgs ev)
\r
619 if (!_listForm.Visible)
\r
621 var idx = (int)((Control)sender).Tag;
\r
622 var ship = (_combinedFleet
\r
623 ? Sniffer.Fleets[0].Ships.Concat(Sniffer.Fleets[1].Ships).ToArray()
\r
624 : Sniffer.Fleets[_currentFleet].Ships)[idx];
\r
626 _listForm.ShowShip(ship.Id);
\r
630 private void UpdateItemInfo()
\r
632 _numberAndHistory.Update();
\r
633 if (_listForm.Visible)
\r
634 _listForm.UpdateList();
\r
637 private void UpdateShipInfo()
\r
641 UpdatePanelShipInfo();
\r
642 NotifyDamagedShip();
\r
643 UpdateChargeInfo();
\r
644 UpdateRepairList();
\r
645 UpdateMissionLabels();
\r
646 if (_listForm.Visible)
\r
647 _listForm.UpdateList();
\r
650 private bool _inSortie;
\r
652 private void SetCurrentFleet()
\r
654 var states = Sniffer.Fleets.Select(fleet => fleet.State).ToArray();
\r
655 var inSortie = states.Any(state => state >= FleetState.Sortie);
\r
656 if (_inSortie || !inSortie)
\r
658 _inSortie = inSortie;
\r
662 if (states[0] == FleetState.Sortie && states[1] == FleetState.Sortie)
\r
664 _combinedFleet = true;
\r
669 _combinedFleet = false;
\r
670 _currentFleet = Array.FindIndex(states, state => state >= FleetState.Sortie);
\r
674 private bool _prevCombined;
\r
676 private void SetCombined()
\r
678 if (Sniffer.IsCombinedFleet && !_prevCombined)
\r
680 _combinedFleet = true;
\r
683 _prevCombined = Sniffer.IsCombinedFleet;
\r
686 private void UpdatePanelShipInfo()
\r
688 var fleets = Sniffer.Fleets;
\r
689 var ships = fleets[_currentFleet].ActualShips;
\r
690 panel7Ships.Visible = ships.Count == 7;
\r
691 _mainLabels.SetShipLabels(ships);
\r
692 if (!Sniffer.IsCombinedFleet)
\r
693 _combinedFleet = false;
\r
694 labelFleet1.Text = _combinedFleet ? CombinedName : "第一";
\r
695 panelCombinedFleet.Visible = _combinedFleet;
\r
696 if (_combinedFleet)
\r
697 _mainLabels.SetCombinedShipLabels(fleets[0].ActualShips, fleets[1].ActualShips);
\r
698 for (var i = 0; i < _labelCheckFleets.Length; i++)
\r
699 _labelCheckFleets[i].Visible = _currentFleet == i;
\r
700 UpdateAkashiTimer();
\r
701 var battle = Sniffer.Battle;
\r
702 UpdateFighterPower(_combinedFleet && (battle.BattleState == BattleState.None || battle.EnemyIsCombined));
\r
704 UpdateCondTimers();
\r
707 private string CombinedName
\r
711 switch (Sniffer.Fleets[0].CombinedType)
\r
713 case CombinedType.Carrier:
\r
715 case CombinedType.Surface:
\r
717 case CombinedType.Transport:
\r
725 private void NotifyDamagedShip()
\r
727 if (!Sniffer.BadlyDamagedShips.Any())
\r
729 _notificationManager.StopRepeat("大破警告");
\r
730 SetNotification("大破警告", string.Join(" ", Sniffer.BadlyDamagedShips));
\r
731 _notificationManager.Flash();
\r
734 public void UpdateFighterPower(bool combined)
\r
736 var fleets = Sniffer.Fleets;
\r
738 ? fleets[0].FighterPower.Zip(fleets[1].FighterPower, (a, b) => a + b).ToArray()
\r
739 : fleets[_currentFleet].FighterPower;
\r
740 labelFighterPower.Text = fp[0].ToString("D");
\r
742 ? fleets[0].ContactTriggerRate + fleets[1].ContactTriggerRate
\r
743 : fleets[_currentFleet].ContactTriggerRate;
\r
744 var text = "制空: " + (fp[0] == fp[1] ? $"{fp[0]}" : $"{fp[0]}~{fp[1]}") +
\r
745 $" 触接: {cr * 100:f1}";
\r
746 _toolTip.SetToolTip(labelFighterPower, text);
\r
747 _toolTip.SetToolTip(labelFighterPowerCaption, text);
\r
750 private void UpdateLoS()
\r
752 var fleet = Sniffer.Fleets[_currentFleet];
\r
753 labelLoS.Text = RoundDown(fleet.GetLineOfSights(1)).ToString("F1");
\r
754 var text = $"係数2: {RoundDown(fleet.GetLineOfSights(2)):F1}\r\n" +
\r
755 $"係数3: {RoundDown(fleet.GetLineOfSights(3)):F1}\r\n" +
\r
756 $"係数4: {RoundDown(fleet.GetLineOfSights(4)):F1}";
\r
757 _toolTip.SetToolTip(labelLoS, text);
\r
758 _toolTip.SetToolTip(labelLoSCaption, text);
\r
761 private double RoundDown(double number)
\r
763 return Floor(number * 10) / 10.0;
\r
766 private void UpdateBattleInfo()
\r
769 _listForm.UpdateBattleResult();
\r
770 _listForm.UpdateAirBattleResult();
\r
771 if (Sniffer.Battle.BattleState == BattleState.None)
\r
773 panelBattleInfo.BringToFront();
\r
774 var battle = Sniffer.Battle;
\r
775 labelFormation.Text = new[] {"同航戦", "反航戦", "T字有利", "T字不利"}[battle.Formation[2] - 1];
\r
776 UpdateBattleFighterPower();
\r
777 if ((Config.Spoilers & Spoiler.ResultRank) != 0)
\r
781 private void UpdateCellInfo()
\r
783 _listForm.UpdateCellInfo();
\r
786 private void ResetBattleInfo()
\r
788 labelFormation.Text = "";
\r
789 labelEnemyFighterPower.Text = "";
\r
790 labelFighterPower.ForeColor = DefaultForeColor;
\r
791 labelResultRank.Text = "判定";
\r
792 panelBattleInfo.Visible = Sniffer.Battle.BattleState != BattleState.None;
\r
795 private void UpdateBattleFighterPower()
\r
797 var battle = Sniffer.Battle;
\r
798 var power = battle.EnemyFighterPower;
\r
799 labelEnemyFighterPower.Text = power.AirCombat + power.UnknownMark;
\r
800 if (power.AirCombat != power.Interception)
\r
802 var text = "防空: " + power.Interception + power.UnknownMark;
\r
803 _toolTip.SetToolTip(labelEnemyFighterPower, text);
\r
804 _toolTip.SetToolTip(labelEnemyFighterPowerCaption, text);
\r
808 _toolTip.SetToolTip(labelEnemyFighterPower, "");
\r
809 _toolTip.SetToolTip(labelEnemyFighterPowerCaption, "");
\r
811 UpdateFighterPower(Sniffer.IsCombinedFleet && battle.EnemyIsCombined);
\r
812 labelFighterPower.ForeColor = new[]
\r
813 {DefaultForeColor, DefaultForeColor, CUDColors.Blue, CUDColors.Green, CUDColors.Orange, CUDColors.Red}[
\r
814 battle.AirControlLevel + 1];
\r
817 private void ShowResultRank()
\r
819 var result = new[] {"完全S", "勝利S", "勝利A", "勝利B", "敗北C", "敗北D", "敗北E"};
\r
820 labelResultRank.Text = result[(int)Sniffer.Battle.ResultRank];
\r
823 private void labelResultRank_Click(object sender, EventArgs e)
\r
828 private void UpdateChargeInfo()
\r
830 var fuelSq = new[] {labelFuelSq1, labelFuelSq2, labelFuelSq3, labelFuelSq4};
\r
831 var bullSq = new[] {labelBullSq1, labelBullSq2, labelBullSq3, labelBullSq4};
\r
833 for (var i = 0; i < fuelSq.Length; i++)
\r
835 var stat = Sniffer.Fleets[i].ChargeStatus;
\r
836 fuelSq[i].ImageIndex = stat.Fuel;
\r
837 bullSq[i].ImageIndex = stat.Bull;
\r
841 private void UpdateNDocLabels()
\r
843 _mainLabels.SetNDockLabels(Sniffer.NDock);
\r
847 private void SetNDockLabel()
\r
849 labelNDock.Text = (Config.ShowEndTime & TimerKind.NDock) != 0 ? "入渠終了" : "入渠";
\r
852 private void labelNDock_Click(object sender, EventArgs e)
\r
854 Config.ShowEndTime ^= TimerKind.NDock;
\r
859 private void UpdateMissionLabels()
\r
861 var nameLabels = new[] {labelMissionName1, labelMissionName2, labelMissionName3};
\r
862 var paramsLabels = new[] {labelMissionParams1, labelMissionParams2, labelMissionParams3};
\r
863 var names = Sniffer.Missions.Select(mission => mission.Name).ToArray();
\r
864 for (var i = 0; i < ShipInfo.FleetCount - 1; i++)
\r
866 paramsLabels[i].Visible = false;
\r
867 if (string.IsNullOrEmpty(names[i]))
\r
869 paramsLabels[i].Text = GenerateFleetParamsForMission(i + 1);
\r
870 paramsLabels[i].Visible = true;
\r
872 nameLabels[i].Text = names[i];
\r
877 private void SetMissionLabel()
\r
879 labelMission.Text = (Config.ShowEndTime & TimerKind.Mission) != 0 ? "遠征終了" : "遠征";
\r
882 private string GenerateFleetParamsForMission(int fleetNumber)
\r
884 var result = new List<string>();
\r
885 var fleet = Sniffer.Fleets[fleetNumber];
\r
886 var kira = fleet.Ships.Count(ship => ship.Cond > 49);
\r
887 var plus = fleet.Ships[0].Cond > 49;
\r
889 result.Add($"キラ{kira}{(plus ? "+" : "")}");
\r
890 var drums = fleet.Ships.SelectMany(ship => ship.Slot).Count(item => item.Spec.IsDrum);
\r
891 var drumShips = fleet.Ships.Count(ship => ship.Slot.Any(item => item.Spec.IsDrum));
\r
893 result.Add($"ド{drums}({drumShips}隻)");
\r
894 if (fleet.DaihatsuBonus > 0)
\r
895 result.Add($"ダ{fleet.DaihatsuBonus * 100:f1}%");
\r
896 return string.Join(" ", result);
\r
899 private void labelMission_Click(object sender, EventArgs e)
\r
901 Config.ShowEndTime ^= TimerKind.Mission;
\r
906 private void UpdateTimers()
\r
908 var mission = new[] {labelMission1, labelMission2, labelMission3};
\r
909 for (var i = 0; i < mission.Length; i++)
\r
911 var entry = Sniffer.Missions[i];
\r
912 SetTimerColor(mission[i], entry.Timer, _now);
\r
913 mission[i].Text = entry.Timer.ToString(_now, (Config.ShowEndTime & TimerKind.Mission) != 0);
\r
915 for (var i = 0; i < Sniffer.NDock.Length; i++)
\r
917 var entry = Sniffer.NDock[i];
\r
918 _mainLabels.SetNDockTimer(i, entry.Timer, _now, (Config.ShowEndTime & TimerKind.NDock) != 0);
\r
920 var kdock = new[] {labelConstruct1, labelConstruct2, labelConstruct3, labelConstruct4};
\r
921 for (var i = 0; i < kdock.Length; i++)
\r
923 var timer = Sniffer.KDock[i];
\r
924 SetTimerColor(kdock[i], timer, _now);
\r
925 kdock[i].Text = timer.ToString(_now);
\r
927 UpdateCondTimers();
\r
928 UpdateAkashiTimer();
\r
929 _timerEnabled = true;
\r
932 private void NotifyTimers()
\r
934 for (var i = 0; i < Sniffer.Missions.Length; i++)
\r
936 var entry = Sniffer.Missions[i];
\r
937 if (entry.Name == "前衛支援任務" || entry.Name == "艦隊決戦支援任務")
\r
939 CheckAlarm("遠征終了", entry.Timer, i + 1, entry.Name);
\r
941 for (var i = 0; i < Sniffer.NDock.Length; i++)
\r
943 var entry = Sniffer.NDock[i];
\r
944 CheckAlarm("入渠終了", entry.Timer, i, entry.Name);
\r
946 for (var i = 0; i < Sniffer.KDock.Length; i++)
\r
948 var timer = Sniffer.KDock[i];
\r
949 CheckAlarm("建造完了", timer, i, "");
\r
951 NotifyCondTimers();
\r
952 NotifyAkashiTimer();
\r
953 _notificationManager.Flash();
\r
956 private void CheckAlarm(string key, AlarmTimer timer, int fleet, string subject)
\r
958 if (timer.CheckAlarm(_prev, _now))
\r
960 SetNotification(key, fleet, subject);
\r
963 var pre = TimeSpan.FromSeconds(Config.Notifications[key].PreliminaryPeriod);
\r
964 if (pre == TimeSpan.Zero)
\r
966 if (timer.CheckAlarm(_prev + pre, _now + pre))
\r
967 SetPreNotification(key, fleet, subject);
\r
970 private void SetTimerColor(Label label, AlarmTimer timer, DateTime now)
\r
972 label.ForeColor = timer.IsFinished(now) ? CUDColors.Red : Color.Black;
\r
975 private void UpdateCondTimers()
\r
978 if (_combinedFleet)
\r
980 var timer1 = Sniffer.GetConditionTimer(0);
\r
981 var timer2 = Sniffer.GetConditionTimer(1);
\r
982 timer = timer2 > timer1 ? timer2 : timer1;
\r
986 timer = Sniffer.GetConditionTimer(_currentFleet);
\r
988 if (timer == DateTime.MinValue)
\r
990 labelCondTimerTitle.Text = "";
\r
991 labelCondTimer.Text = "";
\r
994 var span = TimeSpan.FromSeconds(Ceiling((timer - _now).TotalSeconds));
\r
995 if (span >= TimeSpan.FromMinutes(9))
\r
997 labelCondTimerTitle.Text = "cond40まで";
\r
998 labelCondTimer.Text = (span - TimeSpan.FromMinutes(9)).ToString(@"mm\:ss");
\r
999 labelCondTimer.ForeColor = DefaultForeColor;
\r
1003 labelCondTimerTitle.Text = "cond49まで";
\r
1004 labelCondTimer.Text = (span >= TimeSpan.Zero ? span : TimeSpan.Zero).ToString(@"mm\:ss");
\r
1005 labelCondTimer.ForeColor = span <= TimeSpan.Zero ? CUDColors.Red : DefaultForeColor;
\r
1009 private void NotifyCondTimers()
\r
1011 var notice = Sniffer.GetConditionNotice(_prev, _now);
\r
1012 var pre = TimeSpan.FromSeconds(Config.Notifications["疲労回復"].PreliminaryPeriod);
\r
1013 var preNotice = pre == TimeSpan.Zero
\r
1014 ? new int[ShipInfo.FleetCount]
\r
1015 : Sniffer.GetConditionNotice(_prev + pre, _now + pre);
\r
1016 for (var i = 0; i < ShipInfo.FleetCount; i++)
\r
1018 if (Config.NotifyConditions.Contains(notice[i]))
\r
1020 SetNotification("疲労回復" + notice[i], i, "cond" + notice[i]);
\r
1022 else if (Config.NotifyConditions.Contains(preNotice[i]))
\r
1024 SetPreNotification("疲労回復" + preNotice[i], i, "cond" + notice[i]);
\r
1029 private void UpdateAkashiTimer()
\r
1031 if (Config.UsePresetAkashi)
\r
1032 UpdatePresetAkashiTimer();
\r
1033 _mainLabels.SetAkashiTimer(Sniffer.Fleets[_currentFleet].ActualShips,
\r
1034 Sniffer.AkashiTimer.GetTimers(_currentFleet, _now));
\r
1037 private void UpdatePresetAkashiTimer()
\r
1039 var akashi = Sniffer.AkashiTimer;
\r
1040 var span = akashi.GetPresetDeckTimer(_now);
\r
1041 var color = span == TimeSpan.Zero && akashi.CheckPresetRepairing() ? CUDColors.Red : DefaultForeColor;
\r
1042 var text = span == TimeSpan.MinValue ? "" : span.ToString(@"mm\:ss");
\r
1043 labelAkashiRepairTimer.ForeColor = color;
\r
1044 labelAkashiRepairTimer.Text = text;
\r
1045 if (akashi.CheckPresetRepairing() && !akashi.CheckRepairing(_currentFleet, _now))
\r
1047 labelPresetAkashiTimer.ForeColor = color;
\r
1048 labelPresetAkashiTimer.Text = text;
\r
1052 labelPresetAkashiTimer.ForeColor = DefaultForeColor;
\r
1053 labelPresetAkashiTimer.Text = "";
\r
1057 private void NotifyAkashiTimer()
\r
1059 var akashi = Sniffer.AkashiTimer;
\r
1060 var msgs = akashi.GetNotice(_prev, _now);
\r
1061 if (msgs.Length == 0)
\r
1063 _notificationManager.StopRepeat("泊地修理");
\r
1066 if (!akashi.CheckRepairing(_now) && !(akashi.CheckPresetRepairing() && Config.UsePresetAkashi))
\r
1068 _notificationManager.StopRepeat("泊地修理");
\r
1071 var skipPreliminary = false;
\r
1072 if (msgs[0].Proceeded == "20分経過しました。")
\r
1074 SetNotification("泊地修理20分経過", msgs[0].Proceeded);
\r
1075 msgs[0].Proceeded = "";
\r
1076 skipPreliminary = true;
\r
1077 // 修理完了がいるかもしれないので続ける
\r
1079 for (var i = 0; i < ShipInfo.FleetCount; i++)
\r
1081 if (msgs[i].Proceeded != "")
\r
1082 SetNotification("泊地修理進行", i, msgs[i].Proceeded);
\r
1083 if (msgs[i].Completed != "")
\r
1084 SetNotification("泊地修理完了", i, msgs[i].Completed);
\r
1086 var pre = TimeSpan.FromSeconds(Config.Notifications["泊地修理20分経過"].PreliminaryPeriod);
\r
1087 if (skipPreliminary || pre == TimeSpan.Zero)
\r
1089 if ((msgs = akashi.GetNotice(_prev + pre, _now + pre))[0].Proceeded == "20分経過しました。")
\r
1090 SetPreNotification("泊地修理20分経過", 0, msgs[0].Proceeded);
\r
1093 private void SetNotification(string key, string subject)
\r
1095 SetNotification(key, 0, subject);
\r
1098 private void SetNotification(string key, int fleet, string subject)
\r
1100 var spec = Config.Notifications[_notificationManager.KeyToName(key)];
\r
1101 _notificationManager.Enqueue(key, fleet, subject,
\r
1102 (spec.Flags & Config.NotificationFlags & NotificationType.Repeat) == 0 ? 0 : spec.RepeatInterval);
\r
1105 private void SetPreNotification(string key, int fleet, string subject)
\r
1107 var spec = Config.Notifications[_notificationManager.KeyToName(key)];
\r
1108 if ((spec.Flags & NotificationType.Preliminary) != 0)
\r
1109 _notificationManager.Enqueue(key, fleet, subject, 0, true);
\r
1112 private void UpdateRepairList()
\r
1114 panelRepairList.SetRepairList(Sniffer.RepairList);
\r
1115 _toolTip.SetToolTip(label31, new RepairShipCount(Sniffer.RepairList).ToString());
\r
1118 private void UpdateQuestList()
\r
1120 questPanel.Update(Sniffer.Quests);
\r
1121 Sniffer.GetQuestNotifications(out var notify, out var stop);
\r
1122 foreach (var questName in notify)
\r
1123 SetNotification("任務達成", 0, questName);
\r
1124 foreach (var questName in stop)
\r
1125 _notificationManager.StopRepeat("任務達成", questName);
\r
1126 _notificationManager.Flash();
\r
1129 private void Alarm(string balloonTitle, string balloonMessage, string name)
\r
1131 var flags = Config.Notifications[name].Flags;
\r
1132 var effective = Config.NotificationFlags & Config.Notifications[name].Flags;
\r
1133 if ((effective & NotificationType.FlashWindow) != 0)
\r
1134 Win32API.FlashWindow(Handle);
\r
1135 if ((effective & NotificationType.ShowBaloonTip) != 0)
\r
1136 notifyIconMain.ShowBalloonTip(20000, balloonTitle, balloonMessage, ToolTipIcon.Info);
\r
1137 if ((effective & NotificationType.PlaySound) != 0)
\r
1138 PlaySound(Config.Sounds[name], Config.Sounds.Volume);
\r
1139 if (Config.Pushbullet.On && (flags & NotificationType.Push) != 0)
\r
1143 PushNotification.PushToPushbullet(Config.Pushbullet.Token, balloonTitle, balloonMessage);
\r
1146 if (Config.Pushover.On && (flags & NotificationType.Push) != 0)
\r
1150 PushNotification.PushToPushover(Config.Pushover.ApiKey, Config.Pushover.UserKey,
\r
1151 balloonTitle, balloonMessage);
\r
1156 [DllImport("winmm.dll")]
\r
1157 private static extern int mciSendString(String command,
\r
1158 StringBuilder buffer, int bufferSize, IntPtr hWndCallback);
\r
1160 // ReSharper disable InconsistentNaming
\r
1161 // ReSharper disable once IdentifierTypo
\r
1162 private const int MM_MCINOTIFY = 0x3B9;
\r
1164 private const int MCI_NOTIFY_SUCCESSFUL = 1;
\r
1165 // ReSharper restore InconsistentNaming
\r
1167 public void PlaySound(string file, int volume)
\r
1169 if (!File.Exists(file))
\r
1171 mciSendString("close sound", null, 0, IntPtr.Zero);
\r
1172 if (mciSendString("open \"" + file + "\" type mpegvideo alias sound", null, 0, IntPtr.Zero) != 0)
\r
1174 mciSendString("setaudio sound volume to " + volume * 10, null, 0, IntPtr.Zero);
\r
1175 mciSendString("play sound notify", null, 0, Handle);
\r
1178 protected override void WndProc(ref Message m)
\r
1180 if (m.Msg == MM_MCINOTIFY && (int)m.WParam == MCI_NOTIFY_SUCCESSFUL)
\r
1181 mciSendString("close sound", null, 0, IntPtr.Zero);
\r
1182 base.WndProc(ref m);
\r
1185 private void SetupFleetClick()
\r
1187 var labels = new[]
\r
1189 new[] {labelFleet1, labelFleet2, labelFleet3, labelFleet4},
\r
1190 new[] {labelFuelSq1, labelFuelSq2, labelFuelSq3, labelFuelSq4},
\r
1191 new[] {labelBullSq1, labelBullSq2, labelBullSq3, labelBullSq4}
\r
1193 foreach (var a in labels)
\r
1196 a[0].Click += labelFleet1_Click;
\r
1197 a[0].DoubleClick += labelFleet1_DoubleClick;
\r
1198 for (var fleet = 1; fleet < labels[0].Length; fleet++)
\r
1200 a[fleet].Tag = fleet;
\r
1201 a[fleet].Click += labelFleet_Click;
\r
1202 a[fleet].DoubleClick += labelFleet_DoubleClick;
\r
1207 private void labelFleet_Click(object sender, EventArgs e)
\r
1211 var fleet = (int)((Label)sender).Tag;
\r
1212 if (_currentFleet == fleet)
\r
1214 _combinedFleet = false;
\r
1215 _currentFleet = fleet;
\r
1216 UpdatePanelShipInfo();
\r
1219 private readonly SemaphoreSlim _clickSemaphore = new SemaphoreSlim(1);
\r
1220 private readonly SemaphoreSlim _doubleClickSemaphore = new SemaphoreSlim(0);
\r
1222 private async void labelFleet1_Click(object sender, EventArgs e)
\r
1226 if (_currentFleet != 0)
\r
1228 labelFleet_Click(sender, e);
\r
1231 if (!_clickSemaphore.Wait(0))
\r
1235 if (await _doubleClickSemaphore.WaitAsync(SystemInformation.DoubleClickTime))
\r
1240 _clickSemaphore.Release();
\r
1242 _combinedFleet = Sniffer.IsCombinedFleet && !_combinedFleet;
\r
1243 UpdatePanelShipInfo();
\r
1246 private void labelFleet1_MouseHover(object sender, EventArgs e)
\r
1248 labelFleet1.Text = _currentFleet == 0 && Sniffer.IsCombinedFleet && !_combinedFleet ? "連合" : "第一";
\r
1251 private void labelFleet1_MouseLeave(object sender, EventArgs e)
\r
1253 labelFleet1.Text = _combinedFleet ? CombinedName : "第一";
\r
1256 private void labelFleet_DoubleClick(object sender, EventArgs e)
\r
1260 var fleet = (int)((Label)sender).Tag;
\r
1261 var text = TextGenerator.GenerateFleetData(Sniffer, fleet);
\r
1262 CopyFleetText(text, (Label)sender);
\r
1265 private void labelFleet1_DoubleClick(object sender, EventArgs e)
\r
1269 _doubleClickSemaphore.Release();
\r
1270 var text = TextGenerator.GenerateFleetData(Sniffer, 0);
\r
1271 if (_combinedFleet)
\r
1272 text += TextGenerator.GenerateFleetData(Sniffer, 1);
\r
1273 CopyFleetText(text, (Label)sender);
\r
1276 private void CopyFleetText(string text, Label fleetButton)
\r
1278 if (string.IsNullOrEmpty(text))
\r
1280 Clipboard.SetText(text);
\r
1281 _tooltipCopy.Active = true;
\r
1282 _tooltipCopy.Show("コピーしました。", fleetButton);
\r
1283 Task.Run(async () =>
\r
1285 await Task.Delay(1000);
\r
1286 _tooltipCopy.Active = false;
\r
1290 private void labelBucketHistoryButton_Click(object sender, EventArgs e)
\r
1292 if (labelBucketHistory.Visible)
\r
1294 labelBucketHistory.Visible = false;
\r
1295 labelBucketHistoryButton.BackColor = DefaultBackColor;
\r
1299 labelBucketHistory.Visible = true;
\r
1300 labelBucketHistory.BringToFront();
\r
1301 labelBucketHistoryButton.BackColor = CustomColors.ActiveButtonColor;
\r
1305 private void labelBucketHistory_Click(object sender, EventArgs e)
\r
1307 labelBucketHistory.Visible = false;
\r
1308 labelBucketHistoryButton.BackColor = DefaultBackColor;
\r
1311 private void labelMaterialHistoryButton_Click(object sender, EventArgs e)
\r
1313 if (panelMaterialHistory.Visible)
\r
1315 panelMaterialHistory.Visible = false;
\r
1316 labelMaterialHistoryButton.BackColor = DefaultBackColor;
\r
1320 panelMaterialHistory.Visible = true;
\r
1321 panelMaterialHistory.BringToFront();
\r
1322 labelMaterialHistoryButton.BackColor = CustomColors.ActiveButtonColor;
\r
1326 private void panelMaterialHistory_Click(object sender, EventArgs e)
\r
1328 panelMaterialHistory.Visible = false;
\r
1329 labelMaterialHistoryButton.BackColor = DefaultBackColor;
\r
1332 public void ResetAchievement()
\r
1334 Sniffer.Achievement.Reset();
\r
1338 private void labelRepairListButton_Click(object sender, EventArgs e)
\r
1340 if (panelRepairList.Visible)
\r
1342 panelRepairList.Visible = false;
\r
1343 labelRepairListButton.BackColor = DefaultBackColor;
\r
1347 panelRepairList.Visible = true;
\r
1348 panelRepairList.BringToFront();
\r
1349 labelRepairListButton.BackColor = CustomColors.ActiveButtonColor;
\r
1353 private void panelRepairList_Click(object sender, EventArgs e)
\r
1355 panelRepairList.Visible = false;
\r
1356 labelRepairListButton.BackColor = DefaultBackColor;
\r
1359 private void ShipListToolStripMenuItem_Click(object sender, EventArgs e)
\r
1361 _listForm.UpdateList();
\r
1363 if (_listForm.WindowState == FormWindowState.Minimized)
\r
1364 _listForm.WindowState = FormWindowState.Normal;
\r
1365 _listForm.Activate();
\r
1368 private void LogToolStripMenuItem_Click(object sender, EventArgs e)
\r
1370 Process.Start("http://localhost:" + Config.Proxy.Listen + "/");
\r
1373 private void labelClearQuest_Click(object sender, EventArgs e)
\r
1375 Sniffer.ClearQuests();
\r
1376 UpdateQuestList();
\r
1379 private void labelClearQuest_MouseDown(object sender, MouseEventArgs e)
\r
1381 labelClearQuest.BackColor = CustomColors.ActiveButtonColor;
\r
1384 private void labelClearQuest_MouseUp(object sender, MouseEventArgs e)
\r
1386 labelClearQuest.BackColor = DefaultBackColor;
\r
1389 private void labelQuest_DoubleClick(object sender, EventArgs e)
\r
1391 var label = (Label)sender;
\r
1392 if (string.IsNullOrEmpty(label.Text))
\r
1394 Clipboard.SetText(label.Text);
\r
1395 _tooltipCopy.Active = true;
\r
1396 _tooltipCopy.Show("コピーしました。", label);
\r
1397 Task.Run(async () =>
\r
1399 await Task.Delay(1000);
\r
1400 _tooltipCopy.Active = false;
\r
1404 private void CaptureToolStripMenuItem_Click(object sender, EventArgs e)
\r
1408 var proc = new ProcessStartInfo("BurageSnap.exe") {WorkingDirectory = "Capture"};
\r
1409 Process.Start(proc);
\r
1411 catch (FileNotFoundException)
\r
1414 catch (Win32Exception)
\r