TorchVersion is read-only

This commit is contained in:
Westin Miller
2017-08-30 22:35:50 -07:00
parent 67dba9c820
commit efe7236d31

View File

@@ -53,7 +53,13 @@ namespace Torch
/// <inheritdoc /> /// <inheritdoc />
public ITorchConfig Config { get; protected set; } public ITorchConfig Config { get; protected set; }
/// <inheritdoc /> /// <inheritdoc />
public Version TorchVersion { get; protected set; } public Version TorchVersion { get; }
/// <summary>
/// The version of Torch used, with extra data.
/// </summary>
public string TorchVersionVerbose { get; }
/// <inheritdoc /> /// <inheritdoc />
public Version GameVersion { get; private set; } public Version GameVersion { get; private set; }
/// <inheritdoc /> /// <inheritdoc />
@@ -108,6 +114,7 @@ namespace Torch
Instance = this; Instance = this;
TorchVersion = Assembly.GetExecutingAssembly().GetName().Version; TorchVersion = Assembly.GetExecutingAssembly().GetName().Version;
TorchVersionVerbose = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? TorchVersion.ToString();
RunArgs = new string[0]; RunArgs = new string[0];
Managers = new DependencyManager(); Managers = new DependencyManager();
@@ -245,11 +252,9 @@ namespace Torch
SpaceEngineersGame.SetupBasicGameInfo(); SpaceEngineersGame.SetupBasicGameInfo();
SpaceEngineersGame.SetupPerGameSettings(); SpaceEngineersGame.SetupPerGameSettings();
TorchVersion = Assembly.GetEntryAssembly().GetName().Version; Debug.Assert(MyPerGameSettings.BasicGameInfo.GameVersion != null, "MyPerGameSettings.BasicGameInfo.GameVersion != null");
string verboseVersion = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? TorchVersion.ToString();
GameVersion = new Version(new MyVersion(MyPerGameSettings.BasicGameInfo.GameVersion.Value).FormattedText.ToString().Replace("_", ".")); GameVersion = new Version(new MyVersion(MyPerGameSettings.BasicGameInfo.GameVersion.Value).FormattedText.ToString().Replace("_", "."));
var verInfo = $"{Config.InstanceName} - Torch {TorchVersion}, SE {GameVersion}"; try { Console.Title = $"{Config.InstanceName} - Torch {TorchVersion}, SE {GameVersion}"; }
try { Console.Title = verInfo; }
catch catch
{ {
///Running as service ///Running as service
@@ -260,7 +265,8 @@ namespace Torch
#else #else
Log.Info("RELEASE"); Log.Info("RELEASE");
#endif #endif
Log.Info(verInfo); Log.Info($"Torch Version: {TorchVersionVerbose}");
Log.Info($"Game Version: {GameVersion}");
Log.Info($"Executing assembly: {Assembly.GetEntryAssembly().FullName}"); Log.Info($"Executing assembly: {Assembly.GetEntryAssembly().FullName}");
Log.Info($"Executing directory: {AppDomain.CurrentDomain.BaseDirectory}"); Log.Info($"Executing directory: {AppDomain.CurrentDomain.BaseDirectory}");
@@ -349,7 +355,7 @@ namespace Torch
/// <inheritdoc /> /// <inheritdoc />
public virtual void Update() public virtual void Update()
{ {
Plugins.UpdatePlugins(); GetManager<IPluginManager>().UpdatePlugins();
} }
} }
} }