namespace JiLinApp.Docking.Ptz; public class PtzControlTypeConfig { public string Type { get; set; } public string Name { get; set; } } public class PtzControlTypeConfigHelper { private static Dictionary PctConfigDict { get; set; } public static void Init(List ptzCtrlTypes) { if (PctConfigDict != null) return; Dictionary dict = new(); foreach (var cfg in ptzCtrlTypes) { dict.Add(cfg.Name, cfg); } PctConfigDict ??= dict; } public static PtzControlType GetControlType(string ctrlName) { PctConfigDict.TryGetValue(ctrlName, out var cfg); string ctrlType = cfg != null ? cfg.Type : ""; return ctrlType switch { "PelcoD" => PtzControlType.PelcoD, "PelcoP" => PtzControlType.PelcoP, "DCamera" => PtzControlType.DCamera, "CameraSdk" => PtzControlType.CameraSdk, _ => PtzControlType.None }; } }