private static void SortFilesBeforeFolders(TreeNode root)
 {
     foreach (var node in TreeUtils.Flatten(root, (t) => t.Nodes.AsEnumerable()).ToList())
     {
         var nodes  = node.Nodes.AsEnumerable().ToList();
         var sorted = nodes.OrderBy(n => (ShowSubscriptionsForm.GetPath(n).EndsWith("/") ? "b " : "a ") + n.Name);
         node.Nodes.Clear();
         node.Nodes.AddRange(sorted.ToArray());
     }
 }
Exemple #2
0
 private IEnumerable <TreeNode> GetAllNodes(TreeNode root)
 {
     return(TreeUtils.Flatten(root, n => n.Nodes.Cast <TreeNode>()));
 }