From 78b2d6025553a14af1cd434a20a1f546e2c4e502 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 11 Feb 2024 11:38:05 +0200 Subject: [PATCH] Add serialize overload that accepts KVFile --- .../ValveKeyValue.Test/Test Data/apisurface.txt | 1 + ValveKeyValue/ValveKeyValue/KVSerializer.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/ValveKeyValue/ValveKeyValue.Test/Test Data/apisurface.txt b/ValveKeyValue/ValveKeyValue.Test/Test Data/apisurface.txt index df6a3c9c..45ccb132 100644 --- a/ValveKeyValue/ValveKeyValue.Test/Test Data/apisurface.txt +++ b/ValveKeyValue/ValveKeyValue.Test/Test Data/apisurface.txt @@ -119,6 +119,7 @@ public class ValveKeyValue.KVSerializer public int GetHashCode(); public Type GetType(); protected object MemberwiseClone(); + public void Serialize(System.IO.Stream stream, ValveKeyValue.KVFile data, ValveKeyValue.KVSerializerOptions options); public void Serialize(System.IO.Stream stream, ValveKeyValue.KVObject data, ValveKeyValue.KVSerializerOptions options); public void Serialize(System.IO.Stream stream, ValveKeyValue.TData data, string name, ValveKeyValue.KVSerializerOptions options); public string ToString(); diff --git a/ValveKeyValue/ValveKeyValue/KVSerializer.cs b/ValveKeyValue/ValveKeyValue/KVSerializer.cs index aad3234c..23e03a85 100644 --- a/ValveKeyValue/ValveKeyValue/KVSerializer.cs +++ b/ValveKeyValue/ValveKeyValue/KVSerializer.cs @@ -74,6 +74,15 @@ public void Serialize(Stream stream, KVObject data, KVSerializerOptions options visitor.Visit(data); } + /// + /// Serializes a KeyValue object into stream. + /// + /// The stream to serialize into. + /// The data to serialize. + /// Options to use that can influence the serialization process. + public void Serialize(Stream stream, KVFile data, KVSerializerOptions options = null) => + Serialize(stream, data, options); + /// /// Serializes a KeyValue object into stream in plain text.. ///