From e4ef151b9d8b8843c5a5f428a41ab59cb6543989 Mon Sep 17 00:00:00 2001 From: Emilian Roman Date: Sat, 13 Jul 2019 11:20:50 +0800 Subject: [PATCH] Revert "Deprecate old version identification method" This reverts commit d7fddcaf --- src/AmaiSosu.GUI/AmaiSosu.GUI.csproj | 6 ++++++ src/AmaiSosu.GUI/Main.cs | 13 ++++++++++++- src/AmaiSosu/AmaiSosu.csproj | 3 +++ src/AmaiSosu/Resources/Version.txt | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/AmaiSosu/Resources/Version.txt diff --git a/src/AmaiSosu.GUI/AmaiSosu.GUI.csproj b/src/AmaiSosu.GUI/AmaiSosu.GUI.csproj index 9a903a5..047e873 100644 --- a/src/AmaiSosu.GUI/AmaiSosu.GUI.csproj +++ b/src/AmaiSosu.GUI/AmaiSosu.GUI.csproj @@ -130,8 +130,14 @@ ResXFileCodeGenerator Messages.Designer.cs + + Always + + + git describe --tags > "$(ProjectDir)\Resources\Version.txt" + diff --git a/src/AmaiSosu.GUI/Main.cs b/src/AmaiSosu.GUI/Main.cs index aac8c98..fe4da9f 100644 --- a/src/AmaiSosu.GUI/Main.cs +++ b/src/AmaiSosu.GUI/Main.cs @@ -52,7 +52,18 @@ public sealed class Main : INotifyPropertyChanged /// /// Git version. /// - public string Version => "build-0000"; + public string Version + { + get + { + using (var stream = Assembly.GetExecutingAssembly() + .GetManifestResourceStream(FileNames.AmaiSosuVersion)) + using (var reader = new StreamReader(stream ?? throw new FileNotFoundException())) + { + return reader.ReadToEnd().Trim(); + } + } + } /// /// Installation path. diff --git a/src/AmaiSosu/AmaiSosu.csproj b/src/AmaiSosu/AmaiSosu.csproj index d43713c..ef4cb1d 100644 --- a/src/AmaiSosu/AmaiSosu.csproj +++ b/src/AmaiSosu/AmaiSosu.csproj @@ -74,6 +74,9 @@ ResXFileCodeGenerator FileNames.Designer.cs + + Always +