黄学彪
2019-10-29 0f5a53c7b36c27a0f2bec12e6119207edb6860f8
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs
@@ -282,26 +282,33 @@
            {
                //还原设备对象
                tempRoom.DeviceUIList.Clear();
                foreach (string uiPath in tempRoom.DeviceUIFilePathList)
                for (int i = 0; i < tempRoom.DeviceUIFilePathList.Count; i++)
                {
                    string deviceFile = uiPath.Replace("DeviceUI_", string.Empty);
                    string deviceFile = tempRoom.DeviceUIFilePathList[i];
                    //这个设备文件匹配得到房间
                    listDeviceFile.Remove(deviceFile);
                    if (this.IsFileExists(deviceFile) == false)
                    {
                        //移除掉这个不对劲的路径
                        tempRoom.DeviceUIFilePathList.RemoveAt(i);
                        i--;
                        continue;
                    }
                    tempRoom.DeviceUIList.Add(Common.LocalDevice.Current.GetDeviceUI(uiPath));
                    tempRoom.DeviceUIList.Add(Common.LocalDevice.Current.GetDeviceUI(deviceFile));
                }
                //还原场景对象
                tempRoom.SceneUIList.Clear();
                foreach (string uiPath in tempRoom.SceneUIFilePathList)
                for (int i = 0; i < tempRoom.SceneUIFilePathList.Count; i++)
                {
                    string uiPath = tempRoom.SceneUIFilePathList[i];
                    //这个场景文件匹配得到房间
                    listSceneFile.Remove(uiPath);
                    var byteData = this.GetShardFileContent(uiPath);
                    if (byteData == null)
                    {
                        //移除掉这个不对劲的路径
                        tempRoom.SceneUIFilePathList.RemoveAt(i);
                        i--;
                        continue;
                    }
                    string valueData = System.Text.Encoding.UTF8.GetString(byteData);
@@ -813,7 +820,7 @@
                this.AddShardFile(device.FilePath);
                //设备的UI
                var deviceUi = $"DeviceUI_{device.FilePath}";
                var deviceUi = device.FilePath;
                if (roomTemp.DeviceUIFilePathList.Contains(deviceUi) == false)
                {
                    roomTemp.DeviceUIFilePathList.Add(deviceUi);
@@ -1229,7 +1236,7 @@
                string deviceFileName = device.FilePath;
                //移除路径列表
                roomTemp.DeviceUIFilePathList.Remove($"DeviceUI_{device.FilePath}");
                roomTemp.DeviceUIFilePathList.Remove(device.FilePath);
                if (listHadShard.Contains(deviceFileName) == true)
                {
                    //其他场景分享有这个设备,所以不删除这个设备的根源文件,只是把房间的设备列表路径移除
@@ -1564,7 +1571,7 @@
                //设备
                foreach (var deviceUi in roomTemp.DeviceUIFilePathList)
                {
                    string deviceFile = deviceUi.Replace("DeviceUI_", string.Empty);
                    string deviceFile = deviceUi;
                    if (listDeleteFile.Contains(deviceFile) == true)
                    {
                        //因为一个回路只能分配一个区域,所以可以直接判断