Initial commit
This commit is contained in:
21
MkvToolnixWrapper/MkvInfo/NodeUtils.cs
Normal file
21
MkvToolnixWrapper/MkvInfo/NodeUtils.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace MkvPropEditWrapper.MkvInfo;
|
||||
|
||||
public static class NodeUtils
|
||||
{
|
||||
public static IEnumerable<MkvNode> Descendants(this MkvNode root)
|
||||
{
|
||||
var nodes = new Stack<MkvNode>(new[] {root});
|
||||
|
||||
while (nodes.Any())
|
||||
{
|
||||
var node = nodes.Pop();
|
||||
|
||||
yield return node;
|
||||
|
||||
foreach (var newNode in node.Children)
|
||||
{
|
||||
nodes.Push(newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user