From 22fcd0d263770c8371bd03ca53f097a6ec1678f7 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 24 十二月 2020 12:06:26 +0800
Subject: [PATCH] 20201224-2
---
HDL_ON/Entity/FunctionList.cs | 125 -----------------------------------------
1 files changed, 1 insertions(+), 124 deletions(-)
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 7415c31..61ba91e 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -191,7 +191,7 @@
}
if (filePath.StartsWith("SceneData_"))
{
- var sceneDataBytes = Common.FileUtlis.Files.ReadFile(filePath);
+ var sceneDataBytes = FileUtlis.Files.ReadFile(filePath);
var sceneDataString = System.Text.Encoding.UTF8.GetString(sceneDataBytes);
var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(sceneDataString);
List.scenes.Add(tempScene);
@@ -376,129 +376,6 @@
}
return pack.Code;
}
-
- /// <summary>
- /// 涓嬫潵浜戠璁惧鏁版嵁
- /// </summary>
- public void DownloadFunctionList()
- {
- new Thread(() =>
- {
- var pm = new HttpServerRequest();
- var pack = pm.GetDeviceList();
- if (pack.Code == StateCode.SUCCESS)
- {
- var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(pack.Data.ToString());
- if (deviceList != null)
- {
- if (List.GetDeviceFunctionList().Count > 0)
- {
- for (int i = 0; i < List.GetDeviceFunctionList().Count;)
- {
- var localFunction = List.GetDeviceFunctionList()[i];
- if (localFunction.functionCategory == FunctionCategory.Music)
- {
- i++;
- continue;
- }
- var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId);
- if (newFunction == null)//濡傛灉浜戠鏈�鏂版暟鎹病鏈夎鏉℃暟鎹紝鍒欐湰鍦伴渶瑕佸垹鎺夎鏁版嵁璁板綍
- {
- List.DeleteFunction(localFunction);
- }
- else
- {
- MainPage.Log($"deviceType:{localFunction.spk} local:{localFunction.modifyTime} server:{newFunction.modifyTime}");
- i++;
- if (localFunction.modifyTime != newFunction.modifyTime)
- {
- localFunction.name = newFunction.name;
- localFunction.collect = newFunction.collect;
- localFunction.modifyTime = newFunction.modifyTime;
- localFunction.roomIds = newFunction.roomIds;
- localFunction.bus = newFunction.bus;
- localFunction.SaveFunctionFile();
- }
- deviceList.list.Remove(newFunction);//鎿嶄綔瀹岀殑鏁版嵁娓呯悊鎺夛紝鍓╀笅鐨勫氨鏄柊澧炵殑鍔熻兘
- }
- }
- }
- //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
- foreach (var newFunction in deviceList.list)
- {
- newFunction.SaveFunctionFile();
- List.IniFunctionList(newFunction.savePath);
- }
- }
- //MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁:\r\n{ pack.Data.ToString()}");
- }
- else
- {
- MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁澶辫触:\r\nCode:{pack.Code}; Msg:{pack.message}");
- }
- })
- { IsBackground = true }.Start();
- }
-
- /// <summary>
- /// 涓嬭浇浜戠鍦烘櫙鏁版嵁
- /// </summary>
- public void DownloadSceneList()
- {
- new Thread(() =>
- {
- var pm = new HttpServerRequest();
- var pack = pm.GetSceneList();
- if(pack.Code == StateCode.SUCCESS)
- {
- //MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁:\r\n{pack.Data.ToString()}");
- var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
- if (sceneList != null)
- {
- for (int i=0;i<List.scenes.Count;)
- {
- var localScene = List.scenes[i];
- if (localScene == null)
- {
- List.scenes.Remove(localScene);
- continue;
- }
- var newScene = sceneList.Find((obj) => obj.userSceneId == localScene.userSceneId);
- if (newScene == null)//濡傛灉浜戠鏈�鏂版暟鎹病鏈夎鏉℃暟鎹紝鍒欐湰鍦伴渶瑕佸垹鎺夎鏁版嵁璁板綍
- {
- List.DeleteScene(localScene,false);
- }
- else
- {
- i++;
- if (localScene.modifyTime != newScene.modifyTime)
- {
- localScene.name = newScene.name;
- localScene.collect = newScene.collect;
- localScene.modifyTime = newScene.modifyTime;
- localScene.roomIds = newScene.roomIds;
- localScene.SaveSceneFile();
- }
- sceneList.Remove(newScene);//鎿嶄綔瀹岀殑鏁版嵁娓呯悊鎺夛紝鍓╀笅鐨勫氨鏄柊澧炵殑鍔熻兘
- }
- }
- //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
- foreach (var newScene in sceneList)
- {
- newScene.SaveSceneFile();
- List.scenes.Add(newScene);
- }
- }
- }
- else
- {
- MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁澶辫触:\r\nCode:{pack.Code}; Msg:{pack.message}");
- }
- })
- { IsBackground = true }.Start();
- }
-
-
/// <summary>
/// 鍒犻櫎鍦烘櫙
--
Gitblit v1.8.0