ValveKeyValue 0.10.0.360

There is a newer version of this package available.
See the version list below for details.
dotnet add package ValveKeyValue --version 0.10.0.360                
NuGet\Install-Package ValveKeyValue -Version 0.10.0.360                
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="ValveKeyValue" Version="0.10.0.360" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ValveKeyValue --version 0.10.0.360                
#r "nuget: ValveKeyValue, 0.10.0.360"                
#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 ValveKeyValue as a Cake Addin
#addin nuget:?package=ValveKeyValue&version=0.10.0.360

// Install ValveKeyValue as a Cake Tool
#tool nuget:?package=ValveKeyValue&version=0.10.0.360                

<h1><img src="./Misc/logo.png" width="64" align="center"> Valve's KeyValue for .NET</h1>

Build Status (GitHub) NuGet Coverage Status

This library aims to be fully compatible with Valve's various implementations of KeyValues format parsing (believe us, it's not consistent).

KeyValues1

Used by Steam and the Source engine.

Deserializing text

Basic deserialization

var stream = File.OpenRead("file.vdf"); // or any other Stream

var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
KVObject data = kv.Deserialize(stream);

Console.WriteLine(data["some key"]);

Typed deserialization

public class SimpleObject
{
    public string Name { get; set; }
    public string Value { get; set; }
}

var stream = File.OpenRead("file.vdf"); // or any other Stream

var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
KVObject data = kv.Deserialize<SimpleObject>(stream);

Options

Deserialize method also accepts an KVSerializerOptions object.

By default, operating system specific conditionals are enabled based on the OS the code is running on (RuntimeInformation).

KVSerializerOptions accepts has the following options:

  • Conditions - List of conditions to use to match conditional values.
  • HasEscapeSequences - Whether the parser should translate escape sequences (e.g. \n, \t).
  • EnableValveNullByteBugBehavior - Whether invalid escape sequences should truncate strings rather than throwing a InvalidDataException.
  • FileLoader - Provider for referenced files with #include or #base directives.
var options = new KVSerializerOptions
{
    HasEscapeSequences = true,
};
options.Conditions.Clear(); // Remove default conditionals set by the library
options.Conditions.Add("X360WIDE");

var stream = File.OpenRead("file.vdf");

var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
var data = kv.Deserialize(stream, options);

Deserializing binary

Essentially the same as text, just change KeyValues1Text to KeyValues1Binary.

Serializing to text

class DataObject
{
    public string Name { get; set; }

    public string Developer { get; set; }

    [KVProperty("description")]
    public string Summary { get; set; }

    [KVIgnore]
    public string ExtraData { get; set; }
}

var data = new DataObject
{
    Developer = "Valve Software",
    Name = "Dota 2",
    Summary = "Dota 2 is a complex game.",
    ExtraData = "This will not be serialized."
};

using var stream = File.OpenWrite("file.vdf");

var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
kv.Serialize(stream, data, "root object name");

Serializing to binary

Essentially the same as text, just change KeyValues1Text to KeyValues1Binary.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on ValveKeyValue:

Package Downloads
GameFinder.StoreHandlers.Steam

Library for finding games installed with Steam.

HGV.Basilius

Clients for download hero, ability, and items from daily cache provided by DotaBuff

GameLib.NET

GameLib.NET is a library to give .NET developers easy access to the users installed game launchers and installed games.

ValveResourceFormat

Library to decompile Valve Source 2 files

BD.SteamClient

次元超越 SteamClient 库

GitHub repositories (6)

Showing the top 5 popular GitHub repositories that depend on ValveKeyValue:

Repository Stars
KSP-CKAN/CKAN
The Comprehensive Kerbal Archive Network
ValveResourceFormat/ValveResourceFormat
🔬 Valve's Source 2 resource file format parser, decompiler, and exporter.
terrymacdonald/DisplayMagician
DisplayMagician is an open source tool for automatically configuring your displays and sound for a game or application from a single Windows Shortcut.
overtools/OWLib
Toolchain that lets you interact with the Overwatch files and extract models and stuff.
ruarai/CompilePal
A tool to assist in the compiling of source engine maps
Version Downloads Last updated
0.12.0.391 241 11/2/2024
0.11.0.378 8,425 7/3/2024
0.10.0.360 98,079 3/22/2024
0.9.0.267 84,860 6/5/2023
0.8.2.162 160,603 8/26/2022
0.8.0.139 4,005 2/9/2022
0.8.0.133 1,037 2/4/2022
0.7.1 996 1/13/2022
0.6.0.5 1,313 9/8/2021
0.5.0.4 3,192 9/17/2020
0.4.2 1,577 7/30/2020
0.4.1 904 7/29/2020
0.3.1.152 5,212 6/23/2020
0.3.0.149 863 6/23/2020
0.3.0.144 1,793 3/4/2020
0.2.1.107 3,500 1/16/2018
0.2.0.105 1,448 1/13/2018
0.1.0.102-AppVeyor 1,244 1/13/2018
0.0.1 2,314 3/31/2016