コード例 #1
0
        /// <summary>
        /// Aggregates the matches from the usage queries.
        /// </summary>
        /// <param name="bReadPdbs">if set to <c>true</c> [you get file and line information for the matches].</param>
        public UsageQueryAggregator(bool bReadPdbs)
        {
            MethodMatches   = new List <QueryResult <MethodDefinition> >();
            TypeMatches     = new List <QueryResult <TypeDefinition> >();
            myTypeQuery     = new TypeQuery();
            FieldMatches    = new List <QueryResult <FieldDefinition> >();
            AssemblyMatches = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            if (bReadPdbs)
            {
                myPdbReader = new PdbInformationReader();
            }
        }
コード例 #2
0
ファイル: TypeQuery.cs プロジェクト: arlm/apichange
        /// <summary>
        /// Helper method to get only one specific type by its full qualified type name.
        /// </summary>
        /// <param name="assembly"></param>
        /// <param name="typeName"></param>
        /// <returns></returns>
        public static TypeDefinition GetTypeByName(AssemblyDefinition assembly, string typeName)
        {
            var types = new TypeQuery().GetTypes(assembly);

            foreach (TypeDefinition type in types)
            {
                if (type.FullName == typeName)
                {
                    return(type);
                }
            }

            return(null);
        }
コード例 #3
0
        public List <TypeQuery> GetQueries(string typeQueries, TypeQueryMode additionalFlags)
        {
            if (typeQueries == null)
            {
                throw new ArgumentNullException("typeQueries");
            }

            string trimedQuery = typeQueries.Trim();

            if (trimedQuery == "")
            {
                throw new ArgumentException("typeQueries was an empty string");
            }

            string[] queries = trimedQuery.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            List <TypeQuery> ret = new List <TypeQuery>();

            foreach (string query in queries)
            {
                Match m = myQueryParser.Match(query);
                if (!m.Success)
                {
                    throw new ArgumentException(
                              String.Format("The type query \"{0}\" is not of the form [public|internal|class|interface|struct|enum|nocompiler|api] typename", query));
                }

                TypeQueryMode mode = GetQueryMode(m);
                var           nameSpaceTypeName = SplitNameSpaceAndType(m.Groups["typeName"].Value);
                var           typeQuery         = new TypeQuery(mode, nameSpaceTypeName.Key, nameSpaceTypeName.Value);
                if (typeQuery.SearchMode == TypeQueryMode.None)
                {
                    typeQuery.SearchMode |= additionalFlags;
                }
                ret.Add(typeQuery);
            }

            return(ret);
        }
コード例 #4
0
 public UsageQueryAggregator(TypeQuery query) : this(true)
 {
     myTypeQuery = query;
 }