/// <summary> /// Loads the valid prefixes from the given node.. /// </summary> /// <param name="validPrefixesNode">The node containing the prefixes.</param> /// <param name="settings">The settings collection.</param> private static void LoadValidPrefixes(XmlNode validPrefixesNode, Settings settings) { Param.AssertNotNull(validPrefixesNode, "validPrefixesNode"); Param.AssertNotNull(settings, "settings"); string[] prefixes = validPrefixesNode.InnerText.Split(','); // Get the analyzer. SourceAnalyzer analyzer = settings.Core.GetAnalyzer("Microsoft.StyleCop.CSharp.NamingRules"); if (analyzer != null) { // Get the property descriptor. CollectionPropertyDescriptor propertyDescriptor = analyzer.PropertyDescriptors["Hungarian"] as CollectionPropertyDescriptor; if (propertyDescriptor != null) { settings.SetAddInSettingInternal(analyzer, new CollectionProperty(propertyDescriptor, prefixes)); } } }
/// <summary> /// Sets the given property on the given parser. /// </summary> /// <param name="settings">The settings collection.</param> /// <param name="analyzerId">The ID of the analyzer.</param> /// <param name="propertyName">The name of the property to set.</param> /// <param name="nodeText">The text of the setting from the settings file.</param> private static void LoadAnalyzerSetting(Settings settings, string analyzerId, string propertyName, string nodeText) { Param.AssertNotNull(settings, "settings"); Param.AssertValidString(analyzerId, "analyzerId"); Param.AssertValidString(propertyName, "propertyName"); Param.AssertValidString(nodeText, "nodeText"); SourceAnalyzer analyzer = settings.Core.GetAnalyzer(analyzerId); if (analyzer != null) { PropertyDescriptor<bool> propertyDescriptor = analyzer.PropertyDescriptors[propertyName] as PropertyDescriptor<bool>; if (propertyDescriptor != null) { settings.SetAddInSettingInternal(analyzer, new BooleanProperty(propertyDescriptor, nodeText != "0")); } } }
/// <summary> /// Sets the AnalyzeDesignerFiles property on the C# parser. /// </summary> /// <param name="settings">The settings collection.</param> /// <param name="nodeText">The text of the setting from the settings file.</param> private static void LoadAnalyzeDesignerFilesSetting(Settings settings, string nodeText) { Param.AssertNotNull(settings, "settings"); Param.AssertValidString(nodeText, "nodeText"); SourceParser parser = settings.Core.GetParser("Microsoft.StyleCop.CSharp.CsParser"); if (parser != null) { PropertyDescriptor<bool> propertyDescriptor = parser.PropertyDescriptors["AnalyzeDesignerFiles"] as PropertyDescriptor<bool>; if (propertyDescriptor != null) { settings.SetAddInSettingInternal(parser, new BooleanProperty(propertyDescriptor, nodeText != "0")); } } }
private static void LoadValidPrefixes(XmlNode validPrefixesNode, Settings settings) { string[] innerCollection = validPrefixesNode.InnerText.Split(new char[] { ',' }); SourceAnalyzer addIn = settings.Core.GetAnalyzer("Microsoft.StyleCop.CSharp.NamingRules"); if (addIn != null) { CollectionPropertyDescriptor propertyDescriptor = addIn.PropertyDescriptors["Hungarian"] as CollectionPropertyDescriptor; if (propertyDescriptor != null) { settings.SetAddInSettingInternal(addIn, new CollectionProperty(propertyDescriptor, innerCollection)); } } }
private static void LoadAnalyzerSetting(Settings settings, string analyzerId, string propertyName, string nodeText) { SourceAnalyzer addIn = settings.Core.GetAnalyzer(analyzerId); if (addIn != null) { PropertyDescriptor<bool> propertyDescriptor = addIn.PropertyDescriptors[propertyName] as PropertyDescriptor<bool>; if (propertyDescriptor != null) { settings.SetAddInSettingInternal(addIn, new BooleanProperty(propertyDescriptor, nodeText != "0")); } } }
private static void LoadAnalyzeDesignerFilesSetting(Settings settings, string nodeText) { SourceParser addIn = settings.Core.GetParser("Microsoft.StyleCop.CSharp.CsParser"); if (addIn != null) { PropertyDescriptor<bool> propertyDescriptor = addIn.PropertyDescriptors["AnalyzeDesignerFiles"] as PropertyDescriptor<bool>; if (propertyDescriptor != null) { settings.SetAddInSettingInternal(addIn, new BooleanProperty(propertyDescriptor, nodeText != "0")); } } }