wxr
2020-11-20 a40db3104e6d5d8a5d146ad808e5bb1ad6c8cb07
HDL_ON/DAL/FileUtils.cs
@@ -1,13 +1,8 @@
using System;
using System.IO;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Shared;
//using HDL_ON.UI;
using HDL_ON.DAL.Net;
using HDL_ON.DAL;
using HDL_ON.Entity;
namespace HDL_ON
{
@@ -15,6 +10,17 @@
    {
        public static string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/";
        /// <summary>
        /// 是否存在文件夹
        /// </summary>
        /// <returns></returns>
        public static bool IsExisFolder(string folderName)
        {
            bool result = false;
            var path = Path.Combine(RootPath, folderName);
            result = Directory.Exists(path);
            return result;
        }
        /// <summary>
        /// 创建一个住宅的备份文件夹
        /// </summary>
@@ -45,7 +51,6 @@
            foreach (var fileName in ReadRegionFiles(path))
            {
                File.Delete(Path.Combine(path, fileName));
                MainPage.Log("Del region file :" + fileName);
            }
        }
@@ -79,7 +84,7 @@
                {
                    continue;
                }
                if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "Register_File" || NextFile.Name == "AccountListDB")
                if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "UserInfo_File" || NextFile.Name == "AccountListDB")
                {
                    continue;
                }
@@ -207,10 +212,9 @@
            for (int j = 0; j < filesList.Count; j++)
            {
                var f = filesList[j];
                if (f == "linphonerc" || f == "AccountListDB" || f == "Register_File")
                if (f == "linphonerc" || f == "AccountListDB" || f == "UserInfo_File")
                    continue;
                DeleteFile(f);
                MainPage.Log($"Del file :{f}");
            }
        }
@@ -434,7 +438,7 @@
                    FileStream fs = null;
                    try
                    {
                        HDL_ON.DAL.Net.MyWebClient webClient = new HDL_ON.DAL.Net.MyWebClient();
                        MyWebClient webClient = new MyWebClient();
                        byte[] recevieBytes = webClient.DownloadData(new Uri(url));
                        fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
                        fs.Write(recevieBytes, 0, recevieBytes.Length);