From 9cc8fd11b13813adbdd3c6c31554e5c0bebf4026 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 21 八月 2020 19:53:49 +0800 Subject: [PATCH] 发布到商店的版本 --- ZigbeeApp/Shared/Phone/TemplateData/TemplateCommonLogic.cs | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 39 insertions(+), 8 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/TemplateData/TemplateCommonLogic.cs b/ZigbeeApp/Shared/Phone/TemplateData/TemplateCommonLogic.cs index 4537e58..6c72608 100755 --- a/ZigbeeApp/Shared/Phone/TemplateData/TemplateCommonLogic.cs +++ b/ZigbeeApp/Shared/Phone/TemplateData/TemplateCommonLogic.cs @@ -130,7 +130,7 @@ //璇诲彇妯℃澘Bin鏂囦欢 if (templateBinFile != string.Empty) { - bool hadRoom = HdlRoomLogic.Current.GetAllListRooms().Count > 1; + bool hadRoom = HdlRoomLogic.Current.GetAllListRooms().Count > 1 && Common.Config.Instance.Home.FloorDics.Count == 0; //寮�濮嬭鍙栨枃浠跺唴瀹� this.ReadTemplateFileMethord((strData, saveDiv, deviceType) => { @@ -192,6 +192,7 @@ { //鍙垵濮嬪寲涓�娆�,鏈夋埧闂存椂浠h〃宸茬粡涓嶆槸绗竴娆″姞杞戒簡 Common.Config.Instance.Home.FloorDics = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(this.strTempContentData); + Common.Config.Instance.Home.Save(false); } this.strTempContentData = string.Empty; return true; @@ -265,6 +266,16 @@ //鍐嶆鍒濆鍖栨埧闂� HdlRoomLogic.Current.InitAllRoom(); + + //鏃犳ā鏉挎ā寮忔椂,鎭㈠澶囦唤鐨勬椂鍊�,鎶婂浠芥枃浠跺垹闄� + if (Common.Config.Instance.Home.TemplateMode != 2) + { + //瀛樻斁鐨勮矾寰� + string fullFile = System.IO.Path.Combine(DirNameResourse.LocalTemplateDirectory, TemplateFileName); + HdlFileLogic.Current.DeleteFile(fullFile); + } + //瑕嗙洊鐗╃悊璁惧鎵�鍦ㄧ殑鎴块棿鏁版嵁 + HdlFileLogic.Current.SaveFileContent(DirNameResourse.DeviceRoomIdFile, this.modelData.dicDeviceTemplateRealRoom); } /// <summary> @@ -285,6 +296,7 @@ else if (strData == "#FloorInfo END#") { Common.Config.Instance.Home.FloorDics = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(this.strTempContentData); + Common.Config.Instance.Home.Save(false); this.strTempContentData = string.Empty; return true; } @@ -1493,9 +1505,9 @@ /// 鑾峰彇闇�瑕佸崌绾х殑缃戝叧瀵硅薄(key:鏈湴缃戝叧鐨刬d value:鍗囩骇鍥轰欢鍦板潃,绗竴浣嶆槸Linux,绗簩浣嶆槸鍗忚皟鍣�,涔嬪悗閮芥槸铏氭嫙椹卞姩) /// </summary> /// <returns></returns> - public Dictionary<string, List<string>> GetNeedToUpdateGateway() + public Dictionary<string, List<GatewayNeedUpdateInfo>> GetNeedToUpdateGateway() { - var dicGateway = new Dictionary<string, List<string>>(); + var dicGateway = new Dictionary<string, List<GatewayNeedUpdateInfo>>(); //寰幆缃戝叧鍖归厤鐨勬ā鏉� foreach (var localId in this.modelData.dicGatewayTemplateSelect.Keys) { @@ -1514,8 +1526,9 @@ } var tempGateway = this.modelData.dicGatewayInfo[tempId]; //鍒濆鍖栧鍣� - dicGateway[localId] = new List<string>() { null, null }; + var listUpdateInfo = new List<GatewayNeedUpdateInfo>() { null, null }; + bool needUpdate = false; //Linux鐗堟湰姣旇緝 if (tempGateway.LinuxFirmwareVersion != localGateway.LinuxFirmwareVersion) { @@ -1524,7 +1537,11 @@ if (System.IO.File.Exists(updateFile) == true) { //濡傛灉瀛樺湪鐨勮瘽 - dicGateway[localId][0] = updateFile; + var info = new GatewayNeedUpdateInfo(); + info.Div = 1; + info.FullFileName = updateFile; + listUpdateInfo[0] = info; + needUpdate = true; } } //鍗忚皟鍣ㄧ増鏈瘮杈� @@ -1535,7 +1552,11 @@ if (System.IO.File.Exists(updateFile) == true) { //濡傛灉瀛樺湪鐨勮瘽 - dicGateway[localId][1] = updateFile; + var info = new GatewayNeedUpdateInfo(); + info.Div = 2; + info.FullFileName = updateFile; + listUpdateInfo[1] = info; + needUpdate = true; } } //铏氭嫙椹卞姩姣旇緝 @@ -1546,19 +1567,29 @@ foreach (var tempCode in tempGateway.DriveCodeList) { //闃叉瀹冩斁鐨勯『搴忎笉鏍� - if (localCode.DriveId == tempCode.DriveId && localCode.DriveFwVersion != tempCode.DriveFwVersion) + if (localCode.DriveCode == tempCode.DriveCode && localCode.DriveFwVersion != tempCode.DriveFwVersion) { //铏氭嫙椹卞姩鍗囩骇鍥轰欢鏂囦欢鍏ㄨ矾寰� string updateFile = HdlFirmwareUpdateLogic.GetGatewayDriveCodeFirmwareFile(tempCode); if (System.IO.File.Exists(updateFile) == true) { //濡傛灉瀛樺湪鐨勮瘽 - dicGateway[localId].Add(updateFile); + var info = new GatewayNeedUpdateInfo(); + info.Div = 3; + info.DriveCode = tempCode.DriveCode; + info.FullFileName = updateFile; + listUpdateInfo.Add(info); + needUpdate = true; } } } } } + //娣诲姞鐩爣缂撳瓨 + if (needUpdate == true) + { + dicGateway[localId] = listUpdateInfo; + } } return dicGateway; -- Gitblit v1.8.0