BuildReferencedTypeList() public static method

public static BuildReferencedTypeList ( AssemblyDefinition assemblies ) : HashSet
assemblies Mono.Cecil.AssemblyDefinition
return HashSet
Exemplo n.º 1
0
        public void CollectReferences(string path, bool collectMethods, float progressValue, bool ignoreSystemDlls)
        {
            this._progressValue       = progressValue;
            this._assemblyDefinitions = new HashSet <AssemblyDefinition>();
            string[] array = (!Directory.Exists(path)) ? new string[0] : Directory.GetFiles(path);
            DefaultAssemblyResolver assemblyResolver = AssemblyReferenceChecker.AssemblyResolverFor(path);

            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (!(Path.GetExtension(text) != ".dll"))
                {
                    AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(text, new ReaderParameters
                    {
                        AssemblyResolver = assemblyResolver
                    });
                    if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(assemblyDefinition.Name.Name))
                    {
                        this._assemblyFileNames.Add(Path.GetFileName(text));
                        this._assemblyDefinitions.Add(assemblyDefinition);
                    }
                }
            }
            AssemblyDefinition[] array3 = this._assemblyDefinitions.ToArray <AssemblyDefinition>();
            this._referencedTypes = MonoAOTRegistration.BuildReferencedTypeList(array3);
            if (collectMethods)
            {
                this.CollectReferencedAndDefinedMethods(array3);
            }
        }
 public void CollectReferences(string path, bool withMethods, float progressValue, bool ignoreSystemDlls)
 {
     this.assemblyDefinitions = new HashSet <AssemblyDefinition>();
     string[] array  = (!Directory.Exists(path)) ? new string[0] : Directory.GetFiles(path);
     string[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         string text = array2[i];
         if (!(Path.GetExtension(text) != ".dll"))
         {
             AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(text);
             if (!ignoreSystemDlls || !this.IsiPhoneIgnoredSystemDll(assemblyDefinition.Name.Name))
             {
                 this.assemblyFileNames.Add(Path.GetFileName(text));
                 this.assemblyDefinitions.Add(assemblyDefinition);
             }
         }
     }
     AssemblyDefinition[] array3 = this.assemblyDefinitions.ToArray <AssemblyDefinition>();
     this.referencedTypes = MonoAOTRegistration.BuildReferencedTypeList(array3);
     if (withMethods)
     {
         this.CollectReferencedMethods(array3, this.referencedMethods, this.definedMethods, progressValue);
     }
 }
 public string WhoReferencesClass(string klass, bool ignoreSystemDlls)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     AssemblyReferenceChecker.\u003CWhoReferencesClass\u003Ec__AnonStoreyBD classCAnonStoreyBd = new AssemblyReferenceChecker.\u003CWhoReferencesClass\u003Ec__AnonStoreyBD();
     // ISSUE: reference to a compiler-generated field
     classCAnonStoreyBd.klass = klass;
     using (HashSet <AssemblyDefinition> .Enumerator enumerator = this.assemblyDefinitions.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             AssemblyDefinition current = enumerator.Current;
             if (!ignoreSystemDlls || !this.IsiPhoneIgnoredSystemDll(((AssemblyNameReference)current.get_Name()).get_Name()))
             {
                 // ISSUE: reference to a compiler-generated method
                 if (MonoAOTRegistration.BuildReferencedTypeList(new AssemblyDefinition[1] {
                     current
                 }).Any <string>(new Func <string, bool>(classCAnonStoreyBd.\u003C\u003Em__22C)))
                 {
                     return(((AssemblyNameReference)current.get_Name()).get_Name());
                 }
             }
         }
     }
     return((string)null);
 }
 public void CollectReferencesFromRoots(string dir, IEnumerable <string> roots, bool withMethods, float progressValue, bool ignoreSystemDlls)
 {
     this.CollectReferencesFromRootsRecursive(dir, roots, ignoreSystemDlls);
     AssemblyDefinition[] array = this.assemblyDefinitions.ToArray <AssemblyDefinition>();
     this.referencedTypes = MonoAOTRegistration.BuildReferencedTypeList(array);
     if (withMethods)
     {
         this.CollectReferencedMethods(array, this.referencedMethods, this.definedMethods, progressValue);
     }
 }
        // Follows actually referenced libraries only
        public void CollectReferencesFromRoots(string dir, IEnumerable <string> roots, bool collectMethods, float progressValue, bool ignoreSystemDlls)
        {
            _progressValue = progressValue;

            CollectReferencesFromRootsRecursive(dir, roots, ignoreSystemDlls);

            var assemblyDefinitionsAsArray = _assemblyDefinitions.ToArray();

            _referencedTypes = MonoAOTRegistration.BuildReferencedTypeList(assemblyDefinitionsAsArray);

            if (collectMethods)
            {
                CollectReferencedAndDefinedMethods(assemblyDefinitionsAsArray);
            }
        }
 public string WhoReferencesClass(string klass, bool ignoreSystemDlls)
 {
     foreach (AssemblyDefinition current in this.assemblyDefinitions)
     {
         if (!ignoreSystemDlls || !this.IsiPhoneIgnoredSystemDll(current.Name.Name))
         {
             AssemblyDefinition[] assemblies = new AssemblyDefinition[]
             {
                 current
             };
             HashSet <string> source = MonoAOTRegistration.BuildReferencedTypeList(assemblies);
             if (source.Any((string item) => item.StartsWith(klass)))
             {
                 return(current.Name.Name);
             }
         }
     }
     return(null);
 }
        public string WhoReferencesClass(string klass, bool ignoreSystemDlls)
        {
            foreach (var assembly in _assemblyDefinitions)
            {
                if (ignoreSystemDlls && IsIgnoredSystemDll(assembly))
                {
                    continue;
                }

                var assemblyDefinitionsAsArray = new[] { assembly };
                var types = MonoAOTRegistration.BuildReferencedTypeList(assemblyDefinitionsAsArray);

                if (types.Any(item => item.StartsWith(klass)))
                {
                    return(assembly.Name.Name);
                }
            }

            return(null);
        }
        public void CollectReferences(string path, bool collectMethods, float progressValue, bool ignoreSystemDlls)
        {
            _progressValue = progressValue;

            _assemblyDefinitions = new HashSet <AssemblyDefinition>();

            var filePaths = Directory.Exists(path) ? Directory.GetFiles(path) : new string[0];

            using (var resolver = AssemblyResolverFor(path))
            {
                foreach (var filePath in filePaths)
                {
                    if (Path.GetExtension(filePath) != ".dll")
                    {
                        continue;
                    }

                    var assembly = AssemblyDefinition.ReadAssembly(filePath, new ReaderParameters {
                        AssemblyResolver = resolver
                    });

                    if (ignoreSystemDlls && IsIgnoredSystemDll(assembly))
                    {
                        continue;
                    }

                    _assemblyFileNames.Add(Path.GetFileName(filePath));
                    _assemblyDefinitions.Add(assembly);
                }
            }

            var assemblyDefinitionsAsArray = _assemblyDefinitions.ToArray();

            _referencedTypes = MonoAOTRegistration.BuildReferencedTypeList(assemblyDefinitionsAsArray);

            if (collectMethods)
            {
                CollectReferencedAndDefinedMethods(assemblyDefinitionsAsArray);
            }
        }
Exemplo n.º 9
0
        public string WhoReferencesClass(string klass, bool ignoreSystemDlls)
        {
            string result;

            foreach (AssemblyDefinition current in this._assemblyDefinitions)
            {
                if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(current.Name.Name))
                {
                    AssemblyDefinition[] assemblies = new AssemblyDefinition[]
                    {
                        current
                    };
                    HashSet <string> source = MonoAOTRegistration.BuildReferencedTypeList(assemblies);
                    if (source.Any((string item) => item.StartsWith(klass)))
                    {
                        result = current.Name.Name;
                        return(result);
                    }
                }
            }
            result = null;
            return(result);
        }
Exemplo n.º 10
0
 public void CollectReferences(string path, bool withMethods, float progressValue, bool ignoreSystemDlls)
 {
     this.assemblyDefinitions = new HashSet <AssemblyDefinition>();
     string[] strArray = !Directory.Exists(path) ? new string[0] : Directory.GetFiles(path);
     foreach (string str in strArray)
     {
         if (Path.GetExtension(str) == ".dll")
         {
             AssemblyDefinition item = AssemblyDefinition.ReadAssembly(str);
             if (!ignoreSystemDlls || !this.IsiPhoneIgnoredSystemDll(item.Name.Name))
             {
                 this.assemblyFileNames.Add(Path.GetFileName(str));
                 this.assemblyDefinitions.Add(item);
             }
         }
     }
     AssemblyDefinition[] assemblies = this.assemblyDefinitions.ToArray <AssemblyDefinition>();
     this.referencedTypes = MonoAOTRegistration.BuildReferencedTypeList(assemblies);
     if (withMethods)
     {
         this.CollectReferencedMethods(assemblies, this.referencedMethods, this.definedMethods, progressValue);
     }
 }
 public void CollectReferences(string path, bool withMethods, float progressValue, bool ignoreSystemDlls)
 {
     this.assemblyDefinitions = new HashSet <AssemblyDefinition>();
     foreach (string path1 in !Directory.Exists(path) ? new string[0] : Directory.GetFiles(path))
     {
         if (!(Path.GetExtension(path1) != ".dll"))
         {
             AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(path1);
             if (!ignoreSystemDlls || !this.IsiPhoneIgnoredSystemDll(((AssemblyNameReference)assemblyDefinition.get_Name()).get_Name()))
             {
                 this.assemblyFileNames.Add(Path.GetFileName(path1));
                 this.assemblyDefinitions.Add(assemblyDefinition);
             }
         }
     }
     AssemblyDefinition[] array = ((IEnumerable <AssemblyDefinition>) this.assemblyDefinitions).ToArray <AssemblyDefinition>();
     this.referencedTypes = MonoAOTRegistration.BuildReferencedTypeList(array);
     if (!withMethods)
     {
         return;
     }
     this.CollectReferencedMethods(array, this.referencedMethods, this.definedMethods, progressValue);
 }