From 57a6946e6b9d63cf12c69ae8f6d660e4e05d11b7 Mon Sep 17 00:00:00 2001 From: erik Date: Sat, 28 Feb 2026 13:11:27 +0000 Subject: [PATCH] feat: add CheckAndInstallAsync convenience method to UpdateManager Co-Authored-By: Claude Opus 4.6 --- MosswartMassacre/UpdateManager.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MosswartMassacre/UpdateManager.cs b/MosswartMassacre/UpdateManager.cs index 7f85741..6eaa70c 100644 --- a/MosswartMassacre/UpdateManager.cs +++ b/MosswartMassacre/UpdateManager.cs @@ -206,6 +206,26 @@ namespace MosswartMassacre } } + /// + /// Check for update and auto-install if available. Used by startup auto-update. + /// + public static async Task CheckAndInstallAsync() + { + try + { + bool checkOk = await CheckForUpdateAsync(); + if (checkOk && updateAvailable) + { + PluginCore.WriteToChat("[Update] Auto-installing update..."); + await DownloadAndInstallUpdateAsync(); + } + } + catch (Exception ex) + { + PluginCore.WriteToChat($"[Update] Auto-update failed: {ex.Message}"); + } + } + private static string GetLocalDllPath() { // Get the path to the current DLL