Skip to content

Commit f43e165

Browse files
Merge pull request #47 from nullinside-development-group/fix/update
chore: centralize version number
2 parents f0fce54 + 3130960 commit f43e165

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/TwitchStreamingTools/Constants.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Reflection;
23

34
using Avalonia.Input.Platform;
45

@@ -40,6 +41,11 @@ public static class Constants {
4041
/// </summary>
4142
public const string TWITCH_CLIENT_REDIRECT = $"{API_SITE_DOMAIN}/api/v1/user/twitch-login/twitch-streaming-tools";
4243

44+
/// <summary>
45+
/// The version of the application being run right now.
46+
/// </summary>
47+
public static readonly string? APP_VERSION = Assembly.GetEntryAssembly()?.GetName().Version?.ToString()[..^2];
48+
4349
/// <summary>
4450
/// The reference to the clipboard API.
4551
/// </summary>

src/TwitchStreamingTools/ViewModels/Pages/AccountViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public string? TwitchUsername {
8383
/// <summary>
8484
/// The application version number.
8585
/// </summary>
86-
public string? Version => Assembly.GetEntryAssembly()?.GetName().Version?.ToString();
86+
public string? Version => Constants.APP_VERSION;
8787

8888
/// <inheritdoc />
8989
public void Dispose() {

src/TwitchStreamingTools/Views/MainWindow.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected override void OnInitialized() {
5757
Task.Factory.StartNew(async () => {
5858
GithubLatestReleaseJson? serverVersion =
5959
await GitHubUpdateManager.GetLatestVersion("nullinside-development-group", "twitch-streaming-tools");
60-
string? localVersion = Assembly.GetEntryAssembly()?.GetName().Version?.ToString();
60+
string? localVersion = Constants.APP_VERSION;
6161
if (null == serverVersion || string.IsNullOrWhiteSpace(serverVersion.name) ||
6262
string.IsNullOrWhiteSpace(localVersion)) {
6363
return;

0 commit comments

Comments
 (0)