From 181490fa87bdd85a1ead380e785f216d36bf446d Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 23:18:47 +0200 Subject: [PATCH] Use assembly version for displayed stuff. This is better, as the version is displayed in the file properties dialog --- Vocaluxe/Base/CFont.cs | 2 +- Vocaluxe/Base/CSettings.cs | 63 +++++++++++++++++------------ Vocaluxe/Properties/AssemblyInfo.cs | 4 +- 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index f7b45b25..2495eb4f 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -47,7 +47,7 @@ namespace Vocaluxe.Base _Sizeh = maxHigh; float outline = CFonts.Outline; - TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; + const TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; float factor = _GetFactor(chr, flags); CFonts.Height = Sizeh * factor; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index cfb7c39f..9ac6659c 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using VocaluxeLib.Menu; namespace Vocaluxe.Base @@ -37,44 +38,41 @@ namespace Vocaluxe.Base static class CSettings { #if ARCH_X86 - public const String Arch = "x86"; + private const String _Arch = "x86"; #endif #if ARCH_X64 - public const String Arch = "x64"; + private const String _Arch = "x64"; #endif public static EGameState GameState = EGameState.Start; - public const string ProgramName = "Vocaluxe"; - public const string ProgramCodeName = "Shining Heaven"; - public const int VersionMajor = 0; - public const int VersionMinor = 3; // milestones - public const int VersionSub = 0; // patches + //Adjusting of programName and version now in the assembly config. + //I'd use the major and minor for Main releases, build number for every public release and revision for every bugfix version without any features + //As it is different than before, this is open for discussion. + //TODO: Remove this when this is decided + private const string _ProgramCodeName = "Shining Heaven"; + public const ERevision VersionRevision = ERevision.Alpha; - public const int Build = 78; // Increase on every published version! Never Reset! - public const int DatabaseHighscoreVersion = 2; public const int DatabaseCoverVersion = 1; public const int DatabaseCreditsRessourcesVersion = 1; - public static int RenderW = 1280; - public static int RenderH = 720; + public const int RenderW = 1280; + public const int RenderH = 720; public const int ZNear = -100; public const int ZFar = 100; public static bool IsFullScreen; - public static int VertexBufferElements = 10000; + public const int VertexBufferElements = 10000; public const string Icon = "Vocaluxe.ico"; public const string Logo = "Logo.png"; public const string FallbackLanguage = "English"; - public const string BassRegistration = "Registration.xml"; public static string FileConfig = "Config.xml"; - public const string FileCover = "Cover.xml"; public const string FileFonts = "Fonts.xml"; public const string FileOldHighscoreDB = "Ultrastar.db"; @@ -91,7 +89,6 @@ namespace Vocaluxe.Base public const string FolderGraphics = "Graphics"; public const string FolderFonts = "Fonts"; public const string FolderThemes = "Themes"; - public const string FolderSkins = "Skins"; public const string FolderThemeFonts = "Fonts"; public const string FolderScreens = "Screens"; public static string FolderProfiles = "Profiles"; @@ -130,11 +127,11 @@ namespace Vocaluxe.Base public const int MedleyMinSeriesLength = 3; public const float MedleyMinDuration = 40f; - public static bool TabNavigation = false; + public const bool TabNavigation = false; public const float BackgroundMusicFadeTime = 0.5f; - public static List MusicFileTypes = new List + public static readonly List MusicFileTypes = new List { "*.mp3", "*.wma", @@ -142,16 +139,32 @@ namespace Vocaluxe.Base "*.wav" }; - public static string GetVersionText() + private static AssemblyName _Assembly { - string version = "v" + VersionMajor + "." + - VersionMinor + "." + - VersionSub + " (" + Arch + ")"; + get { return Assembly.GetExecutingAssembly().GetName(); } + } + + public static string ProgramName + { + get { return _Assembly.Name; } + } + private static string _Version + { + get + { + Version v = _Assembly.Version; + return "v" + v.Major + "." + v.Minor + "." + v.Build; + } + } + + private static string _GetVersionText() + { + string version = _Version + " (" + _Arch + ")"; // ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) // ReSharper restore ConditionIsAlwaysTrueOrFalse - version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", Build); + version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", _Assembly.Version.Revision); return version; } @@ -161,11 +174,11 @@ namespace Vocaluxe.Base string version = ProgramName; // ReSharper disable ConditionIsAlwaysTrueOrFalse - if (ProgramCodeName != "") + if (_ProgramCodeName != "") // ReSharper restore ConditionIsAlwaysTrueOrFalse - version += " \"" + ProgramCodeName + "\""; + version += " \"" + _ProgramCodeName + "\""; - return version + " " + GetVersionText(); + return version + " " + _GetVersionText(); } private static string _GetVersionStatus() diff --git a/Vocaluxe/Properties/AssemblyInfo.cs b/Vocaluxe/Properties/AssemblyInfo.cs index f51f6afd..7f74a4d8 100644 --- a/Vocaluxe/Properties/AssemblyInfo.cs +++ b/Vocaluxe/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ using System.Runtime.InteropServices; // Revision // -[assembly: AssemblyVersion("0.3.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("0.3.0.78")] +[assembly: AssemblyFileVersion("0.3.0.78")] \ No newline at end of file