/// <summary> /// Scan a type of the assembly /// </summary> /// <param name="curType">Type to be scanned</param> /// <param name="defaultValue">Default behavior of elements (True if they have to be skipped)</param> /// <returns>List of skipped members</returns> private List <Configuration.SkipBase> ScanType(TypeDefinition curType, bool?defaultValue) { List <Configuration.SkipBase> result = new List <ObfuscarStandardAttributeHelper.Core.Configuration.SkipBase>(); Configuration.SkipType toAdd = null; System.Reflection.ObfuscationAttribute toFind = this.GetAndStripObfuscationCustomAttribute(curType); if (toFind != null) { // Do we need to skip obsfuscation ? if (toFind.ApplyToMembers == true) { defaultValue = toFind.Exclude; } else { toAdd = new ObfuscarStandardAttributeHelper.Core.Configuration.SkipType(); toAdd.Name = curType.FullName; } } List <Configuration.SkipBase> elems = this.ScanMembers(curType, defaultValue); if (defaultValue.HasValue && defaultValue.Value == true) { toAdd = new ObfuscarStandardAttributeHelper.Core.Configuration.SkipType(); toAdd.Name = curType.FullName; } if (toAdd != null) { result.Add(toAdd); } result.AddRange(elems); foreach (TypeDefinition subType in curType.NestedTypes) { result.AddRange(this.ScanType(subType, defaultValue)); } return(result); }
/// <summary> /// Scan a type of the assembly /// </summary> /// <param name="curType">Type to be scanned</param> /// <param name="defaultValue">Default behavior of elements (True if they have to be skipped)</param> /// <returns>List of skipped members</returns> private List<Configuration.SkipBase> ScanType(TypeDefinition curType, bool? defaultValue) { List<Configuration.SkipBase> result = new List<ObfuscarStandardAttributeHelper.Core.Configuration.SkipBase>(); Configuration.SkipType toAdd = null; System.Reflection.ObfuscationAttribute toFind = this.GetAndStripObfuscationCustomAttribute(curType); if (toFind != null) { // Do we need to skip obsfuscation ? if (toFind.ApplyToMembers == true) { defaultValue = toFind.Exclude; } else { toAdd = new ObfuscarStandardAttributeHelper.Core.Configuration.SkipType(); toAdd.Name = curType.FullName; } } List<Configuration.SkipBase> elems = this.ScanMembers(curType, defaultValue); if (defaultValue.HasValue && defaultValue.Value == true) { toAdd = new ObfuscarStandardAttributeHelper.Core.Configuration.SkipType(); toAdd.Name = curType.FullName; } if (toAdd != null) { result.Add(toAdd); } result.AddRange(elems); foreach (TypeDefinition subType in curType.NestedTypes) { result.AddRange(this.ScanType(subType, defaultValue)); } return result; }