Skip to content

Commit 8155302

Browse files
committed
[FlashpointManager] Add /launcher argument, support for using multiple arguments at the same time
1 parent b380b35 commit 8155302

4 files changed

Lines changed: 44 additions & 24 deletions

File tree

FlashpointManager/src/Common.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ public static class FPM
190190
public static bool UpdateMode { get; set; } = false;
191191
// Controls whether the update tab is selected at launch
192192
public static bool OpenUpdateTab { get; set; } = false;
193+
// Controls whether the launcher should be opened upon the manager closing
194+
public static bool OpenLauncherOnClose { get; set; } = false;
193195
// Controls components that will be automatically downloaded at launch
194196
public static List<string> AutoDownload { get; set; } = new List<string>();
195197

FlashpointManager/src/Forms/Main.Designer.cs

Lines changed: 14 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FlashpointManager/src/Forms/Main.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Diagnostics;
23
using System.IO;
34
using System.Linq;
45
using System.Threading.Tasks;
@@ -48,7 +49,7 @@ private void Main_Load(object sender, EventArgs e)
4849
FPM.CheckDependencies(false);
4950
ChangeButton_Click(this, new EventArgs());
5051

51-
Environment.Exit(0);
52+
Close();
5253
}
5354

5455
if (FPM.OpenUpdateTab) TabControl.SelectTab(1);
@@ -156,5 +157,17 @@ await Task.Run(() => {
156157

157158
Close();
158159
}
160+
161+
private void Main_FormClosing(object sender, FormClosingEventArgs e)
162+
{
163+
if (FPM.OpenLauncherOnClose)
164+
{
165+
new Process() { StartInfo = {
166+
UseShellExecute = true,
167+
FileName = "Flashpoint.exe",
168+
WorkingDirectory = Path.Combine(FPM.SourcePath, "Launcher")
169+
}}.Start();
170+
}
171+
}
159172
}
160173
}

FlashpointManager/src/Program.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,23 @@ static void Main(string[] args)
9393
{
9494
FPM.OpenUpdateTab = true;
9595
}
96-
else
96+
97+
// Open launcher on close if /launcher argument is passed
98+
if (args.Any(v => v.ToLower() == "/launcher"))
9799
{
98-
// Automatically download components if /download argument is passed
99-
var argsList = args.ToList();
100-
int first = argsList.FindIndex(v => v.ToLower() == "/download");
100+
FPM.OpenLauncherOnClose = true;
101+
}
102+
103+
// Automatically download components if /download argument is passed
104+
var argsList = args.ToList();
105+
int first = argsList.FindIndex(v => v.ToLower() == "/download");
101106

102-
if (first > -1 && first < argsList.Count - 1)
103-
{
104-
int last = argsList.FindIndex(first + 1, v => v.StartsWith("/"));
105-
if (last == -1) last = argsList.Count;
107+
if (first > -1 && first < argsList.Count - 1)
108+
{
109+
int last = argsList.FindIndex(first + 1, v => v.StartsWith("/"));
110+
if (last == -1) last = argsList.Count;
106111

107-
FPM.AutoDownload.AddRange(argsList.Skip(first + 1).Take(last - first - 1));
108-
}
112+
FPM.AutoDownload.AddRange(argsList.Skip(first + 1).Take(last - first - 1));
109113
}
110114
}
111115

0 commit comments

Comments
 (0)