gnome-vfs-sharp[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4]2.20.0.0Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.File Operations; basic POSIX-style file operations.
using Gnome.Vfs;
using System;
using System.Text;
namespace Test.Gnome.Vfs {
public class TestSync {
static void Main (string[] args)
{
if (args.Length != 1) {
Console.WriteLine ("Usage: TestSync <uri>");
return;
}
Gnome.Vfs.Vfs.Initialize ();
Gnome.Vfs.Uri uri = new Gnome.Vfs.Uri (args[0]);
Handle handle = Sync.Open (uri, OpenMode.Read);
UTF8Encoding utf8 = new UTF8Encoding ();
byte[] buffer = new byte[1024];
Result result = Result.Ok;
while (result == Result.Ok) {
ulong bytesRead;
result = Sync.Read (handle, out buffer[0],
(ulong)buffer.Length, out bytesRead);
Console.WriteLine ("result read '{0}' = {1}", uri, result);
if (bytesRead == 0)
break;
Console.WriteLine ("read ({0} bytes) : '{1}'",
bytesRead, utf8.GetString (buffer, 0, (int)bytesRead));
}
string test;
result = Sync.FileControl (handle, "file:test", out test);
Console.WriteLine ("result filecontrol '{0}' = {1}", uri, result);
Console.WriteLine ("result file:test = {0}", test);
result = Sync.Close (handle);
Console.WriteLine ("result close '{0}' = {1}", uri, result);
Gnome.Vfs.Vfs.Shutdown ();
}
}
}
System.ObjectMethodGnome.Vfs.ResultClose file associated with .
a a To be addedMethodGnome.Vfs.HandleCreate uri according to . representing the to create.
.
Whether the file should be created in "exclusive" mode: i.e. if this flag is true, the operation will fail if a file with the same name already exists.
Bitmap representing the for the newly created file (Unix style).
a To be addedMethodGnome.Vfs.HandleCreate according to . for the file to create.
.
Whether the file should be created in "exclusive" mode: i.e. if this flag is true, the operation will fail if a file with the same name already exists.
Bitmap representing the for the newly created file (Unix style).
a To be addedMethodGnome.Vfs.HandleOpen uri according to . representing the to open.
.
a To be addedMethodGnome.Vfs.HandleOpen according to . to open.
.
a To be addedMethodGnome.Vfs.ResultRead specified number of bytes from the uri . of the file to read data from.
array that must be at least as large as the specified number of bytes to read. The array needs to be passed as "out buffer[0]".
The number of bytes to read.
The number of bytes actually read.
a As with Unix system calls, the number of bytes read can effectively be less than the specified number of bytes on return and will be stored in bytes_read.MethodGnome.Vfs.ResultSet the current position for reading/writing through . for which the current position must be changed.
value representing the starting position.
number of bytes to skip from the position specified by (a positive value means to move forward; a negative one to move backwards).
a To be addedMethodGnome.Vfs.ResultWrite number of bytes from buffer byte array into the file pointed to be . of the file to write data to.
array containing the data to be written.
number of bytes to write.
number of bytes actually written.
a As with Unix system calls, the number of bytes written can effectively be less than the specified number or bytes on return and will be stored in bytes_written.MethodGnome.Vfs.ResultReturn the current position on . This is the point in the file pointed to by that reads and writes will occur on. for which the current position must be retrieved.
Contains the position on return.
a To be addedMethodGnome.Vfs.ResultTruncate the file represented by uri to the specified length. Data past the new length will be discarded. representation of .
length of the new file.
a To be addedMethodGnome.Vfs.ResultTruncate the file pointed at by to the specified length. Data past the new length will be discarded. to the file to be truncated.
length of the new file.
a To be addedMethodGnome.Vfs.ResultExecute a backend dependent operation specified by the string operation.
a to the file to affect.
operation to execute.
data needed to execute the operation.
a This is typically used for specialized vfs backends that need additional operations that gnome-vfs doesn't have. Compare it to the unix call ioctl(). The format of data depends on the operation. Operation that are backend specific are normally namespaced by their module name.