使用来遍历文件和目录计划

检测设备2021年09月06日

private rayList myList = new rayList();

}//public class FileDirectoryEnumerable : numerable

/// summary

/// 文件和目录的遍历器

/// /summary

/// remarks本对象为Win32API函数 FindFirstFile , FindNextFile

/// 和 FindClose 的一个包装

///

/// 以下代码演示使用了 FileDirectoryEnumerator

///

/// FileDirectoryEnumerator e = new FileDirectoryEnumerator();

/// archPath = @\"c:\\\";

/// set();

/// turnStringType = true ;

/// while (veNext())

/// {

/// iteLine

/// ( String(\"yyyy-MM-dd HH:mm:ss\")

/// + \" \" + leLength + \" \\t\" + );

/// }

/// ose();

而卧室支摆放着一张1米宽的床、一张小桌和一台书柜。堂屋里的灯泡坏了 /// adLine();

///

/// 编写 袁永福 ( )/remarks

public class FileDirectoryEnumerator : numerator

{

#region 表示对象当前状态的数据和属性 **********************************

/// summary

/// 当前对象

/// /summary

private object objCurrentObject = null;

private bool bolIsEmpty = false;

/// summary

/// 该目录为空

/// /summary

public bool IsEmpty

{

get { return bolIsEmpty; }

}

private int intSearchedCount = 0;

/// summary

/// 已找到的对象的个数

/// /summary

public int SearchedCount

{

get { return intSearchedCount; }

}

private bool bolIsFile = true;

/// summary

/// 当前对象是否为文件,若为true则当前对象为文件,否则为目录

/// /summary

public bool IsFile

{

get { return bolIsFile; }

}

private int intLastErrorCode = 0;

/// summary

/// 最后一次操作的Win32错误代码

/// /summary

public int LastErrorCode

{

get { return intLastErrorCode; }

}

/// summary

/// 当前对象的名称

/// /summary

public string Name

{

get

{

if (jCurrentObject != null)

{

if (objCurrentObject is string)

return (string)jCurrentObject;

else

return ((leSystemInfo)jCurrentObject).Name;

}

return null;

}

}

/// summary

/// 当前对象属性

/// /summary

public leAttributes Attributes

{

get { return (leAttributes)FileAttributes; }

}

/// summary

/// 当前对象创建时间

/// /summary

public teTime CreationTime

{

get

{

long time = ToLong(CreationTime_dwHighDateTime, CreationTime_dwLowDateTime);

teTime dtm = omFileTimeUtc(time);

return LocalTime();

}

}

/// summary

/// 当前对象最后访问时间

/// /summary

public teTime LastAccessTime

{

get

{

long time = ToLong(LastAccessTime_dwHighDateTime, LastAccessTime_dwLowDateTime);

teTime dtm = omFileTimeUtc(time);

return LocalTime();

}

}

/// summary

/// 当前对象最后保存时间

/// /summary

public teTime LastWriteTime

{

get

{

long time = ToLong(LastWriteTime_dwHighDateTime, LastWriteTime_dwLowDateTime);

teTime dtm = omFileTimeUtc(time);

return LocalTime();

}

}

/// summary

/// 当前文件长度,若为当前对象为文件则返回文件长度,若当前对象为目录则返回0

/// /summary

public long FileLength

{

get

{

if (lIsFile)

return ToLong(ileSizeHigh, ileSizeLow);

else

return 0;

}

}

#endregion

查看本文来源

沈阳治疗宫颈糜烂哪家好
广州治疗白癜风医院哪好
女性卫生用品
相关阅读
恭喜!千万粉丝网红“小刚学长”当爸,亲自帮妻子按摩不必要血栓

对于身为百万粉丝网成员的小马上,同窗来说,五四绝对是一个值得庆祝的往...

2024-09-05
职场情商课:掌控“现像效应”,发挥积极作用,遵从自己的内心

本文看点:惯常effect是心理学之外的专业术语,又指乐队烟火effect,又叫“随...

2024-07-27
热门 抱怨是最浪费力气且没用的事情。 内心强大,是抗击一切痛苦的前提。 活着比什么都重要,活在当下。

热门 抱怨是最浪费力气且就让的事情。 内心强盛,是抵御一切病痛的前提。...

2024-06-29
公职考试也看“家庭背景”,这3类人很有优势,考上机会很大!

公详的垄断压力却是是一年比一年大,每年省详、国详都是几十上百万人报上...

2024-06-23
【手慢无】Plus会员专享47元 京东自营帅气竞走雨衣

2022-06-23 09:18:04 所作:张军 随着夏末暴雨的预示,打工人出门需要更高的随...

2024-05-05
你曾经羡慕的人,在起初都貌似完美无缺

你以前喜欢的人,在先前都貌似完美无缺。即便当他逐渐四分五裂转化成一堆...

2024-02-23
友情链接