| | |
| | | string fullDir = string.Empty;
|
| | | if (upPath == string.Empty)
|
| | | {
|
| | | //将模板数据保存到到指定的文件夹中
|
| | | var templateName = TemplateData.TemplateCommonLogic.Current.GetNewTemplateFileName();
|
| | | var templateFile = TemplateData.TemplateCommonLogic.Current.SaveTemplateDataToFile(templateName, "HomeTemplate");
|
| | |
|
| | | //将模板bin文件移动到备份文件夹中
|
| | | try { System.IO.File.Move(templateFile, System.IO.Path.Combine(Config.Instance.FullPath, templateName)); }
|
| | | catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex, "移动模板失败"); }
|
| | |
|
| | | //获取本地文件
|
| | | listAllFile = HdlFileLogic.Current.GetRootPathListFile();
|
| | | fullDir = Common.Config.Instance.FullPath;
|
| | |
| | |
|
| | | foreach (string fileName in listAllFile)
|
| | | {
|
| | | //判断指定文件是否需要上传(根目录的才判断)
|
| | | if (upPath == string.Empty && this.IsNotUpLoadFile(fileName) == true)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (fileName.EndsWith(".png") == true
|
| | | || fileName.EndsWith(".bin") == true)
|
| | | {
|
| | |
| | | Shared.Common.CommonPage.BackKeyCanClick = true;
|
| | | UserCenterResourse.AccountOption.AppCanSignout = true;
|
| | | return false;
|
| | | }
|
| | | //判断是否是应该上传的文件
|
| | | if (IsNotUpLoadFile(file) == true && upPath == string.Empty)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | //整理数据
|
| | | var datainfo = new FileInfoData();
|
| | |
| | | //关闭进度条
|
| | | ProgressFormBar.Current.Close();
|
| | |
|
| | | //清空全部房间
|
| | | HdlRoomLogic.Current.DeleteAllRoom();
|
| | | //清空本地全部的场景数据
|
| | | HdlSceneLogic.Current.DeleteAllLocalScene();
|
| | | //如果读取到的文件完全没有问题,则清理本地的文件
|
| | | HdlFileLogic.Current.DeleteAllLocationFile(false);
|
| | |
|
| | | //清理本地的模板文件
|
| | | TemplateData.TemplateCommonLogic.Current.DeleteAllLocalFile();
|
| | |
|
| | | //没有错误的话,则移动到当前住宅文件夹下面
|
| | | HdlFileLogic.Current.MoveDirectoryFileToHomeDirectory(tempDirectory, true);
|
| | |
| | | /// </summary>
|
| | | /// <param name="file"></param>
|
| | | /// <returns></returns>
|
| | | private bool IsNotUpLoadFile(string file)
|
| | | public bool IsNotUpLoadFile(string file)
|
| | | {
|
| | | if (file.StartsWith("Device_") == true
|
| | | || file.StartsWith("Gateway_") == true
|
| | | || file.StartsWith("Room_") == true
|
| | | || file.StartsWith("Scene_") == true)
|
| | | if (file == "Config.json")
|
| | | {
|
| | | //设备,网关,房间,场景文件不需要上传,它已经保存在bin模板文件中
|
| | | //不能覆盖Config文件
|
| | | return true;
|
| | | }
|
| | | return false;
|