private List <XMemberDefinition> BuildMissingMembers(XTypeDefinition currentClass, System.Reflection.MemberInfo[] members)
        {
            List <XMemberDefinition> elementsToAdd = new List <XMemberDefinition>();

            //
            foreach (System.Reflection.MemberInfo member in members)
            {
                System.Reflection.MemberTypes realType = member.MemberType;
                if (realType == System.Reflection.MemberTypes.Method)
                {
                    System.Reflection.MethodInfo method = (System.Reflection.MethodInfo)member;
                    // Check for Getter/Setter
                    if ((method.Attributes & System.Reflection.MethodAttributes.SpecialName) == System.Reflection.MethodAttributes.SpecialName)
                    {
                        string getsetName = member.Name;
                        if (getsetName.StartsWith("get_") || getsetName.StartsWith("set_"))
                        {
                            // Oooppsss
                            continue;
                        }
                    }
                }
                // Now, We will have to check Parameters / Return Type
                if (!CheckForMember(currentClass, member))
                {
                    // and re-create our own prototype
                    elementsToAdd.Add(CreateMember(member, members));
                }
            }
            return(elementsToAdd);
        }
Esempio n. 2
0
 internal MemberInfo[] FindOwnerMembers(string memberName, System.Reflection.MemberTypes memberType)
 {
     return(MyOwnerImport.FindMembers(memberName, memberType));
 }
Esempio n. 3
0
 public virtual System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr)
 {
     throw null;
 }
Esempio n. 4
0
        /// <summary>
        /// 読み書きに使用するメンバ情報を取得します。
        /// </summary>
        /// <param name="type">メンバを保持する型を指定します。</param>
        /// <param name="member">メンバ名を指定します。</param>
        /// <param name="bindings">検索するメンバのバインドの形態を指定します。</param>
        /// <param name="flags">検索するメンバの種類を指定します。</param>
        /// <returns>見つかったメンバの情報を返します。</returns>
        /// <exception cref="System.Reflection.AmbiguousMatchException">
        /// 適合するメンバが複数見つかった場合に発生します。
        /// </exception>
        /// <exception cref="System.MissingFieldException">
        /// 適合するメンバ (フィールドに限らない) が見つからなかった場合に発生します。
        /// </exception>
        protected static System.Reflection.MemberInfo GetMemberInfo(System.Type type, string member, Ref::BindingFlags bindings, InvokingFlags flags)
        {
            const System.Reflection.MemberTypes MT
                = System.Reflection.MemberTypes.Field
                  | System.Reflection.MemberTypes.Property
                  | System.Reflection.MemberTypes.Method;

            System.Reflection.MemberInfo[] infos = type.GetMember(member, MT, bindings);
            bool found = false;

            System.Reflection.MemberInfo ret = null;
            for (int i = 0; i < infos.Length; i++)
            {
                switch (infos[i].MemberType)
                {
                case System.Reflection.MemberTypes.Field:
                    if ((flags & InvokingFlags.Field) != 0)
                    {
                        goto regist;
                    }
                    break;

                case System.Reflection.MemberTypes.Property:
                    if ((flags & InvokingFlags.PropertyNoIndexParameter) != 0 &&
                        ((System.Reflection.PropertyInfo)infos[i]).GetIndexParameters().Length == 0)
                    {
                        goto regist;
                    }
                    break;

                case System.Reflection.MemberTypes.Method:
                    System.Reflection.ParameterInfo[] pinfos = ((System.Reflection.MethodInfo)infos[i]).GetParameters();
                    if ((flags & InvokingFlags.Method_NoParameter) != 0 && pinfos.Length == 0)
                    {
                        goto regist;
                    }
                    if ((flags & InvokingFlags.Method_ParamAccessor) != 0 &&
                        pinfos.Length == 1 &&
                        pinfos[0].ParameterType.IsAssignableFrom(typeof(StreamAccessor)))
                    {
                        goto regist;
                    }
                    if ((flags & InvokingFlags.Method_ParamObjectAccessor) != 0 &&
                        pinfos.Length == 2 &&
                        pinfos[1].ParameterType.IsAssignableFrom(typeof(StreamAccessor)))
                    {
                        goto regist;
                    }
                    break;
regist:
                    if (found)
                    {
                        throw new System.Reflection.AmbiguousMatchException();
                    }
                    found = true;
                    ret   = infos[i];
                    break;
                }
            }
            if (!found)
            {
                throw new System.MissingFieldException(type.FullName, member);
            }
            return(ret);
        }
Esempio n. 5
0
 public virtual System.Reflection.MemberInfo[] FindMembers(System.Reflection.MemberTypes memberType, System.Reflection.BindingFlags bindingAttr, System.Reflection.MemberFilter filter, object filterCriteria)
 {
     throw null;
 }