| | |
| | | { |
| | | deviceList = new DevcieApiPack(); |
| | | } |
| | | string delFile = ""; |
| | | if (FunctionList.List.GetDeviceFunctionList().Count > 0) |
| | | { |
| | | |
| | |
| | | continue; |
| | | } |
| | | var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); |
| | | if (newFunction == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | //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(); |
| | | // //} |
| | | // localFunction = newFunction; |
| | | // localFunction.SaveFunctionFile(); |
| | | // deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | //} |
| | | |
| | | if (delFile == localFunction.savePath) |
| | | { |
| | | 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(); |
| | | //} |
| | | localFunction = newFunction; |
| | | localFunction.SaveFunctionFile(); |
| | | deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | continue; |
| | | } |
| | | delFile = localFunction.savePath; |
| | | FunctionList.List.DeleteFunction(localFunction); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | //处理剩下的新增功能 |
| | | foreach (var newFunction in deviceList.list) |
| | | foreach (var newFunction in deviceList.list) |
| | | { |
| | | newFunction.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(newFunction.savePath); |