Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 6af0544

Browse files
committed
Make the update to v2 of PMF clearer, with an opt in to the v2 update at launch.
1 parent ebb33b0 commit 6af0544

1 file changed

Lines changed: 46 additions & 16 deletions

File tree

PenumbraModForwarder.UI/Program.cs

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,33 @@ static class Program {
1919

2020
[STAThread]
2121
static void Main(string[] args) {
22-
MessageBox.Show("This is a notice that Penumbra Mod Forwarder is rebranding to Atomos in this next update.", "Penumbra Mod Forwarder Migration To Atomos");
2322
_serviceProvider = Extensions.ServiceExtensions.Configuration();
24-
var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory);
25-
MigrateOldConfigIfExists();
26-
DownloadAndExtractAtomos();
27-
SelfDestruct(files);
23+
24+
Application.EnableVisualStyles();
25+
Application.SetCompatibleTextRenderingDefault(false);
26+
27+
if (args.Length > 0) {
28+
var filePath = args[0];
29+
HandleFileArgs(filePath);
30+
return;
31+
}
32+
33+
Application.ApplicationExit += OnApplicationExit;
34+
35+
IsProgramAlreadyRunning();
36+
37+
CheckForUpdates();
38+
39+
if (IsExiting) {
40+
return;
41+
}
42+
}
43+
44+
private static void OnApplicationExit(object? sender, EventArgs e) {
45+
ExitApplication();
2846
}
29-
public static void DownloadAndExtractAtomos() {
47+
48+
public static void DownloadAndUpdateToAtomos() {
3049
string downloadPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Atomos.zip");
3150
string atomosPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Atomos.Launcher.exe");
3251
using (var client = new WebClient()) {
@@ -36,17 +55,16 @@ public static void DownloadAndExtractAtomos() {
3655
File.Delete(downloadPath);
3756
Process.Start(atomosPath);
3857
}
39-
public static void SelfDestruct(string[] paths) {
58+
public static void CleanupOldFiles(string[] paths) {
4059
foreach (var item in paths) {
41-
Process.Start(new ProcessStartInfo() {
42-
Arguments = "/C choice /C Y /N /D Y /T 3 & Del \"" + item + "\"",
43-
WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true, FileName = "cmd.exe"
44-
});
60+
if (item.EndsWith(".dll") || item.EndsWith(".dll")) {
61+
Process.Start(new ProcessStartInfo() {
62+
Arguments = "/C choice /C Y /N /D Y /T 3 & Del \"" + item + "\"",
63+
WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true, FileName = "cmd.exe"
64+
});
65+
}
4566
}
4667
}
47-
private static void OnApplicationExit(object sender, EventArgs e) {
48-
// Optional: Additional cleanup if needed
49-
}
5068

5169
public static void ExitApplication() {
5270
IsExiting = true;
@@ -105,8 +123,20 @@ private static void MigrateOldConfigIfExists() {
105123
}
106124

107125
private static void CheckForUpdates() {
108-
var updateService = _serviceProvider.GetRequiredService<IUpdateService>();
109-
updateService.CheckForUpdates();
126+
if (MessageBox.Show("Penumbra Mod Forwarder has a new update to version 2.0. Please be aware that in order to better differentiate the program from other similarly named FFXIV tools we will be re-branding to Atomos Mod Forwarder. Update now?", "Penumbra Mod Forwarder Update Notice", MessageBoxButtons.YesNo) == DialogResult.Yes) {
127+
// Get a snapshot of the current PMF install.
128+
var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory);
129+
130+
// Migrate lingering old configurations
131+
MigrateOldConfigIfExists();
132+
133+
// Update to Atomos
134+
DownloadAndUpdateToAtomos();
135+
136+
// Cleanup
137+
CleanupOldFiles(files);
138+
IsExiting = true;
139+
}
110140
}
111141

112142
private static void CreateStartMenuShortcut() {

0 commit comments

Comments
 (0)