diff --git a/Tranga/Server.cs b/Tranga/Server.cs index 95dad91..8ed2e2c 100644 --- a/Tranga/Server.cs +++ b/Tranga/Server.cs @@ -198,7 +198,7 @@ public class Server : GlobalBase SendResponse(HttpStatusCode.OK, response, _parent.jobBoss.jobs.Where(jjob => jjob is DownloadNewChapters).OrderBy(jjob => ((DownloadNewChapters)jjob).manga.sortName)); break; case "Settings": - SendResponse(HttpStatusCode.OK, response, TrangaSettings.Serialize()); + SendResponse(HttpStatusCode.OK, response, TrangaSettings.AsJObject()); break; case "Settings/userAgent": SendResponse(HttpStatusCode.OK, response, TrangaSettings.userAgent); diff --git a/Tranga/TrangaSettings.cs b/Tranga/TrangaSettings.cs index ec44ecc..b945fe5 100644 --- a/Tranga/TrangaSettings.cs +++ b/Tranga/TrangaSettings.cs @@ -151,7 +151,7 @@ public static class TrangaSettings File.WriteAllText(settingsFilePath, Serialize()); } - public static string Serialize() + public static JObject AsJObject() { JObject jobj = new JObject(); jobj.Add("downloadLocation", JToken.FromObject(TrangaSettings.downloadLocation)); @@ -161,9 +161,11 @@ public static class TrangaSettings jobj.Add("aprilFoolsMode", JToken.FromObject(TrangaSettings.aprilFoolsMode)); jobj.Add("version", JToken.FromObject(TrangaSettings.version)); jobj.Add("requestLimits", JToken.FromObject(TrangaSettings.requestLimits)); - return jobj.ToString(); + return jobj; } + public static string Serialize() => AsJObject().ToString(); + public static void Deserialize(string serialized) { JObject jobj = JObject.Parse(serialized);