From 4f0ab0ad21ce450b7856d50f98322a7899361386 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 22 九月 2020 10:30:01 +0800
Subject: [PATCH] 不要下载这个备份
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs | 168 ++++++++++++++++++++++++-------------------------------
1 files changed, 73 insertions(+), 95 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs
index 8ec74ce..938c65c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs
@@ -5,7 +5,6 @@
using System.IO;
using System.Net;
using System.Text;
-using System.Threading.Tasks;
using ZigBee.Device;
namespace Shared.Phone.UserCenter
@@ -53,7 +52,7 @@
/// </summary>
/// <param name="listDistributedMark"></param>
/// <returns></returns>
- private async Task<List<string>> SetShardFileToLocation(List<string> listDistributedMark)
+ private List<string> SetShardFileToLocation(List<string> listDistributedMark)
{
if (listDistributedMark.Count == 0)
{
@@ -63,7 +62,7 @@
List<string> listFile = new List<string>();
//鏂囦欢澶�
- string strDir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory);
+ string strDir = DirNameResourse.DownLoadShardDirectory;
//涓嶅厑璁告寜绯荤粺鐨勮繑鍥為敭
Shared.Common.CommonPage.BackKeyCanClick = false;
@@ -73,8 +72,8 @@
{
string keys = listDistributedMark[i];
var dataPra = new { DistributedMark = keys, HouseDistributedMark = Common.Config.Instance.Home.Id, IsOtherAccountControl = Common.Config.Instance.Home.IsOthreShare };
- var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetOneShareData", false, dataPra);
- if (result == null)
+ var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetOneShareData", false, dataPra, null, true);
+ if (string.IsNullOrEmpty(result) == true)
{
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
@@ -85,7 +84,7 @@
//鏂囦欢鍚嶅瓧
listFile.Add(dataResult.ShareName);
//淇濆瓨鍒版寚瀹氭枃浠跺す涓�
- Global.WriteFileToDirectoryByBytes(strDir, dataResult.ShareName, dataResult.ShareDataBytes);
+ HdlFileLogic.Current.SaveByteToFile(System.IO.Path.Combine(strDir, dataResult.ShareName), dataResult.ShareDataBytes);
//璁剧疆杩涘害鍊�
ProgressFormBar.Current.SetValue(i + 1, listMarkCount);
}
@@ -104,13 +103,13 @@
/// <returns></returns>
public byte[] GetShardFileContent(string fileName)
{
- string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName);
+ string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName);
if (System.IO.File.Exists(fullName) == false)
{
return null;
}
- string path = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory);
- var varByte = Global.ReadFileByDirectory(path, fileName);
+ string path = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName);
+ var varByte = HdlFileLogic.Current.ReadFileByteContent(path);
return varByte;
}
@@ -120,10 +119,7 @@
/// <returns></returns>
public List<string> GetLocalAllShardFile()
{
- string path = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory);
- var listFile = HdlAutoBackupLogic.GetFileFromDirectory(path);
-
- return listFile;
+ return HdlFileLogic.Current.GetFileFromDirectory(DirNameResourse.DownLoadShardDirectory);
}
/// <summary>
@@ -133,7 +129,7 @@
/// <returns></returns>
public bool IsFileExists(string fileName)
{
- string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName);
+ string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName);
if (System.IO.File.Exists(fullName) == false)
{
return false;
@@ -155,9 +151,9 @@
{
return;
}
- string oldName = UserCenterLogic.CombinePath(fileName);
- string newName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName);
- System.IO.File.Copy(oldName, newName, true);
+ string oldName = System.IO.Path.Combine(Config.Instance.FullPath, fileName);
+ string newName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName);
+ HdlFileLogic.Current.CopyFile(oldName, newName);
}
/// <summary>
@@ -167,12 +163,9 @@
public void AddShardFile(Common.Room room)
{
room.IsSharedRoom = true;
- var data = Newtonsoft.Json.JsonConvert.SerializeObject(room);
- var byteData = System.Text.Encoding.UTF8.GetBytes(data);
-
- string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, room.FileName);
+ string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, room.FileName);
//鍐欏叆鍐呭
- Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
+ HdlFileLogic.Current.SaveFileContent(fullName, room);
}
/// <summary>
@@ -182,12 +175,9 @@
public void AddShardFile(Common.SceneUI scene)
{
scene.IsSharedScene = true;
- var data = Newtonsoft.Json.JsonConvert.SerializeObject(scene);
- var byteData = System.Text.Encoding.UTF8.GetBytes(data);
-
- string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, scene.FileName);
+ string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, scene.FileName);
//鍐欏叆鍐呭
- Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
+ HdlFileLogic.Current.SaveFileContent(fullName, scene);
}
/// <summary>
@@ -196,12 +186,9 @@
/// <param name="dic">妤煎眰</param>
public void AddShardFile(Dictionary<string, string> dic)
{
- var data = Newtonsoft.Json.JsonConvert.SerializeObject(dic);
- var byteData = System.Text.Encoding.UTF8.GetBytes(data);
-
- string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, DirNameResourse.ShardFloorFile);
+ string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, DirNameResourse.ShardFloorFile);
//鍐欏叆鍐呭
- Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
+ HdlFileLogic.Current.SaveFileContent(fullName, dic);
}
#endregion
@@ -214,11 +201,8 @@
/// <param name="fileName">鎸囧畾鏂囦欢鍚嶅瓧</param>
public void DeleteShardFile(string fileName)
{
- fileName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName);
- if (System.IO.File.Exists(fileName) == true)
- {
- System.IO.File.Delete(fileName);
- }
+ fileName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName);
+ HdlFileLogic.Current.DeleteFile(fileName);
}
/// <summary>
@@ -228,8 +212,7 @@
{
this.dicShardDeviceFile.Clear();
//鍒涘缓鏂囦欢澶�
- string strDir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory);
- Global.CreateEmptyDirectory(strDir, true);
+ HdlFileLogic.Current.CreateDirectory(DirNameResourse.DownLoadShardDirectory, true);
}
#endregion
@@ -239,7 +222,7 @@
/// <summary>
/// 鍚屾鏈嶅姟鍣ㄧ殑鍒嗕韩鍐呭(閲岄潰鍙礋璐f妸涓滆タ瀛樺叆鏈湴)
/// </summary>
- public async Task<bool> SynchronizeDbSharedContent()
+ public bool SynchronizeDbSharedContent()
{
if (UserCenterResourse.UserInfo.AuthorityNo != 3)
{
@@ -249,8 +232,7 @@
//鑾峰彇涓讳汉鍒嗕韩缁欐垚鍛樼殑鏂囦欢鍒楄〃
var infoPra = new { DistributedMark = Config.Instance.Guid, HouseDistributedMark = Common.Config.Instance.Home.Id, IsOtherAccountControl = Common.Config.Instance.Home.IsOthreShare };
- var listNotShow = new List<string>() { "NotSetAgain" };
- var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra, listNotShow);
+ var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra);
if (string.IsNullOrEmpty(result) == true)
{
return false;
@@ -291,7 +273,7 @@
//灏嗗垎浜殑鏁版嵁瀛樺叆鏈湴(鑾峰彇鐨勬槸鏈湴娌℃湁鐨�)
this.ClearShardDirectory();
- var listDbFile = await this.SetShardFileToLocation(listAddMark);
+ var listDbFile = this.SetShardFileToLocation(listAddMark);
if (listDbFile == null)
{
//鍏抽棴
@@ -302,22 +284,16 @@
//鐢熸垚鏂囦欢
foreach (string fileName in listDbFile)
{
- var oldPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName);
+ var oldPath = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName);
var newPath = System.IO.Path.Combine(Config.Instance.FullPath, fileName);
- System.IO.File.Copy(oldPath, newPath, true);
-
- if (fileName.StartsWith("Room_") == true)
- {
- //鎴块棿鏂囦欢鐗规畩澶勭悊
- Config.Instance.Home.AddRoomId(fileName.Replace("Room_", string.Empty).Replace(".json", string.Empty));
- }
+ HdlFileLogic.Current.CopyFile(oldPath, newPath);
}
//娓呯┖鍏变韩鏂囦欢澶�
this.ClearShardDirectory();
}
//鍚屾鏈嶅姟鍣ㄧ殑鍙栨秷浜嗙殑鍒嗕韩鍐呭
- return await this.SynchronizeDeleteSharedContent(listShardFile, dicUpdateTime);
+ return this.SynchronizeDeleteSharedContent(listShardFile, dicUpdateTime);
}
/// <summary>
@@ -326,7 +302,7 @@
/// <param name="listShardFile">浜戠涓婇潰鍒嗕韩鐨勬枃浠�,涓篘ull鏃朵粠鏂拌幏鍙�</param>
/// <param name="dicUpdateTime">鍒嗕韩鏂囦欢鐨勬洿鏂版椂闂�,涓篘ull鏃朵粠鏂拌幏鍙�</param>
/// <returns></returns>
- public async Task<bool> SynchronizeDeleteSharedContent(HashSet<string> listShardFile = null, Dictionary<string, string> dicUpdateTime = null)
+ public bool SynchronizeDeleteSharedContent(HashSet<string> listShardFile = null, Dictionary<string, string> dicUpdateTime = null)
{
if (UserCenterResourse.UserInfo.AuthorityNo != 3)
{
@@ -349,8 +325,7 @@
listShardFile = new HashSet<string>();
//鑾峰彇涓讳汉鍒嗕韩缁欐垚鍛樼殑鏂囦欢鍒楄〃
var infoPra = new { DistributedMark = Config.Instance.Guid, HouseDistributedMark = Common.Config.Instance.Home.Id, IsOtherAccountControl = Common.Config.Instance.Home.IsOthreShare };
- var listNotShow = new List<string>() { "NotSetAgain" };
- var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra, listNotShow);
+ var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra);
if (string.IsNullOrEmpty(result) == true)
{
//鍏抽棴
@@ -365,8 +340,10 @@
}
}
+ //娓呯┖妤煎眰鏁版嵁
+ Common.Config.Instance.Home.FloorDics.Clear();
//鐒跺悗妫�娴嬫湰鍦扮殑鏂囦欢
- var listLocalFile = Global.FileListByHomeId();
+ var listLocalFile = HdlFileLogic.Current.GetRootPathListFile();
foreach (string fileName in listLocalFile)
{
if (fileName == DirNameResourse.ShardFloorFile)
@@ -375,8 +352,7 @@
var varData = Global.ReadFileByHomeId(fileName);
var dicFloor = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(Encoding.UTF8.GetString(varData));
Common.Config.Instance.Home.FloorDics = dicFloor;
- Common.Config.Instance.Home.Save(false);
-
+ //鏆傛椂涓嶄繚瀛�,鐣欏湪鏈�鍚庨潰鎵嶄繚瀛�
Global.DeleteFilebyHomeId(fileName);
}
@@ -407,8 +383,6 @@
//鍒犻櫎鎺夎繖涓埧闂存枃浠�
Global.DeleteFilebyHomeId(fileName);
dicUpdateTime.Remove(fileName);
-
- Config.Instance.Home.RemoveRoomId(nowRoom.Id);
}
//妫�娴嬫湰鍦板満鏅枃浠�,鏄惁瀛樺湪宸茬粡鍙栨秷浜嗗叡浜簡鐨�
else if (fileName.StartsWith("Scene_") == true)
@@ -425,6 +399,10 @@
dicUpdateTime.Remove(fileName);
}
}
+
+ //淇濆瓨妤煎眰鏁版嵁
+ Common.Config.Instance.Home.Save(false);
+
//缃戝叧鏂囦欢闈炲悎娉曟�ф槸鍒锋柊璁惧鍒楄〃鐨勫嚱鏁伴噷闈㈠疄鐜�
//淇濆瓨鍏ㄩ儴鍒嗕韩鏂囦欢鐨勬洿鏂版棩鏈�
@@ -446,7 +424,7 @@
private Dictionary<string, string> GetAllShardFileAgoUpdateTime()
{
var dicTime = new Dictionary<string, string>();
- var data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ShardFileUpdateFile);
+ var data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.ShardFileUpdateTimeFile);
if (data == null)
{
//鐩爣鏂囦欢涓嶅瓨鍦�
@@ -462,9 +440,7 @@
/// <param name="dicTime"></param>
private void SaveAllShardFileAgoUpdateTime(Dictionary<string, string> dicTime)
{
- var data = Newtonsoft.Json.JsonConvert.SerializeObject(dicTime);
- var byteData = System.Text.Encoding.UTF8.GetBytes(data);
- Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ShardFileUpdateFile, byteData);
+ HdlFileLogic.Current.SaveFileContent(DirNameResourse.ShardFileUpdateTimeFile, dicTime);
}
#endregion
@@ -482,7 +458,7 @@
/// <para>New鐨勬椂鍊欒寰楀SubAccountDistributedMark璧嬪��,瀹冩槸鎴愬憳鍒楄〃鎺ュ彛杩斿洖鐨凷ubAccountDistributedMark</para>
/// </param>
/// <returns></returns>
- public async Task<bool> GetMemberShardContentListAndSetToLocation(MemberShardInfoData memberShardInfo)
+ public bool GetMemberShardContentListAndSetToLocation(MemberShardInfoData memberShardInfo)
{
if (memberShardInfo.Refresh == false)
{
@@ -502,8 +478,8 @@
HouseDistributedMark = Shared.Common.Config.Instance.HomeId,
IsOtherAccountControl = Common.Config.Instance.Home.IsOthreShare
};
- var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra);
- if (result == null)
+ var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra);
+ if (string.IsNullOrEmpty(result) == true)
{
//鍏抽棴杩涘害鏉�
ProgressFormBar.Current.Close();
@@ -537,7 +513,7 @@
}
//灏嗗垎浜殑鏁版嵁瀛樺叆鏈湴,杩斿洖鐨勬槸鏂囦欢鍚嶅瓧(寮傚父鏃惰繑鍥瀗ull)
- var listFile = await this.SetShardFileToLocation(listMark);
+ var listFile = this.SetShardFileToLocation(listMark);
if (listFile == null)
{
//鍏抽棴杩涘害鏉�
@@ -655,7 +631,7 @@
var tempUi = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.SceneUI>(valueData);
//鑾峰彇鍦烘櫙閲岄潰鐨勫叏閮ㄧ洰鏍�(2019.11.05杩藉姞鎿嶄綔,鏈夊彲鑳介偅涓澶囨槸鐢卞満鏅祵濂楁潵鐨�,鎵�浠ュ畠鏈夊彲鑳戒笉灞炰簬浠讳綍鎴块棿)
- foreach (var data in tempUi.AddSceneMemberDataList)
+ foreach (var data in tempUi.AdjustTargetList)
{
//璁惧
if (data.Type == 0)
@@ -731,7 +707,7 @@
/// <param name="listScene">閫夋嫨涓婁紶鐨勫満鏅�(涓嶈鑾峰彇瀹冮噷闈㈢殑缁戝畾鍒楄〃)</param>
/// <param name="BarMaxValue">杩涘害鏉$殑鏈�澶у��,濡傛灉涓嶄负-1,鍒欏唴閮ㄤ笉浼氳嚜鍔ㄥ脊鍑鸿繘搴︽潯</param>
/// <param name="listCheckFile">鏂囦欢閲嶅涓婁紶妫�娴�</param>
- public async Task<bool> DoUploadSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
+ public bool DoUploadSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
List<CommonDevice> listDevice, List<Common.SceneUI> listScene, int BarMaxValue = -1, HashSet<string> listCheckFile = null)
{
if (listDevice.Count == 0 && listScene.Count == 0)
@@ -785,11 +761,11 @@
}
//涓婁紶鍒嗕韩
- var result = await this.DoUploadShardContent(memberShardInfo, listFile, listCheckFile);
+ var result = this.DoUploadShardContent(memberShardInfo, listFile, listCheckFile);
if (result == true)
{
//鍒犻櫎鎸囧畾鑷畾涔夊浘鐗�
- result = await this.DoDeleteSharedContent(memberShardInfo, listDelPic);
+ result = this.DoDeleteSharedContent(memberShardInfo, listDelPic);
}
if (BarMaxValue == -1)
{
@@ -952,7 +928,7 @@
/// <returns></returns>
public void GetSceneDeviceList(Common.SceneUI scene, HashSet<string> listCheck, List<Common.SceneUI> listSceneUI, List<CommonDevice> listDevice)
{
- foreach (var data in scene.AddSceneMemberDataList)
+ foreach (var data in scene.AdjustTargetList)
{
//璁惧
if (data.Type == 0)
@@ -1003,7 +979,7 @@
/// <param name="listFile">涓婁紶鐨勬枃浠跺悕</param>
/// <param name="listCheckFile">閲嶅鏂囦欢涓婁紶妫�娴�</param>
/// <returns></returns>
- private async Task<bool> DoUploadShardContent(MemberShardInfoData memberShardInfo, List<string> listFile, HashSet<string> listCheckFile)
+ private bool DoUploadShardContent(MemberShardInfoData memberShardInfo, List<string> listFile, HashSet<string> listCheckFile)
{
var dicKeys = new Dictionary<string, string>();
for (int i = 0; i < listFile.Count; i++)
@@ -1038,8 +1014,8 @@
//杩藉姞鍏变韩
if (memberShardInfo.dicAllShardKeys.ContainsKey(fileName) == false)
{
- var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/AddShareData", false, info);
- if (result == null)
+ var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/AddShareData", false, info, null, true);
+ if (string.IsNullOrEmpty(result) == true)
{
return false;
}
@@ -1049,7 +1025,7 @@
else
{
info.DistributedMark = memberShardInfo.dicAllShardKeys[fileName];
- var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info);
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info, null, true);
if (result == false)
{
return false;
@@ -1077,7 +1053,7 @@
/// <returns></returns>
private string UpLoadBigBackupFileToDB(MemberShardInfoData memberShardInfo, string fileName)
{
- string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadShardDirectory, fileName);
+ string fullName = System.IO.Path.Combine(DirNameResourse.DownLoadShardDirectory, fileName);
if (System.IO.File.Exists(fullName) == false)
{
return null;
@@ -1270,7 +1246,7 @@
/// <param name="listDevice">瑕佸彇娑堢殑璁惧</param>
/// <param name="listSceneUI">瑕佸彇娑堢殑鍦烘櫙</param>
/// <returns></returns>
- public async Task<bool> DoDeleteSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
+ public bool DoDeleteSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
List<CommonDevice> listDevice, List<SceneUI> listSceneUI)
{
var roomTemp = memberShardInfo.dicShardRoom[nowRoom.FileName];
@@ -1307,7 +1283,6 @@
}
listDeleteFile.Add(device.FilePath);
}
-
//鍐嶅紕鍦烘櫙
foreach (var sceneUI in listSceneUI)
{
@@ -1399,12 +1374,12 @@
}
//鎵ц绉婚櫎鍒嗕韩鏁版嵁
- var result = await this.DoDeleteSharedContent(memberShardInfo, nowRoom, listMark, listDeleteFile);
+ var result = this.DoDeleteSharedContent(memberShardInfo, nowRoom, listMark, listDeleteFile);
//鍚屾鎴块棿鏂囦欢
if (result == true && listDeleteFile.Contains(roomTemp.FileName) == false)
{
//鎵ц涓婁紶鎴块棿瀵硅薄
- result = await this.DoUploadRoomObject(memberShardInfo, roomTemp);
+ result = this.DoUploadRoomObject(memberShardInfo, roomTemp);
}
//鍚屾妤煎眰鏁版嵁
if (result == true && listDeleteFile.Contains(roomTemp.FileName) == true)
@@ -1412,16 +1387,19 @@
int floorCount = 0;
foreach (var myRoom in memberShardInfo.dicShardRoom.Values)
{
- if (myRoom.FloorId == roomTemp.FloorId) { floorCount++; }
+ //2020.03.24杩藉姞:涓嶈兘鏄嚜韬埧闂�
+ if (myRoom.FloorId == roomTemp.FloorId && myRoom.Id != roomTemp.Id)
+ {
+ floorCount++;
+ }
}
if (floorCount == 0)
{
//濡傛灉璇ユゼ灞傚凡缁忓垹瀹屾埧闂翠簡,鍒欐洿鏂版ゼ灞�
memberShardInfo.dicShardFloor.Remove(roomTemp.FloorId);
//鎵ц涓婁紶瀵硅薄
- result = await this.DoUploadFloorObject(memberShardInfo);
+ result = this.DoUploadFloorObject(memberShardInfo);
}
-
}
if (result == false)
@@ -1448,7 +1426,7 @@
/// <param name="listMark">瑕佺Щ闄ょ殑涓婚敭</param>
/// <param name="listDeleteFile">瑕佸垹闄ょ殑鏂囦欢(鎴块棿鏂囦欢闇�瑕佸垹闄ょ殑璇�,蹇呴』鏀惧湪鏈�鍚�)</param>
/// <returns></returns>
- private async Task<bool> DoDeleteSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
+ private bool DoDeleteSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
List<string> listMark, List<string> listDeleteFile)
{
if (listMark.Count == 0)
@@ -1469,7 +1447,7 @@
info.DistributedMark = markKeys;
//鎵ц鍒犻櫎
- var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/DeleteShareData", false, info);
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/DeleteShareData", false, info, null, true);
if (result == false)
{
//鍏抽棴杩涘害鏉�
@@ -1500,7 +1478,7 @@
/// <param name="memberShardInfo">鎴愬憳鐨勫垎浜唴瀹�</param>
/// <param name="listDelFile">鍒犻櫎鐨勬枃浠�</param>
/// <returns></returns>
- private async Task<bool> DoDeleteSharedContent(MemberShardInfoData memberShardInfo, List<string> listDelFile)
+ private bool DoDeleteSharedContent(MemberShardInfoData memberShardInfo, List<string> listDelFile)
{
if (listDelFile.Count == 0)
{
@@ -1518,7 +1496,7 @@
info.DistributedMark = memberShardInfo.dicAllShardKeys[fileName];
//鎵ц鍒犻櫎
- var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/DeleteShareData", false, info);
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/DeleteShareData", false, info, null, true);
if (result == false)
{
return false;
@@ -1544,7 +1522,7 @@
/// <param name="memberShardInfo">鎴愬憳鐨勫叡浜唴瀹�</param>
/// <param name="upDateRoom">闇�瑕佷笂浼犲埌浜戠鐨勬埧闂村璞�</param>
/// <returns></returns>
- private async Task<bool> DoUploadRoomObject(MemberShardInfoData memberShardInfo, Common.Room upDateRoom)
+ private bool DoUploadRoomObject(MemberShardInfoData memberShardInfo, Common.Room upDateRoom)
{
if (upDateRoom.Id == "Other")
{
@@ -1558,7 +1536,7 @@
var data = Newtonsoft.Json.JsonConvert.SerializeObject(upDateRoom);
var byteData = System.Text.Encoding.UTF8.GetBytes(data);
info.ShareDataBytes = byteData;
- var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info);
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info, null, true);
if (result == false)
{
return false;
@@ -1578,7 +1556,7 @@
/// </summary>
/// <param name="memberShardInfo">鎴愬憳鐨勫叡浜唴瀹�</param>
/// <returns></returns>
- private async Task<bool> DoUploadFloorObject(MemberShardInfoData memberShardInfo)
+ private bool DoUploadFloorObject(MemberShardInfoData memberShardInfo)
{
var info = new EditorShardContent();
info.DistributedMark = memberShardInfo.dicAllShardKeys[DirNameResourse.ShardFloorFile];
@@ -1588,7 +1566,7 @@
var data = Newtonsoft.Json.JsonConvert.SerializeObject(memberShardInfo.dicShardFloor);
var byteData = System.Text.Encoding.UTF8.GetBytes(data);
info.ShareDataBytes = byteData;
- var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info);
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info, null, true);
if (result == false)
{
return false;
@@ -1695,7 +1673,7 @@
/// <param name="listBindScene">缁戝畾鐨勫満鏅璞�</param>
private void GetSceneBindListKeys(Common.SceneUI scene, ref Dictionary<string, string> dicDeviceKeys, ref List<SceneUI> listBindScene)
{
- foreach (var data in scene.AddSceneMemberDataList)
+ foreach (var data in scene.AdjustTargetList)
{
//璁惧
if (data.Type == 0)
@@ -1726,7 +1704,7 @@
/// <param name="listKeys">涓婚敭鍒楄〃(璁惧鍜屽満鏅�)</param>
private void GetSceneBindListKeys(Common.SceneUI scene, ref HashSet<string> listKeys)
{
- foreach (var data in scene.AddSceneMemberDataList)
+ foreach (var data in scene.AdjustTargetList)
{
//璁惧
if (data.Type == 0)
--
Gitblit v1.8.0