| | |
| | | { |
| | | deviceList = new DevcieApiPack(); |
| | | } |
| | | { |
| | | if (FunctionList.List.GetDeviceFunctionList().Count > 0) |
| | | { |
| | | for (int i = 0; i < FunctionList.List.GetDeviceFunctionList().Count;) |
| | | for (int i = 0; i < FunctionList.List.GetDeviceFunctionList().Count;) |
| | | { |
| | | var localFunction = FunctionList.List.GetDeviceFunctionList()[i]; |
| | | if (localFunction.functionCategory == FunctionCategory.Music) |
| | | { |
| | | var localFunction = FunctionList.List.GetDeviceFunctionList()[i]; |
| | | if (localFunction.functionCategory == FunctionCategory.Music) |
| | | i++; |
| | | continue; |
| | | } |
| | | var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); |
| | | if (newFunction == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | { |
| | | FunctionList.List.DeleteFunction(localFunction); |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log($"deviceType:{localFunction.spk} local:{localFunction.modifyTime} server:{newFunction.modifyTime}"); |
| | | i++; |
| | | if (localFunction.modifyTime != newFunction.modifyTime) |
| | | { |
| | | i++; |
| | | continue; |
| | | //可优化 |
| | | localFunction.name = newFunction.name; |
| | | localFunction.collect = newFunction.collect; |
| | | localFunction.modifyTime = newFunction.modifyTime; |
| | | localFunction.roomIds = newFunction.roomIds; |
| | | localFunction.bus = newFunction.bus; |
| | | localFunction.SaveFunctionFile(); |
| | | } |
| | | var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); |
| | | if (newFunction == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | { |
| | | FunctionList.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);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | } |
| | | deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | } |
| | | } |
| | | //处理剩下的新增功能 |
| | |
| | | if (sceneList == null) |
| | | { |
| | | sceneList = new List<Scene>(); |
| | | } |
| | | for (int i = 0; i < FunctionList.List.scenes.Count;) |
| | | { |
| | | var localScene = FunctionList.List.scenes[i]; |
| | |
| | | continue; |
| | | } |
| | | var newScene = sceneList.Find((obj) => obj.userSceneId == localScene.userSceneId); |
| | | if (newScene == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | if (newScene == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | { |
| | | FunctionList.List.DeleteScene(localScene, false); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | if (localScene.modifyTime != newScene.modifyTime) |
| | | { |
| | | FunctionList.List.DeleteScene(localScene, false); |
| | | localScene.name = newScene.name; |
| | | localScene.collect = newScene.collect; |
| | | localScene.modifyTime = newScene.modifyTime; |
| | | localScene.roomIds = newScene.roomIds; |
| | | localScene.SaveSceneFile(); |
| | | } |
| | | 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);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | } |
| | | sceneList.Remove(newScene);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | } |
| | | //处理剩下的新增功能 |
| | | foreach (var newScene in sceneList) |
| | | foreach (var tempScene in sceneList) |
| | | { |
| | | newScene.SaveSceneFile(); |
| | | FunctionList.List.scenes.Add(newScene); |
| | | tempScene.SaveSceneFile(); |
| | | FunctionList.List.scenes.Add(tempScene); |
| | | } |
| | | } |
| | | //如果是一端口需要提前下载场景数据,否则控制不了一端口场景 |