MoonTools.NETPhysFS/README.md

33 lines
1.0 KiB
Markdown
Raw Normal View History

2020-01-18 03:29:39 +00:00
# MoonTools.NETPhysFS
2016-01-27 18:05:23 +00:00
2020-02-21 07:28:57 +00:00
[![Build Status](https://drone.moonside.games/api/badges/MoonsideGames/MoonTools.NETPhysFS/status.svg)](https://drone.moonside.games/MoonsideGames/MoonTools.NETPhysFS)
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
2020-03-03 01:49:53 +00:00
git submodule add https://gitea.moonside.games/MoonsideGames/MoonTools.NETPhysFS.git
2020-01-18 03:29:39 +00:00
```
2017-03-08 22:07:28 +00:00
2020-01-18 03:38:52 +00:00
You must also 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
```
2020-01-18 03:45:32 +00:00
## Acknowledgements
This project was forked from the very helpful SharpPhysFS by Francesco Bertolaccini.