From d5b1da3d511ca87562228dec7f6e3e1c787877ab Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Wed, 1 Aug 2018 23:18:47 -0500 Subject: [PATCH] Began implementing support for modsaber.ml --- IllusionInjector/IllusionInjector.csproj | 5 +- .../Updating/ModsaberML/ApiEndpoint.cs | 52 +++++++++++++++++++ .../Updating/{ => Old}/ModUpdater.cs | 0 .../Updating/{ => Old}/UpdateScript.cs | 0 ...ionInjector.csproj.CoreCompileInputs.cache | 2 +- 5 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 IllusionInjector/Updating/ModsaberML/ApiEndpoint.cs rename IllusionInjector/Updating/{ => Old}/ModUpdater.cs (100%) rename IllusionInjector/Updating/{ => Old}/UpdateScript.cs (100%) diff --git a/IllusionInjector/IllusionInjector.csproj b/IllusionInjector/IllusionInjector.csproj index 460cdc30..8e29ff76 100644 --- a/IllusionInjector/IllusionInjector.csproj +++ b/IllusionInjector/IllusionInjector.csproj @@ -68,8 +68,9 @@ - - + + + diff --git a/IllusionInjector/Updating/ModsaberML/ApiEndpoint.cs b/IllusionInjector/Updating/ModsaberML/ApiEndpoint.cs new file mode 100644 index 00000000..d5b312ec --- /dev/null +++ b/IllusionInjector/Updating/ModsaberML/ApiEndpoint.cs @@ -0,0 +1,52 @@ +using SimpleJSON; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IllusionInjector.Updating.ModsaberML +{ + class ApiEndpoint + { + const string ApiBase = "https://www.modsaber.ml/api/"; + const string GetApprovedEndpoint = "public/temp/approved"; + + public class Mod + { + public string Name; + public Version Version; + public bool Approved; + public string Title; + public Version GameVersion; + public string Author; + public string SteamFile; + public string OculusFile; + + public static Mod DecodeJSON(JSONObject obj) + { + var outp = new Mod + { + Name = obj["name"], + Version = new Version(obj["version"]), + Approved = obj["approved"].AsBool, + Title = obj["title"], + GameVersion = new Version(obj["gameVersion"]), + Author = obj["author"] + }; + + foreach (var item in obj["files"].Keys) + { + var key = item as JSONString; + if (key.Value == "steam") + outp.SteamFile = obj[key.Value]["url"]; + if (key.Value == "oculus") + outp.OculusFile = obj[key.Value]["url"]; + } + + return outp; + } + } + + } +} diff --git a/IllusionInjector/Updating/ModUpdater.cs b/IllusionInjector/Updating/Old/ModUpdater.cs similarity index 100% rename from IllusionInjector/Updating/ModUpdater.cs rename to IllusionInjector/Updating/Old/ModUpdater.cs diff --git a/IllusionInjector/Updating/UpdateScript.cs b/IllusionInjector/Updating/Old/UpdateScript.cs similarity index 100% rename from IllusionInjector/Updating/UpdateScript.cs rename to IllusionInjector/Updating/Old/UpdateScript.cs diff --git a/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache b/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache index d1bbfadb..278fe638 100644 --- a/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache +++ b/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -c45de925bb8a7971d5428fabdc9f32b04b599913 +1b7ab3d058c6a212976e4869e8586d3cc95bb707