public void AddHighlight(string id, IHighlight highlight) { if (partitionDic.ContainsKey(id)) { var part = partitionDic[id]; //part.Highlight = highlight; part.Highlight.getRules().AddRange(highlight.getRules()); var rules = part.Highlight.getRules(); foreach (var rule in rules) { if (rule is MultiLineRule) { MultiLineRule prule = rule as MultiLineRule; var partid = prule.id; var newpart = new Partition(prule, new DefaultHighlight(prule.attr)); part.AddPartition(newpart); partitionDic.Add(partid, newpart); } } } else { var part = new Partition(id, highlight); partitionDic.Add(id, part); var rules = highlight.getRules(); foreach (var rule in rules) { if (rule is MultiLineRule) { MultiLineRule prule = rule as MultiLineRule; var partid = prule.id; var newpart = new Partition(prule, new DefaultHighlight(prule.attr)); part.AddPartition(newpart); partitionDic.Add(partid, newpart); } } } }
public Partition(MultiLineRule rule, IHighlight Highlight) { this.rule = rule; this.ID = this.rule.id; this.Highlight = Highlight; }