KeyValues2 0.5.0

dotnet add package KeyValues2 --version 0.5.0                
NuGet\Install-Package KeyValues2 -Version 0.5.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KeyValues2" Version="0.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KeyValues2 --version 0.5.0                
#r "nuget: KeyValues2, 0.5.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install KeyValues2 as a Cake Addin
#addin nuget:?package=KeyValues2&version=0.5.0

// Install KeyValues2 as a Cake Tool
#tool nuget:?package=KeyValues2&version=0.5.0                

Datamodel.NET is a CLR library which implements the Datamodel structure and Datamodel Exchange file format.

Datamodel is a strongly-typed generic data structure designed by Valve Corporation for use in their games. Datamodel Exchange is a Datamodel container file format with multiple possible encodings; binary and ASCII ("keyvalues2") are included.

Datamodel Attributes

The following CLR types are supported as Datamodel attributes:

  • int
  • float
  • bool
  • string
  • byte
  • byte[]
  • ulong
  • System.TimeSpan

Additionally, the following Datamodel.NET types are supported:

  • Element (a named collection of attributes)
  • Vector2
  • Vector3 / QAngle
  • Vector4 / Quaternion
  • Matrix (4x4)

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.)

Datamodel.NET features

  • Threaded, thread-safe
  • Support for all known versions of Valve's binary and keyvalues2 DMX encodings
  • Convenient IEnumerable, INotifyPropertyChanged and INotifyCollectionChanged implementations
  • Supports partial trust
  • Inline documentation
  • Binary codec supports just-in-time attribute loading
  • Write your own codecs with the ICodec interface
  • Support for property based attributes, Datamodel.Element subclassing (serialize only)

Quick example

var HelloWorld = new Datamodel.Datamodel("helloworld", 1); // must provide a format name (can be anything) and version

HelloWorld.Root = new Datamodel.Element(HelloWorld, "my_root");
HelloWorld.Root["Hello"] = "World"; // any supported attribute type can be assigned

var MyString = HelloWorld.Root.Get<string>("Hello");

HelloWorld.Save("hello world.dmx", "keyvalues2", 1); // must provide an encoding name and version
<--! dmx encoding keyvalues2 1 format helloworld 1>
{
    "Hello" "string" "World"
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on KeyValues2:

Package Downloads
ValveResourceFormat

Library to decompile Valve Source 2 files

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on KeyValues2:

Repository Stars
ValveResourceFormat/ValveResourceFormat
🔬 Valve's Source 2 resource file format parser, decompiler, and exporter.
Version Downloads Last updated
0.5.0 542 9/25/2024
0.5.0-beta 4,277 3/11/2024
0.4.0 750 1/22/2024
0.3.0 6,623 6/30/2023
0.2.0 204 5/3/2023