From 04f779286cfd074d91008b6568236fc0e841f019 Mon Sep 17 00:00:00 2001 From: Husky Date: Mon, 3 Jun 2019 21:12:30 +0200 Subject: [PATCH] git hash wird angezeigt --- .gitignore | 1 + SanSystem/Global.cs | 27 +++++++++++++++++++++++++++ SanSystem/SanSystem.csproj | 10 +++++++--- SanSystem/frmMain.cs | 3 +++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1ed1994..72c6d5a 100644 --- a/.gitignore +++ b/.gitignore @@ -260,3 +260,4 @@ paket-files/ __pycache__/ *.pyc /projekte/* +/SanSystem/version.txt diff --git a/SanSystem/Global.cs b/SanSystem/Global.cs index ca0de99..2793a1e 100644 --- a/SanSystem/Global.cs +++ b/SanSystem/Global.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; @@ -18,8 +19,17 @@ namespace SanSystem const string firmkey = "Cosysda"; const string subkey = "SanManager"; const string speicherpfad_to_projekts = "projekte"; + private readonly string programmversion = string.Empty; string projektpfad = "18-850"; + + public string PROGRAMMVERSION + { + get + { + return programmversion; + } + } public string ProjektNummer { @@ -103,6 +113,23 @@ namespace SanSystem public Global() { LadeRegistry(); + programmversion = ReadProgrammVersion(); + } + + private string ReadProgrammVersion() + { + // Nachfolgend zeigt alle resources an + //string[] resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames(); + string version = string.Empty; + using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SanSystem." + "version.txt")) + { + using (StreamReader reader = new StreamReader(stream)) + { + version = reader.ReadToEnd(); + } + } + + return version; } ~Global() diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj index befba3e..f33ad69 100644 --- a/SanSystem/SanSystem.csproj +++ b/SanSystem/SanSystem.csproj @@ -322,13 +322,17 @@ TempCAN + + + Always + + - - + git rev-parse HEAD > "$(ProjectDir)\version.txt" - + \ No newline at end of file diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs index 5bd5fcc..86bd340 100644 --- a/SanSystem/frmMain.cs +++ b/SanSystem/frmMain.cs @@ -55,11 +55,14 @@ namespace SanSystem öffnenToolStripMenuItem.Text = Global.Instance.language.Labels["mainmenu_projekt_open"]; toolStripStatus_projekt_Label.Text = Datenbank.Instance.projekt; + this.Text += " " + Global.Instance.PROGRAMMVERSION; #if (DEBUG || LAPTOP) this.Text += " INTERNE DEBUG VERSION"; #endif if (Wupi.QueryInfo(0, QueryInfoOption.FirmCode) == 0) this.Text += " nicht geschützter Version nur für TESTZWECKE!"; + + }