feat: auto-check for updates 30s after startup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
57a6946e6b
commit
a13d30f0b2
2 changed files with 25 additions and 0 deletions
|
|
@ -66,6 +66,7 @@ namespace MosswartMassacre
|
||||||
private static Timer vitalsTimer;
|
private static Timer vitalsTimer;
|
||||||
private static System.Windows.Forms.Timer commandTimer;
|
private static System.Windows.Forms.Timer commandTimer;
|
||||||
private static Timer characterStatsTimer;
|
private static Timer characterStatsTimer;
|
||||||
|
private static Timer _updateCheckTimer;
|
||||||
private static readonly Queue<string> pendingCommands = new Queue<string>();
|
private static readonly Queue<string> pendingCommands = new Queue<string>();
|
||||||
private static RareTracker _staticRareTracker;
|
private static RareTracker _staticRareTracker;
|
||||||
public static bool RareMetaEnabled
|
public static bool RareMetaEnabled
|
||||||
|
|
@ -198,6 +199,12 @@ namespace MosswartMassacre
|
||||||
commandTimer.Dispose();
|
commandTimer.Dispose();
|
||||||
commandTimer = null;
|
commandTimer = null;
|
||||||
}
|
}
|
||||||
|
if (_updateCheckTimer != null)
|
||||||
|
{
|
||||||
|
_updateCheckTimer.Stop();
|
||||||
|
_updateCheckTimer.Dispose();
|
||||||
|
_updateCheckTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize kill tracker (owns the 1-sec stats timer)
|
// Initialize kill tracker (owns the 1-sec stats timer)
|
||||||
_killTracker = new KillTracker(
|
_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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -361,6 +379,13 @@ namespace MosswartMassacre
|
||||||
characterStatsTimer = null;
|
characterStatsTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_updateCheckTimer != null)
|
||||||
|
{
|
||||||
|
_updateCheckTimer.Stop();
|
||||||
|
_updateCheckTimer.Dispose();
|
||||||
|
_updateCheckTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Dispose quest manager
|
// Dispose quest manager
|
||||||
if (questManager != null)
|
if (questManager != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue