| | |
| | | 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> |
| | | public static string CreateRegionBackup(string regionId) |
| | |
| | | foreach (var fileName in ReadRegionFiles(path)) |
| | | { |
| | | File.Delete(Path.Combine(path, fileName)); |
| | | MainPage.Log("Del region file :" + fileName); |
| | | } |
| | | } |
| | | |
| | |
| | | foreach (FileInfo NextFile in thFolders) |
| | | { |
| | | index++; |
| | | if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "Register_File" || NextFile.Name == "AccountListDB") |
| | | if (NextFile.Name == "headImage.png") |
| | | { |
| | | continue; |
| | | } |
| | | if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "UserInfo_File" || NextFile.Name == "AccountListDB") |
| | | { |
| | | continue; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 遍历文件 |
| | | /// </summary> |
| | | public static List<string> ReadFiles(bool reInit = true) |
| | | public static List<string> ReadFiles() |
| | | { |
| | | List<string> listFiles = new List<string>(); |
| | | DirectoryInfo TheFolder = new DirectoryInfo(RootPath); |
| | |
| | | { |
| | | listFiles.Add(NextFile.Name); |
| | | } |
| | | try |
| | | { |
| | | if (reInit) |
| | | { |
| | | MainPage.LocationFiles = listFiles; |
| | | } |
| | | } |
| | | catch { } |
| | | return listFiles; |
| | | } |
| | | |
| | |
| | | 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}"); |
| | | } |
| | | } |
| | | |