Skip to content

Commit 39d76bc

Browse files
committed
ModuleScript: Don't log if library's version is higher than latest
1 parent 921e047 commit 39d76bc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Source/MonoBehaviours/ModuleScript.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ private void CheckForTime(in KMBombInfo bombInfo)
424424

425425
private void LogMultiple(in string[] logs) => logs.ForEach(s => Log(s));
426426

427+
private static short VersionToNumber(string s) => short.Parse(s.Replace(".", "").PadRight(4, '0'));
428+
427429
private IEnumerator EditorCheckLatest()
428430
{
429431
if (!IsEditor)
@@ -439,8 +441,8 @@ private IEnumerator EditorCheckLatest()
439441
yield break;
440442
}
441443

442-
if (req.downloadHandler.text.Trim() != PathManager.GetVersionLibrary().ProductVersion)
443-
Log($"The library is out of date! Latest Version: {req.downloadHandler.text.Trim()}, Local Version: {PathManager.GetVersionLibrary().ProductVersion}. Please download the latest version here: https://github.com/Emik03/KeepCoding/releases", LogType.Error);
444+
if (VersionToNumber(PathManager.Version().ProductVersion) < VersionToNumber(req.downloadHandler.text.Trim()))
445+
Log($"The library is out of date! Latest Version: {req.downloadHandler.text.Trim()}, Local Version: {PathManager.Version().ProductVersion}. Please download the latest version here: https://github.com/Emik03/KeepCoding/releases", LogType.Error);
444446
}
445447

446448
private IEnumerator BombTime(KMBombInfo bombInfo)

0 commit comments

Comments
 (0)