improve update checker

This commit is contained in:
Evil Factory
2022-04-14 13:10:21 -03:00
parent 0ccac372a8
commit 3517b4c3ce
2 changed files with 7 additions and 5 deletions

View File

@@ -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)
{

View File

@@ -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
};