本文整理汇总了C#中FilePath.GetFileList方法的典型用法代码示例。如果您正苦于以下问题:C# FilePath.GetFileList方法的具体用法?C# FilePath.GetFileList怎么用?C# FilePath.GetFileList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath.GetFileList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckDates
private void CheckDates(string dateType, DateTime filterDate, bool? direction)
{
var outputList = new List<string>();
var outputBuilder = new StringBuilder();
var excludeExtensionList = new List<string>
{
"sln",
"db"
};
var excludeFileNameList = new List<string>
{
"listfilesbydate_log_"
};
var excludeFilePathList = new List<string>
{
"deploy",
".vs",
"argos-localizer",
".git"
};
var multiThreadingHelper = new MultiThreadingHelper();
var filePath = new FilePath(multiThreadingHelper);
var fileList = filePath.GetFileList(_initialDirectory, null, excludeExtensionList, null, excludeFileNameList, null, excludeFilePathList).Distinct();
outputBuilder.Append($"Start: {DateTime.Now}{Environment.NewLine}{Environment.NewLine}");
Parallel.ForEach(fileList,
file =>
{
// DateTime.Today, Time.LastWrite
if (_checkFileDates.IsDifferent(file, dateType, filterDate, direction))
{
var checkFiles = _checkFileDates.For(file);
var output =
$"{checkFiles.FileName}{Environment.NewLine}" +
$"{checkFiles.CreationTime}{Environment.NewLine}" +
$"{checkFiles.LastWriteTime}{Environment.NewLine}" +
$"{checkFiles.LastAccessTime}{Environment.NewLine}{Environment.NewLine}";
outputList.Add(output);
}
});
outputList.ForEach(o => outputBuilder.Append(o));
outputBuilder.Append($"End: {DateTime.Now}{Environment.NewLine}{Environment.NewLine}");
_result = outputBuilder.ToString();
File.AppendAllText([email protected]"{_loggingPath}\ListFilesByDate_Log_{DateTime.Now:yyyy-MM-dd_HHmm}.txt", _result);
}