ValveKeyValue 0.11.0.378
dotnet add package ValveKeyValue --version 0.11.0.378
NuGet\Install-Package ValveKeyValue -Version 0.11.0.378
<PackageReference Include="ValveKeyValue" Version="0.11.0.378" />
paket add ValveKeyValue --version 0.11.0.378
#r "nuget: ValveKeyValue, 0.11.0.378"
// Install ValveKeyValue as a Cake Addin #addin nuget:?package=ValveKeyValue&version=0.11.0.378 // Install ValveKeyValue as a Cake Tool #tool nuget:?package=ValveKeyValue&version=0.11.0.378
<h1><img src="./Misc/logo.png" width="64" align="center"> Valve's KeyValue for .NET</h1>
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 aInvalidDataException
.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 | Versions 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. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages (9)
Showing the top 5 NuGet packages that depend on ValveKeyValue:
Package | Downloads |
---|---|
GameFinder.StoreHandlers.Steam
Library for finding games installed with Steam. |
|
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 库 |
|
HedgeModManager.Steam
Package Description |
GitHub repositories (5)
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.11.0.378 | 1,543 | 7/3/2024 |
0.10.0.360 | 78,098 | 3/22/2024 |
0.9.0.267 | 82,609 | 6/5/2023 |
0.8.2.162 | 157,282 | 8/26/2022 |
0.8.0.139 | 4,003 | 2/9/2022 |
0.8.0.133 | 1,036 | 2/4/2022 |
0.7.1 | 990 | 1/13/2022 |
0.6.0.5 | 1,312 | 9/8/2021 |
0.5.0.4 | 3,181 | 9/17/2020 |
0.4.2 | 1,574 | 7/30/2020 |
0.4.1 | 902 | 7/29/2020 |
0.3.1.152 | 3,481 | 6/23/2020 |
0.3.0.149 | 860 | 6/23/2020 |
0.3.0.144 | 1,792 | 3/4/2020 |
0.2.1.107 | 3,497 | 1/16/2018 |
0.2.0.105 | 1,443 | 1/13/2018 |
0.1.0.102-AppVeyor | 1,241 | 1/13/2018 |
0.0.1 | 2,310 | 3/31/2016 |
View release notes at https://github.com/ValveResourceFormat/ValveKeyValue/releases