Ejemplo n.º 1
0
        public byte[] ProcessData(byte[] data)
        {
            var stringData = stringEncoder.EncodeToString(data);
            var sb         = new StringBuilder();

            var matches    = varRegex.Matches(stringData);
            var startIndex = 0;

            for (var i = 0; i < matches.Count; ++i)
            {
                var match    = matches[i];
                var varKey   = match.Groups[1].Value;
                var varValue = GetVarValue(varKey);
                sb.Append(stringData.Substring(startIndex, match.Index - startIndex));
                sb.Append($"<span class=\"{options.VarValueSpanClass}\">{varValue}</span>");
                startIndex = match.Index + match.Value.Length;
            }
            sb.Append(stringData.Substring(startIndex));
            var replacedString = sb.ToString();

            return(stringEncoder.EncodeFromString(replacedString));
        }
Ejemplo n.º 2
0
 public string Encode(string data)
 {
     return(Encode(stringEncoder.EncodeFromString(data)));
 }