Skip to content

Commit dcbb9e5

Browse files
committed
Fix version check error
1 parent d6a6c2b commit dcbb9e5

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

‎Torch.Server/Initializer.cs‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,35 +92,38 @@ public bool Initialize(string[] args)
9292
}
9393

9494

95+
// Define the required version once
96+
var requiredVersion = new Version(9, 86, 62, 31);
97+
9598
// Steam Client 64-bit DLL
9699
var clientSource64 = Path.Combine(basePath, "DedicatedServer64", "steamclient64.dll");
97100
var clientTarget64 = Path.Combine(basePath, "steamclient64.dll");
98-
CopyAndVerifyDll(clientSource64, clientTarget64, new Version("9.86.62.31"));
99-
101+
CopyAndVerifyDll(clientSource64, clientTarget64, requiredVersion);
102+
100103
// Steam Client 32-bit DLL
101104
var clientSource = Path.Combine(basePath, "DedicatedServer64", "steamclient.dll");
102105
var clientTarget = Path.Combine(basePath, "steamclient.dll");
103-
CopyAndVerifyDll(clientSource, clientTarget, new Version("9.86.62.31"));
104-
106+
CopyAndVerifyDll(clientSource, clientTarget, requiredVersion);
107+
105108
// tier0 64-bit DLL
106109
var tier0Source64 = Path.Combine(basePath, "DedicatedServer64", "tier0_s64.dll");
107110
var tier0Target64 = Path.Combine(basePath, "tier0_s64.dll");
108-
CopyAndVerifyDll(tier0Source64, tier0Target64, new Version("9.86.62.31"));
109-
111+
CopyAndVerifyDll(tier0Source64, tier0Target64, requiredVersion);
112+
110113
// tier0 32-bit DLL
111114
var tier0Source = Path.Combine(basePath, "DedicatedServer64", "tier0_s.dll");
112115
var tier0Target = Path.Combine(basePath, "tier0_s.dll");
113-
CopyAndVerifyDll(tier0Source, tier0Target, new Version("9.86.62.31"));
114-
116+
CopyAndVerifyDll(tier0Source, tier0Target, requiredVersion);
117+
115118
// vstdlib 64-bit DLL
116119
var vstdlibSource64 = Path.Combine(basePath, "DedicatedServer64", "vstdlib_s64.dll");
117120
var vstdlibTarget64 = Path.Combine(basePath, "vstdlib_s64.dll");
118-
CopyAndVerifyDll(vstdlibSource64, vstdlibTarget64, new Version("9.86.62.31"));
119-
121+
CopyAndVerifyDll(vstdlibSource64, vstdlibTarget64, requiredVersion);
122+
120123
// vstdlib 32-bit DLL
121124
var vstdlibSource = Path.Combine(basePath, "DedicatedServer64", "vstdlib_s.dll");
122125
var vstdlibTarget = Path.Combine(basePath, "vstdlib_s.dll");
123-
CopyAndVerifyDll(vstdlibSource, vstdlibTarget, new Version("9.86.62.31"));
126+
CopyAndVerifyDll(vstdlibSource, vstdlibTarget, requiredVersion);
124127

125128

126129
var havokSource = Path.Combine(basePath, "DedicatedServer64", "Havok.dll");
@@ -277,9 +280,9 @@ private void CopyAndVerifyDll(string sourcePath, string targetPath, Version requ
277280
if (requiredVersion != null)
278281
{
279282
var targetVersion = FileVersionInfo.GetVersionInfo(targetPath);
280-
var currentVersion = new Version(targetVersion.FileVersion);
283+
var currentVersion = targetVersion.FileVersion;
281284

282-
if (currentVersion != requiredVersion)
285+
if (currentVersion != requiredVersion.ToString())
283286
{
284287
File.Delete(targetPath);
285288
File.Copy(sourcePath, targetPath);

0 commit comments

Comments
 (0)