コード例 #1
0
        private void PrintMethod(MethodDeclaration method)
        {
            _builder.Append(method.Name);
            PrintGenericParameters(method.GenericParameters);
            PrintMethodParameters(method.Parameters);

            if (!method.IsConstructor())
            {
                _builder.Append(" : ");
                PrintTypeSig(method.ReturnType.Type);
            }
        }
コード例 #2
0
        public static bool CanEncrypt(MethodDeclaration method)
        {
            if (method.IsAbstract)
            {
                return(false);
            }

            if (method.CodeType != MethodCodeTypeFlags.CIL)
            {
                return(false);
            }

            if (method.CallConv != MethodCallingConvention.Default)
            {
                return(false);
            }

            if (method.IsConstructor())
            {
                return(false);
            }

            if (method.GenericParameters.Count > 0)
            {
                return(false);
            }

            var ownerType = method.GetOwnerType();

            if (ownerType.IsInterface)
            {
                return(false);
            }

            if (ownerType.IsValueType())
            {
                return(false);
            }

            if (!MethodBody.IsValid(method))
            {
                return(false);
            }

            var methodBody = MethodBody.Load(method);

            if (HasVarArgCall(methodBody.Instructions))
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
        public static bool CanRename(MethodDeclaration method)
        {
            // Do not rename constructors.
            if (method.IsConstructor())
            {
                return(false);
            }

            // Do not rename dynamic methods.
            if (method.CodeType == MethodCodeTypeFlags.Runtime)
            {
                return(false);
            }

            return(true);
        }