/// <summary>
        /// Clones the contents of the collection.
        /// </summary>
        /// <returns>Returns the cloned collection.</returns>
        public override PropertyCollection Clone()
        {
            AddInPropertyCollection clone = new AddInPropertyCollection(this.addIn);
            foreach (PropertyValue item in this.Properties)
            {
                clone.Add(item.Clone());
            }

            return clone;
        }
        /// <summary>
        /// Clones the contents of the collection.
        /// </summary>
        /// <returns>Returns the cloned collection.</returns>
        public override PropertyCollection Clone()
        {
            AddInPropertyCollection clone = new AddInPropertyCollection(this.addIn);

            foreach (PropertyValue item in this.Properties)
            {
                clone.Add(item.Clone());
            }

            return(clone);
        }
        /// <summary>
        /// Initializes the properties defaults from StyleCop settings.
        /// It assumes that the first 6 chars of each property are the code (i.e. SA1600) and the rest matches the name as defined in StyleCop settings
        /// (ex: SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine =&gt;  CurlyBracketsForMultiLineStatementsMustNotShareLine should be the name in StyleCop settings). 
        /// </summary>
        protected void InitPropertiesDefaults()
        {
            Settings styleCopSettings = Utils.GetStyleCopSettings();

            if (styleCopSettings != null)
            {
                this.analyzerSettingsProperties = styleCopSettings.AnalyzerSettings.FirstOrDefault(n => n.AddIn.Id == this.AnalyzerName);
            }

            PropertyInfo[] propertyInfos = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);

            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                if (propertyInfo.PropertyType == typeof(bool))
                {
                    string settingsProperty = propertyInfo.Name.Substring(6);
                    bool propertyValue = this.IsPropertyEnabled(settingsProperty);
                    propertyInfo.SetValue(this, propertyValue, null);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Initializes the properties defaults from StyleCop settings.
        /// It assumes that the first 6 chars of each property are the code (i.e. SA1600) and the rest matches the name as defined in StyleCop settings
        /// (ex: SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine =&gt;  CurlyBracketsForMultiLineStatementsMustNotShareLine should be the name in StyleCop settings).
        /// </summary>
        protected void InitPropertiesDefaults()
        {
            Settings styleCopSettings = Utils.GetStyleCopSettings();

            if (styleCopSettings != null)
            {
                this.analyzerSettingsProperties = styleCopSettings.AnalyzerSettings.FirstOrDefault(n => n.AddIn.Id == this.AnalyzerName);
            }

            PropertyInfo[] propertyInfos = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);

            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                if (propertyInfo.PropertyType == typeof(bool))
                {
                    string settingsProperty = propertyInfo.Name.Substring(6);
                    bool   propertyValue    = this.IsPropertyEnabled(settingsProperty);
                    propertyInfo.SetValue(this, propertyValue, null);
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalyzerSettings"/> class.
 /// </summary>
 /// <param name="settings">
 /// The settings.
 /// </param>
 /// <param name="analyzerId">
 /// The analyzer id.
 /// </param>
 public AnalyzerSettings(Settings settings, string analyzerId)
 {
     this.analyzerSettings = settings == null ? null : settings.AnalyzerSettings.FirstOrDefault(a => a.AddIn.Id == analyzerId);
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalyzerSettings"/> class.
 /// </summary>
 /// <param name="settings">
 /// The settings.
 /// </param>
 /// <param name="analyzerId">
 /// The analyzer id.
 /// </param>
 public AnalyzerSettings(Settings settings, string analyzerId)
 {
     this.analyzerSettings = settings == null ? null : settings.AnalyzerSettings.FirstOrDefault(a => a.AddIn.Id == analyzerId);
 }