Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client/Monolith.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -281,6 +282,7 @@ public struct MonolithMeta
{
public long ElapsedTime;
public DateTime GenerationDate;
public Dictionary<string,bool> Settings;
}

[Serializable]
Expand Down
17 changes: 16 additions & 1 deletion client/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace specify_client;
using System.Reflection;
using System.Collections.Generic;

public static class Settings
{
Expand All @@ -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<string, bool> Serialize()
{
var res = new Dictionary<string, bool>();
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;
}
}