wx.FileSys.FileSystem Class Reference

Inheritance diagram for wx.FileSys.FileSystem:

wx.Object

List of all members.

Public Member Functions

void ChangePathTo (string location)
void ChangePathTo (string location, bool is_dir)
 FileSystem ()
string FindFirst (string wildcard, KindOfFile kind)
string FindNext ()
FSFile OpenFile (string location)

Static Public Member Functions

static void AddHandler (FileSystemHandler handler)
static void CleanUpHandlers ()

Properties

string Path [get, set]


Detailed Description

This wrapps wxFileSystem but concentrates on the methods that are not already implemented in the .NET framework.

Constructor & Destructor Documentation

wx.FileSys.FileSystem.FileSystem (  ) 

The wxWidgets file system uses instances created by the default constructor as handles for accessing files systems of various types through something like an URL. File system are implemented by a handler (refer to class FileSystemHandler). This wrapper to the .NET framework also allows file system handlers to be written in C# or another CRL language.


Member Function Documentation

static void wx.FileSys.FileSystem.AddHandler ( FileSystemHandler  handler  )  [static]

Adds the provided instance as a handler to the handler list. Refer for instance to MemoryFSHandler for a wrapper to a standard wxWidgets resource handler. Note, that all inheritors of FileSystemHandler may be used here.

The native object wrapped by handler will be owned by the singleton managing file system handlers. This will raise an exception, if te handler instance is already shared by another object.

Please refer also to CleanUpHandlers().

void wx.FileSys.FileSystem.ChangePathTo ( string  location  ) 

void wx.FileSys.FileSystem.ChangePathTo ( string  location,
bool  is_dir 
)

Sets the current location. location parameter passed to OpenFile is relative to this path. Caution! Unless is_dir is true the location parameter is not the directory name but the name of the file in this directory. All these commands change the path to "dir/subdir/":

        FileSystem fs=new FileSystem();
        fs.ChangePathTo("dir/subdir/xh.htm");
        fs.ChangePathTo("dir/subdir", true);
        fs.ChangePathTo("dir/subdir/", true);
Parameters:
location the new location. Its meaning depends on the value of is_dir
is_dir if true location is new directory. If false (default) location is file in the new directory.
Example:
  f = fs -> OpenFile("hello.htm"); // opens file 'hello.htm'
  fs -> ChangePathTo("subdir/folder", true);
  f = fs -> OpenFile("hello.htm"); // opens file 'subdir/folder/hello.htm' !!

static void wx.FileSys.FileSystem.CleanUpHandlers (  )  [static]

Clean up all installed file handlers. Calling this method is unfortunately necessary on shutting down applications installing some kinds of file system handlers by using AddHandler(). The reason is: wxWidgets will delete the C++ instances of installed file system handlers on shutting down. However, wxWidgets can of course not delete the corresponding .NET instances. These may also try to delete C++ instances on being disposed. So, we will likely to get access violations.

string wx.FileSys.FileSystem.FindFirst ( string  wildcard,
KindOfFile  kind 
)

Returns name of the first filename (within filesystem's current path) that matches wildcard. flags may be one of KindOfFile.wxFILE (only files), KindOfFile.wxDIR (only directories) or KindOfFile.Indifferent (both).

Returns filename or empty string if no more matching file exists.

string wx.FileSys.FileSystem.FindNext (  ) 

Finds the next filename matching constraints of the previous FindFirst(). Returns filename or empty string if no more matching file exists.

FSFile wx.FileSys.FileSystem.OpenFile ( string  location  ) 

Opens the file and returns a FSFile object or null if failed. It first tries to open the file in relative scope (based on value passed to ChangePathTo() method) and then as an absolute path.


Property Documentation

string wx.FileSys.FileSystem.Path [get, set]

Returns the path according to ChangePathTo(). Setting this value is synonym to ChangePathTo().


Manual of the wx.NET   (c) 2003-2011 the wx.NET project at   Get wx.NET at SourceForge.net. Fast, secure and Free Open Source software downloads