public string ParseParameters(string inputText) { //Begin text Parameters Match parameterMatch = null; do { parameterMatch = BaseParameterRegex.Match(inputText); if (parameterMatch.Success) { var ParameterNameMatch = ParameterNameExtractorRegex.Match(parameterMatch.Value); var parameterOrderNumberMatch = ParameterNumberExtractorRegex.Match(parameterMatch.Value); bool parameterReplaced = false; if (ParameterNameMatch.Success && parameterOrderNumberMatch.Success) { var ProceduralTextParameterParserKey = new ProceduralTextParameterParserKey(Convert.ToInt32(parameterOrderNumberMatch.Value), ParameterNameMatch.Value); if (ProceduralTextParameterParser.TextParameter.ContainsKey(ProceduralTextParameterParserKey)) { //We replace the parameter text by a template that will be hidden by image inputText = inputText.Substring(0, parameterMatch.Index) + ProceduralTextParameterParser.TextParameter[ProceduralTextParameterParserKey] + inputText.Substring(parameterMatch.Index + parameterMatch.Value.Length, inputText.Length - (parameterMatch.Index + parameterMatch.Value.Length)); parameterReplaced = true; } } if (!parameterReplaced) { //We remove the parameter text inputText = inputText.Substring(0, parameterMatch.Index) + inputText.Substring(parameterMatch.Index + parameterMatch.Value.Length, inputText.Length - (parameterMatch.Index + parameterMatch.Value.Length)); } } } while (parameterMatch.Success); //End text parameters //Begin text parameters int cnt = 0; foreach (char c in ProceduralText.RichTextQuadRegex.Replace(inputText, "@")) { if (c == '@') { cnt++; } } for (int i = cnt - 1; i >= 0; i--) { this.ParametersImage.Push(ProceduralTextParameterParser.ImagesParametersOrdered[i]); } //End text parameters return(inputText); }
public bool Equals(ProceduralTextParameterParserKey other) { return(ParameterNb == other.ParameterNb && ParameterType == other.ParameterType); }