Redid the tree again.
[Gitrdone.git] / NodeSorter.cs
blob3a9e02f71ac531a94cf04404c6d8b69a1a066ffa
1 using System;
2 using System.Collections;
3 using System.Text;
4 using System.Windows.Forms;
6 namespace Gitrdone
8 public class NodeSorter : IComparer
10 public int Compare(object x, object y)
12 TreeNode tx = x as TreeNode;
13 TreeNode ty = y as TreeNode;
15 // Compare the length of the strings, returning the difference.
16 if (tx.Nodes.Count > 0 && ty.Nodes.Count < 1)
17 return -1;
18 if (tx.Nodes.Count < 1 && ty.Nodes.Count > 0)
19 return 1;
21 return string.Compare(tx.Text, ty.Text);