黄学彪
2019-11-25 5727cf0b9b54da0a191dd1e23cb5abf21320fbff
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs
@@ -151,7 +151,7 @@
            }
            //删除文件
            string strroot = UserCenterResourse.LocalRootPath;
            string strroot = Common.Config.Instance.FullPath;
            var backPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupdeleteDirectory);
            foreach (var file in listData)
            {
@@ -183,7 +183,7 @@
            }
            //删除文件
            string strroot = UserCenterResourse.LocalRootPath;
            string strroot = Common.Config.Instance.FullPath;
            var backPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory);
            foreach (var file in listData)
            {
@@ -219,7 +219,7 @@
        /// <returns></returns>
        public static List<string> GetAutoBackupEditorFile()
        {
            string strroot = UserCenterResourse.LocalRootPath;
            string strroot = Common.Config.Instance.FullPath;
            var path = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory);
            return GetFileFromDirectory(path);
@@ -231,7 +231,7 @@
        /// <returns></returns>
        public static List<string> GetAutoBackupDeleteFile()
        {
            string strroot = UserCenterResourse.LocalRootPath;
            string strroot = Common.Config.Instance.FullPath;
            var path = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupdeleteDirectory);
            return GetFileFromDirectory(path);
@@ -269,12 +269,12 @@
        /// <param name="fileName">文件的名字,不含路径</param>
        public static void AddOrEditorFile(string fileName)
        {
            if (UserCenterResourse.LocalRootPath == string.Empty)
            //根目录
            string strroot = Common.Config.Instance.FullPath;
            if (strroot == string.Empty)
            {
                return;
            }
            //根目录
            string strroot = UserCenterResourse.LocalRootPath;
            //自动备份目录
            string strBackPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory);
@@ -306,12 +306,12 @@
        /// <param name="fileName">文件的名字,不含路径</param>
        public static void DeleteFile(string fileName)
        {
            if (UserCenterResourse.LocalRootPath == string.Empty)
            //根目录
            string strroot = Common.Config.Instance.FullPath;
            if (strroot == string.Empty)
            {
                return;
            }
            //根目录
            string strroot = UserCenterResourse.LocalRootPath;
            //自动删除备份目录
            string strBackPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupdeleteDirectory);
@@ -337,19 +337,19 @@
            //如果本地已经拥有了这个文件,则说明不是新手机,不再自动还原
            if (System.IO.File.Exists(checkFile) == true)
            {
                //同步服务器的取消了的分享内容
                await HdlShardLogic.Current.SynchronizeDeleteSharedContent();
                //同步服务器的分享内容
                await HdlShardLogic.Current.SynchronizeDbSharedContent();
                return 0;
            }
            //创建一个空文件
            var file = System.IO.File.Create(checkFile);
            file.Close();
            //暂时不支持成员
            if (UserCenterResourse.UserInfo.AuthorityNo == 3)
            {
                //同步服务器的分享内容
                await HdlShardLogic.Current.SynchronizeDbSharedContent();
                //创建一个空文件(标识已经完成同步)
                var file = System.IO.File.Create(checkFile);
                file.Close();
                return 1;
            }
@@ -357,14 +357,15 @@
            var data = await HdlBackupLogic.Current.GetBackupListNameFromDB(1);
            if (data == null)
            {
                //异常,删除检测文件
                System.IO.File.Delete(checkFile);
                return -1;
            }
            if (data.Count == 0)
            {
                //同步服务器的分享内容
                await HdlShardLogic.Current.SynchronizeDbSharedContent();
                //创建一个空文件(标识已经完成同步)
                var file = System.IO.File.Create(checkFile);
                file.Close();
                return 1;
            }
            //自动备份只有一个
@@ -388,8 +389,10 @@
            //没有错误的话,则移动到当前住宅文件夹下面
            Global.MoveDirectoryFileToHomeDirectory(tempDir, true);
            //同步服务器的取消了的分享内容
            await HdlShardLogic.Current.SynchronizeDeleteSharedContent();
            //创建一个空文件(标识已经完成同步)
            var file2 = System.IO.File.Create(checkFile);
            file2.Close();
            return 1;
        }
@@ -477,7 +480,7 @@
                //暂不支持成员
                return;
            }
            string strroot = UserCenterResourse.LocalRootPath;
            string strroot = Common.Config.Instance.FullPath;
            var path = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory);
            List<string> listFile1 = GetFileFromDirectory(path);
@@ -497,11 +500,11 @@
            string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupNotPromptedFile);
            if (System.IO.File.Exists(fullName) == false)
            {
                Application.RunOnMainThread(() =>
                {
                    var form = new HdlBackup.HdlAutoBackupSettionForm();
                    form.AddForm();
                });
                //Application.RunOnMainThread(() =>
                //{
                //    var form = new HdlBackup.HdlAutoBackupSettionForm();
                //    form.AddForm();
                //});
                return;
            }
            BackupNotPrompted info = null;
@@ -514,12 +517,12 @@
            }
            if (info.Day == 0)
            {
                Application.RunOnMainThread(() =>
                {
                    var form = new HdlBackup.HdlAutoBackupSettionForm();
                    form.AddForm();
                });
                return;
                //Application.RunOnMainThread(() =>
                //{
                //    var form = new HdlBackup.HdlAutoBackupSettionForm();
                //    form.AddForm();
                //});
                //return;
            }
            DateTime oldTime = Convert.ToDateTime(info.OldDay);
@@ -527,11 +530,11 @@
            //时间已经超过
            if (intDay > info.Day)
            {
                Application.RunOnMainThread(() =>
                {
                    var form = new HdlBackup.HdlAutoBackupSettionForm();
                    form.AddForm();
                });
                //Application.RunOnMainThread(() =>
                //{
                //    var form = new HdlBackup.HdlAutoBackupSettionForm();
                //    form.AddForm();
                //});
            }
        }