diff options
author | emkael <emkael@tlen.pl> | 2017-08-22 21:43:08 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-08-22 21:45:18 +0200 |
commit | cda00c4a001a736524812fa9a62844a2da715651 (patch) | |
tree | f20d11e536ae2554c736482b9f47feacbdd4deb3 | |
parent | 1bb11519992d69339943cb20b50fcb7a84769fa7 (diff) |
Automatic version number and build date loading
-rw-r--r-- | Aktywator/Aktywator.csproj | 6 | ||||
-rw-r--r-- | Aktywator/MainForm.cs | 5 | ||||
-rw-r--r-- | Aktywator/Properties/Resources.Designer.cs | 54 | ||||
-rw-r--r-- | Aktywator/Properties/Resources.resx | 13 | ||||
-rw-r--r-- | Aktywator/Resources/BuildDate.txt | 1 |
5 files changed, 48 insertions, 31 deletions
diff --git a/Aktywator/Aktywator.csproj b/Aktywator/Aktywator.csproj index a4dc515..f7a2fa6 100644 --- a/Aktywator/Aktywator.csproj +++ b/Aktywator/Aktywator.csproj @@ -129,6 +129,7 @@ <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DependentUpon>Resources.resx</DependentUpon> + <DesignTime>True</DesignTime> </Compile> <None Include="app.config" /> <None Include="Properties\Settings.settings"> @@ -143,6 +144,7 @@ </ItemGroup> <ItemGroup> <Content Include="aktywator.ico" /> + <None Include="Resources\BuildDate.txt" /> </ItemGroup> <ItemGroup> <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> @@ -162,6 +164,10 @@ </BootstrapperPackage> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PreBuildEvent>echo %25date%25 > "$(ProjectDir)\Resources\BuildDate.txt" +</PreBuildEvent> + </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/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 25268b6..5b3539e 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -7,13 +7,14 @@ using System.Text; using System.Windows.Forms; using System.Data.OleDb; using Microsoft.Win32; +using System.Reflection; namespace Aktywator { public partial class MainForm : Form { - public string version = "1.1.0-beta"; - public string date = "30.07.2017"; + public string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + public string date = Properties.Resources.BuildDate.Trim(); private Bws bws; private List<Setting> bwsSettings; diff --git a/Aktywator/Properties/Resources.Designer.cs b/Aktywator/Properties/Resources.Designer.cs index 927703d..afcf17c 100644 --- a/Aktywator/Properties/Resources.Designer.cs +++ b/Aktywator/Properties/Resources.Designer.cs @@ -1,17 +1,17 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:4.0.30319.1 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ -namespace Aktywator.Properties -{ - - +namespace Aktywator.Properties { + using System; + + /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> @@ -22,50 +22,52 @@ namespace Aktywator.Properties [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Aktywator.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } + + /// <summary> + /// Looks up a localized string similar to 2017-08-22 + ///. + /// </summary> + internal static string BuildDate { + get { + return ResourceManager.GetString("BuildDate", resourceCulture); + } + } } } diff --git a/Aktywator/Properties/Resources.resx b/Aktywator/Properties/Resources.resx index af7dbeb..0470204 100644 --- a/Aktywator/Properties/Resources.resx +++ b/Aktywator/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> @@ -68,9 +69,10 @@ <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> @@ -85,9 +87,10 @@ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> @@ -114,4 +117,8 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="BuildDate" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\BuildDate.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;windows-1250</value> + </data> </root>
\ No newline at end of file diff --git a/Aktywator/Resources/BuildDate.txt b/Aktywator/Resources/BuildDate.txt new file mode 100644 index 0000000..2c6557e --- /dev/null +++ b/Aktywator/Resources/BuildDate.txt @@ -0,0 +1 @@ +2017-08-22 |