From 82dcbd7d36330919db9e22a65ad8638871e28fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Fri, 16 Dec 2022 10:05:35 +0100 Subject: [PATCH] Improve reported versions --- CommonHelpers/Instance.cs | 14 +++++++++----- Updater/Program.cs | 7 +++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CommonHelpers/Instance.cs b/CommonHelpers/Instance.cs index 700601e..e792040 100644 --- a/CommonHelpers/Instance.cs +++ b/CommonHelpers/Instance.cs @@ -220,16 +220,20 @@ namespace CommonHelpers } } - public static Version? ApplicationVersion - { - get => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; - } - public static String ProductVersion { get => Application.ProductVersion; } + public static String ProductVersionWithSha + { + get + { + var releaseVersion = typeof(Instance).Assembly.GetCustomAttributes().FirstOrDefault(); + return releaseVersion?.InformationalVersion ?? ProductVersion; + } + } + private static System.Timers.Timer? updateTimer; public static void RunUpdater(string Title, bool user = false, int recheckIntervalHours = 24) diff --git a/Updater/Program.cs b/Updater/Program.cs index 72a5d72..fdb1888 100644 --- a/Updater/Program.cs +++ b/Updater/Program.cs @@ -66,7 +66,10 @@ namespace Updater AutoUpdater.RemindLaterTimeSpan = RemindLaterFormat.Days; AutoUpdater.LetUserSelectRemindLater = true; AutoUpdater.ShowRemindLaterButton = true; - AutoUpdater.HttpUserAgent = String.Format("AutoUpdater/{0}/{1}", Instance.MachineID, Instance.ProductVersion); + AutoUpdater.HttpUserAgent = String.Format("AutoUpdater/{0}/{1}/{2}", + Instance.MachineID, + Instance.ProductVersionWithSha, + Instance.IsProductionBuild ? "prod" : "dev"); AutoUpdater.PersistenceProvider = persistence; AutoUpdater.ReportErrors = userCheck || cmdLine; AutoUpdater.UpdateFormSize = new Size(800, 300); @@ -89,7 +92,7 @@ namespace Updater "https://steam-deck-tools.ayufan.dev/docs/updates/{0}_{1}.xml?version={2}&machineID={3}&env={4}", Instance.IsDEBUG ? "debug" : "release", IsUsingInstaller ? "setup" : "zip", - HttpUtility.UrlEncode(Instance.ProductVersion), + HttpUtility.UrlEncode(Instance.ProductVersionWithSha), HttpUtility.UrlEncode(Instance.MachineID), Instance.IsProductionBuild ? "prod" : "dev" );