private IEnumerable <SafeUri> GetDirectories(GLib.IFile dir, bool followSymlinks) { var enumerator = dir.EnumerateChildren("standard::type,standard::name", followSymlinks ? FileQueryInfoFlags.None : FileQueryInfoFlags.NofollowSymlinks, null); foreach (FileInfo file in enumerator) { if ((file.FileType & FileType.Directory) != 0) { var ret = new SafeUri(System.IO.Path.Combine(dir.Path, file.Name), false); file.Dispose(); yield return(ret); } else { file.Dispose(); } } if (!enumerator.IsClosed) { enumerator.Close(null); enumerator.Dispose(); } }
static void gtml_reload() { GLib.IFile applications = GLib.FileFactory.NewForPath("./gtml"); GLib.KeyFile programs = new GLib.KeyFile(); bool load = false; if (GLib.FileFactory.NewForPath("./data").Exists) { if (GLib.FileFactory.NewForPath("./data/programs.gkf").Exists) { load = programs.LoadFromFile("./data/programs.gkf", gkfflags); } } else { GLib.FileFactory.NewForPath("./data").MakeDirectoryWithParents(null); } if (load == true) { if (programs.HasGroup("Programs")) { string[] names = programs.GetKeys("Programs"); int x = 0; while (names[x].Equals("") != true || names[x] != null) { string location = programs.GetString("Programs", names[x]); create_stacks(names[x], location); location = null; x++; break; } } else { System.Console.WriteLine("No linked programs in data."); } } else { System.Console.WriteLine("No linked programs\n"); } GLib.FileEnumerator apps = applications.EnumerateChildren("*", feflags, null); while (true) { GLib.FileInfo info = apps.NextFile(); if (info == null) { apps.Dispose(); break; } else { GLib.IFile outf = applications.GetChildForDisplayName(info.DisplayName); string name = info.DisplayName; if ((name.Equals(".") && name.Equals("..")) == false && (name.Length != 0 || name != null)) { string path = outf.Path; if (info.FileType == GLib.FileType.Directory) { create_stacks(name, path); /* * if (!gtk_stack_get_child_by_name (GTK_STACK(stack),path)) { * create_stacks (name,path); * } * * * * */ } } } } if (stack.CurrentPageWidget == null) { ; //gtml_import_full (); } }