public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection errors = base.Validate(manager, obj);
            PropertyBind bind = obj as PropertyBind;

            if (bind == null)
            {
                throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(PropertyBind).FullName }), "obj");
            }
            PropertyValidationContext validationContext = manager.Context[typeof(PropertyValidationContext)] as PropertyValidationContext;

            if (validationContext == null)
            {
                throw new InvalidOperationException(SR.GetString("Error_ContextStackItemMissing", new object[] { typeof(BindValidationContext).Name }));
            }
            Activity activity = manager.Context[typeof(Activity)] as Activity;

            if (activity == null)
            {
                throw new InvalidOperationException(SR.GetString("Error_ContextStackItemMissing", new object[] { typeof(Activity).Name }));
            }
            ValidationError item = null;

            if (string.IsNullOrEmpty(bind.Name))
            {
                item = new ValidationError(SR.GetString("Error_PropertyNotSet", new object[] { "Name" }), 0x116)
                {
                    PropertyName = base.GetFullPropertyName(manager) + ".Name"
                };
            }
            else
            {
                BindValidationContext context2 = manager.Context[typeof(BindValidationContext)] as BindValidationContext;
                if (context2 == null)
                {
                    Type baseType = BindHelpers.GetBaseType(manager, validationContext);
                    if (baseType != null)
                    {
                        AccessTypes accessType = BindHelpers.GetAccessType(manager, validationContext);
                        context2 = new BindValidationContext(baseType, accessType);
                    }
                }
                if (context2 != null)
                {
                    Type targetType = context2.TargetType;
                    if (item == null)
                    {
                        errors.AddRange(this.ValidateBindProperty(manager, activity, bind, new BindValidationContext(targetType, context2.Access)));
                    }
                }
            }
            if (item != null)
            {
                errors.Add(item);
            }
            return(errors);
        }
Пример #2
0
    //对外接口
    public void AddProperty(int id, float addValue)
    {
        int basePro = PropertyBind.ToBind((PropertyTypeEnum)id);

        if (basePro < 0)
        {
            return;
        }
        if (!PropertyBind.IsRate((PropertyTypeEnum)id))
        {
            __AddPropertyValue(basePro, addValue, PropertyBind.GetMinValue((PropertyTypeEnum)id));
        }
        else
        {
            float value = (addValue / 100.0f) * (float)__GetBaseProperty(basePro);
            __AddPropertyValue(basePro, value, PropertyBind.GetMinValue((PropertyTypeEnum)id));
        }
    }
Пример #3
0
    public float GetProperty(int id)
    {
        int basePro = PropertyBind.ToBind((PropertyTypeEnum)id);

        return(__GetPropertyValue(basePro));
    }
Пример #4
0
    public void SetBaseProperty(int id, float addValue)
    {
        int basePro = PropertyBind.ToBind((PropertyTypeEnum)id);

        __SetBaseProperty(basePro, addValue);
    }
        private ValidationErrorCollection ValidateBindProperty(ValidationManager manager, Activity activity, PropertyBind bind, BindValidationContext validationContext)
        {
            ValidationErrorCollection errors = new ValidationErrorCollection();
            string   name = bind.Name;
            Activity enclosingActivity = Helpers.GetEnclosingActivity(activity);
            Activity refActivity       = enclosingActivity;

            if ((name.IndexOf('.') != -1) && (refActivity != null))
            {
                refActivity = Helpers.GetDataSourceActivity(activity, bind.Name, out name);
            }
            if (refActivity == null)
            {
                ValidationError error = new ValidationError(SR.GetString("Error_NoEnclosingContext", new object[] { activity.Name }), 0x130)
                {
                    PropertyName = base.GetFullPropertyName(manager) + ".Name"
                };
                errors.Add(error);
                return(errors);
            }
            ValidationError item         = null;
            PropertyInfo    property     = null;
            Type            activityType = null;

            if (property == null)
            {
                activityType = BindValidatorHelper.GetActivityType(manager, refActivity);
                if (activityType != null)
                {
                    property = activityType.GetProperty(name, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
                }
            }
            if (activityType == null)
            {
                item = new ValidationError(SR.GetString("Error_TypeNotResolvedInPropertyName", new object[] { "Name" }), 0x163)
                {
                    PropertyName = base.GetFullPropertyName(manager)
                };
            }
            else if (property == null)
            {
                item = new ValidationError(SR.GetString("Error_PropertyNotExists", new object[] { base.GetFullPropertyName(manager), name }), 0x164)
                {
                    PropertyName = base.GetFullPropertyName(manager)
                };
            }
            else if (!property.CanRead)
            {
                item = new ValidationError(SR.GetString("Error_PropertyReferenceNoGetter", new object[] { base.GetFullPropertyName(manager), name }), 360)
                {
                    PropertyName = base.GetFullPropertyName(manager)
                };
            }
            else if (property.GetGetMethod() == null)
            {
                item = new ValidationError(SR.GetString("Error_PropertyReferenceGetterNoAccess", new object[] { base.GetFullPropertyName(manager), name }), 0x60a)
                {
                    PropertyName = base.GetFullPropertyName(manager)
                };
            }
            else if (((refActivity != enclosingActivity) && !property.GetGetMethod().IsAssembly) && !property.GetGetMethod().IsPublic)
            {
                item = new ValidationError(SR.GetString("Error_PropertyNotAccessible", new object[] { base.GetFullPropertyName(manager), name }), 0x165)
                {
                    PropertyName = base.GetFullPropertyName(manager)
                };
            }
            else if (property.PropertyType == null)
            {
                item = new ValidationError(SR.GetString("Error_PropertyTypeNotResolved", new object[] { base.GetFullPropertyName(manager), name }), 0x166)
                {
                    PropertyName = base.GetFullPropertyName(manager)
                };
            }
            else
            {
                MemberInfo memberInfo = property;
                if (((bind.Path == null) || (bind.Path.Length == 0)) && ((validationContext.TargetType != null) && !ActivityBindValidator.DoesTargetTypeMatch(validationContext.TargetType, property.PropertyType, validationContext.Access)))
                {
                    item = new ValidationError(SR.GetString("Error_PropertyTypeMismatch", new object[] { base.GetFullPropertyName(manager), property.PropertyType.FullName, validationContext.TargetType.FullName }), 0x167)
                    {
                        PropertyName = base.GetFullPropertyName(manager)
                    };
                }
                else if (!string.IsNullOrEmpty(bind.Path))
                {
                    memberInfo = MemberBind.GetMemberInfo(property.PropertyType, bind.Path);
                    if (memberInfo == null)
                    {
                        item = new ValidationError(SR.GetString("Error_InvalidMemberPath", new object[] { name, bind.Path }), 300)
                        {
                            PropertyName = base.GetFullPropertyName(manager) + ".Path"
                        };
                    }
                    else
                    {
                        using ((WorkflowCompilationContext.Current == null) ? WorkflowCompilationContext.CreateScope(manager) : null)
                        {
                            if (WorkflowCompilationContext.Current.CheckTypes)
                            {
                                item = MemberBind.ValidateTypesInPath(property.PropertyType, bind.Path);
                                if (item != null)
                                {
                                    item.PropertyName = base.GetFullPropertyName(manager) + ".Path";
                                }
                            }
                        }
                        if (item == null)
                        {
                            Type memberType = (memberInfo is FieldInfo) ? (memberInfo as FieldInfo).FieldType : (memberInfo as PropertyInfo).PropertyType;
                            if (!ActivityBindValidator.DoesTargetTypeMatch(validationContext.TargetType, memberType, validationContext.Access))
                            {
                                item = new ValidationError(SR.GetString("Error_TargetTypeDataSourcePathMismatch", new object[] { validationContext.TargetType.FullName }), 0x141)
                                {
                                    PropertyName = base.GetFullPropertyName(manager) + ".Path"
                                };
                            }
                        }
                    }
                }
                if (item == null)
                {
                    if (memberInfo is PropertyInfo)
                    {
                        PropertyInfo info3 = memberInfo as PropertyInfo;
                        if (!info3.CanRead && ((validationContext.Access & AccessTypes.Read) != 0))
                        {
                            item = new ValidationError(SR.GetString("Error_PropertyNoGetter", new object[] { info3.Name, bind.Path }), 0x142)
                            {
                                PropertyName = base.GetFullPropertyName(manager) + ".Path"
                            };
                        }
                        else if (!info3.CanWrite && ((validationContext.Access & AccessTypes.Write) != 0))
                        {
                            item = new ValidationError(SR.GetString("Error_PropertyNoSetter", new object[] { info3.Name, bind.Path }), 0x143)
                            {
                                PropertyName = base.GetFullPropertyName(manager) + ".Path"
                            };
                        }
                    }
                    else if (memberInfo is FieldInfo)
                    {
                        FieldInfo info4 = memberInfo as FieldInfo;
                        if (((info4.Attributes & (FieldAttributes.Literal | FieldAttributes.InitOnly)) != FieldAttributes.PrivateScope) && ((validationContext.Access & AccessTypes.Write) != 0))
                        {
                            item = new ValidationError(SR.GetString("Error_ReadOnlyField", new object[] { info4.Name }), 0x145)
                            {
                                PropertyName = base.GetFullPropertyName(manager) + ".Path"
                            };
                        }
                    }
                }
            }
            if (item != null)
            {
                errors.Add(item);
            }
            return(errors);
        }
Пример #6
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            ActivityBind bind = obj as ActivityBind;
            if (bind == null)
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(ActivityBind).FullName), "obj");

            Activity activity = manager.Context[typeof(Activity)] as Activity;
            if (activity == null)
                throw new InvalidOperationException(SR.GetString(SR.Error_ContextStackItemMissing, typeof(Activity).Name));

            PropertyValidationContext validationContext = manager.Context[typeof(PropertyValidationContext)] as PropertyValidationContext;
            if (validationContext == null)
                throw new InvalidOperationException(SR.GetString(SR.Error_ContextStackItemMissing, typeof(BindValidationContext).Name));

            ValidationError error = null;
            if (string.IsNullOrEmpty(bind.Name))
            {
                error = new ValidationError(SR.GetString(SR.Error_IDNotSetForActivitySource), ErrorNumbers.Error_IDNotSetForActivitySource);
                error.PropertyName = GetFullPropertyName(manager) + ".Name";
                validationErrors.Add(error);
            }
            else
            {
                Activity refActivity = Helpers.ParseActivityForBind(activity, bind.Name);
                if (refActivity == null)
                {
                    if (bind.Name.StartsWith("/"))
                        error = new ValidationError(SR.GetString(SR.Error_CannotResolveRelativeActivity, bind.Name), ErrorNumbers.Error_CannotResolveRelativeActivity);
                    else
                        error = new ValidationError(SR.GetString(SR.Error_CannotResolveActivity, bind.Name), ErrorNumbers.Error_CannotResolveActivity);
                    error.PropertyName = GetFullPropertyName(manager) + ".Name";
                    validationErrors.Add(error);
                }

                if (String.IsNullOrEmpty(bind.Path))
                {
                    error = new ValidationError(SR.GetString(SR.Error_PathNotSetForActivitySource), ErrorNumbers.Error_PathNotSetForActivitySource);
                    error.PropertyName = GetFullPropertyName(manager) + ".Path";
                    validationErrors.Add(error);
                }

                if (refActivity != null && validationErrors.Count == 0)
                {
                    string memberName = bind.Path;
                    string path = String.Empty;
                    int indexOfSeparator = memberName.IndexOfAny(new char[] { '.', '/', '[' });
                    if (indexOfSeparator != -1)
                    {
                        path = memberName.Substring(indexOfSeparator);
                        path = path.StartsWith(".") ? path.Substring(1) : path;
                        memberName = memberName.Substring(0, indexOfSeparator);
                    }

                    Type baseType = BindHelpers.GetBaseType(manager, validationContext);

                    //We need to bifurcate to field, method, property or ActivityBind, we need to distinguish based on first
                    //part of the path
                    MemberInfo memberInfo = null;
                    Type declaringType = null;

                    if (!String.IsNullOrEmpty(memberName))
                    {
                        declaringType = BindValidatorHelper.GetActivityType(manager, refActivity);
                        if (declaringType != null)
                        {
                            memberInfo = MemberBind.GetMemberInfo(declaringType, memberName);

                            //it could be an indexer property that requires [..] part to get correctly resolved
                            if (memberInfo == null && path.StartsWith("[", StringComparison.Ordinal))
                            {
                                string indexerPart = bind.Path.Substring(indexOfSeparator);
                                int closingBracketIndex = indexerPart.IndexOf(']');
                                if (closingBracketIndex != -1)
                                {
                                    string firstIndexerPart = indexerPart.Substring(0, closingBracketIndex + 1); //strip potential long path like Item[0].Foo
                                    path = (closingBracketIndex + 1 < indexerPart.Length) ? indexerPart.Substring(closingBracketIndex + 1) : string.Empty;
                                    path = path.StartsWith(".") ? path.Substring(1) : path;
                                    indexerPart = firstIndexerPart;
                                }
                                memberName = memberName + indexerPart;
                                memberInfo = MemberBind.GetMemberInfo(declaringType, memberName);
                            }
                        }
                    }

                    Validator validator = null;
                    object actualBind = null; //now there are two different class hierarchies - ActivityBind is not related to the BindBase/MemberBind
                    if (memberInfo != null)
                    {
                        string qualifier = (!String.IsNullOrEmpty(refActivity.QualifiedName)) ? refActivity.QualifiedName : bind.Name;

                        if (memberInfo is FieldInfo)
                        {
                            actualBind = new FieldBind(qualifier + "." + memberName, path);
                            validator = new FieldBindValidator();
                        }
                        else if (memberInfo is MethodInfo)
                        {
                            if (typeof(Delegate).IsAssignableFrom(baseType))
                            {
                                actualBind = new MethodBind(qualifier + "." + memberName);
                                validator = new MethodBindValidator();
                            }
                            else
                            {
                                error = new ValidationError(SR.GetString(SR.Error_InvalidMemberType, memberName, GetFullPropertyName(manager)), ErrorNumbers.Error_InvalidMemberType);
                                error.PropertyName = GetFullPropertyName(manager);
                                validationErrors.Add(error);
                            }
                        }
                        else if (memberInfo is PropertyInfo)
                        {
                            //Only if the referenced activity is the same it is a PropertyBind otherwise it is a ActivityBind
                            if (refActivity == activity)
                            {
                                actualBind = new PropertyBind(qualifier + "." + memberName, path);
                                validator = new PropertyBindValidator();
                            }
                            else
                            {
                                actualBind = bind;
                                validator = this;
                            }
                        }
                        else if (memberInfo is EventInfo)
                        {
                            actualBind = bind;
                            validator = this;
                        }
                    }
                    else if (memberInfo == null && baseType != null && typeof(Delegate).IsAssignableFrom(baseType))
                    {
                        actualBind = bind;
                        validator = this;
                    }

                    if (validator != null && actualBind != null)
                    {
                        if (validator == this && actualBind is ActivityBind)
                            validationErrors.AddRange(ValidateActivityBind(manager, actualBind));
                        else
                            validationErrors.AddRange(validator.Validate(manager, actualBind));
                    }
                    else if (error == null)
                    {
                        error = new ValidationError(SR.GetString(SR.Error_PathCouldNotBeResolvedToMember, bind.Path, (!string.IsNullOrEmpty(refActivity.QualifiedName)) ? refActivity.QualifiedName : refActivity.GetType().Name), ErrorNumbers.Error_PathCouldNotBeResolvedToMember);
                        error.PropertyName = GetFullPropertyName(manager);
                        validationErrors.Add(error);
                    }
                }
            }

            return validationErrors;
        }
Пример #7
0
        private ValidationErrorCollection ValidateBindProperty(ValidationManager manager, Activity activity, PropertyBind bind, BindValidationContext validationContext)
        {
            ValidationErrorCollection validationErrors = new ValidationErrorCollection();

            string dsName = bind.Name;
            Activity activityContext = Helpers.GetEnclosingActivity(activity);
            Activity dataSourceActivity = activityContext;
            if (dsName.IndexOf('.') != -1 && dataSourceActivity != null)
                dataSourceActivity = Helpers.GetDataSourceActivity(activity, bind.Name, out dsName);

            if (dataSourceActivity == null)
            {
                ValidationError error = new ValidationError(SR.GetString(SR.Error_NoEnclosingContext, activity.Name), ErrorNumbers.Error_NoEnclosingContext);
                error.PropertyName = GetFullPropertyName(manager) + ".Name";
                validationErrors.Add(error);
            }
            else
            {
                ValidationError error = null;

                PropertyInfo propertyInfo = null;
                System.Type resolvedType = null;
                if (propertyInfo == null)
                {
                    resolvedType = BindValidatorHelper.GetActivityType(manager, dataSourceActivity);
                    if (resolvedType != null)
                        propertyInfo = resolvedType.GetProperty(dsName, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
                }

                if (resolvedType == null)
                {
                    error = new ValidationError(SR.GetString(SR.Error_TypeNotResolvedInPropertyName, "Name"), ErrorNumbers.Error_TypeNotResolvedInPropertyName);
                    error.PropertyName = GetFullPropertyName(manager);
                }
                else
                {
                    if (propertyInfo == null)
                    {
                        error = new ValidationError(SR.GetString(SR.Error_PropertyNotExists, GetFullPropertyName(manager), dsName), ErrorNumbers.Error_PropertyNotExists);
                        error.PropertyName = GetFullPropertyName(manager);
                    }
                    else if (!propertyInfo.CanRead)
                    {
                        error = new ValidationError(SR.GetString(SR.Error_PropertyReferenceNoGetter, GetFullPropertyName(manager), dsName), ErrorNumbers.Error_PropertyReferenceNoGetter);
                        error.PropertyName = GetFullPropertyName(manager);
                    }
                    else if (propertyInfo.GetGetMethod() == null)
                    {
                        error = new ValidationError(SR.GetString(SR.Error_PropertyReferenceGetterNoAccess, GetFullPropertyName(manager), dsName), ErrorNumbers.Error_PropertyReferenceGetterNoAccess);
                        error.PropertyName = GetFullPropertyName(manager);
                    }
                    else if (dataSourceActivity != activityContext && !propertyInfo.GetGetMethod().IsAssembly && !propertyInfo.GetGetMethod().IsPublic)
                    {
                        error = new ValidationError(SR.GetString(SR.Error_PropertyNotAccessible, GetFullPropertyName(manager), dsName), ErrorNumbers.Error_PropertyNotAccessible);
                        error.PropertyName = GetFullPropertyName(manager);
                    }
                    else if (propertyInfo.PropertyType == null)
                    {
                        error = new ValidationError(SR.GetString(SR.Error_PropertyTypeNotResolved, GetFullPropertyName(manager), dsName), ErrorNumbers.Error_PropertyTypeNotResolved);
                        error.PropertyName = GetFullPropertyName(manager);
                    }
                    else
                    {
                        MemberInfo memberInfo = propertyInfo;
                        if ((bind.Path == null || bind.Path.Length == 0) && (validationContext.TargetType != null && !ActivityBindValidator.DoesTargetTypeMatch(validationContext.TargetType, propertyInfo.PropertyType, validationContext.Access)))
                        {
                            error = new ValidationError(SR.GetString(SR.Error_PropertyTypeMismatch, GetFullPropertyName(manager), propertyInfo.PropertyType.FullName, validationContext.TargetType.FullName), ErrorNumbers.Error_PropertyTypeMismatch);
                            error.PropertyName = GetFullPropertyName(manager);
                        }
                        else if (!string.IsNullOrEmpty(bind.Path))
                        {
                            memberInfo = MemberBind.GetMemberInfo(propertyInfo.PropertyType, bind.Path);
                            if (memberInfo == null)
                            {
                                error = new ValidationError(SR.GetString(SR.Error_InvalidMemberPath, dsName, bind.Path), ErrorNumbers.Error_InvalidMemberPath);
                                error.PropertyName = GetFullPropertyName(manager) + ".Path";
                            }
                            else
                            {
                                IDisposable localContextScope = (WorkflowCompilationContext.Current == null ? WorkflowCompilationContext.CreateScope(manager) : null);
                                try
                                {
                                    if (WorkflowCompilationContext.Current.CheckTypes)
                                    {
                                        error = MemberBind.ValidateTypesInPath(propertyInfo.PropertyType, bind.Path);
                                        if (error != null)
                                            error.PropertyName = GetFullPropertyName(manager) + ".Path";
                                    }
                                }
                                finally
                                {
                                    if (localContextScope != null)
                                    {
                                        localContextScope.Dispose();
                                    }
                                }

                                if (error == null)
                                {
                                    Type memberType = (memberInfo is FieldInfo ? (memberInfo as FieldInfo).FieldType : (memberInfo as PropertyInfo).PropertyType);
                                    if (!ActivityBindValidator.DoesTargetTypeMatch(validationContext.TargetType, memberType, validationContext.Access))
                                    {
                                        error = new ValidationError(SR.GetString(SR.Error_TargetTypeDataSourcePathMismatch, validationContext.TargetType.FullName), ErrorNumbers.Error_TargetTypeDataSourcePathMismatch);
                                        error.PropertyName = GetFullPropertyName(manager) + ".Path";
                                    }
                                }
                            }
                        }
                        if (error == null)
                        {
                            if (memberInfo is PropertyInfo)
                            {
                                PropertyInfo pathPropertyInfo = memberInfo as PropertyInfo;
                                if (!pathPropertyInfo.CanRead && ((validationContext.Access & AccessTypes.Read) != 0))
                                {
                                    error = new ValidationError(SR.GetString(SR.Error_PropertyNoGetter, pathPropertyInfo.Name, bind.Path), ErrorNumbers.Error_PropertyNoGetter);
                                    error.PropertyName = GetFullPropertyName(manager) + ".Path";
                                }
                                else if (!pathPropertyInfo.CanWrite && ((validationContext.Access & AccessTypes.Write) != 0))
                                {
                                    error = new ValidationError(SR.GetString(SR.Error_PropertyNoSetter, pathPropertyInfo.Name, bind.Path), ErrorNumbers.Error_PropertyNoSetter);
                                    error.PropertyName = GetFullPropertyName(manager) + ".Path";
                                }
                            }
                            else if (memberInfo is FieldInfo)
                            {
                                FieldInfo pathFieldInfo = memberInfo as FieldInfo;
                                if (((pathFieldInfo.Attributes & (FieldAttributes.InitOnly | FieldAttributes.Literal)) != 0) &&
                                    ((validationContext.Access & AccessTypes.Write) != 0))
                                {
                                    error = new ValidationError(SR.GetString(SR.Error_ReadOnlyField, pathFieldInfo.Name), ErrorNumbers.Error_ReadOnlyField);
                                    error.PropertyName = GetFullPropertyName(manager) + ".Path";
                                }
                            }
                        }
                    }
                }
                if (error != null)
                    validationErrors.Add(error);
            }
            return validationErrors;
        }
Пример #8
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection errors = base.Validate(manager, obj);
            ActivityBind bind = obj as ActivityBind;

            if (bind == null)
            {
                throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(ActivityBind).FullName }), "obj");
            }
            Activity activity = manager.Context[typeof(Activity)] as Activity;

            if (activity == null)
            {
                throw new InvalidOperationException(SR.GetString("Error_ContextStackItemMissing", new object[] { typeof(Activity).Name }));
            }
            PropertyValidationContext validationContext = manager.Context[typeof(PropertyValidationContext)] as PropertyValidationContext;

            if (validationContext == null)
            {
                throw new InvalidOperationException(SR.GetString("Error_ContextStackItemMissing", new object[] { typeof(BindValidationContext).Name }));
            }
            ValidationError item = null;

            if (string.IsNullOrEmpty(bind.Name))
            {
                item = new ValidationError(SR.GetString("Error_IDNotSetForActivitySource"), 0x613)
                {
                    PropertyName = base.GetFullPropertyName(manager) + ".Name"
                };
                errors.Add(item);
                return(errors);
            }
            Activity refActivity = Helpers.ParseActivityForBind(activity, bind.Name);

            if (refActivity == null)
            {
                if (bind.Name.StartsWith("/"))
                {
                    item = new ValidationError(SR.GetString("Error_CannotResolveRelativeActivity", new object[] { bind.Name }), 0x128);
                }
                else
                {
                    item = new ValidationError(SR.GetString("Error_CannotResolveActivity", new object[] { bind.Name }), 0x129);
                }
                item.PropertyName = base.GetFullPropertyName(manager) + ".Name";
                errors.Add(item);
            }
            if (string.IsNullOrEmpty(bind.Path))
            {
                item = new ValidationError(SR.GetString("Error_PathNotSetForActivitySource"), 0x12b)
                {
                    PropertyName = base.GetFullPropertyName(manager) + ".Path"
                };
                errors.Add(item);
            }
            if ((refActivity != null) && (errors.Count == 0))
            {
                string path       = bind.Path;
                string str2       = string.Empty;
                int    startIndex = path.IndexOfAny(new char[] { '.', '/', '[' });
                if (startIndex != -1)
                {
                    str2 = path.Substring(startIndex);
                    str2 = str2.StartsWith(".") ? str2.Substring(1) : str2;
                    path = path.Substring(0, startIndex);
                }
                Type       baseType   = BindHelpers.GetBaseType(manager, validationContext);
                MemberInfo memberInfo = null;
                Type       srcType    = null;
                if (!string.IsNullOrEmpty(path))
                {
                    srcType = BindValidatorHelper.GetActivityType(manager, refActivity);
                    if (srcType != null)
                    {
                        memberInfo = MemberBind.GetMemberInfo(srcType, path);
                        if ((memberInfo == null) && str2.StartsWith("[", StringComparison.Ordinal))
                        {
                            string str3  = bind.Path.Substring(startIndex);
                            int    index = str3.IndexOf(']');
                            if (index != -1)
                            {
                                string str4 = str3.Substring(0, index + 1);
                                str2 = ((index + 1) < str3.Length) ? str3.Substring(index + 1) : string.Empty;
                                str2 = str2.StartsWith(".") ? str2.Substring(1) : str2;
                                str3 = str4;
                            }
                            path       = path + str3;
                            memberInfo = MemberBind.GetMemberInfo(srcType, path);
                        }
                    }
                }
                Validator validator = null;
                object    obj2      = null;
                if (memberInfo != null)
                {
                    string str5 = !string.IsNullOrEmpty(refActivity.QualifiedName) ? refActivity.QualifiedName : bind.Name;
                    if (memberInfo is FieldInfo)
                    {
                        obj2      = new FieldBind(str5 + "." + path, str2);
                        validator = new FieldBindValidator();
                    }
                    else if (memberInfo is MethodInfo)
                    {
                        if (typeof(Delegate).IsAssignableFrom(baseType))
                        {
                            obj2      = new MethodBind(str5 + "." + path);
                            validator = new MethodBindValidator();
                        }
                        else
                        {
                            item = new ValidationError(SR.GetString("Error_InvalidMemberType", new object[] { path, base.GetFullPropertyName(manager) }), 0x629)
                            {
                                PropertyName = base.GetFullPropertyName(manager)
                            };
                            errors.Add(item);
                        }
                    }
                    else if (memberInfo is PropertyInfo)
                    {
                        if (refActivity == activity)
                        {
                            obj2      = new PropertyBind(str5 + "." + path, str2);
                            validator = new PropertyBindValidator();
                        }
                        else
                        {
                            obj2      = bind;
                            validator = this;
                        }
                    }
                    else if (memberInfo is EventInfo)
                    {
                        obj2      = bind;
                        validator = this;
                    }
                }
                else if (((memberInfo == null) && (baseType != null)) && typeof(Delegate).IsAssignableFrom(baseType))
                {
                    obj2      = bind;
                    validator = this;
                }
                if ((validator != null) && (obj2 != null))
                {
                    if ((validator == this) && (obj2 is ActivityBind))
                    {
                        errors.AddRange(this.ValidateActivityBind(manager, obj2));
                        return(errors);
                    }
                    errors.AddRange(validator.Validate(manager, obj2));
                    return(errors);
                }
                if (item == null)
                {
                    item = new ValidationError(SR.GetString("Error_PathCouldNotBeResolvedToMember", new object[] { bind.Path, !string.IsNullOrEmpty(refActivity.QualifiedName) ? refActivity.QualifiedName : refActivity.GetType().Name }), 0x60d)
                    {
                        PropertyName = base.GetFullPropertyName(manager)
                    };
                    errors.Add(item);
                }
            }
            return(errors);
        }