Exemplo n.º 1
0
        void TestClass(Type type)
        {
            Assert.AreSame(typeof(object).Assembly, type.Assembly);
            IClass c = (IClass)mscorlib.GetClassByReflectionName(type.FullName, false);

            Assert.AreEqual(type.FullName, c.DotNetName);
        }
Exemplo n.º 2
0
        public object GetDescription(DesignItemProperty property)
        {
            IProjectContent pc = MyTypeFinder.GetProjectContent(file);

            if (pc != null)
            {
                // For attached Properties
                if (property.DependencyFullName != null && property.Name.Contains("."))
                {
                    IClass c = pc.GetClassByReflectionName(property.DependencyProperty.OwnerType.FullName, true);
                    if (c != null)
                    {
                        IMember m = DefaultProjectContent.GetMemberByReflectionName(c, property.DependencyProperty.Name + "Property");
                        if (m != null)
                        {
                            return(CodeCompletionItem.ConvertDocumentation(m.Documentation));
                        }
                    }
                }
                else
                {
                    IClass c = pc.GetClassByReflectionName(property.DeclaringType.FullName, true);
                    if (c != null)
                    {
                        IMember m = DefaultProjectContent.GetMemberByReflectionName(c, property.Name);
                        if (m != null)
                        {
                            return(CodeCompletionItem.ConvertDocumentation(m.Documentation));
                        }
                    }
                }
            }
            return(null);
        }
Exemplo n.º 3
0
        protected IClass GetClassFromName(string name)
        {
            if (name == null)
            {
                return(null);
            }
            if (ProjectService.OpenSolution == null)
            {
                return(null);
            }

            foreach (IProject project in ProjectService.OpenSolution.Projects)
            {
                IProjectContent content = ParserService.GetProjectContent(project);
                if (content != null)
                {
                    IClass c = content.GetClassByReflectionName(name, true);
                    if (c != null)
                    {
                        return(c);
                    }
                }
            }

            return(null);
        }
        public bool HasField(string reflectionTypeName, int typeParameterCount, string fieldName)
        {
            IClass c;

            if (typeParameterCount > 0)
            {
                c = _projectContent.GetClass(reflectionTypeName, typeParameterCount);
            }
            else
            {
                c = _projectContent.GetClassByReflectionName(reflectionTypeName, true);
            }
            if (c == null)
            {
                return(false);
            }
            foreach (IField field in c.DefaultReturnType.GetFields())
            {
                if (field.Name == fieldName)
                {
                    return(true);
                }
            }
            return(false);
        }
		internal static FilePosition GetPosition(IProjectContent pc, string className, string memberName)
		{
			IClass c = pc.GetClassByReflectionName(className, false);
			if (string.IsNullOrEmpty(memberName))
				return pc.GetPosition(c);
			if (c != null) {
				IMember m = DefaultProjectContent.GetMemberByReflectionName(c, memberName);
				if (m != null)
					return pc.GetPosition(m);
			}
			return FilePosition.Empty;
		}
Exemplo n.º 6
0
        internal static FilePosition GetPosition(IProjectContent pc, string className, string memberName)
        {
            IClass c = pc.GetClassByReflectionName(className, false);

            if (string.IsNullOrEmpty(memberName))
            {
                return(pc.GetPosition(c));
            }
            if (c != null)
            {
                IMember m = DefaultProjectContent.GetMemberByReflectionName(c, memberName);
                if (m != null)
                {
                    return(pc.GetPosition(m));
                }
            }
            return(FilePosition.Empty);
        }