feat: cfg option to log a switch when proxying

This commit is contained in:
rladenson 2024-11-08 14:46:07 -07:00
parent 0c802ab0bd
commit dfcef884f2
9 changed files with 49 additions and 3 deletions

View file

@ -22,7 +22,7 @@ public class SystemConfigPatch: PatchObject
public Partial<bool> HidDisplaySplit { get; set; }
public Partial<bool> HidDisplayCaps { get; set; }
public Partial<SystemConfig.HidPadFormat> HidListPadding { get; set; }
public Partial<bool> ProxySwitch { get; set; }
public override Query Apply(Query q) => q.ApplyPatch(wrapper => wrapper
.With("ui_tz", UiTz)
@ -39,6 +39,7 @@ public class SystemConfigPatch: PatchObject
.With("hid_display_split", HidDisplaySplit)
.With("hid_display_caps", HidDisplayCaps)
.With("hid_list_padding", HidListPadding)
.With("proxy_switch", ProxySwitch)
);
public new void AssertIsValid()
@ -103,6 +104,9 @@ public class SystemConfigPatch: PatchObject
if (HidListPadding.IsPresent)
o.Add("hid_list_padding", HidListPadding.Value.ToUserString());
if (ProxySwitch.IsPresent)
o.Add("proxy_switch", ProxySwitch.Value);
return o;
}
@ -140,6 +144,9 @@ public class SystemConfigPatch: PatchObject
if (o.ContainsKey("hid_display_caps"))
patch.HidDisplayCaps = o.Value<bool>("hid_display_caps");
if (o.ContainsKey("proxy_switch"))
patch.ProxySwitch = o.Value<bool>("proxy_switch");
return patch;
}
}

View file

@ -24,6 +24,7 @@ public class SystemConfig
public bool HidDisplaySplit { get; }
public bool HidDisplayCaps { get; }
public HidPadFormat HidListPadding { get; }
public bool ProxySwitch { get; }
public enum HidPadFormat
{
@ -52,6 +53,7 @@ public static class SystemConfigExt
o.Add("hid_display_split", cfg.HidDisplaySplit);
o.Add("hid_display_caps", cfg.HidDisplayCaps);
o.Add("hid_list_padding", cfg.HidListPadding.ToUserString());
o.Add("proxy_switch", cfg.ProxySwitch);
o.Add("description_templates", JArray.FromObject(cfg.DescriptionTemplates));