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)); }
public string Encode(string data) { return(Encode(stringEncoder.EncodeFromString(data))); }