Skip to content

Commit 105991a

Browse files
committed
Update readme
1 parent 5950c5f commit 105991a

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

Readme.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,39 @@ Modern implementation of (some) EPD MessageStudio file formats written in manage
88

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

11-
## Setup
11+
### MSBT Usage
1212

13+
> From Binary
14+
```cs
15+
byte[] data = File.ReadAllBytes("path/to/file.msbt");
16+
Msbt msbt = Msbt.FromBinary(data);
1317
```
14-
...
18+
19+
> From Binary (Constructor)
20+
```cs
21+
byte[] data = File.ReadAllBytes("path/to/file.msbt");
22+
Msbt msbt = new(data);
23+
```
24+
25+
> To Binary
26+
```cs
27+
/* ... */
28+
29+
using MemoryStream ms = new();
30+
msbt.ToBinary(ms,
31+
endianness: Endian.Little,
32+
encoding: Encoding.Unicode // Encoding.UTF8 is not supported!
33+
);
34+
```
35+
36+
> To Yaml
37+
```cs
38+
/* ... */
39+
40+
string yaml = msbt.ToYaml();
41+
42+
// For performance, use ReadOnlyMsbt
43+
byte[] data = File.ReadAllBytes("path/to/file.msbt");
44+
ReadOnlyMsbt readOnlyMsbt = new(data);
45+
string yaml = readOnlyMsbt.ToYaml();
1546
```

0 commit comments

Comments
 (0)