private PathInfo[] GetSubPropertiesOnType(System.Type typeToGetPropertiesOn, string currentPath) { List<PathInfo> list = new List<PathInfo>(); if ((typeToGetPropertiesOn != typeof(string)) && (!TypeProvider.IsAssignable(typeof(Delegate), typeToGetPropertiesOn) || this.boundType.IsSubclassOf(typeof(Delegate)))) { currentPath = string.IsNullOrEmpty(currentPath) ? string.Empty : (currentPath + "."); ITypeProvider service = this.serviceProvider.GetService(typeof(ITypeProvider)) as ITypeProvider; foreach (PropertyInfo info in this.GetProperties(typeToGetPropertiesOn)) { MethodInfo getMethod = info.GetGetMethod(); System.Type memberType = BindHelpers.GetMemberType(info); if (memberType != null) { if (service != null) { System.Type type = service.GetType(memberType.FullName, false); memberType = (type != null) ? type : memberType; } if (((this.IsPropertyBrowsable(info) && (getMethod != null)) && (memberType != null)) && ((!IsTypePrimitive(memberType) || TypeProvider.IsAssignable(this.boundType, memberType)) && (!(this.boundType != typeof(object)) || !(memberType == typeof(object))))) { string name = info.Name; name = currentPath + name + this.ConstructIndexString(getMethod); list.Add(new PathInfo(name, info, memberType)); list.AddRange(this.GetArraySubProperties(memberType, name)); } } } foreach (FieldInfo info3 in typeToGetPropertiesOn.GetFields(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance)) { System.Type fromType = BindHelpers.GetMemberType(info3); if ((fromType != null) && !TypeProvider.IsAssignable(typeof(DependencyProperty), fromType)) { if (service != null) { System.Type type4 = service.GetType(fromType.FullName, false); fromType = (type4 != null) ? type4 : fromType; } if (((this.IsPropertyBrowsable(info3) && (fromType != null)) && (!IsTypePrimitive(fromType) || TypeProvider.IsAssignable(this.boundType, fromType))) && ((!(this.boundType != typeof(object)) || !(fromType == typeof(object))) && (TypeProvider.IsAssignable(typeof(Delegate), this.boundType) || !TypeProvider.IsAssignable(typeof(Delegate), fromType)))) { string path = currentPath + info3.Name; list.Add(new PathInfo(path, info3, BindHelpers.GetMemberType(info3))); list.AddRange(this.GetArraySubProperties(fromType, path)); } } } if (this.boundType.IsSubclassOf(typeof(Delegate))) { foreach (EventInfo info4 in typeToGetPropertiesOn.GetEvents(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance)) { System.Type type5 = BindHelpers.GetMemberType(info4); if (type5 != null) { if (service != null) { System.Type type6 = service.GetType(type5.FullName, false); type5 = (type6 != null) ? type6 : type5; } if ((this.IsPropertyBrowsable(info4) && (type5 != null)) && TypeProvider.IsAssignable(this.boundType, type5)) { list.Add(new PathInfo(currentPath + info4.Name, info4, type5)); } } } } } return list.ToArray(); }
private static void RemoveDeletedProperties(List<CustomProperty> propCollection, System.Type customActivityType, IServiceProvider serviceProvider) { IMemberCreationService service = serviceProvider.GetService(typeof(IMemberCreationService)) as IMemberCreationService; if (service == null) { throw new Exception(SR.GetString("General_MissingService", new object[] { typeof(IMemberCreationService).FullName })); } foreach (PropertyInfo info in customActivityType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { bool flag = false; foreach (CustomProperty property in propCollection) { if ((info.Name == property.oldPropertyName) && (info.PropertyType.FullName == property.oldPropertyType)) { flag = true; break; } } if (!flag) { service.RemoveProperty(customActivityType.FullName, info.Name, info.PropertyType); } } foreach (EventInfo info2 in customActivityType.GetEvents(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { bool flag2 = false; foreach (CustomProperty property2 in propCollection) { if ((info2.Name == property2.oldPropertyName) && (info2.EventHandlerType.FullName == property2.oldPropertyType)) { flag2 = true; break; } } if ((!flag2 && (info2.Name != null)) && (info2.EventHandlerType != null)) { service.RemoveEvent(customActivityType.FullName, info2.Name, info2.EventHandlerType); } } }