diff --git a/RuriLib/Blocks/BlockFunction.cs b/RuriLib/Blocks/BlockFunction.cs index 58e4b7d..1e867a8 100644 --- a/RuriLib/Blocks/BlockFunction.cs +++ b/RuriLib/Blocks/BlockFunction.cs @@ -6,6 +6,7 @@ using System.Data; using System.Globalization; using System.IO; using System.Linq; +using System.Net; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; @@ -66,6 +67,12 @@ namespace RuriLib /// Decodes a URL-encoded input. URLDecode, + /// Encodes the input to be displayed in HTML or XML. + HTMLEntityEncode, + + /// Decoded an input containing HTML or XML entities. + HTMLEntityDecode, + /// Converts a unix timestamp to a formatted date. UnixTimeToDate, @@ -500,6 +507,14 @@ namespace RuriLib outputString = Base64Decode(localInputString); break; + case Function.HTMLEntityEncode: + outputString = WebUtility.HtmlEncode(localInputString); + break; + + case Function.HTMLEntityDecode: + outputString = WebUtility.HtmlDecode(localInputString); + break; + case Function.Hash: outputString = GetHash(localInputString, hashType).ToLower(); break;