Use far simpler method for defining assembly version, that does not rely on reflection.

This commit is contained in:
UnknownShadow200 2017-05-10 12:33:11 +10:00
parent 912eda7025
commit 24a8cfcf0d
3 changed files with 8 additions and 51 deletions

View File

@ -15,11 +15,7 @@
or implied. See the Licenses for the specific language governing or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses. permissions and limitations under the Licenses.
*/ */
using System; using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading;
namespace MCGalaxy { namespace MCGalaxy {
/// <summary> This class provides for more advanced modification to MCGalaxy </summary> /// <summary> This class provides for more advanced modification to MCGalaxy </summary>

View File

@ -58,23 +58,11 @@ namespace MCGalaxy {
public static PlayerMetaList RankInfo = new PlayerMetaList("text/rankinfo.txt"); public static PlayerMetaList RankInfo = new PlayerMetaList("text/rankinfo.txt");
public static PlayerMetaList TempRanks = new PlayerMetaList("text/tempranks.txt"); public static PlayerMetaList TempRanks = new PlayerMetaList("text/tempranks.txt");
public static PlayerMetaList Notes = new PlayerMetaList("text/notes.txt"); public static PlayerMetaList Notes = new PlayerMetaList("text/notes.txt");
public static Version Version { get { return System.Reflection.Assembly.GetAssembly(typeof(Server)).GetName().Version; } }
static string versionString = null;
static object versionLock = new object();
// Cache getting the version /// <summary> *** DO NOT USE THIS! *** Use VersionString, as this field is a constant and is inlined if used. </summary>
public static string VersionString { public const string InternalVersion = "1.8.9.0";
get { public static Version Version { get { return new Version(InternalVersion); } }
lock (versionLock) { public static string VersionString { get { return InternalVersion; } }
if (versionString == null) {
Version v = Version;
versionString = v.Major + "." + v.Minor + "." + v.Build + "." + v.Revision;
}
return versionString;
}
}
}
public static string SoftwareName = "MCGalaxy"; public static string SoftwareName = "MCGalaxy";
public static string SoftwareNameVersioned { get { return SoftwareName + " " + VersionString; } } public static string SoftwareNameVersioned { get { return SoftwareName + " " + VersionString; } }

View File

@ -18,35 +18,8 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MCGalaxy")] [assembly: AssemblyTitle("MCGalaxy")]
[assembly: AssemblyDescription("Minecraft Classic Custom Server Software")] [assembly: AssemblyDescription("ClassiCube Server Software")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MCGalaxy")] [assembly: AssemblyProduct("MCGalaxy")]
[assembly: AssemblyCopyright("Copyright © 2015-2016")] [assembly: AssemblyCopyright("Copyright © 2015-2017")]
[assembly: AssemblyTrademark("Forging the Way")] [assembly: AssemblyVersion(MCGalaxy.Server.VersionInternal)]
//[assembly: AssemblyDevs("MCGalaxy Development Team")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("24d9085c-78ba-4f53-b69c-f2b52153683f")]
[assembly: AssemblyVersion("1.8.9.0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// This system is to be followed in every update for easy referencing at later dates.
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: