Example #1
0
        private void GetHexadecimalString(Tokenizer tokenizer)
        {
            Token nextToken = tokenizer.TokenExcludedComments();

            StringBuilder token = new StringBuilder();

            while (nextToken.ToString() != ">")
            {
                token.Append(HexadecimalEscaper.FilterNonHexCharAndUpperCase(nextToken.ToString()));

                nextToken = tokenizer.TokenExcludedComments();
            }
            value = HexadecimalEscaper.ConvertHexToString(token.ToString());
        }
Example #2
0
        private static string Escape(string literalString)
        {
            StringBuilder literalStringEscaped = new StringBuilder();
            int           i = 0;

            while (i < literalString.Length)
            {
                if (literalString[i] == '#' && i < literalString.Length - 2)
                {
                    HexadecimalEscaper hexEscaper = new HexadecimalEscaper();

                    literalStringEscaped.Append(hexEscaper.GetValue(literalString.Substring(i + 1, 2)));
                    i += 3;
                }
                else
                {
                    literalStringEscaped.Append(literalString[i]);
                    i++;
                }
            }
            return(literalStringEscaped.ToString());
        }