using System; using System.Collections.Generic; namespace Shared { [System.Serializable] public class YIPanel { static YIPanel () { ReadPanel (); //if (yIPaneList.Count == 0) { // ///模拟测试 // yIPaneList.Add (new YIPanel { SubnetID = 3, DeviceID = 1, Name = "毅面板" }); // //Current = new YIPanel { SubnetID = 3, DeviceID = 1, Name = "毅面板" }; //} } public static YIPanel Current { get; set; } public static void ReadPanel () { if (yIPaneList.Count == 0) { var filesList = Shared.IO.FileUtils.ReadFiles ().FindAll ((obj) => { string [] str = obj.Split ('_'); return obj.StartsWith ("Equipment_YIPanel_") && str.Length == 4; }); //var filesList=room.DeviceFilePathList.FindAll ((obj)=> obj.StartsWith ("Equipment_YIPanel_") && obj.Split ('_').Length == 4); foreach (var file in filesList) { //if (file.Split ('_') [1] != ModuleType.YIPanel.ToString ()) { // continue; //} var yipanelstring = System.Text.Encoding.UTF8.GetString (Shared.IO.FileUtils.ReadFile (file)); if (yipanelstring == null) { continue; } var jObject = Newtonsoft.Json.Linq.JObject.Parse (yipanelstring); if (jObject == null) { continue; } YIPanel yIPanel = new YIPanel (); yIPanel.Name = jObject ["Name"]?.ToString (); yIPanel.SubnetID = jObject.Value ("SubnetID"); yIPanel.DeviceID = jObject.Value ("DeviceID"); yIPaneList.Add (yIPanel); } } } public byte SubnetID; public byte DeviceID; public string Name = ""; public ModuleType Type = ModuleType.YIPanel; public static List yIPaneList = new List (); public List yIPaneDeviceList = new List (); public List yIPanelSceneList = new List (); public List DeviceTypeList = new List (); } [System.Serializable] public class DeviceIfon { public byte largeclass; public byte subclass; public byte channelnumber; } }