internal static string Print(MethodDeclaration method)
        {
            var printer = new NodePrinter();

            printer._method = method;
            printer._type   = method.GetOwnerType();
            printer.PrintMethod(method);

            return(printer.ToString());
        }
Пример #2
0
        public MethodDetailsViewModel(MethodViewModel parent)
            : base(parent)
        {
            _projectMethod = Parent.ProjectMethod;

            _method    = Parent.Method;
            _ownerType = _method.GetOwnerType();
            _isVisibleOutsideAssembly = _method.IsVisibleOutsideAssembly();

            _parentProperties = new NodeProperties();
            _parentProperties.LoadParent(Parent);
        }
Пример #3
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);
        }
Пример #4
0
        public MethodViewModel FindMethod(MethodDeclaration method)
        {
            var type = method.GetOwnerType();

            var typeViewModel = FindType(type);

            if (typeViewModel == null)
            {
                return(null);
            }

            return(typeViewModel.FindMethod(method));
        }