improve update checker
This commit is contained in:
@@ -15,11 +15,11 @@ namespace Barotrauma
|
|||||||
if (luaCsPackage == null) { return; }
|
if (luaCsPackage == null) { return; }
|
||||||
|
|
||||||
string clientVersion = File.ReadAllText(LuaSetup.VERSION_FILE);
|
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") });
|
new LocalizedString[2] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
|
||||||
|
|
||||||
msg.Buttons[0].OnClicked = (GUIButton button, object obj) =>
|
msg.Buttons[0].OnClicked = (GUIButton button, object obj) =>
|
||||||
@@ -39,7 +39,7 @@ namespace Barotrauma
|
|||||||
File.Copy(Path.Combine(luaCsPath, "Binary", file), file, true);
|
File.Copy(Path.Combine(luaCsPath, "Binary", file), file, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
File.WriteAllText(LuaSetup.VERSION_FILE, serverVersion);
|
File.WriteAllText(LuaSetup.VERSION_FILE, workshopVersion);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
IgnoreLayoutGroups = false
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user