diff --git a/client/Monolith.cs b/client/Monolith.cs index a76f1d9..6338a0f 100644 --- a/client/Monolith.cs +++ b/client/Monolith.cs @@ -46,7 +46,8 @@ public Monolith() Version = Program.SpecifyVersion; Meta = new MonolithMeta { - ElapsedTime = Program.Time.ElapsedMilliseconds + ElapsedTime = Program.Time.ElapsedMilliseconds, + Settings = Settings.Serialize() }; BasicInfo = new MonolithBasicInfo(); System = new MonolithSystem(); @@ -281,6 +282,7 @@ public struct MonolithMeta { public long ElapsedTime; public DateTime GenerationDate; + public Dictionary Settings; } [Serializable] diff --git a/client/Settings.cs b/client/Settings.cs index 5e38bbd..9dfaffa 100644 --- a/client/Settings.cs +++ b/client/Settings.cs @@ -1,4 +1,6 @@ namespace specify_client; +using System.Reflection; +using System.Collections.Generic; public static class Settings { @@ -8,6 +10,19 @@ public static class Settings public static bool RedactNetworking { get; set; } = false; public static bool DontUpload { get; set; } = false; public static bool Headless { get; set; } = false; - public static bool LocalCulture { get; set; } = false; public static bool EnableDebug = false; // Deliberately not a property. + + /** We cannot directly serialize a static class for the JSON, so we make it a dictionary */ + public static Dictionary Serialize() + { + var res = new Dictionary(); + BindingFlags flags = BindingFlags.Public | BindingFlags.Static; + + foreach (var property in typeof(Settings).GetProperties(flags)) + res[property.Name] = (bool)property.GetValue(null); + foreach (var field in typeof(Settings).GetFields(flags)) + res[field.Name] = (bool)field.GetValue(null); + + return res; + } } \ No newline at end of file