From 3517b4c3ce136d3e0e4bd10b651c843fc71b6780 Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Thu, 14 Apr 2022 13:10:21 -0300 Subject: [PATCH] improve update checker --- .../ClientSource/Lua/LuaCsUpdateChecker.cs | 8 ++++---- .../ClientSource/Screens/MainMenuScreen.cs | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/Lua/LuaCsUpdateChecker.cs b/Barotrauma/BarotraumaClient/ClientSource/Lua/LuaCsUpdateChecker.cs index 0fa185285..88caad34a 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Lua/LuaCsUpdateChecker.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Lua/LuaCsUpdateChecker.cs @@ -15,11 +15,11 @@ namespace Barotrauma if (luaCsPackage == null) { return; } string clientVersion = File.ReadAllText(LuaSetup.VERSION_FILE); - string serverVersion = luaCsPackage.ModVersion; + string workshopVersion = luaCsPackage.ModVersion; - if (clientVersion == serverVersion) { return; } + if (clientVersion == workshopVersion) { return; } - var msg = new GUIMessageBox("LuaCs Update", $"Your LuaCs client version is different from the version found in the LuaCsForBarotrauma workshop files. Do you want to update?\n\n Client Version: {clientVersion}\n Server Version: {serverVersion}", + var msg = new GUIMessageBox("LuaCs Update", $"Your LuaCs client version is different from the version found in the LuaCsForBarotrauma workshop files. Do you want to update?\n\n Client Version: {clientVersion}\n Workshop Version: {workshopVersion}", new LocalizedString[2] { TextManager.Get("Yes"), TextManager.Get("Cancel") }); msg.Buttons[0].OnClicked = (GUIButton button, object obj) => @@ -39,7 +39,7 @@ namespace Barotrauma File.Copy(Path.Combine(luaCsPath, "Binary", file), file, true); } - File.WriteAllText(LuaSetup.VERSION_FILE, serverVersion); + File.WriteAllText(LuaSetup.VERSION_FILE, workshopVersion); } catch (Exception e) { diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs index 6c91b5166..b6eee982d 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs @@ -442,7 +442,9 @@ namespace Barotrauma } }; - new GUITextBlock(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopLeft) { AbsoluteOffset = new Point(10, 10) }, "Using LuaForBarotrauma version " + AssemblyInfo.GitRevision, Color.Red) + string version = File.Exists(LuaSetup.VERSION_FILE) ? File.ReadAllText(LuaSetup.VERSION_FILE) : "Github"; + + new GUITextBlock(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopLeft) { AbsoluteOffset = new Point(10, 10) }, $"Using LuaCsForBarotrauma revision {AssemblyInfo.GitRevision} version {version}", Color.Red) { IgnoreLayoutGroups = false };