From d7f3556e43321d0102ccf7343ed9c420558bc3db Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 2 Oct 2018 11:51:08 -0400 Subject: [PATCH] Cleanup ByondExecutableLock --- .../Components/Byond/ByondExecutableLock.cs | 19 ++++++++++++++++--- .../Components/Byond/ByondManager.cs | 7 +------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Byond/ByondExecutableLock.cs b/src/Tgstation.Server.Host/Components/Byond/ByondExecutableLock.cs index 3431ede531..3e33e03e0c 100644 --- a/src/Tgstation.Server.Host/Components/Byond/ByondExecutableLock.cs +++ b/src/Tgstation.Server.Host/Components/Byond/ByondExecutableLock.cs @@ -6,13 +6,26 @@ namespace Tgstation.Server.Host.Components.Byond sealed class ByondExecutableLock : IByondExecutableLock { /// - public Version Version { get; set; } + public Version Version { get; } /// - public string DreamDaemonPath { get; set; } + public string DreamDaemonPath { get; } /// - public string DreamMakerPath { get; set; } + public string DreamMakerPath { get; } + + /// + /// Construct a + /// + /// The value of + /// The value of + /// The value of + public ByondExecutableLock(Version version, string dreamDaemonPath, string dreamMakerPath) + { + Version = version ?? throw new ArgumentNullException(nameof(version)); + dreamDaemonPath = dreamDaemonPath ?? throw new ArgumentNullException(nameof(dreamDaemonPath)); + dreamMakerPath = dreamMakerPath ?? throw new ArgumentNullException(nameof(dreamMakerPath)); + } //at one point in design, byond versions were to delete themselves if they werent the active version //That changed at some point so these functions are intentioanlly left blank diff --git a/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs b/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs index e152c2ddca..8c597e7d23 100644 --- a/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs +++ b/src/Tgstation.Server.Host/Components/Byond/ByondManager.cs @@ -197,12 +197,7 @@ namespace Tgstation.Server.Host.Components.Byond var versionKey = VersionKey(versionToUse); - return new ByondExecutableLock - { - DreamDaemonPath = ioManager.ResolvePath(ioManager.ConcatPath(versionKey, BinPath, byondInstaller.DreamDaemonName)), - DreamMakerPath = ioManager.ResolvePath(ioManager.ConcatPath(versionKey, BinPath, byondInstaller.DreamMakerName)), - Version = versionToUse - }; + return new ByondExecutableLock(versionToUse, ioManager.ResolvePath(ioManager.ConcatPath(versionKey, BinPath, byondInstaller.DreamDaemonName)), ioManager.ResolvePath(ioManager.ConcatPath(versionKey, BinPath, byondInstaller.DreamMakerName))); } ///