feat: add warning message on login when plugins need an update

This commit is contained in:
goat 2020-03-23 20:19:17 +09:00
parent a4ea6e9d6e
commit 117cc3ef44

View file

@ -10,6 +10,7 @@ using Dalamud.Game.Chat;
using Dalamud.Game.Chat.SeStringHandling; using Dalamud.Game.Chat.SeStringHandling;
using Dalamud.Game.Chat.SeStringHandling.Payloads; using Dalamud.Game.Chat.SeStringHandling.Payloads;
using Dalamud.Game.Internal.Libc; using Dalamud.Game.Internal.Libc;
using Dalamud.Plugin;
using Serilog; using Serilog;
namespace Dalamud.Game { namespace Dalamud.Game {
@ -113,12 +114,26 @@ namespace Dalamud.Game {
if (string.IsNullOrEmpty(this.dalamud.Configuration.LastVersion) || !assemblyVersion.StartsWith(this.dalamud.Configuration.LastVersion)) { if (string.IsNullOrEmpty(this.dalamud.Configuration.LastVersion) || !assemblyVersion.StartsWith(this.dalamud.Configuration.LastVersion)) {
this.dalamud.Framework.Gui.Chat.PrintChat(new XivChatEntry { this.dalamud.Framework.Gui.Chat.PrintChat(new XivChatEntry {
MessageBytes = Encoding.UTF8.GetBytes("The In-Game addon has been updated or was reinstalled successfully! Please check the discord for a full changelog."), MessageBytes = Encoding.UTF8.GetBytes("The In-Game addon has been updated or was reinstalled successfully! Please check the discord for a full changelog."),
Type = XivChatType.Urgent Type = XivChatType.Notice
}); });
this.dalamud.Configuration.LastVersion = assemblyVersion; this.dalamud.Configuration.LastVersion = assemblyVersion;
this.dalamud.Configuration.Save(this.dalamud.StartInfo.ConfigurationPath); this.dalamud.Configuration.Save(this.dalamud.StartInfo.ConfigurationPath);
} }
try {
var hasNeedsUpdate = this.dalamud.PluginRepository.UpdatePlugins(true).UpdatedCount != 0;
if (hasNeedsUpdate) {
this.dalamud.Framework.Gui.Chat.PrintChat(new XivChatEntry
{
MessageBytes = Encoding.UTF8.GetBytes("One or more of your plugins needs to be updated. Please use the /xlplugins command in-game to update them!"),
Type = XivChatType.Urgent
});
}
} catch (Exception e) {
Log.Error(e, "Could not check for plugin updates.");
}
} }
#if !DEBUG && false #if !DEBUG && false