From 52005ed57f3f7bc796fdd1a878e4f298a126f1e8 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 29 十月 2019 16:48:47 +0800
Subject: [PATCH] 2019.10.29-3
---
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