From ce032d8e4d8c66cc96af769f9a6c0a63fba3d3bf Mon Sep 17 00:00:00 2001 From: LumaLivy Date: Thu, 4 Nov 2021 00:57:42 -0400 Subject: [PATCH] Add another TaggedStringElement definition to support multiple key value pairs in XML tags --- ProjectLighthouse/Serialization/LbpSerializer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ProjectLighthouse/Serialization/LbpSerializer.cs b/ProjectLighthouse/Serialization/LbpSerializer.cs index 9bec4cb2..29fc17fd 100644 --- a/ProjectLighthouse/Serialization/LbpSerializer.cs +++ b/ProjectLighthouse/Serialization/LbpSerializer.cs @@ -26,6 +26,11 @@ namespace LBPUnion.ProjectLighthouse.Serialization public static string TaggedStringElement(string key, object value, string tagKey, object tagValue) => $"<{key} {tagKey}=\"{tagValue}\">{value}"; + public static string TaggedStringElement(string key, object value, Dictionary attrKeyValuePairs) + => $"<{key} " + + Enumerable.Aggregate(attrKeyValuePairs, string.Empty, (current, kvp) => current + $"{kvp.Key}=\"{kvp.Value}\" ") + + $">{value}"; + public static string Elements (params KeyValuePair[] pairs) => pairs.Aggregate(string.Empty, (current, pair) => current + StringElement(pair));