Skip to content

Commit

Permalink
Removed SimpleJSON for NewtonSoft.JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
NuggoDEV committed Jan 20, 2024
1 parent 5b11a37 commit 50244b7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Counters+/Utils/VersionUtility.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Hive.Versioning;
using IPA.Loader;
using SimpleJSON;
using System.Collections;
using UnityEngine.Networking;
using Newtonsoft.Json;

namespace CountersPlus.Utils
{
Expand All @@ -17,7 +17,7 @@ public VersionUtility()
// I could grab this straight from PluginMetadata but this is for cleanness.
PluginVersion = PluginManager.GetPlugin("Counters+").HVersion;

Utils.SharedCoroutineStarter.instance.StartCoroutine(GetBeatModsVersion());
SharedCoroutineStarter.instance.StartCoroutine(GetBeatModsVersion());
}

private IEnumerator GetBeatModsVersion()
Expand All @@ -30,15 +30,22 @@ private IEnumerator GetBeatModsVersion()
Plugin.Logger.Error("Failed to download version info.");
yield break;
}
JSONNode node = JSON.Parse(www.downloadHandler.text);
foreach (JSONNode child in node)
BeatmodsResult[] results = JsonConvert.DeserializeObject<BeatmodsResult[]>(www.downloadHandler.text);
foreach (BeatmodsResult result in results)
{
if (child["status"] != "approved") continue;
BeatModsVersion = new Version(child["version"].Value);
if (result.status != "approved") continue;
BeatModsVersion = new Version(result.version);
break;
}
}
if (!HasLatestVersion) Plugin.Logger.Warn("Uh oh! We aren't up to date!");
}


}
class BeatmodsResult
{
[JsonProperty("status")] internal string status;
[JsonProperty("version")] internal string version;
}
}

0 comments on commit 50244b7

Please sign in to comment.