-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainForm.cs
56 lines (48 loc) · 1.75 KB
/
MainForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Machina;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FFXIVCollectHelper
{
public partial class MainForm : Form
{
private readonly GameMonitor monitor = new GameMonitor();
private PlayerSetupInfo info = null;
public MainForm()
{
InitializeComponent();
}
private void OnLoad(object sender, EventArgs e)
{
var thisFilename = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
var appName = "FFXIV Collect Helper";
var fw = new FirewallWrapper();
if (!fw.IsFirewallDisabled() && !fw.IsFirewallApplicationConfigured(appName))
fw.AddFirewallApplicationEntry(appName, thisFilename);
monitor.PlayerSetupInfoReceived = OnPlayerSetupInfoReceived;
monitor.Start();
}
private void OnPlayerSetupInfoReceived(PlayerSetupInfo info)
{
monitoringProgressIndicator.Image = Properties.Resources.check;
monitoringExplanationLabel.Text = $"Found character: {info.PlayerName}. {info.AcquiredMounts.Count} mounts, {info.AcquiredBardings.Count} bardings, {info.AcquiredOrchestrions.Count} orchestrions.";
importExplanationLabel.Enabled = true;
copyButton.Enabled = true;
this.info = info;
}
private void OnCopyButtonClicked(object sender, EventArgs e)
{
copyButton.Text = "Copied!";
}
private void OnClose(object sender, FormClosedEventArgs e)
{
monitor.Stop();
}
}
}