private ArrayList ConvertPatternsToRegexs(StringItem[] patterns) { ArrayList Matchers = new ArrayList(); foreach (StringItem RawPattern in patterns) { StringBuilder RegexPattern = new StringBuilder(RawPattern.StringValue); RegexPattern.Replace("\\", "\\\\"); RegexPattern.Replace(".", "\\."); RegexPattern.Replace("*", ".*"); RegexPattern.Replace("$", "\\$"); RegexPattern.Replace("^", "\\^"); RegexPattern.Replace("{", "\\{"); RegexPattern.Replace("[", "\\["); RegexPattern.Replace("(", "\\("); RegexPattern.Replace(")", "\\)"); RegexPattern.Replace("+", "\\+"); if (RegexPattern.Length > 0) { RegexPattern.Insert(0, "^"); RegexPattern.Append("$"); } string PatternText = RegexPattern.ToString(); if ((PatternText.StartsWith("^.*"))) { PatternText = PatternText.Substring(3); } if ((PatternText.EndsWith(".*$"))) { PatternText = PatternText.Substring(0, RegexPattern.Length - 3); } Matchers.Add(new Regex(PatternText)); } return Matchers; }
public StringList(params string[] args) { foreach (string @string in args) { StringItem Item = new StringItem(@string); this.StringItems.Add(Item.StringValue, Item); } }
public void Add(string key, StringItem value) { this.InnerHashtable.Add(key, value); value.Index = this.Count; this.IndexedTable.Add(value.Index, value.StringValue); }
public void Add(string key, StringItem value) { this.InnerHashtable.Add(key, value); value.Index = this.Count; this.IndexedTable.Add(value.Index, value.StringValue); }