コード例 #1
0
        /// <summary>
        /// Determines whether the specified attribute has a property with the specified value.
        /// </summary>
        /// <param name="attributeFullName">Full name of the attribute.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="propertyValue">The property value.</param>
        /// <returns>
        ///     <c>true</c> if the attribute property has the specified value; otherwise, <c>false</c>.
        /// </returns>
        public bool HasAttributePropertyValue(string attributeFullName, string propertyName, object propertyValue)
        {
            if (HasAttribute(attributeFullName))
            {
                return(InternalHasAttributePropertyValue((CodeElement)codeType, attributeFullName, propertyName, propertyValue));
            }

            CodeElement element = FileCodeModelHelper.FindCodeElementFromType((CodeElement)codeType, attributeFullName, vsCMElement.vsCMElementAttribute);

            if (element != null)
            {
                return(InternalHasAttributePropertyValue(element, attributeFullName, propertyName, propertyValue));
            }

            return(false);
        }
コード例 #2
0
        private bool Evaluate(out object newValue)
        {
            newValue = null;
            string typeName = ExpressionEvaluationHelper.EvaluateExpression((IDictionaryService)GetService(typeof(IDictionaryService)),
                                                                            TypeNameExpression) as string;
            Project project = ExpressionEvaluationHelper.EvaluateExpression((IDictionaryService)GetService(typeof(IDictionaryService)),
                                                                            ProjectExpression) as Project;

            if (typeName != null && project != null)
            {
                CodeClass targetClass = FileCodeModelHelper.FindCodeElementFromType(project, typeName, vsCMElement.vsCMElementClass) as CodeClass;
                newValue = (targetClass != null);
                return(true);
            }

            return(false);
        }