internal void IgnorePaths(MemberInfo destinationMember) { foreach (var pathMap in PathMaps.Where(pm => pm.MemberPath.First == destinationMember)) { pathMap.Ignored = true; } }
public static int FindLongestPath(int[][] map) { int result = 1; int[][] lookput = PathMaps.IntPathMap(Size); Path = PathMaps.StringPathMap(Size); for (int i = 0; i < Size; i++) { for (int j = 0; j < Size; j++) { lookput[i][j] = -1; Path[i][j] = map[i][j].ToString(); } } for (int i = 0; i < Size; i++) { for (int j = 0; j < Size; j++) { if (lookput[i][j] == -1) { FindLongestPathFromAPosition(i, j, map, lookput); } result = Math.Max(result, lookput[i][j]); } } foreach (var item in Path) { foreach (var i in item) { int[] pathList = Array.ConvertAll(i.Split('-'), int.Parse); if (pathList.Length == result) { var deep = pathList[0] - pathList[pathList.Length - 1]; if (deep > maxDeep) { maxDeep = deep; maxPath = i; } } } } return(result); }
private void ApplyInheritedTypeMap(TypeMap inheritedTypeMap) { foreach (var inheritedMappedProperty in inheritedTypeMap.GetPropertyMaps().Where(m => m.IsMapped())) { var conventionPropertyMap = GetPropertyMaps() .SingleOrDefault(m => m.DestinationProperty.Name == inheritedMappedProperty.DestinationProperty.Name); if (conventionPropertyMap != null) { conventionPropertyMap.ApplyInheritedPropertyMap(inheritedMappedProperty); } else { var propertyMap = new PropertyMap(inheritedMappedProperty, this); _inheritedMaps.Add(propertyMap); } } //Include BeforeMap foreach (var beforeMapAction in inheritedTypeMap._beforeMapActions) { AddBeforeMapAction(beforeMapAction); } //Include AfterMap foreach (var afterMapAction in inheritedTypeMap._afterMapActions) { AddAfterMapAction(afterMapAction); } var notOverridenSourceConfigs = inheritedTypeMap._sourceMemberConfigs.Where( baseConfig => _sourceMemberConfigs.All(derivedConfig => derivedConfig.SourceMember != baseConfig.SourceMember)); _sourceMemberConfigs.AddRange(notOverridenSourceConfigs); var notOverridenPathMaps = inheritedTypeMap.PathMaps.Where( baseConfig => PathMaps.All(derivedConfig => derivedConfig.MemberPath != baseConfig.MemberPath)); _pathMaps.AddRange(notOverridenPathMaps); }
public string[] GetUnmappedPropertyNames() { var autoMappedProperties = GetPropertyNames(PropertyMaps); IEnumerable <string> properties; if (ConfiguredMemberList == MemberList.Destination) { properties = DestinationTypeDetails.PublicWriteAccessors .Select(p => p.Name) .Except(autoMappedProperties) .Except(PathMaps.Select(p => p.MemberPath.First.Name)); } else { var redirectedSourceMembers = MemberMaps .Where(pm => pm.IsMapped && pm.SourceMember != null && pm.SourceMember.Name != pm.DestinationName) .Select(pm => pm.SourceMember.Name); var ignoredSourceMembers = SourceMemberConfigs .Where(smc => smc.IsIgnored()) .Select(pm => pm.SourceMember.Name); properties = SourceTypeDetails.PublicReadAccessors .Select(p => p.Name) .Except(autoMappedProperties) .Except(redirectedSourceMembers) .Except(ignoredSourceMembers); } return(properties.Where(memberName => !Profile.GlobalIgnores.Any(memberName.StartsWith)).ToArray()); string GetPropertyName(PropertyMap pm) => ConfiguredMemberList == MemberList.Destination ? pm.DestinationName : pm.SourceMember != null ? pm.SourceMember.Name : pm.DestinationName; string[] GetPropertyNames(IEnumerable <PropertyMap> propertyMaps) => propertyMaps.Where(pm => pm.IsMapped).Select(GetPropertyName).ToArray(); }
public PathMap FindPathMapByDestinationPath(string destinationFullPath) => PathMaps.SingleOrDefault(item => string.Join(".", item.MemberPath.Members.Select(m => m.Name)) == destinationFullPath);
private List <PathMap> NotOverridenPathMaps(TypeMap inheritedTypeMap) => inheritedTypeMap.PathMaps.Where( baseConfig => PathMaps.All(derivedConfig => derivedConfig.MemberPath != baseConfig.MemberPath)).ToList();