DeleteAllDllsFrom() private static method

private static DeleteAllDllsFrom ( string managedLibrariesDirectory ) : void
managedLibrariesDirectory string
return void
Esempio n. 1
0
        public static void MonoLink(BuildTarget buildTarget, string managedLibrariesDirectory, string[] input, string[] allAssemblies, RuntimeClassRegistry usedClasses)
        {
            Process process             = MonoProcessUtility.PrepareMonoProcess(buildTarget, managedLibrariesDirectory);
            string  buildToolsDirectory = BuildPipeline.GetBuildToolsDirectory(buildTarget);
            string  text             = null;
            string  frameWorksFolder = MonoInstallationFinder.GetFrameWorksFolder();
            string  text2            = Path.Combine(frameWorksFolder, MonoAssemblyStripping.StripperExe());
            string  text3            = Path.Combine(Path.GetDirectoryName(text2), "link.xml");
            string  text4            = Path.Combine(managedLibrariesDirectory, "output");

            Directory.CreateDirectory(text4);
            process.StartInfo.Arguments = "\"" + text2 + "\" -l none -c link";
            for (int i = 0; i < input.Length; i++)
            {
                string           str     = input[i];
                ProcessStartInfo expr_80 = process.StartInfo;
                expr_80.Arguments = expr_80.Arguments + " -a \"" + str + "\"";
            }
            ProcessStartInfo expr_B3   = process.StartInfo;
            string           arguments = expr_B3.Arguments;

            expr_B3.Arguments = string.Concat(new string[]
            {
                arguments,
                " -out output -x \"",
                text3,
                "\" -d \"",
                managedLibrariesDirectory,
                "\""
            });
            string text5 = Path.Combine(buildToolsDirectory, "link.xml");

            if (File.Exists(text5))
            {
                ProcessStartInfo expr_110 = process.StartInfo;
                expr_110.Arguments = expr_110.Arguments + " -x \"" + text5 + "\"";
            }
            string text6 = Path.Combine(Path.GetDirectoryName(text2), "Core.xml");

            if (File.Exists(text6))
            {
                ProcessStartInfo expr_151 = process.StartInfo;
                expr_151.Arguments = expr_151.Arguments + " -x \"" + text6 + "\"";
            }
            string[] files = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "Assets"), "link.xml", SearchOption.AllDirectories);
            string[] array = files;
            for (int j = 0; j < array.Length; j++)
            {
                string           str2     = array[j];
                ProcessStartInfo expr_1A2 = process.StartInfo;
                expr_1A2.Arguments = expr_1A2.Arguments + " -x \"" + str2 + "\"";
            }
            if (usedClasses != null)
            {
                text = MonoAssemblyStripping.GenerateBlackList(managedLibrariesDirectory, usedClasses, allAssemblies);
                ProcessStartInfo expr_1E6 = process.StartInfo;
                expr_1E6.Arguments = expr_1E6.Arguments + " -x \"" + text + "\"";
            }
            MonoProcessUtility.RunMonoProcess(process, "assemblies stripper", Path.Combine(text4, "mscorlib.dll"));
            MonoAssemblyStripping.DeleteAllDllsFrom(managedLibrariesDirectory);
            MonoAssemblyStripping.CopyAllDlls(managedLibrariesDirectory, text4);
            string[] files2 = Directory.GetFiles(managedLibrariesDirectory);
            for (int k = 0; k < files2.Length; k++)
            {
                string text7 = files2[k];
                if (text7.Contains(".mdb"))
                {
                    string path = text7.Replace(".mdb", string.Empty);
                    if (!File.Exists(path))
                    {
                        FileUtil.DeleteFileOrDirectory(text7);
                    }
                }
            }
            if (text != null)
            {
                FileUtil.DeleteFileOrDirectory(Path.Combine(managedLibrariesDirectory, text));
            }
            FileUtil.DeleteFileOrDirectory(text4);
        }
        public static void MonoLink(BuildTarget buildTarget, string managedLibrariesDirectory, string[] input, string[] allAssemblies, RuntimeClassRegistry usedClasses)
        {
            Process process             = MonoProcessUtility.PrepareMonoProcess(buildTarget, managedLibrariesDirectory);
            string  buildToolsDirectory = BuildPipeline.GetBuildToolsDirectory(buildTarget);
            string  path2 = (string)null;
            string  path1 = Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), MonoAssemblyStripping.StripperExe());
            string  str1  = Path.Combine(Path.GetDirectoryName(path1), "link.xml");
            string  str2  = Path.Combine(managedLibrariesDirectory, "output");

            Directory.CreateDirectory(str2);
            process.StartInfo.Arguments = "\"" + path1 + "\" -l none -c link";
            foreach (string str3 in input)
            {
                ProcessStartInfo startInfo = process.StartInfo;
                string           str4      = startInfo.Arguments + " -a \"" + str3 + "\"";
                startInfo.Arguments = str4;
            }
            ProcessStartInfo startInfo1 = process.StartInfo;
            string           str5       = startInfo1.Arguments + " -out output -x \"" + str1 + "\" -d \"" + managedLibrariesDirectory + "\"";

            startInfo1.Arguments = str5;
            string path3 = Path.Combine(buildToolsDirectory, "link.xml");

            if (File.Exists(path3))
            {
                ProcessStartInfo startInfo2 = process.StartInfo;
                string           str3       = startInfo2.Arguments + " -x \"" + path3 + "\"";
                startInfo2.Arguments = str3;
            }
            string path4 = Path.Combine(Path.GetDirectoryName(path1), "Core.xml");

            if (File.Exists(path4))
            {
                ProcessStartInfo startInfo2 = process.StartInfo;
                string           str3       = startInfo2.Arguments + " -x \"" + path4 + "\"";
                startInfo2.Arguments = str3;
            }
            foreach (string file in Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "Assets"), "link.xml", SearchOption.AllDirectories))
            {
                ProcessStartInfo startInfo2 = process.StartInfo;
                string           str3       = startInfo2.Arguments + " -x \"" + file + "\"";
                startInfo2.Arguments = str3;
            }
            if (usedClasses != null)
            {
                path2 = MonoAssemblyStripping.GenerateBlackList(managedLibrariesDirectory, usedClasses, allAssemblies);
                ProcessStartInfo startInfo2 = process.StartInfo;
                string           str3       = startInfo2.Arguments + " -x \"" + path2 + "\"";
                startInfo2.Arguments = str3;
            }
            foreach (string file in Directory.GetFiles(Path.Combine(BuildPipeline.GetPlaybackEngineDirectory(EditorUserBuildSettings.activeBuildTarget, BuildOptions.None), "Whitelists"), "*.xml"))
            {
                ProcessStartInfo startInfo2 = process.StartInfo;
                string           str3       = startInfo2.Arguments + " -x \"" + file + "\"";
                startInfo2.Arguments = str3;
            }
            MonoProcessUtility.RunMonoProcess(process, "assemblies stripper", Path.Combine(str2, "mscorlib.dll"));
            MonoAssemblyStripping.DeleteAllDllsFrom(managedLibrariesDirectory);
            MonoAssemblyStripping.CopyAllDlls(managedLibrariesDirectory, str2);
            foreach (string file in Directory.GetFiles(managedLibrariesDirectory))
            {
                if (file.Contains(".mdb") && !File.Exists(file.Replace(".mdb", string.Empty)))
                {
                    FileUtil.DeleteFileOrDirectory(file);
                }
            }
            if (path2 != null)
            {
                FileUtil.DeleteFileOrDirectory(Path.Combine(managedLibrariesDirectory, path2));
            }
            FileUtil.DeleteFileOrDirectory(str2);
        }