From 9bea7e583716c410833cafa1c897ffc350dfd2f4 Mon Sep 17 00:00:00 2001 From: SealsRock12 Date: Sun, 18 Oct 2026 22:22:33 -0700 Subject: [PATCH 1/4] serialize settings --- client/Monolith.cs | 4 +++- client/Settings.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) 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..65aa6dd 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 { @@ -10,4 +12,18 @@ public static class Settings 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 */ + 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).GetProperties(flags)) + res[field.Name] = (bool)field.GetValue(null); + + return res; + } } \ No newline at end of file From 69055618b1b38d6bd4e2efed9eef2f6ad8a9b8c5 Mon Sep 17 00:00:00 2001 From: SealsRock12 Date: Sun, 18 Oct 2026 23:08:02 -0700 Subject: [PATCH 2/4] a field is not a property --- client/Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/Settings.cs b/client/Settings.cs index 65aa6dd..85af8f8 100644 --- a/client/Settings.cs +++ b/client/Settings.cs @@ -21,7 +21,7 @@ public static Dictionary Serialize() foreach (var property in typeof(Settings).GetProperties(flags)) res[property.Name] = (bool)property.GetValue(null); - foreach (var field in typeof(Settings).GetProperties(flags)) + foreach (var field in typeof(Settings).GetFields(flags)) res[field.Name] = (bool)field.GetValue(null); return res; From 624429849178331b902b91c05d43eaea91bde9ac Mon Sep 17 00:00:00 2001 From: SealsRock12 Date: Sun, 18 Oct 2026 23:17:07 -0700 Subject: [PATCH 3/4] remove unused LocalCulture setting https://discord.com/channels/749314018837135390/1071069637887918183/1175884736300859502 --- client/Settings.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/client/Settings.cs b/client/Settings.cs index 85af8f8..d8eb8da 100644 --- a/client/Settings.cs +++ b/client/Settings.cs @@ -10,7 +10,6 @@ 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 */ From 1bfdfb5cbca0c6eb5def7d6f23c4c940cbb128ea Mon Sep 17 00:00:00 2001 From: SealsRock12 Date: Sun, 18 Oct 2026 23:28:54 -0700 Subject: [PATCH 4/4] better comments --- client/Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/Settings.cs b/client/Settings.cs index d8eb8da..9dfaffa 100644 --- a/client/Settings.cs +++ b/client/Settings.cs @@ -12,7 +12,7 @@ public static class Settings public static bool Headless { get; set; } = false; public static bool EnableDebug = false; // Deliberately not a property. - /** We cannot directly serialize a static class */ + /** We cannot directly serialize a static class for the JSON, so we make it a dictionary */ public static Dictionary Serialize() { var res = new Dictionary();