IsDLLUsed() public method

public IsDLLUsed ( string dll ) : bool
dll string
return bool
Example #1
0
        // this logic produces similar list of assemblies that IL2CPP will convert (it differs in the way it collects winmd files)
        public static IEnumerable <AssemblyDefinition> CollectAllAssemblies(string librariesFolder, RuntimeClassRegistry usedClasses)
        {
            var resolver = new DefaultAssemblyResolver();

            resolver.RemoveSearchDirectory(".");
            resolver.RemoveSearchDirectory("bin");
            resolver.AddSearchDirectory(librariesFolder);

            var usedDlls = usedClasses.GetUserAssemblies().Where(s => usedClasses.IsDLLUsed(s)).Select(file => AssemblyNameReference.Parse(Path.GetFileNameWithoutExtension(file)));

            return(CollectAssembliesRecursive(usedDlls.Select(dll => ResolveAssemblyReference(resolver, dll)).Where(a => a != null)));
        }
        public static IEnumerable <AssemblyDefinition> CollectAllAssemblies(string librariesFolder, RuntimeClassRegistry usedClasses)
        {
            DefaultAssemblyResolver resolver = new DefaultAssemblyResolver();

            resolver.RemoveSearchDirectory(".");
            resolver.RemoveSearchDirectory("bin");
            resolver.AddSearchDirectory(librariesFolder);
            IEnumerable <AssemblyNameReference> source = from s in usedClasses.GetUserAssemblies()
                                                         where usedClasses.IsDLLUsed(s)
                                                         select s into file
                                                         select AssemblyNameReference.Parse(Path.GetFileNameWithoutExtension(file));

            return(MonoAssemblyStripping.CollectAssembliesRecursive(from dll in source
                                                                    select MonoAssemblyStripping.ResolveAssemblyReference(resolver, dll) into a
                                                                    where a != null
                                                                    select a));
        }
        public static string GenerateLinkXmlToPreserveDerivedTypes(string stagingArea, string librariesFolder, RuntimeClassRegistry usedClasses)
        {
            string fullPath = Path.GetFullPath(Path.Combine(stagingArea, "preserved_derived_types.xml"));
            DefaultAssemblyResolver resolver = new DefaultAssemblyResolver();

            resolver.AddSearchDirectory(librariesFolder);
            using (TextWriter textWriter = new StreamWriter(fullPath))
            {
                textWriter.WriteLine("<linker>");
                foreach (AssemblyDefinition current in MonoAssemblyStripping.CollectAssembliesRecursive(from s in usedClasses.GetUserAssemblies()
                                                                                                        where usedClasses.IsDLLUsed(s)
                                                                                                        select s into file
                                                                                                        select resolver.Resolve(Path.GetFileNameWithoutExtension(file), new ReaderParameters
                {
                    AssemblyResolver = resolver
                })))
                {
                    if (!(current.Name.Name == "UnityEngine"))
                    {
                        HashSet <TypeDefinition> hashSet = new HashSet <TypeDefinition>();
                        MonoAssemblyStripping.CollectBlackListTypes(hashSet, current.MainModule.Types, usedClasses.GetAllManagedBaseClassesAsString());
                        if (hashSet.Count != 0)
                        {
                            textWriter.WriteLine("<assembly fullname=\"{0}\">", current.Name.Name);
                            foreach (TypeDefinition current2 in hashSet)
                            {
                                textWriter.WriteLine("<type fullname=\"{0}\" preserve=\"all\"/>", current2.FullName);
                            }
                            textWriter.WriteLine("</assembly>");
                        }
                    }
                }
                textWriter.WriteLine("</linker>");
            }
            return(fullPath);
        }