示例#1
0
        public static void Fill(TreeEntry entry, double chance)
        {
            double f;

            while ((f = r.NextDouble()) < chance)
            {
                var e = new TextTreeEntry(f.ToString());
                entry.Add(e);
                Fill(e, chance * chance);
            }
        }
示例#2
0
        void Discover(TreeEntry entry, DirectoryInfo di, int level, int maxlevel)
        {
            if (level > maxlevel)
            {
                return;
            }

            var child = new TextTreeEntry(di.Name);

            entry.Add(child);

            foreach (var dir in di.GetDirectories())
            {
                Discover(child, dir, level + 1, maxlevel);
            }
        }