public static ArrayList ProcessHeaderFooterFormula(string formulaExpression) { if (formulaExpression == null) { return(null); } ArrayList arrayList = new ArrayList(); string text = null; MatchCollection matchCollection = FormulaHandler.m_RegexAmpDetection.Matches(formulaExpression, 0); if (matchCollection == null || matchCollection.Count == 0) { text = formulaExpression; } else { int num = 0; string text2 = null; string text3 = null; for (int i = 0; i <= matchCollection.Count; i++) { text3 = ((i >= matchCollection.Count) ? formulaExpression.Substring(num, formulaExpression.Length - num) : formulaExpression.Substring(num, matchCollection[i].Index - num)); text3 = text3.Trim(); if (text3.Length > 0) { text = ((text != null) ? (text + "&" + text3) : text3); } if (i < matchCollection.Count) { text3 = formulaExpression.Substring(matchCollection[i].Index, matchCollection[i].Length); num = matchCollection[i].Index + matchCollection[i].Length; if (!(text3 == "&")) { text2 = text3.Trim(); int length = text2.Length; if (length > 1 && text2[0] == '"' && text2[length - 1] == '"') { text2 = text2.Substring(1, length - 2); } if (text != null) { Match match = FormulaHandler.m_RegexGlobalOnly.Match(text); if (match.Success) { GlobalExpressionType globalExpressionType = FormulaHandler.WordHeaderFooterFormula(match, text); if (globalExpressionType == GlobalExpressionType.Unknown) { return(null); } arrayList.Add(globalExpressionType); text = null; goto IL_0174; } return(null); } goto IL_0174; } } continue; IL_0174: arrayList.Add(text2); } } if (text != null) { Match match2 = FormulaHandler.m_RegexGlobalOnly.Match(text); if (match2.Success) { GlobalExpressionType globalExpressionType2 = FormulaHandler.WordHeaderFooterFormula(match2, text); if (globalExpressionType2 == GlobalExpressionType.Unknown) { return(null); } arrayList.Add(globalExpressionType2); goto IL_01cc; } return(null); } goto IL_01cc; IL_01cc: return(arrayList); }
static FormulaHandler() { FormulaHandler.m_RegexGlobalOnly = null; FormulaHandler.m_RegexAmpDetection = null; FormulaHandler.InitRegularExpressions(); }