JLChen
2020-06-04 6d55af8792cf8fbef0055e677b900fc352dba9a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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;
 
    }
}