/// <summary> /// 获取当前目录下的文件夹递归文件编码 /// </summary> private void InspectFaceFolderEncoding() { foreach (var temp in FaceFolder.GetDirectories()) { var folder = new EncodingScrutatorFolder(temp, InspectFileWhiteListSetting, IncludeFileSetting) { //IncludeFileSetting = IncludeFileSetting, //InspectFileWhiteListSetting = InspectFileWhiteListSetting, SitpulationEncodingSetting = SitpulationEncodingSetting, _includeRegexFile = _includeRegexFile, //Parent = FaceFolder, Parent = this, Progress = Progress }; Folder.Add(folder); //不包含 if (InspectFileWhiteListSetting.FolderWhiteList.Any(t => String.Equals(t, temp.Name))) { folder.Ignore = true; } if (!folder.Ignore) { //递归 folder.InspectFolderEncoding(); } } }
/// <summary> /// 获取文件夹所有文件的编码,异步函数 /// </summary> public static async Task InspectFolderEncodingAsync(EncodingScrutatorFolder encodingScrutatorFolder, IProgress <EncodingScrutatorFile> progress) { encodingScrutatorFolder.Progress = progress; //await new Task(encodingScrutatorFolder.InspectFolderEncoding); await Task.Run(() => encodingScrutatorFolder.InspectFolderEncoding()); }