MoonTools.NETPhysFS/README.md

36 lines
1.3 KiB
Markdown
Raw Normal View History

2016-01-27 18:05:23 +00:00
# SharpPhysFS
## PhysicsFS wrapper for .NET
This library is a wrapper around the [PhysFS library](https://icculus.org/physfs/) designed
to work with .NET languages. As such, it employs standard .NET behaviors such as *Exceptions*
and *IEnumerable*s to represent native objects. It also provides access to the underlying low-level
methods and a *Stream* subclass for easy use of the APIs.
2016-01-29 19:09:32 +00:00
The documentation for the methods is copied from the original doxygen and only slightly adapted.
## Platform support
2016-09-24 17:00:32 +00:00
The library is designed to work regardless of the underlying OS, so it should run on Windows, Linux
2016-01-29 19:09:32 +00:00
and OSX equally well. I haven't tested the OSX port though, and I only superficially tried it on Linux.
If anyone feels so inclined, he/she could contribute by testing it and reporting the results. This would
2016-01-31 10:38:14 +00:00
be greatly appreciated.
## Installation
You can use this library by compiling it as described in the [wiki](https://github.com/frabert/SharpPhysFS/wiki)
or by adding it as a reference using NuGet:
2016-09-24 17:00:32 +00:00
Install-Package SharpPhysFS
2017-03-08 22:07:28 +00:00
2017-04-12 18:51:25 +00:00
You should also include compiled shared library of physfs alongside your binary files to be loaded.
## Usage
````c#
using(var pfs = new PhysFS("")) // This ensures correct initialization and deinitialization
2017-05-28 12:47:02 +00:00
using(var reader = new StreamReader(pfs.OpenRead("/helloworld.txt")))
2017-04-12 18:51:25 +00:00
{
var contents = reader.ReadToEnd();
}
2017-05-28 12:47:02 +00:00
````