From 3721f31f720a493b639cd9e5782a7b7d4c5c1544 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Tue, 6 Feb 2018 13:14:23 +0100 Subject: [PATCH] Add build-related resources to ATxTray. Refers to #2 --- ATXTray/Properties/Resources.resx | 6 ++++++ ATxTray/ATXTray.csproj | 8 ++++++++ ATxTray/AutoTxTray.cs | 6 +++++- ATxTray/Properties/Resources.Designer.cs | 20 ++++++++++++++++++++ ATxTray/Resources/.gitignore | 3 +++ 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 ATxTray/Resources/.gitignore diff --git a/ATXTray/Properties/Resources.resx b/ATXTray/Properties/Resources.resx index 2b26db5..719fb31 100644 --- a/ATXTray/Properties/Resources.resx +++ b/ATXTray/Properties/Resources.resx @@ -118,6 +118,12 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="BuildCommit" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\BuildCommit.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + </data> + <data name="BuildDate" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\BuildDate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value> + </data> <data name="IconDefault" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\IconDefault.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> diff --git a/ATxTray/ATXTray.csproj b/ATxTray/ATXTray.csproj index c73dad1..051f9e1 100644 --- a/ATxTray/ATXTray.csproj +++ b/ATxTray/ATXTray.csproj @@ -105,8 +105,16 @@ </ItemGroup> <ItemGroup> <Content Include="IconDefault.ico" /> + <None Include="Resources\BuildDate.txt" /> + <None Include="Resources\BuildCommit.txt" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PreBuildEvent>PowerShell -NoProfile -ExecutionPolicy RemoteSigned $(SolutionDir)\Scripts\Prepare-Build.ps1 $(ProjectDir)</PreBuildEvent> + </PropertyGroup> + <PropertyGroup> + <PostBuildEvent>PowerShell -Command "Write-Host $(ConfigurationName)" > $(ProjectDir)\Resources\BuildConfiguration.txt</PostBuildEvent> + </PropertyGroup> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> diff --git a/ATxTray/AutoTxTray.cs b/ATxTray/AutoTxTray.cs index 4a32a1a..c0029fa 100644 --- a/ATxTray/AutoTxTray.cs +++ b/ATxTray/AutoTxTray.cs @@ -70,11 +70,15 @@ namespace ATxTray var logRule = new LoggingRule("*", LogLevel.Debug, fileTarget); logConfig.LoggingRules.Add(logRule); LogManager.Configuration = logConfig; - + #endregion + Log.Info("-----------------------"); Log.Info("{0} initializing...", AppTitle); + Log.Info("build: [{0}]", Properties.Resources.BuildDate.Trim()); + Log.Info("commit: [{0}]", Properties.Resources.BuildCommit.Trim()); + Log.Info("-----------------------"); Log.Debug(" - config file: [{0}]", ConfigFile); Log.Debug(" - status file: [{0}]", StatusFile); diff --git a/ATxTray/Properties/Resources.Designer.cs b/ATxTray/Properties/Resources.Designer.cs index e8ee16c..cc28f91 100644 --- a/ATxTray/Properties/Resources.Designer.cs +++ b/ATxTray/Properties/Resources.Designer.cs @@ -60,6 +60,26 @@ namespace ATxTray.Properties { } } + /// <summary> + /// Looks up a localized string similar to autotransfer-v1-265-g1b03979-unclean + ///. + /// </summary> + internal static string BuildCommit { + get { + return ResourceManager.GetString("BuildCommit", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to 2018-02-06 11:38:53 + ///. + /// </summary> + internal static string BuildDate { + get { + return ResourceManager.GetString("BuildDate", resourceCulture); + } + } + /// <summary> /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// </summary> diff --git a/ATxTray/Resources/.gitignore b/ATxTray/Resources/.gitignore new file mode 100644 index 0000000..06696d3 --- /dev/null +++ b/ATxTray/Resources/.gitignore @@ -0,0 +1,3 @@ +BuildDate.txt +BuildConfiguration.txt +BuildCommit.txt \ No newline at end of file -- GitLab