2004-11-02 19:17:05 +00:00
|
|
|
using GLib;
|
2004-11-01 20:03:30 +00:00
|
|
|
using Gnome.Vfs;
|
|
|
|
using System;
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
namespace Test.Gnome.Vfs {
|
|
|
|
public class TestInfo {
|
2004-11-02 19:17:05 +00:00
|
|
|
private static MainLoop loop;
|
|
|
|
|
2004-11-01 20:03:30 +00:00
|
|
|
static void Main (string[] args)
|
|
|
|
{
|
|
|
|
if (args.Length != 1) {
|
|
|
|
Console.WriteLine ("Usage: TestDirectory <uri>");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Gnome.Vfs.Vfs.Initialize ();
|
|
|
|
|
|
|
|
FileInfo[] entries = Gnome.Vfs.Directory.GetEntries (args[0]);
|
|
|
|
|
2004-11-02 19:17:05 +00:00
|
|
|
Console.WriteLine ("Directory {0} contains {1} entries:", args[0], entries.Length);
|
|
|
|
foreach (FileInfo info in entries) {
|
|
|
|
//Console.WriteLine (info.Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
Gnome.Vfs.Directory.GetEntries (args[0], FileInfoOptions.Default,
|
|
|
|
20, (int)Gnome.Vfs.Async.Priority.Default,
|
|
|
|
new AsyncDirectoryLoadCallback (OnDirectoryLoad));
|
|
|
|
|
|
|
|
loop = new MainLoop ();
|
|
|
|
loop.Run ();
|
2004-11-01 20:03:30 +00:00
|
|
|
|
|
|
|
Gnome.Vfs.Vfs.Shutdown ();
|
|
|
|
}
|
2004-11-02 19:17:05 +00:00
|
|
|
|
|
|
|
private static void OnDirectoryLoad (Result result, FileInfo[] entries, uint entries_read)
|
|
|
|
{
|
|
|
|
Console.WriteLine ("DirectoryLoad: {0}", result);
|
|
|
|
if (result != Result.Ok && result != Result.ErrorEof) {
|
|
|
|
loop.Quit ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Console.WriteLine ("read {0} entries", entries_read);
|
|
|
|
foreach (FileInfo info in entries) {
|
|
|
|
//Console.WriteLine (info.Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Result.ErrorEof)
|
|
|
|
loop.Quit ();
|
|
|
|
}
|
2004-11-01 20:03:30 +00:00
|
|
|
}
|
|
|
|
}
|