mirror of
https://github.com/StarBeat/UnityDependencyAnalyzer.git
synced 2026-03-08 05:35:27 +08:00
加速目录遍历
This commit is contained in:
parent
fc84dc5f7e
commit
0f2937a67a
@ -25,9 +25,27 @@ namespace AssetDependencyGraph
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void TraverseDirectoryParallel(string path, Action<string> action)
|
||||||
|
{
|
||||||
|
Parallel.ForEach(Directory.EnumerateFileSystemEntries(path, "*", SearchOption.AllDirectories), action);
|
||||||
|
}
|
||||||
|
|
||||||
public static void TraverseDirectory(string path, Action<string> action, int depth = 1)
|
public static void TraverseDirectory(string path, Action<string> action, int depth = 1)
|
||||||
{
|
{
|
||||||
if(depth == 0)
|
//if (depth == -1)
|
||||||
|
//{
|
||||||
|
// //foreach (string file in Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories))
|
||||||
|
// //{
|
||||||
|
// // action.Invoke(file);
|
||||||
|
// //}
|
||||||
|
|
||||||
|
// //foreach (string directory in Directory.EnumerateDirectories(path, "*.*", SearchOption.AllDirectories))
|
||||||
|
// //{
|
||||||
|
// // action.Invoke(directory);
|
||||||
|
// //}
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (depth == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user