| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 预创建个人中心全部的文件夹_________
|
| | |
|
| | | /// <summary>
|
| | | /// 预创建个人中心全部的文件夹
|
| | | /// </summary>
|
| | | public void CreatAllUserCenterDirectory()
|
| | | {
|
| | | //本地缓存的根目录
|
| | | this.CreateDirectory(DirNameResourse.LocalMemoryDirectory);
|
| | |
|
| | | //自动备份【文件夹】(编辑,追加)
|
| | | this.CreateDirectory(DirNameResourse.AutoBackupDirectory);
|
| | |
|
| | | //自动备份【文件夹】(删除)
|
| | | this.CreateDirectory(DirNameResourse.AutoBackupdeleteDirectory);
|
| | |
|
| | | //下载备份的时候所使用的临时【文件夹】
|
| | | this.CreateDirectory(DirNameResourse.DownLoadBackupTempDirectory);
|
| | |
|
| | | //保存安防记录的【文件夹】
|
| | | this.CreateDirectory(DirNameResourse.SafeguardAlarmDirectory);
|
| | |
|
| | | //下载分享文件的临时【文件夹】
|
| | | this.CreateDirectory(DirNameResourse.DownLoadShardDirectory);
|
| | |
|
| | | //LOG出力【文件夹】
|
| | | this.CreateDirectory(DirNameResourse.LogDirectory);
|
| | |
|
| | | //模板缓存存放的【文件夹】
|
| | | this.CreateDirectory(DirNameResourse.LocalTemplateDirectory);
|
| | | this.CreateDirectory(DirNameResourse.AllResidenceTemplateDirectory);
|
| | |
|
| | | //用户图片目录路径【文件夹】
|
| | | if (UserCenterResourse.AccountOption.UserPictruePath != string.Empty)
|
| | | {
|
| | | this.CreateDirectory(UserCenterResourse.AccountOption.UserPictruePath);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 文件保存和读取_____________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// 文件保存(整天忘记,所以建一个函数来玩玩)
|
| | | /// </summary>
|
| | | /// <param name="fullName">全路径</param>
|
| | | /// <param name="obj">需要序列化的东西</param>
|
| | | /// <param name="textValue">文本</param>
|
| | | public void SaveTextToFile(string fullName, string textValue)
|
| | | {
|
| | | var byteData = Encoding.UTF8.GetBytes(textValue);
|
| | | this.SaveByteToFile(fullName, byteData);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 文件保存(整天忘记,所以建一个函数来玩玩)
|
| | | /// </summary>
|
| | | /// <param name="fullName">全路径</param>
|
| | | /// <param name="byteData">byte数据</param>
|
| | | public void SaveByteToFile(string fullName, byte[] byteData)
|
| | | {
|
| | | if (byteData == null) { return; }
|
| | | //写入内容
|
| | | System.IO.FileStream fileStream = null;
|
| | | try
|
| | |
| | | return new List<string>();
|
| | | }
|
| | |
|
| | | List<string> list = new List<string>();
|
| | | var files = System.IO.Directory.GetFiles(directory);
|
| | | foreach (var file in files)
|
| | | var list = new List<string>();
|
| | | try
|
| | | {
|
| | | string fileName = file;
|
| | | if (onlyFileName == true)
|
| | | //2020.07.10的时候,出现过获取失败异常 提示:write fault on path
|
| | | var files = System.IO.Directory.GetFiles(directory);
|
| | | foreach (var file in files)
|
| | | {
|
| | | fileName = fileName.Substring(directory.Length + 1);
|
| | | string fileName = file;
|
| | | if (onlyFileName == true)
|
| | | {
|
| | | fileName = fileName.Substring(directory.Length + 1);
|
| | | }
|
| | | list.Add(fileName);
|
| | | }
|
| | | list.Add(fileName);
|
| | | }
|
| | | catch (Exception ex)
|
| | | { HdlLogLogic.Current.WriteLog(ex); }
|
| | |
|
| | | return list;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取根目录的全部文件列表
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public List<string> GetRootPathListFile()
|
| | | {
|
| | | return this.GetFileFromDirectory(Common.Config.Instance.FullPath);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | var rootPath = Common.Config.Instance.FullPath;
|
| | | foreach (var file in listFile)
|
| | | {
|
| | | if (file.StartsWith("ModelData_") == true)
|
| | | {
|
| | | //复制模板数据文件到指定文件夹
|
| | | TemplateData.TemplateCommonLogic.Current.CopyTemplateFileToLocalDirectory2(System.IO.Path.Combine(fulldirectory, file));
|
| | | continue;
|
| | | }
|
| | | string oldFile = System.IO.Path.Combine(fulldirectory, file);
|
| | | string newFile = System.IO.Path.Combine(rootPath, file);
|
| | | //移动文件
|