1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- namespace XGame.Framework.FileSystem
- {
- /// <summary>
- /// 文件夹操作接口
- /// </summary>
- public interface IDirectoryOperator
- {
- /// <summary>
- /// 新建文件夹(逐级新建)
- /// </summary>
- /// <param name="fullDirectory">文件夹全路径</param>
- /// <returns>True: 新建成功; False: 新建失败</returns>
- bool Mkdir(string fullDirectory);
- /// <summary>
- /// 删除文件夹
- /// </summary>
- /// <param name="fullDirectory">文件夹全路径</param>
- /// <param name="includeSelf">删除自身</param>
- /// <returns>True: 删除成功; False: 删除失败;</returns>
- bool Delete(string fullDirectory, bool includeSelf = true);
- /// <summary>
- /// 文件夹是否存在
- /// </summary>
- /// <param name="fullDirectory">文件夹全路径</param>
- /// <returns>True: 存在; False: 不存在;</returns>
- bool Exist(string fullDirectory);
- /// <summary>
- /// 复制(含子文件夹和子文件)
- /// </summary>
- /// <param name="source">源文件夹</param>
- /// <param name="destination">目标文件夹(清空)</param>
- /// <returns>True: 复制成功; False: 复制失败</returns>
- bool Copy(string source, string destination, bool overwrite);
- /// <summary>
- /// 获取文件夹名
- /// </summary>
- /// <param name="fullDirectory">文件夹全路径</param>
- /// <returns>文件夹名(最后一个"/")</returns>
- string GetDirectoryName(string fullDirectory);
- /// <summary>
- /// 获取文件夹下的所有文件或者文件夹的路径
- /// </summary>
- /// <param name="fullDirectory">文件夹全路径</param>
- /// <returns></returns>
- string[] GetFileSystemEntries(string fullDirectory);
- /// <summary>
- /// 异步删除文件夹
- /// </summary>
- /// <param name="fullDirectory">完整路径</param>
- /// <param name="includeSelf">是否包含自身</param>
- /// <returns></returns>
- IDeleteDirectoryAsync DeleteAsync(string fullDirectory, bool includeSelf = true);
- /// <summary>
- /// 重命名
- /// </summary>
- /// <param name="from"></param>
- /// <param name="to"></param>
- /// <returns></returns>
- bool Rename(string from, string to);
- /// <summary>
- /// 获取文件夹下指定拓展名文件
- /// </summary>
- /// <param name="fullDirectory">根文件夹全路径</param>
- /// <param name="extension">拓展名(".xxx")</param>
- /// <param name="recursion">递归</param>
- /// <returns></returns>
- string[] GetFiles(string fullDirectory, string extension, bool recursion = true);
- }
- }
|