From b7b3e92bed9c4553e30e2901a1877f088a5f8823 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期一, 04 十一月 2019 17:20:52 +0800 Subject: [PATCH] 2019.11.4 --- ZigbeeApp/Shared/Common/Device.cs | 24 +++++------------------- 1 files changed, 5 insertions(+), 19 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index 85ac646..8f0dc65 100755 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -85,7 +85,7 @@ /// </summary> private Dictionary<string, HashSet<int>> dicDeviceEpoint = new Dictionary<string, HashSet<int>>(); /// <summary> - /// 璁惧Mac椤哄簭(閲岄潰鏄疢ac鍦板潃) + /// 璁惧Mac椤哄簭 /// </summary> private Dictionary<string, List<string>> dicDeviceSort = null; /// <summary> @@ -1563,33 +1563,19 @@ /// <returns></returns> public List<CommonDevice> SortDevice(List<CommonDevice> listDevice) { - var dic = new Dictionary<string, List<CommonDevice>>(); + var dic = new Dictionary<string, CommonDevice>(); for (int i = 0; i < listDevice.Count; i++) { - if (dic.ContainsKey(listDevice[i].DeviceAddr) == false) - { - dic[listDevice[i].DeviceAddr] = new List<CommonDevice>(); - } - dic[listDevice[i].DeviceAddr].Add(listDevice[i]); + dic[(this.GetDeviceMainKeys(listDevice[i]))] = listDevice[i]; } var list = new List<CommonDevice>(); - var listCheck = new HashSet<string>(); foreach (var listSort in this.dicDeviceSort.Values) { for (int i = 0; i < listSort.Count; i++) { - if (dic.ContainsKey(listSort[i]) == true && listCheck.Contains(listSort[i]) == false) + if (dic.ContainsKey(listSort[i]) == true) { - listCheck.Add(listSort[i]); - dic[listSort[i]].Sort((obj1, obj2) => - { - if (obj1.DeviceEpoint > obj2.DeviceEpoint) - { - return 1; - } - return -1; - }); - list.AddRange(dic[listSort[i]]); + list.Add(dic[listSort[i]]); } } } -- Gitblit v1.8.0