private static AnalyzerConfiguration ReadAnalyzerSection(XmlReader reader) { AnalyzerConfiguration configuration = new AnalyzerConfiguration(); while (true) { SkipToNextElement(reader); if (reader.NodeType == XmlNodeType.Element) { if (string.Equals(reader.Name, PropertyTagName)) { string name = reader.GetAttribute(PropertyNameTagName); string value = reader.GetAttribute(PropertyValueTagName); configuration.Add(name, value); } else { // We've hit the end of the analyzer tag. break; } } else { // We've hit the end of the analyzer tag. break; } } return(configuration); }
internal static ConfigurationFile FromFile(string path) { ConfigurationFile file = new ConfigurationFile(); using (XmlReader reader = XmlReader.Create(path)) { while (!reader.EOF) { if (reader.NodeType == XmlNodeType.Element && string.Equals(reader.Name, AnalyzerSectionName)) { // Get the analyzer name. string analyzerName = reader.GetAttribute(AnalyzerName); AnalyzerConfiguration configuration = ReadAnalyzerSection(reader); file.Analyzers.Add(analyzerName, configuration); } else { // Read the next node. reader.Read(); } } } return(file); }
internal bool TryGetAnalyzerConfiguration(Analyzer analyzer, out AnalyzerConfiguration config) { return(_analyzerConfigurations.TryGetValue(analyzer.GetType().FullName, out config)); }