/// <summary> /// 返回文件保存的路径,无需指定的时间,默认为当前月份 /// </summary> /// <param name="dirPath">存放的主路径</param> /// <param name="category">文件存放的类型</param> /// <param name="enumMethod">枚举:文件路径组织的类型</param> /// <returns></returns> public static string GetFilePath(string dirPath, string category, EnumFileDirSaveMethod enumMethod) { CL.UI.Logic.DirPath.DirPathRule result = null; if (enumMethod == EnumFileDirSaveMethod.DateFirst) { CL.UI.Logic.DirPath.DirPathRule dirRule = new CL.UI.Logic.DirPath.DirPathRule(dirPath); CL.UI.Logic.DirPath.DateRule dateRule = new CL.UI.Logic.DirPath.DateRule(dirRule); result = new UI.Logic.DirPath.CategoryRule(dateRule, category); } else { CL.UI.Logic.DirPath.DirPathRule dirRule = new CL.UI.Logic.DirPath.DirPathRule(dirPath); CL.UI.Logic.DirPath.CategoryRule categoryRule = new UI.Logic.DirPath.CategoryRule(dirRule, category); result = new CL.UI.Logic.DirPath.DateRule(categoryRule); } return(result.GetPath()); }
/// <summary> /// 确保一个路径的存在 /// 判断,如果没有,会主动创建 /// </summary> /// <param name="dirPath">存放的主路径</param> /// <param name="category">文件存放的类型</param> /// <param name="enumMethod">枚举:文件路径组织的类型</param> public static void EnsureDirectoryExists(string dirPath, string category, EnumFileDirSaveMethod enumMethod) { CL.Common.Commons.FileIOHelper.CreateDirectory(GetFilePath(dirPath, category, enumMethod)); }