Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchLeaders committed Dec 6, 2023
1 parent 5950c5f commit 105991a
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,39 @@ Modern implementation of (some) EPD MessageStudio file formats written in manage

- MSBT (**M**essage **S**tudio **B**inary **T**ext)

## Setup
### MSBT Usage

> From Binary
```cs
byte[] data = File.ReadAllBytes("path/to/file.msbt");
Msbt msbt = Msbt.FromBinary(data);
```
...

> From Binary (Constructor)
```cs
byte[] data = File.ReadAllBytes("path/to/file.msbt");
Msbt msbt = new(data);
```

> To Binary
```cs
/* ... */

using MemoryStream ms = new();
msbt.ToBinary(ms,
endianness: Endian.Little,
encoding: Encoding.Unicode // Encoding.UTF8 is not supported!
);
```

> To Yaml
```cs
/* ... */

string yaml = msbt.ToYaml();

// For performance, use ReadOnlyMsbt
byte[] data = File.ReadAllBytes("path/to/file.msbt");
ReadOnlyMsbt readOnlyMsbt = new(data);
string yaml = readOnlyMsbt.ToYaml();
```

0 comments on commit 105991a

Please sign in to comment.