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<byte> ("SubnetID");
|
yIPanel.DeviceID = jObject.Value<byte> ("DeviceID");
|
yIPaneList.Add (yIPanel);
|
}
|
}
|
}
|
public byte SubnetID;
|
public byte DeviceID;
|
public string Name = "";
|
public ModuleType Type = ModuleType.YIPanel;
|
|
public static List<YIPanel> yIPaneList = new List<YIPanel> ();
|
public List<YiPanelCommon> yIPaneDeviceList = new List<YiPanelCommon> ();
|
public List<YiPanelScene> yIPanelSceneList = new List<YiPanelScene> ();
|
public List<DeviceIfon> DeviceTypeList = new List<DeviceIfon> ();
|
}
|
|
|
|
[System.Serializable]
|
public class DeviceIfon
|
{
|
|
public byte largeclass;
|
public byte subclass;
|
public byte channelnumber;
|
|
}
|
}
|