2020-01-18 03:29:39 +00:00
|
|
|
# MoonTools.NETPhysFS
|
2016-01-27 18:05:23 +00:00
|
|
|
|
2020-01-18 03:29:39 +00:00
|
|
|
## PhysFS wrapper for .NET Standard
|
2016-01-27 18:05:23 +00:00
|
|
|
|
2020-01-18 03:29:39 +00:00
|
|
|
This library is a .NET Standard wrapper around the cross-platform IO libary [PhysFS](https://icculus.org/physfs/).
|
|
|
|
It provides *IEnumerable* iterators to avoid creating garbage, and a *Stream* subclass for easy usage.
|
2016-01-31 10:38:14 +00:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
2020-01-18 03:29:39 +00:00
|
|
|
You can use this library by adding it as a submodule and then referencing it in your .csproj file.
|
2016-01-31 10:38:14 +00:00
|
|
|
|
2020-01-18 03:29:39 +00:00
|
|
|
```sh
|
|
|
|
git submodule add
|
|
|
|
```
|
2017-03-08 22:07:28 +00:00
|
|
|
|
2020-01-18 03:29:39 +00:00
|
|
|
You must include a compiled binary of PhysFS for your platform for this to work properly.
|
2017-04-12 18:51:25 +00:00
|
|
|
|
2020-01-18 03:29:39 +00:00
|
|
|
## Example
|
2017-04-12 18:51:25 +00:00
|
|
|
|
2020-01-18 03:29:39 +00:00
|
|
|
```csharp
|
|
|
|
using var pfs = new PhysFS(""); // automatic dispose pattern
|
|
|
|
using (var reader = new StreamReader(pfs.OpenRead("/helloworld.txt")))
|
2017-04-12 18:51:25 +00:00
|
|
|
{
|
|
|
|
var contents = reader.ReadToEnd();
|
|
|
|
}
|
2020-01-18 03:29:39 +00:00
|
|
|
```
|