Пример #1
0
        public WhoReferencesAssembly(UsageQueryAggregator aggregator, string fileName) : base(aggregator)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentException("File name was null or empty.");
            }

            this.myAssembly = Path.GetFileNameWithoutExtension(fileName);
            aggregator.AddVisitScope(fileName);
        }
        public WhoInstantiatesType(UsageQueryAggregator aggregator, TypeDefinition type) : base(aggregator)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type was null");
            }

            this.myType = type;
            this.Aggregator.AddVisitScope(type.Module.Assembly.Name.Name);
        }
        public WhoUsesStringConstant(UsageQueryAggregator aggregator, string searchString, bool bExactMatch, StringComparison compMode) : base(aggregator)
        {
            if (string.IsNullOrEmpty(searchString))
            {
                throw new ArgumentException("The search string was null or empty");
            }

            this.mySearchString   = searchString;
            this.mybExatchMatch   = bExactMatch;
            this.myComparisonMode = compMode;
        }
        public WhoUsesStringConstant(UsageQueryAggregator aggregator, string searchString, bool bExactMatch, StringComparison compMode) : base(aggregator)
        {
            if (string.IsNullOrEmpty(searchString))
            {
                throw new ArgumentException("The search string was null or empty");
            }

            this.mySearchString = searchString;
            this.mybExatchMatch = bExactMatch;
            this.myComparisonMode = compMode;
        }
Пример #5
0
        public UsageVisitor(UsageQueryAggregator aggregator)
        {
            if (aggregator == null)
            {
                throw new ArgumentNullException("aggregator");
            }

            this.Aggregator = aggregator;

            // subscribe ourself to the aggregator when the query is constructed
            this.Aggregator.AddQuery(this);
        }
        public WhoDerivesFromType(UsageQueryAggregator aggregator, List<TypeDefinition> typeDefs) : base(aggregator)
        {
            if (typeDefs == null)
            {
                throw new ArgumentException("The type list to query for was null.");
            }

            foreach (var type in typeDefs)
            {
                this.Aggregator.AddVisitScope(type.Module.Assembly.Name.Name);
            }

            this.mySearchBaseTypes = typeDefs;
        }
        public WhoDerivesFromType(UsageQueryAggregator aggregator, List <TypeDefinition> typeDefs) : base(aggregator)
        {
            if (typeDefs == null)
            {
                throw new ArgumentException("The type list to query for was null.");
            }

            foreach (var type in typeDefs)
            {
                this.Aggregator.AddVisitScope(type.Module.Assembly.Name.Name);
            }

            this.mySearchBaseTypes = typeDefs;
        }
        public WhoHasFieldOfType(UsageQueryAggregator aggregator, List<TypeDefinition> fieldTypes) : base(aggregator)
        {
            if (fieldTypes == null)
            {
                throw new ArgumentNullException("fieldTypes");
            }

            this.mySearchTypes = fieldTypes;

            foreach (var fieldType in fieldTypes)
            {
                this.mySearchTypeNames.Add(fieldType.Name);
                this.Aggregator.AddVisitScope(fieldType.Module.Assembly.Name.Name);
            }
        }
Пример #9
0
        public WhoHasFieldOfType(UsageQueryAggregator aggregator, List <TypeDefinition> fieldTypes) : base(aggregator)
        {
            if (fieldTypes == null)
            {
                throw new ArgumentNullException("fieldTypes");
            }

            this.mySearchTypes = fieldTypes;

            foreach (var fieldType in fieldTypes)
            {
                this.mySearchTypeNames.Add(fieldType.Name);
                this.Aggregator.AddVisitScope(fieldType.Module.Assembly.Name.Name);
            }
        }
        public WhoUsesEvents(UsageQueryAggregator aggreagator, List <EventDefinition> events) : base(aggreagator)
        {
            if (events == null)
            {
                throw new ArgumentException("The events list was null.");
            }

            this.myEvents = events;

            foreach (var ev in this.myEvents)
            {
                this.Aggregator.AddVisitScope(ev.AddMethod.DeclaringType.Module.Assembly.Name.Name);
                this.myEventNames.Add(ev.AddMethod.Name);
                this.myEventNames.Add(ev.RemoveMethod.Name);
            }
        }
        public WhoUsesMethod(UsageQueryAggregator aggregator, List<MethodDefinition> methods) : base(aggregator)
        {
            if (methods == null)
            {
                throw new ArgumentNullException("The method list to query for was null.");
            }

            foreach (var method in methods)
            {
                this.Aggregator.AddVisitScope(method.DeclaringType.Module.Assembly.Name.Name);
                List<MethodDefinition> typeMethods = null;
                if (!this.myMethodNames.TryGetValue(method.DeclaringType.Name, out typeMethods))
                {
                    typeMethods = new List<MethodDefinition>();
                    this.myMethodNames[method.DeclaringType.Name] = typeMethods;
                }
                this.myMethodNames[method.DeclaringType.Name].Add(method);
            }
        }
Пример #12
0
        public WhoAccessesField(UsageQueryAggregator aggregator, List <FieldDefinition> fields) : base(aggregator)
        {
            if (fields == null)
            {
                throw new ArgumentException("The field list was null.");
            }

            this.mySearchFields = fields;

            foreach (var field in fields)
            {
                if (field.HasConstant)
                {
                    throw new ArgumentException(string.Format("The field {0} is constant. Its value is compiled directly into the users of this constant which makes is impossible to search for users of it.", field.Print(FieldPrintOptions.All)));
                }
                this.myDeclaringTypeNamesToSearch.Add(field.DeclaringType.Name);
                this.Aggregator.AddVisitScope(field.DeclaringType.Module.Assembly.Name.Name);
            }
        }
        public WhoAccessesField(UsageQueryAggregator aggregator, List<FieldDefinition> fields) : base(aggregator)
        {
            if (fields == null)
            {
                throw new ArgumentException("The field list was null.");
            }

            this.mySearchFields = fields;

            foreach (var field in fields)
            {
                if (field.HasConstant)
                {
                    throw new ArgumentException(string.Format("The field {0} is constant. Its value is compiled directly into the users of this constant which makes is impossible to search for users of it.", field.Print(FieldPrintOptions.All)));
                }
                this.myDeclaringTypeNamesToSearch.Add(field.DeclaringType.Name);
                this.Aggregator.AddVisitScope(field.DeclaringType.Module.Assembly.Name.Name);
            }
        }
Пример #14
0
        public WhoUsesMethod(UsageQueryAggregator aggregator, List <MethodDefinition> methods) : base(aggregator)
        {
            if (methods == null)
            {
                throw new ArgumentNullException("The method list to query for was null.");
            }

            foreach (var method in methods)
            {
                this.Aggregator.AddVisitScope(method.DeclaringType.Module.Assembly.Name.Name);
                List <MethodDefinition> typeMethods = null;
                if (!this.myMethodNames.TryGetValue(method.DeclaringType.Name, out typeMethods))
                {
                    typeMethods = new List <MethodDefinition>();
                    this.myMethodNames[method.DeclaringType.Name] = typeMethods;
                }
                this.myMethodNames[method.DeclaringType.Name].Add(method);
            }
        }
        public WhoUsesType(UsageQueryAggregator aggregator, List <TypeDefinition> funcArgTypes) : base(aggregator)
        {
            using (var t = new Tracer(Level.L5, myType, "WhoUsesType"))
            {
                if (funcArgTypes == null)
                {
                    throw new ArgumentNullException("funcArgTypes");
                }

                this.mySearchArgTypes = funcArgTypes;

                foreach (var funcArgType in funcArgTypes)
                {
                    t.Info("Adding search type {0}", new LazyFormat(() => funcArgType.Print()));
                    this.myArgSearchTypeNames.Add(funcArgType.Name);
                    this.Aggregator.AddVisitScope(funcArgType.Module.Assembly.Name.Name);
                    new WhoAccessesField(aggregator, notConst.GetMatchingFields(funcArgType));
                }
            }
        }
        public WhoUsesType(UsageQueryAggregator aggregator, List<TypeDefinition> funcArgTypes) : base(aggregator)
        {
            using (var t = new Tracer(Level.L5, myType, "WhoUsesType"))
            {
                if (funcArgTypes == null)
                {
                    throw new ArgumentNullException("funcArgTypes");
                }

                this.mySearchArgTypes = funcArgTypes;

                foreach (var funcArgType in funcArgTypes)
                {
                    t.Info("Adding search type {0}", new LazyFormat(() => funcArgType.Print()));
                    this.myArgSearchTypeNames.Add(funcArgType.Name);
                    this.Aggregator.AddVisitScope(funcArgType.Module.Assembly.Name.Name);
                    new WhoAccessesField(aggregator, notConst.GetMatchingFields(funcArgType));
                }
            }
        }
        public WhoImplementsInterface(UsageQueryAggregator aggreator, List<TypeDefinition> interfaces) : base(aggreator)
        {
            if (interfaces == null || interfaces.Count == 0)
            {
                throw new ArgumentException("The interfaces collection was null.");
            }

            foreach (var type in interfaces)
            {
                if (!type.IsInterface)
                {
                    throw new ArgumentException(string.Format("The type {0} is not an interface", type.Print()));
                }

                this.Aggregator.AddVisitScope(type.Module.Assembly.Name.Name);
                if (!this.myInterfaceNames.ContainsKey(type.Name))
                {
                    this.myInterfaceNames.Add(type.Name, type);
                }
            }
        }
        public WhoImplementsInterface(UsageQueryAggregator aggreator, List <TypeDefinition> interfaces) : base(aggreator)
        {
            if (interfaces == null || interfaces.Count == 0)
            {
                throw new ArgumentException("The interfaces collection was null.");
            }

            foreach (var type in interfaces)
            {
                if (!type.IsInterface)
                {
                    throw new ArgumentException(string.Format("The type {0} is not an interface", type.Print()));
                }

                this.Aggregator.AddVisitScope(type.Module.Assembly.Name.Name);
                if (!this.myInterfaceNames.ContainsKey(type.Name))
                {
                    this.myInterfaceNames.Add(type.Name, type);
                }
            }
        }
 public WhoAccessesField(UsageQueryAggregator aggreagator, FieldDefinition field) : this(aggreagator, new List<FieldDefinition>
 {
     ThrowIfNull("field", field)
 })
 {
 }
 public WhoImplementsInterface(UsageQueryAggregator aggregator, TypeDefinition itf) : this(aggregator, new List<TypeDefinition>
 {
     ThrowIfNull("itf", itf)
 })
 {
 }
 public WhoDerivesFromType(UsageQueryAggregator aggregator, TypeDefinition typeDef) : this(aggregator, new List<TypeDefinition>
 {
     ThrowIfNull("typeDef", typeDef)
 })
 {
 }
 public WhoDerivesFromType(UsageQueryAggregator aggregator, TypeDefinition typeDef) : this(aggregator, new List <TypeDefinition>
 {
     ThrowIfNull("typeDef", typeDef)
 })
 {
 }
 public WhoUsesType(UsageQueryAggregator aggregator, TypeDefinition funcArgType) : this(aggregator, new List<TypeDefinition>
 {
     ThrowIfNull("funcArgType", funcArgType)
 })
 {
 }
 public WhoUsesStringConstant(UsageQueryAggregator aggregator, string searchString) : this(aggregator, searchString, false, StringComparison.OrdinalIgnoreCase)
 {
 }
 public WhoUsesStringConstant(UsageQueryAggregator aggregator, string searchString, bool bExactMatch) : this(aggregator, searchString, bExactMatch, StringComparison.OrdinalIgnoreCase)
 {
 }
 public WhoHasFieldOfType(UsageQueryAggregator aggregator, TypeDefinition fieldType) : this(aggregator, new List<TypeDefinition>
 {
     ThrowIfNull("fieldType", fieldType)
 })
 {
 }
 public WhoUsesType(UsageQueryAggregator aggregator, TypeDefinition funcArgType) : this(aggregator, new List <TypeDefinition>
 {
     ThrowIfNull("funcArgType", funcArgType)
 })
 {
 }
Пример #28
0
 public WhoAccessesField(UsageQueryAggregator aggreagator, FieldDefinition field) : this(aggreagator, new List <FieldDefinition>
 {
     ThrowIfNull("field", field)
 })
 {
 }
 public WhoUsesStringConstant(UsageQueryAggregator aggregator, string searchString) : this(aggregator, searchString, false, StringComparison.OrdinalIgnoreCase)
 {
 }
 public WhoUsesStringConstant(UsageQueryAggregator aggregator, string searchString, bool bExactMatch) : this(aggregator, searchString, bExactMatch, StringComparison.OrdinalIgnoreCase)
 {
 }
 public WhoImplementsInterface(UsageQueryAggregator aggregator, TypeDefinition itf) : this(aggregator, new List <TypeDefinition>
 {
     ThrowIfNull("itf", itf)
 })
 {
 }
 public WhoUsesEvents(UsageQueryAggregator aggregator, EventDefinition ev) : this(aggregator, new List <EventDefinition>
 {
     ThrowIfNull("ev", ev)
 })
 {
 }
Пример #33
0
 public WhoHasFieldOfType(UsageQueryAggregator aggregator, TypeDefinition fieldType) : this(aggregator, new List <TypeDefinition>
 {
     ThrowIfNull("fieldType", fieldType)
 })
 {
 }