Skip to content

Commit 4223b7a

Browse files
authored
Update readme
1 parent 49e8e24 commit 4223b7a

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ dotnet add package KeyValues2
88
```
99

1010
```cs
11-
using var Datamodel;
11+
using Datamodel;
1212

1313
// Load a file with unknown layout
14-
var dm = Datamodel.Load("my_file.dmx");
14+
using var dm = Datamodel.Load("my_file.dmx");
1515
var element = dm.Root;
1616
var value = element.Get<string>("my_property");
1717

1818
// Load a file with a known layout
19-
var map = Datamodel.Load<CMapRootElement>("fy_pool.vmap");
19+
using var map = Datamodel.Load<CMapRootElement>("fy_pool.vmap");
2020
var root = (CMapRootElement)map.Root;
2121
Debug.Assert(root.IsPrefab == false);
2222

2323
// Layout definition
2424
// Full implementation can be found here:
25-
/// https://github.com/ValveResourceFormat/Datamodel.NET/blob/master/Tests/ValveMap.cs
25+
// https://github.com/ValveResourceFormat/Datamodel.NET/blob/master/Tests/ValveMap.cs
2626
[LowercaseProperties]
2727
class CMapRootElement : Element
2828
{
@@ -60,26 +60,27 @@ HelloWorld.Save("hello world.dmx", "keyvalues2", 1); // must provide an encoding
6060
}
6161
```
6262

63-
## Datamodel Attributes
63+
## Attributes
6464

65-
The following CLR types are supported as Datamodel attributes:
65+
The following .NET types are supported as Datamodel attributes:
6666

6767
* `int`
6868
* `float`
6969
* `bool`
7070
* `string`
7171
* `byte`
7272
* `byte[]`
73+
* `Vector2`
74+
* `Vector3`
75+
* `Vector4` / `Quaternion`
76+
* `Matrix4x4`
7377
* `ulong`
7478
* `System.TimeSpan`
7579

7680
Additionally, the following Datamodel.NET types are supported:
7781

7882
* `Element` (a named collection of attributes)
79-
* `Vector2`
80-
* `Vector3` / `QAngle`
81-
* `Vector4` / `Quaternion`
82-
* `Matrix` (4x4)
83+
* `QAngle`
8384

8485
`IList<T>` collections of the above types are also supported. (This can be a bit confusing given that both `byte` and `byte[]` are valid attribute types; use the `ByteArray` type if you run into trouble.)
8586

0 commit comments

Comments
 (0)