[chronojump] Use assembly attributes and reflection to get the version number and more info if needed
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [chronojump] Use assembly attributes and reflection to get the version number and more info if needed
- Date: Wed, 12 Aug 2009 14:59:44 +0000 (UTC)
commit cc9a7f6f1a049912bf1b5fc0b76c86bd7a8d87e2
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Aug 12 16:58:43 2009 +0200
Use assembly attributes and reflection to get the version number and more info if needed
src/AssemblyInfo.cs | 32 ++++++++++++++++++++++++++++++++
src/Makefile.am | 1 +
src/chronojump.cs | 17 ++++-------------
3 files changed, 37 insertions(+), 13 deletions(-)
---
diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs
new file mode 100755
index 0000000..fa357a4
--- /dev/null
+++ b/src/AssemblyInfo.cs
@@ -0,0 +1,32 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("ChronoJump")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Xavier De Blas")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("0.8.9.4")]
+
+// The following attributes specify the key for the sign of your assembly. See the
+// .NET Framework documentation for more information about signing.
+// This is not required, if you don't want signing let these attributes like they're.
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
diff --git a/src/Makefile.am b/src/Makefile.am
index 065b9ed..4e22e2e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -145,6 +145,7 @@ FILES = \
execute/reactionTime.cs\
execute/multiChronopic.cs\
../chronojump_server/ChronojumpServer.cs\
+ AssemblyInfo.cs\
chronojump.cs\
person.cs\
event.cs\
diff --git a/src/chronojump.cs b/src/chronojump.cs
index e32f8e7..fdaef38 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -24,7 +24,8 @@ using Gtk;
using Glade;
using Mono.Unix;
using System.IO; //"File" things
-using System.Threading;
+using System.Threading;
+using System.Reflection; // Read Version
using System.Diagnostics; //Process
using System.Collections; //ArrayList
@@ -585,18 +586,8 @@ Console.WriteLine("--6--");
}
private static string readVersion() {
- string version = "";
- try {
- StreamReader reader = File.OpenText(Constants.FileNameVersion);
- version = reader.ReadToEnd();
- reader.Close();
-
- //delete the '\n' that ReaderToEnd() has put
- version = version.TrimEnd(new char[1] {'\n'});
- } catch {
- version = "not available";
- }
- return version;
+ Version version = Assembly.GetExecutingAssembly().GetName().Version;
+ return String.Format("{0}.{1}.{2}.{3}",version.Major,version.Minor,version.Build,version.Revision);
}
private bool checkIfChronojumpExitAbnormally() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]