Skip to content

Commit 12af868

Browse files
committed
Future proof hash checking
1 parent 7cd5d7a commit 12af868

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Source/Plugin.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,28 @@ private bool VerifyGameVersion()
211211
{
212212
var contents = new WebClient().DownloadString(HASHES_OVERRIDE_URL);
213213
var hashes = Utils.ParseConfig(contents);
214+
215+
var found = false;
214216

215-
if (!hashes.Contains(hash))
217+
foreach (var versionedHash in hashes)
218+
{
219+
try
220+
{
221+
var (versions, remoteHash) = versionedHash.Split(':') switch { var x => (x[0].Split(','), x[1]) };
222+
223+
if (remoteHash != hash || !versions.Contains(PLUGIN_VERSION))
224+
continue;
225+
226+
found = true;
227+
break;
228+
}
229+
catch
230+
{
231+
// Broken line, ignore
232+
}
233+
}
234+
235+
if (!found)
216236
return false;
217237

218238
Logger.LogInfo("Game version verified using remote hashes");

0 commit comments

Comments
 (0)