From a4f57bf9dda3d52e04f537a2ca24db95761eb888 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 11 十二月 2020 11:34:14 +0800 Subject: [PATCH] Revert "Merge branch 'CJL-NEW' into NewFilePath" --- HDL_ON/Entity/FunctionList.cs | 35 +++++++++++++++++++++++++++++++---- 1 files changed, 31 insertions(+), 4 deletions(-) diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 22da38f..06fcf7a 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -112,6 +112,11 @@ var functionDataBytes = FileUtils.ReadFile(filePath); var functionDataString = System.Text.Encoding.UTF8.GetString(functionDataBytes); var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); + if (tempFunction == null) + { + FileUtils.DeleteFile(filePath); + return; + } if (tempFunction.DeleteSign) { //todo 鍒犻櫎浜戠鏁版嵁 20201203--App涓嶈兘鍒犻櫎鍔熻兘鏁版嵁 @@ -344,6 +349,24 @@ } /// <summary> + /// 鍔熻兘缁戝畾鎴块棿 + /// </summary> + public string FunctionsBindRooms(List<string> roomIds,List<string> deviceIds) + { + var pm = new HttpServerRequest(); + var pack = pm.BindDeviceToRoom(deviceIds, roomIds); + if(pack.Code == StateCode.SUCCESS) + { + + } + else + { + Utlis.ShowTip(Shared.Language.StringByID(StringId.EditFunctionInfoFail) + "\r\nCode:" + pack.Code); + } + return pack.Code; + } + + /// <summary> /// 涓嬫潵浜戠璁惧鏁版嵁 /// </summary> public void DownloadFunctionList() @@ -365,8 +388,9 @@ // } //}) //{ IsBackground = true }.Start(); - foreach (var localFunction in List.GetAllDeviceFunctionList()) + for (int i =0;i < List.GetAllDeviceFunctionList().Count;) { + var localFunction = List.GetAllDeviceFunctionList()[i]; var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); if (newFunction == null)//濡傛灉浜戠鏈�鏂版暟鎹病鏈夎鏉℃暟鎹紝鍒欐湰鍦伴渶瑕佸垹鎺夎鏁版嵁璁板綍 { @@ -374,6 +398,7 @@ } else { + i++; if (localFunction.modifyTime != newFunction.modifyTime) { localFunction.name = newFunction.name; @@ -393,7 +418,7 @@ List.IniFunctionList(newFunction.savePath); } } - MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁:\r\n{ pack.Data.ToString()}"); + //MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁:\r\n{ pack.Data.ToString()}"); } else { @@ -414,7 +439,7 @@ var pack = pm.GetSceneList(); if(pack.Code == StateCode.SUCCESS) { - MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁:\r\n{pack.Data.ToString()}"); + //MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁:\r\n{pack.Data.ToString()}"); var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString()); if (sceneList != null) { @@ -426,8 +451,9 @@ // } //}) //{ IsBackground = true }.Start(); - foreach (var localScene in List.scenes) + for(int i=0;i<List.scenes.Count;) { + var localScene = List.scenes[i]; var newScene = sceneList.Find((obj) => obj.userSceneId == localScene.userSceneId); if (newScene == null)//濡傛灉浜戠鏈�鏂版暟鎹病鏈夎鏉℃暟鎹紝鍒欐湰鍦伴渶瑕佸垹鎺夎鏁版嵁璁板綍 { @@ -435,6 +461,7 @@ } else { + i++; if (localScene.modifyTime != newScene.modifyTime) { localScene.name = newScene.name; -- Gitblit v1.8.0