예제 #1
0
        protected override void GetMethods(out DmdMethodInfo getMethod, out DmdMethodInfo setMethod, out DmdMethodInfo[] otherMethods)
        {
            var info = COMThread(GetMethods_COMThread);

            getMethod    = info.getMethod;
            setMethod    = info.setMethod;
            otherMethods = info.otherMethods;
        }
예제 #2
0
        protected override void GetMethods(out DmdMethodInfo addMethod, out DmdMethodInfo removeMethod, out DmdMethodInfo raiseMethod, out DmdMethodInfo[] otherMethods)
        {
            var info = COMThread(GetMethods_COMThread);

            addMethod    = info.addMethod;
            removeMethod = info.removeMethod;
            raiseMethod  = info.raiseMethod;
            otherMethods = info.otherMethods;
        }
예제 #3
0
        protected override void GetMethods(out DmdMethodInfo addMethod, out DmdMethodInfo removeMethod, out DmdMethodInfo raiseMethod, out DmdMethodInfo[] otherMethods)
        {
            addMethod    = null;
            removeMethod = null;
            raiseMethod  = null;
            List <DmdMethodInfo> otherMethodsList = null;

            var ridList = reader.Metadata.GetMethodSemanticsRidList(Table.Event, Rid);

            for (int i = 0; i < ridList.Count; i++)
            {
                if (!reader.TablesStream.TryReadMethodSemanticsRow(ridList[i], out var row))
                {
                    continue;
                }
                var method = ReflectedType.GetMethod(Module, 0x06000000 + (int)row.Method) as DmdMethodInfo;
                if ((object)method == null)
                {
                    continue;
                }

                switch ((MethodSemanticsAttributes)row.Semantic)
                {
                case MethodSemanticsAttributes.AddOn:
                    if ((object)addMethod == null)
                    {
                        addMethod = method;
                    }
                    break;

                case MethodSemanticsAttributes.RemoveOn:
                    if ((object)removeMethod == null)
                    {
                        removeMethod = method;
                    }
                    break;

                case MethodSemanticsAttributes.Fire:
                    if ((object)raiseMethod == null)
                    {
                        raiseMethod = method;
                    }
                    break;

                case MethodSemanticsAttributes.Other:
                    if (otherMethodsList == null)
                    {
                        otherMethodsList = new List <DmdMethodInfo>();
                    }
                    otherMethodsList.Add(method);
                    break;
                }
            }

            otherMethods = otherMethodsList?.ToArray();
        }
예제 #4
0
 static object GetColor(DmdMethodInfo method, object staticValue, object instanceValue)
 {
     if ((object)method == null)
     {
         return(instanceValue);
     }
     if (method.IsStatic)
     {
         return(staticValue);
     }
     return(instanceValue);
 }
예제 #5
0
 static DbgTextColor GetColor(DmdMethodInfo method, DbgTextColor staticValue, DbgTextColor instanceValue)
 {
     if ((object)method == null)
     {
         return(instanceValue);
     }
     if (method.IsStatic)
     {
         return(staticValue);
     }
     return(instanceValue);
 }
예제 #6
0
 public PreserveSigAttributeInfo(DmdMethodInfo method)
 {
     if ((method.MethodImplementationFlags & DmdMethodImplAttributes.PreserveSig) != 0)
     {
         var caType = method.AppDomain.GetWellKnownType(DmdWellKnownType.System_Runtime_InteropServices_PreserveSigAttribute, isOptional: true);
         ctor = caType?.GetConstructor(Array.Empty <DmdType>());
         Debug.Assert((object)caType == null || (object)ctor != null);
     }
     else
     {
         ctor = null;
     }
 }
예제 #7
0
        protected override void GetMethods(out DmdMethodInfo getMethod, out DmdMethodInfo setMethod, out DmdMethodInfo[] otherMethods)
        {
            getMethod = null;
            setMethod = null;
            List <DmdMethodInfo> otherMethodsList = null;

            var ridList = reader.Metadata.GetMethodSemanticsRidList(Table.Property, Rid);

            for (uint i = 0; i < ridList.Length; i++)
            {
                var row    = reader.TablesStream.ReadMethodSemanticsRow(ridList[i]);
                var method = ReflectedType.GetMethod(Module, 0x06000000 + (int)row.Method) as DmdMethodInfo;
                if ((object)method == null)
                {
                    continue;
                }

                switch ((MethodSemanticsAttributes)row.Semantic)
                {
                case MethodSemanticsAttributes.Setter:
                    if ((object)setMethod == null)
                    {
                        setMethod = method;
                    }
                    break;

                case MethodSemanticsAttributes.Getter:
                    if ((object)getMethod == null)
                    {
                        getMethod = method;
                    }
                    break;

                case MethodSemanticsAttributes.Other:
                    if (otherMethodsList == null)
                    {
                        otherMethodsList = new List <DmdMethodInfo>();
                    }
                    otherMethodsList.Add(method);
                    break;
                }
            }

            otherMethods = otherMethodsList?.ToArray();
        }
예제 #8
0
 public static DmdMethodInfo?FilterAccessor(DmdGetAccessorOptions options, DmdMethodInfo method)
 {
     if ((options & DmdGetAccessorOptions.All) != 0)
     {
         return(method);
     }
     if (method is null)
     {
         return(null);
     }
     if (method.IsPrivate && (object?)method.DeclaringType != method.ReflectedType)
     {
         return(null);
     }
     if (method.IsPublic || (options & DmdGetAccessorOptions.NonPublic) != 0)
     {
         return(method);
     }
     return(null);
 }
예제 #9
0
 protected abstract void GetMethods(out DmdMethodInfo addMethod, out DmdMethodInfo removeMethod, out DmdMethodInfo raiseMethod, out DmdMethodInfo[] otherMethods);
예제 #10
0
 internal DmdMethodInfo SetParentDefinition(DmdMethodInfo method) => parentDefinition = method;
예제 #11
0
 public ToStringState(DmdMethodInfo toStringMethod) => ToStringMethod = toStringMethod;
예제 #12
0
 protected abstract void GetMethods(out DmdMethodInfo getMethod, out DmdMethodInfo setMethod, out DmdMethodInfo[] otherMethods);
예제 #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="id">Return value id</param>
 /// <param name="method">Method</param>
 /// <param name="value">Value returned by <paramref name="method"/></param>
 public DbgDotNetReturnValueInfo(uint id, DmdMethodInfo method, DbgDotNetValue value)
 {
     Id     = id;
     Method = method ?? throw new ArgumentNullException(nameof(method));
     Value  = value ?? throw new ArgumentNullException(nameof(value));
 }