Upload files to "Classes/EzVersionChecking"
This commit is contained in:
1 parent
e01dbf7209
commit
07baed88f8
3 files changed
+235
No files matched your search
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using UnityEngine;
|
||||
using FortniteEmoteWheel.Classes.Admin;
|
||||
|
||||
// i got permission from ZlothY: https://git.hamburbur.org/ZlothY/ZlothYNametag/src/branch/main/EzVersionChecking
|
||||
namespace FortniteEmoteWheel.Classes.EzVersionChecking;
|
||||
|
||||
public static class VersionCheckingInitializer
|
||||
{
|
||||
public static Action VersionOutdatedDetected;
|
||||
|
||||
public static bool VersionOutdated;
|
||||
|
||||
public static string OutdatedMessage;
|
||||
|
||||
public static Version LatestVersion;
|
||||
|
||||
public static void StartVersionChecking()
|
||||
{
|
||||
JObject data = HamburburData.Data;
|
||||
|
||||
JToken modVersionInfo =
|
||||
((JArray)data["modVersionInfo"])!.FirstOrDefault(token => (string)token["modName"] ==
|
||||
Constants.Name);
|
||||
|
||||
if (modVersionInfo != null)
|
||||
{
|
||||
LatestVersion = new Version(((string)modVersionInfo["latestVersion"])!);
|
||||
|
||||
OutdatedMessage = (string)modVersionInfo["outdatedMessage"];
|
||||
|
||||
Version localVersion = new(Constants.Version);
|
||||
|
||||
if (localVersion < LatestVersion)
|
||||
VersionOutdated = true;
|
||||
}
|
||||
|
||||
if (VersionOutdated)
|
||||
return;
|
||||
|
||||
new GameObject($"{Constants.Name} Version Checking").AddComponent<ContinousVersionChecking>();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user