30 lines
579 B
C#
30 lines
579 B
C#
using System.Xml.Linq;
|
|
|
|
namespace OF_DL.Utils;
|
|
|
|
internal static class XmlUtils
|
|
{
|
|
// When true, return original text without parsing/stripping.
|
|
public static bool Passthrough { get; set; } = false;
|
|
|
|
public static string EvaluateInnerText(string xmlValue)
|
|
{
|
|
if (Passthrough)
|
|
{
|
|
return xmlValue;
|
|
}
|
|
|
|
try
|
|
{
|
|
XElement parsedText = XElement.Parse($"<root>{xmlValue}</root>");
|
|
return parsedText.Value;
|
|
}
|
|
catch
|
|
{
|
|
// ignored
|
|
}
|
|
|
|
return "";
|
|
}
|
|
}
|