feat: auto-check for updates 30s after startup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erik 2026-02-28 13:13:35 +00:00
parent 57a6946e6b
commit a13d30f0b2
2 changed files with 25 additions and 0 deletions

View file

@ -66,6 +66,7 @@ namespace MosswartMassacre
private static Timer vitalsTimer;
private static System.Windows.Forms.Timer commandTimer;
private static Timer characterStatsTimer;
private static Timer _updateCheckTimer;
private static readonly Queue<string> pendingCommands = new Queue<string>();
private static RareTracker _staticRareTracker;
public static bool RareMetaEnabled
@ -198,6 +199,12 @@ namespace MosswartMassacre
commandTimer.Dispose();
commandTimer = null;
}
if (_updateCheckTimer != null)
{
_updateCheckTimer.Stop();
_updateCheckTimer.Dispose();
_updateCheckTimer = null;
}
// Initialize kill tracker (owns the 1-sec stats timer)
_killTracker = new KillTracker(
@ -296,6 +303,17 @@ namespace MosswartMassacre
}
}
// Auto-update: check for updates 30s after startup
_updateCheckTimer = new Timer(30000);
_updateCheckTimer.AutoReset = false;
_updateCheckTimer.Elapsed += (s, ev) =>
{
Task.Run(() => UpdateManager.CheckAndInstallAsync());
_updateCheckTimer?.Dispose();
_updateCheckTimer = null;
};
_updateCheckTimer.Start();
}
catch (Exception ex)
{
@ -361,6 +379,13 @@ namespace MosswartMassacre
characterStatsTimer = null;
}
if (_updateCheckTimer != null)
{
_updateCheckTimer.Stop();
_updateCheckTimer.Dispose();
_updateCheckTimer = null;
}
// Dispose quest manager
if (questManager != null)
{