code/Athena0.0.1/common/Util/File/DirFileHelper.cs
(开头部分) 31KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Text;
using System.IO;
using System.Data;
using System.Web;
namespace Athena.common.Util
{
/// <summary>
/// 文件操作夹
/// </summary>
public static class DirFileHelper
{
#region 检测指定目录是否存在
/// <summary>
/// 检测指定目录是否存在
/// </summary>
/// <param name="directoryPath">目录的绝对路径</param>
/// <returns></returns>
public static bool IsExistDirectory(string directoryPath)
{
return Directory.Exists(directoryPath);
}
#endregion
#region 检测指定文件是否存在,如果存在返回true
/// <summary>
/// 检测指定文件是否存在,如果存在则返回true。
/// </summary>
/// <param name="filePath">文件的绝对路径</param>
public static bool IsExistFile(string filePath)
{
return System.IO.File.Exists(filePath);
}
#endregion
#region 获取指定目录中的文件列表
/// <summary>
/// 获取指定目录中所有文件列表
/// </summary>
/// <param name="directoryPath">指定目录的绝对路径</param>
public static string[] GetFileNames(string directoryPath)
{
//如果目录不存在,则抛出异常
if (!IsExistDirectory(directoryPath))
{
throw new FileNotFoundException();
}
//获取文件列表
return Directory.GetFiles(directoryPath);
}
#endregion
#region 获取指定目录中所有子目录列表,若要搜索嵌套的子目录列表,请使用重载方法.
/// <summary>
/// 获取指定目录中所有子目录列表,若要搜索嵌套的子目录列表,请使用重载方法.
/// </summary>
/// <param name="directoryPath">指定目录的绝对路径</param>
public static string[] GetDirectories(string directoryPath)
{
后面还有 771 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
