display the current version in the changelog window (#34556)
* just works first try * introduce more magic numbers into the codebase * idiot doesnt know the difference between AND/OR
This commit is contained in:
@@ -8,6 +8,8 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Shared;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
|
||||||
namespace Content.Client.Changelog
|
namespace Content.Client.Changelog
|
||||||
@@ -15,8 +17,9 @@ namespace Content.Client.Changelog
|
|||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class ChangelogWindow : FancyWindow
|
public sealed partial class ChangelogWindow : FancyWindow
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IClientAdminManager _adminManager = default!;
|
|
||||||
[Dependency] private readonly ChangelogManager _changelog = default!;
|
[Dependency] private readonly ChangelogManager _changelog = default!;
|
||||||
|
[Dependency] private readonly IClientAdminManager _adminManager = default!;
|
||||||
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
|
||||||
public ChangelogWindow()
|
public ChangelogWindow()
|
||||||
{
|
{
|
||||||
@@ -67,8 +70,22 @@ namespace Content.Client.Changelog
|
|||||||
Tabs.SetTabTitle(i++, Loc.GetString($"changelog-tab-title-{changelog.Name}"));
|
Tabs.SetTabTitle(i++, Loc.GetString($"changelog-tab-title-{changelog.Name}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var version = typeof(ChangelogWindow).Assembly.GetName().Version ?? new Version(1, 0);
|
// Try to get the current version from the build.json file
|
||||||
VersionLabel.Text = Loc.GetString("changelog-version-tag", ("version", version.ToString()));
|
var version = _cfg.GetCVar(CVars.BuildVersion);
|
||||||
|
var forkId = _cfg.GetCVar(CVars.BuildForkId);
|
||||||
|
|
||||||
|
var versionText = Loc.GetString("changelog-version-unknown");
|
||||||
|
|
||||||
|
// Make sure these aren't empty, like in a dev env
|
||||||
|
if (!string.IsNullOrEmpty(version) && !string.IsNullOrEmpty(forkId))
|
||||||
|
{
|
||||||
|
versionText = Loc.GetString("changelog-version-tag",
|
||||||
|
("fork", forkId),
|
||||||
|
("version", version[..7])); // Only show the first 7 characters
|
||||||
|
}
|
||||||
|
|
||||||
|
// if else statements are ugly, shut up
|
||||||
|
VersionLabel.Text = versionText;
|
||||||
|
|
||||||
TabsUpdated();
|
TabsUpdated();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ changelog-author-changed = [color=#EEE]{ $author }[/color] changed:
|
|||||||
changelog-today = Today
|
changelog-today = Today
|
||||||
changelog-yesterday = Yesterday
|
changelog-yesterday = Yesterday
|
||||||
changelog-new-changes = new changes
|
changelog-new-changes = new changes
|
||||||
changelog-version-tag = version v{ $version }
|
changelog-version-unknown = Unknown Version
|
||||||
|
changelog-version-tag = { $fork }/{ $version }
|
||||||
|
|
||||||
changelog-button = Changelog
|
changelog-button = Changelog
|
||||||
changelog-button-new-entries = Changelog (new!)
|
changelog-button-new-entries = Changelog (new!)
|
||||||
|
|||||||
Reference in New Issue
Block a user