WIP: port fronters embed to CV2
Some checks failed
Build and push Docker image / .net docker build (push) Has been cancelled
.net checks / run .net tests (push) Has been cancelled
.net checks / dotnet-format (push) Has been cancelled
Build and push Rust service Docker images / rust docker build (push) Has been cancelled
rust checks / cargo fmt (push) Has been cancelled

This commit is contained in:
asleepyskye 2025-09-22 08:18:10 -04:00
parent 651ac6ba5c
commit 9495b95afa
7 changed files with 239 additions and 2 deletions

View file

@ -25,6 +25,7 @@ public class SystemConfigPatch: PatchObject
public Partial<bool> CardShowColorHex { get; set; }
public Partial<string?> NameFormat { get; set; }
public Partial<SystemConfig.HidPadFormat> HidListPadding { get; set; }
public Partial<SystemConfig.ListFormat> FronterListFormat { get; set; }
public Partial<SystemConfig.ProxySwitchAction> ProxySwitch { get; set; }
public override Query Apply(Query q) => q.ApplyPatch(wrapper => wrapper
@ -43,6 +44,7 @@ public class SystemConfigPatch: PatchObject
.With("hid_display_caps", HidDisplayCaps)
.With("hid_list_padding", HidListPadding)
.With("card_show_color_hex", CardShowColorHex)
.With("fronter_list_format", FronterListFormat)
.With("proxy_switch", ProxySwitch)
.With("name_format", NameFormat)
);
@ -112,6 +114,9 @@ public class SystemConfigPatch: PatchObject
if (CardShowColorHex.IsPresent)
o.Add("card_show_color_hex", CardShowColorHex.Value);
if (FronterListFormat.IsPresent)
o.Add("fronter_list_format", FronterListFormat.Value.ToUserString());
if (ProxySwitch.IsPresent)
o.Add("proxy_switch", ProxySwitch.Value.ToUserString());
@ -158,6 +163,13 @@ public class SystemConfigPatch: PatchObject
if (o.ContainsKey("card_show_color_hex"))
patch.CardShowColorHex = o.Value<bool>("card_show_color_hex");
if (o.ContainsKey("fronter_list_format"))
patch.FronterListFormat = o.Value<string>("fronter_list_format") switch
{
"full" => SystemConfig.ListFormat.Full,
_ => SystemConfig.ListFormat.Short,
};
if (o.ContainsKey("proxy_switch"))
patch.ProxySwitch = o.Value<string>("proxy_switch") switch
{

View file

@ -26,6 +26,7 @@ public class SystemConfig
public bool CardShowColorHex { get; }
public HidPadFormat HidListPadding { get; }
public ProxySwitchAction ProxySwitch { get; }
public ListFormat FronterListFormat { get; }
public string NameFormat { get; }
public enum HidPadFormat
@ -40,6 +41,11 @@ public class SystemConfig
New = 1,
Add = 2,
}
public enum ListFormat
{
Short = 0,
Full = 1,
}
}
public static class SystemConfigExt
@ -62,6 +68,7 @@ public static class SystemConfigExt
o.Add("hid_display_caps", cfg.HidDisplayCaps);
o.Add("hid_list_padding", cfg.HidListPadding.ToUserString());
o.Add("card_show_color_hex", cfg.CardShowColorHex);
o.Add("fronter_list_format", cfg.FronterListFormat.ToUserString());
o.Add("proxy_switch", cfg.ProxySwitch.ToUserString());
o.Add("name_format", cfg.NameFormat);
@ -77,5 +84,5 @@ public static class SystemConfigExt
}
public static string ToUserString(this SystemConfig.ProxySwitchAction val) => val.ToString().ToLower();
public static string ToUserString(this SystemConfig.ListFormat val) => val.ToString().ToLower();
}