private void GenerateTree(TreeItem<FileSystemItem> node, int depth, int level = 0) { var itemCount = C.Random<int>(_fakingRules.GetItemCount(level)); var nodes = node.AddRange(C.CollectionOfFake<FileSystemItem>(itemCount, new { Type = _fakingRules.GetItemTypes(level), Name = new Range(8,13) })); foreach (var n in nodes) { n.Content.FullPath = n.Content.Path = node.Content.Path + "/" + n.Content.Name; n.Content.Size = C.Random<int>(0xFF, 0xFFFF); if (level < depth) GenerateTree(n, depth, level+1); } }
private void GenerateTree(TreeItem <FileSystemItem> node, int depth, int level = 0) { var itemCount = C.Random <int>(_fakingRules.GetItemCount(level)); var nodes = node.AddRange(C.CollectionOfFake <FileSystemItem>(itemCount, new { Type = _fakingRules.GetItemTypes(level), Name = new Range(8, 13) })); foreach (var n in nodes) { n.Content.FullPath = n.Content.Path = node.Content.Path + "/" + n.Content.Name; n.Content.Size = C.Random <int>(0xFF, 0xFFFF); if (level < depth) { GenerateTree(n, depth, level + 1); } } }