Refactoring the umbraco version from GlobalSettings to be a seperate class that simply wraps the version from the assembly.

Since the version will come from the assembly there is no need to have it as part of the GlobalSetting, which is internal and needs a makeover of its own.
This commit is contained in:
Morten Christensen
2012-11-26 11:18:06 -01:00
parent 34ac97442d
commit 0ae707fe78
20 changed files with 91 additions and 60 deletions

View File

@@ -254,7 +254,7 @@ namespace Umbraco.Core.Configuration
try
{
string configStatus = ConfigurationStatus;
string currentVersion = Version.ToString(3);
string currentVersion = UmbracoVersion.Current.ToString(3);
if (currentVersion != configStatus)
@@ -406,28 +406,16 @@ namespace Umbraco.Core.Configuration
}
}
/// <summary>
/// Gets the current version of Umbraco.
/// Version class with the specified major, minor, build (Patch), and revision numbers.
/// </summary>
/// <remarks>
/// CURRENT UMBRACO VERSION ID.
/// </remarks>
public static Version Version
{
get { return _version ?? (_version = typeof (GlobalSettings).Assembly.GetName().Version); }
}
/// <summary>
/// Gets the current version.
/// </summary>
/// <value>The current version.</value>
[Obsolete("Use Umbraco.Core.Configuration.GlobalSettings.Version instead", false)]
[Obsolete("Use Umbraco.Core.Configuration.UmbracoVersion.Current instead", false)]
public static string CurrentVersion
{
get
{
return Version.ToString(3);
return UmbracoVersion.Current.ToString(3);
}
}
@@ -435,12 +423,12 @@ namespace Umbraco.Core.Configuration
/// Gets the major version number.
/// </summary>
/// <value>The major version number.</value>
[Obsolete("Use Umbraco.Core.Configuration.GlobalSettings.Version instead", false)]
[Obsolete("Use Umbraco.Core.Configuration.UmbracoVersion.Current instead", false)]
public static int VersionMajor
{
get
{
return Version.Major;
return UmbracoVersion.Current.Major;
}
}
@@ -448,12 +436,12 @@ namespace Umbraco.Core.Configuration
/// Gets the minor version number.
/// </summary>
/// <value>The minor version number.</value>
[Obsolete("Use Umbraco.Core.Configuration.GlobalSettings.Version instead", false)]
[Obsolete("Use Umbraco.Core.Configuration.UmbracoVersion.Current instead", false)]
public static int VersionMinor
{
get
{
return Version.Minor;
return UmbracoVersion.Current.Minor;
}
}
@@ -461,12 +449,12 @@ namespace Umbraco.Core.Configuration
/// Gets the patch version number.
/// </summary>
/// <value>The patch version number.</value>
[Obsolete("Use Umbraco.Core.Configuration.GlobalSettings.Version instead", false)]
[Obsolete("Use Umbraco.Core.Configuration.UmbracoVersion.Current instead", false)]
public static int VersionPatch
{
get
{
return Version.Build;
return UmbracoVersion.Current.Build;
}
}
@@ -474,12 +462,12 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
[Obsolete("Use Umbraco.Core.Configuration.GlobalSettings.Version instead", false)]
[Obsolete("Use Umbraco.Core.Configuration.UmbracoVersion.Current instead", false)]
public static string VersionComment
{
get
{
return "";
return Umbraco.Core.Configuration.UmbracoVersion.CurrentComment;
}
}

View File

@@ -0,0 +1,27 @@
using System;
namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static Version _version;
/// <summary>
/// Gets the current version of Umbraco.
/// Version class with the specified major, minor, build (Patch), and revision numbers.
/// </summary>
/// <remarks>
/// CURRENT UMBRACO VERSION ID.
/// </remarks>
public static Version Current
{
get { return _version ?? (_version = typeof(UmbracoVersion).Assembly.GetName().Version); }
}
/// <summary>
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
public static string CurrentComment { get { return ""; } }
}
}