diff --git a/ProjectLighthouse/Helpers/Extensions/StringExtensions.cs b/ProjectLighthouse/Helpers/Extensions/StringExtensions.cs index 0d4d4df1..72ef05af 100644 --- a/ProjectLighthouse/Helpers/Extensions/StringExtensions.cs +++ b/ProjectLighthouse/Helpers/Extensions/StringExtensions.cs @@ -6,7 +6,5 @@ namespace LBPUnion.ProjectLighthouse.Helpers.Extensions public static class StringExtensions { public static string ToFileName(this string text) => Path.GetInvalidFileNameChars().Aggregate(text, (current, c) => current.Replace(c.ToString(), "")); - - public static string ToSafeXml(this string text) => text.Replace("<", "<").Replace(">", ">"); } } \ No newline at end of file diff --git a/ProjectLighthouse/Serialization/LbpSerializer.cs b/ProjectLighthouse/Serialization/LbpSerializer.cs index 73a0c7f1..cfa64535 100644 --- a/ProjectLighthouse/Serialization/LbpSerializer.cs +++ b/ProjectLighthouse/Serialization/LbpSerializer.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; -using LBPUnion.ProjectLighthouse.Helpers.Extensions; namespace LBPUnion.ProjectLighthouse.Serialization { @@ -13,27 +12,22 @@ namespace LBPUnion.ProjectLighthouse.Serialization [SuppressMessage("ReSharper", "UnusedMember.Global")] public static class LbpSerializer { - // IMPORTANT: All functions using values must call .ToSafeXml(); public static string BlankElement(string key) => $"<{key}>"; - public static string StringElement(KeyValuePair pair) => $"<{pair.Key}>{pair.Value.ToString().ToSafeXml()}"; + public static string StringElement(KeyValuePair pair) => $"<{pair.Key}>{pair.Value}"; - public static string StringElement(string key, bool value) => $"<{key}>{value.ToString().ToLower().ToSafeXml()}"; + public static string StringElement(string key, bool value) => $"<{key}>{value.ToString().ToLower()}"; - public static string StringElement(string key, object value) => $"<{key}>{value.ToString().ToSafeXml()}"; + public static string StringElement(string key, object value) => $"<{key}>{value}"; public static string TaggedStringElement (KeyValuePair pair, KeyValuePair tagPair) - => $"<{pair.Key} {tagPair.Key}=\"{tagPair.Value.ToString().ToSafeXml()}\">{pair.Value.ToString().ToSafeXml()}"; + => $"<{pair.Key} {tagPair.Key}=\"{tagPair.Value}\">{pair.Value}"; - public static string TaggedStringElement - (string key, object value, string tagKey, object tagValue) - => $"<{key} {tagKey}=\"{tagValue.ToString().ToSafeXml()}\">{value.ToString().ToSafeXml()}"; + 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} " + - attrKeyValuePairs.Aggregate(string.Empty, (current, kvp) => current + $"{kvp.Key}=\"{kvp.Value.ToString().ToSafeXml()}\" ") + - $">{value.ToString().ToSafeXml()}"; + => $"<{key} " + attrKeyValuePairs.Aggregate(string.Empty, (current, kvp) => current + $"{kvp.Key}=\"{kvp.Value}\" ") + $">{value}"; public static string Elements (params KeyValuePair[] pairs)