| | |
| | | { |
| | | _FunctionList = new FunctionList(); |
| | | #region 恢复数据 |
| | | var filePathList = FileUtils.ReadFiles(); |
| | | var filePathList = Common.FileUtlis.Files.ReadFiles(); |
| | | foreach (var filePath in filePathList) |
| | | { |
| | | _FunctionList.IniFunctionList(filePath); |
| | |
| | | { |
| | | if (filePath.StartsWith("FunctionData_")) |
| | | { |
| | | var functionDataBytes = FileUtils.ReadFile(filePath); |
| | | var functionDataBytes = Common.FileUtlis.Files.ReadFile(filePath); |
| | | var functionDataString = System.Text.Encoding.UTF8.GetString(functionDataBytes); |
| | | var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); |
| | | if (tempFunction == null) |
| | | { |
| | | FileUtils.DeleteFile(filePath); |
| | | Common.FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | } |
| | | if (tempFunction.DeleteSign) |
| | |
| | | } |
| | | if (filePath.StartsWith("SceneData_")) |
| | | { |
| | | var sceneDataBytes = FileUtils.ReadFile(filePath); |
| | | var sceneDataBytes = Common.FileUtlis.Files.ReadFile(filePath); |
| | | var sceneDataString = System.Text.Encoding.UTF8.GetString(sceneDataBytes); |
| | | var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(sceneDataString); |
| | | List.scenes.Add(tempScene); |
| | |
| | | /// </summary> |
| | | public void DelAllFunctionData() |
| | | { |
| | | var filePathList = FileUtils.ReadFiles(); |
| | | var filePathList = Common.FileUtlis.Files.ReadFiles(); |
| | | foreach (var filePath in filePathList) |
| | | { |
| | | if (filePath.StartsWith("FunctionData_") && filePath.Length == 13 + 28) |
| | | { |
| | | FileUtils.DeleteFile(filePath); |
| | | Common.FileUtlis.Files.DeleteFile(filePath); |
| | | } |
| | | } |
| | | _FunctionList = new FunctionList(); |
| | |
| | | var packCode = pm.DeleteScene(scene.userSceneId); |
| | | if (packCode == StateCode.SUCCESS) |
| | | { |
| | | FileUtils.DeleteFile(scene.savePath); |
| | | Common.FileUtlis.Files.DeleteFile(scene.savePath); |
| | | List.scenes.Remove(scene); |
| | | } |
| | | else |
| | |
| | | } |
| | | else |
| | | { |
| | | FileUtils.DeleteFile(scene.savePath); |
| | | Common.FileUtlis.Files.DeleteFile(scene.savePath); |
| | | List.scenes.Remove(scene); |
| | | } |
| | | } |
| | |
| | | _FunctionList.fans.Remove(_FunctionList.fans.Find((obj) => obj.deviceId == delTemp.deviceId)); |
| | | break; |
| | | } |
| | | FileUtils.DeleteFile(delTemp.savePath); |
| | | Common.FileUtlis.Files.DeleteFile(delTemp.savePath); |
| | | } |
| | | |
| | | bool lockReadFunctionStatus = false; |
| | |
| | | lockReadFunctionStatus = true; |
| | | try |
| | | { |
| | | if (DriverLayer.Control.Ins.IsRemote) |
| | | { |
| | | var functionIds = new List<string>(); |
| | | foreach (var function in GetAllDeviceFunctionList()) |
| | | { |
| | | functionIds.Add(function.deviceId); |
| | | } |
| | | DriverLayer.Control.Ins.SendApiReadCommand(functionIds); |
| | | } |
| | | else |
| | | { |
| | | foreach (var function in GetAllDeviceFunctionList()) |
| | | { |
| | | switch (function.functionCategory) |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"Refresh Residence Function Status Error : {ex.Message}"); |