示例#1
0
        public static void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames)
        {
            string buildToolsDirectory = BuildPipeline.GetBuildToolsDirectory(buildTarget);
            string str = Path.Combine(buildToolsDirectory, "mono-cil-strip.exe");

            for (int i = 0; i < fileNames.Length; i++)
            {
                string  text    = fileNames[i];
                Process process = MonoProcessUtility.PrepareMonoProcess(buildTarget, managedLibrariesDirectory);
                string  text2   = text + ".out";
                process.StartInfo.Arguments = "\"" + str + "\"";
                ProcessStartInfo expr_5B   = process.StartInfo;
                string           arguments = expr_5B.Arguments;
                expr_5B.Arguments = string.Concat(new string[]
                {
                    arguments,
                    " \"",
                    text,
                    "\" \"",
                    text,
                    ".out\""
                });
                MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, text2));
                MonoAssemblyStripping.ReplaceFile(managedLibrariesDirectory + "/" + text2, managedLibrariesDirectory + "/" + text);
                File.Delete(managedLibrariesDirectory + "/" + text2);
            }
        }
        public static void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames)
        {
            string profileDirectory = MonoInstallationFinder.GetProfileDirectory(BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6), "MonoBleedingEdge");
            string str = Path.Combine(profileDirectory, "mono-cil-strip.exe");

            for (int i = 0; i < fileNames.Length; i++)
            {
                string  text    = fileNames[i];
                Process process = MonoProcessUtility.PrepareMonoProcessBleedingEdge(managedLibrariesDirectory);
                string  text2   = text + ".out";
                process.StartInfo.Arguments = "\"" + str + "\"";
                ProcessStartInfo expr_67   = process.StartInfo;
                string           arguments = expr_67.Arguments;
                expr_67.Arguments = string.Concat(new string[]
                {
                    arguments,
                    " \"",
                    text,
                    "\" \"",
                    text,
                    ".out\""
                });
                MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, text2));
                MonoAssemblyStripping.ReplaceFile(managedLibrariesDirectory + "/" + text2, managedLibrariesDirectory + "/" + text);
                File.Delete(managedLibrariesDirectory + "/" + text2);
            }
        }
示例#3
0
        public static void RunMonoProcess(Process process, string name, string resultingFile)
        {
            MonoProcessRunner monoProcessRunner = new MonoProcessRunner();
            bool flag = monoProcessRunner.Run(process);

            if (process.ExitCode != 0 || !File.Exists(resultingFile))
            {
                string message = "Failed " + name + ": " + MonoProcessUtility.ProcessToString(process) + " result file exists: " + (object)File.Exists(resultingFile) + ". Timed out: " + (object)!flag + "\n\n" + "stdout:\n" + (object)monoProcessRunner.Output + "\n" + "stderr:\n" + (object)monoProcessRunner.Error + "\n";
                Console.WriteLine(message);
                throw new UnityException(message);
            }
        }
示例#4
0
        public static Process PrepareMonoProcess(BuildTarget target, string workDir)
        {
            Process process = new Process();

            process.StartInfo.FileName = MonoProcessUtility.GetMonoExec(target);
            process.StartInfo.EnvironmentVariables["_WAPI_PROCESS_HANDLE_OFFSET"] = "5";
            process.StartInfo.EnvironmentVariables["MONO_PATH"] = MonoProcessUtility.GetMonoPath(target);
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.WorkingDirectory       = workDir;
            return(process);
        }
        public static void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames)
        {
            string str1 = Path.Combine(BuildPipeline.GetBuildToolsDirectory(buildTarget), "mono-cil-strip.exe");

            foreach (string fileName in fileNames)
            {
                Process process = MonoProcessUtility.PrepareMonoProcess(buildTarget, managedLibrariesDirectory);
                string  path2   = fileName + ".out";
                process.StartInfo.Arguments = "\"" + str1 + "\"";
                ProcessStartInfo startInfo = process.StartInfo;
                string           str2      = startInfo.Arguments + " \"" + fileName + "\" \"" + fileName + ".out\"";
                startInfo.Arguments = str2;
                MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, path2));
                MonoAssemblyStripping.ReplaceFile(managedLibrariesDirectory + "/" + path2, managedLibrariesDirectory + "/" + fileName);
                File.Delete(managedLibrariesDirectory + "/" + path2);
            }
        }
        public static void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames)
        {
            string str2 = Path.Combine(BuildPipeline.GetBuildToolsDirectory(buildTarget), "mono-cil-strip.exe");

            foreach (string str3 in fileNames)
            {
                Process process = MonoProcessUtility.PrepareMonoProcess(buildTarget, managedLibrariesDirectory);
                string  str4    = str3 + ".out";
                process.StartInfo.Arguments = "\"" + str2 + "\"";
                ProcessStartInfo startInfo  = process.StartInfo;
                string           arguments  = startInfo.Arguments;
                string[]         textArray1 = new string[] { arguments, " \"", str3, "\" \"", str3, ".out\"" };
                startInfo.Arguments = string.Concat(textArray1);
                MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, str4));
                ReplaceFile(managedLibrariesDirectory + "/" + str4, managedLibrariesDirectory + "/" + str3);
                File.Delete(managedLibrariesDirectory + "/" + str4);
            }
        }
示例#7
0
        static public void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames)
        {
            string basePath    = MonoInstallationFinder.GetProfileDirectory(BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6), MonoInstallationFinder.MonoBleedingEdgeInstallation);
            string cilStripper = Path.Combine(basePath, "mono-cil-strip.exe");

            foreach (string fileName in fileNames)
            {
                Process process = MonoProcessUtility.PrepareMonoProcessBleedingEdge(managedLibrariesDirectory);
                string  outFile = fileName + ".out";

                process.StartInfo.Arguments  = "\"" + cilStripper + "\"";
                process.StartInfo.Arguments += " \"" + fileName + "\" \"" + fileName + ".out\"";

                MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, outFile));

                ReplaceFile(managedLibrariesDirectory + "/" + outFile, managedLibrariesDirectory + "/" + fileName);
                File.Delete(managedLibrariesDirectory + "/" + outFile);
            }
        }
        public static void RunMonoProcess(Process process, string name, string resultingFile)
        {
            MonoProcessRunner monoProcessRunner = new MonoProcessRunner();
            bool flag = monoProcessRunner.Run(process);

            if (process.ExitCode != 0 || !File.Exists(resultingFile))
            {
                string text = string.Concat(new object[]
                {
                    "Failed ",
                    name,
                    ": ",
                    MonoProcessUtility.ProcessToString(process),
                    " result file exists: ",
                    File.Exists(resultingFile),
                    ". Timed out: ",
                    !flag
                });
                text += "\n\n";
                string text2 = text;
                text = string.Concat(new object[]
                {
                    text2,
                    "stdout:\n",
                    monoProcessRunner.Output,
                    "\n"
                });
                text2 = text;
                text  = string.Concat(new object[]
                {
                    text2,
                    "stderr:\n",
                    monoProcessRunner.Error,
                    "\n"
                });
                Console.WriteLine(text);
                throw new UnityException(text);
            }
        }
        static public void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames)
        {
            // Previously requested the directory for the ApiCompatibilityLevel.NET_4_6 profile. That gets
            // translated to unityjit which does not contain mono-cil-strip.exe.
            // Per the scripting team, hardcoding to 4.5 is the correct course of action at this time.
            string basePath    = MonoInstallationFinder.GetProfileDirectory("4.5", MonoInstallationFinder.MonoBleedingEdgeInstallation);
            string cilStripper = Path.Combine(basePath, "mono-cil-strip.exe");

            foreach (string fileName in fileNames)
            {
                Process process = MonoProcessUtility.PrepareMonoProcessBleedingEdge(managedLibrariesDirectory);
                string  outFile = fileName + ".out";

                process.StartInfo.Arguments  = "\"" + cilStripper + "\"";
                process.StartInfo.Arguments += " \"" + fileName + "\" \"" + fileName + ".out\"";

                MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, outFile));

                ReplaceFile(managedLibrariesDirectory + "/" + outFile, managedLibrariesDirectory + "/" + fileName);
                File.Delete(managedLibrariesDirectory + "/" + outFile);
            }
        }
示例#10
0
        private static void CrossCompileAOT(BuildTarget target, string crossCompilerAbsolutePath, string assembliesAbsoluteDirectory, CrossCompileOptions crossCompileOptions, string input, string output, string additionalOptions)
        {
            string text = string.Empty;

            if (!MonoCrossCompile.IsDebugableAssembly(input))
            {
                crossCompileOptions &= ~CrossCompileOptions.Debugging;
                crossCompileOptions &= ~CrossCompileOptions.LoadSymbols;
            }
            bool flag  = (crossCompileOptions & CrossCompileOptions.Debugging) != CrossCompileOptions.Dynamic;
            bool flag2 = (crossCompileOptions & CrossCompileOptions.LoadSymbols) != CrossCompileOptions.Dynamic;
            bool flag3 = flag || flag2;

            if (flag3)
            {
                text += "--debug ";
            }
            if (flag)
            {
                text += "--optimize=-linears ";
            }
            text += "--aot=full,asmonly,";
            if (flag3)
            {
                text += "write-symbols,";
            }
            if ((crossCompileOptions & CrossCompileOptions.Debugging) != CrossCompileOptions.Dynamic)
            {
                text += "soft-debug,";
            }
            else
            {
                if (!flag3)
                {
                    text += "nodebug,";
                }
            }
            if (target != BuildTarget.iOS)
            {
                text += "print-skipped,";
            }
            if (additionalOptions != null & additionalOptions.Trim().Length > 0)
            {
                text = text + additionalOptions.Trim() + ",";
            }
            string fileName = Path.GetFileName(output);
            string text2    = Path.Combine(assembliesAbsoluteDirectory, fileName);

            if ((crossCompileOptions & CrossCompileOptions.FastICall) != CrossCompileOptions.Dynamic)
            {
                text += "ficall,";
            }
            if ((crossCompileOptions & CrossCompileOptions.Static) != CrossCompileOptions.Dynamic)
            {
                text += "static,";
            }
            string text3 = text;

            text = string.Concat(new string[]
            {
                text3,
                "outfile=\"",
                fileName,
                "\" \"",
                input,
                "\" "
            });
            Process process = new Process();

            process.StartInfo.FileName  = crossCompilerAbsolutePath;
            process.StartInfo.Arguments = text;
            process.StartInfo.EnvironmentVariables["MONO_PATH"]  = assembliesAbsoluteDirectory;
            process.StartInfo.EnvironmentVariables["GAC_PATH"]   = assembliesAbsoluteDirectory;
            process.StartInfo.EnvironmentVariables["GC_DONT_GC"] = "yes please";
            if ((crossCompileOptions & CrossCompileOptions.ExplicitNullChecks) != CrossCompileOptions.Dynamic)
            {
                process.StartInfo.EnvironmentVariables["MONO_DEBUG"] = "explicit-null-checks";
            }
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.RedirectStandardOutput = true;
            if (MonoCrossCompile.ArtifactsPath != null)
            {
                if (!Directory.Exists(MonoCrossCompile.ArtifactsPath))
                {
                    Directory.CreateDirectory(MonoCrossCompile.ArtifactsPath);
                }
                File.AppendAllText(MonoCrossCompile.ArtifactsPath + "output.txt", process.StartInfo.FileName + "\n");
                File.AppendAllText(MonoCrossCompile.ArtifactsPath + "output.txt", process.StartInfo.Arguments + "\n");
                File.AppendAllText(MonoCrossCompile.ArtifactsPath + "output.txt", assembliesAbsoluteDirectory + "\n");
                File.AppendAllText(MonoCrossCompile.ArtifactsPath + "output.txt", text2 + "\n");
                File.AppendAllText(MonoCrossCompile.ArtifactsPath + "output.txt", input + "\n");
                File.AppendAllText(MonoCrossCompile.ArtifactsPath + "houtput.txt", fileName + "\n\n");
                File.Copy(assembliesAbsoluteDirectory + "\\" + input, MonoCrossCompile.ArtifactsPath + "\\" + input, true);
            }
            process.StartInfo.WorkingDirectory = assembliesAbsoluteDirectory;
            MonoProcessUtility.RunMonoProcess(process, "AOT cross compiler", text2);
            File.Move(text2, output);
            if ((crossCompileOptions & CrossCompileOptions.Static) == CrossCompileOptions.Dynamic)
            {
                string text4 = Path.Combine(assembliesAbsoluteDirectory, fileName + ".def");
                if (File.Exists(text4))
                {
                    File.Move(text4, output + ".def");
                }
            }
        }
示例#11
0
        static void CrossCompileAOT(BuildTarget target, string crossCompilerAbsolutePath, string assembliesAbsoluteDirectory, CrossCompileOptions crossCompileOptions, string input, string output, string additionalOptions)
        {
            string arguments = "";

            // We don't want debugging for non-script assemblies (anyway source code is not available for the end users)
            if (!IsDebugableAssembly(input))
            {
                crossCompileOptions &= ~CrossCompileOptions.Debugging;
                crossCompileOptions &= ~CrossCompileOptions.LoadSymbols;
            }

            bool debugging     = ((crossCompileOptions & CrossCompileOptions.Debugging) != 0);
            bool loadSymbols   = ((crossCompileOptions & CrossCompileOptions.LoadSymbols) != 0);
            bool initDebugging = (debugging || loadSymbols);

            if (initDebugging)
            {
                arguments += "--debug ";
            }

            if (debugging)
            {
                // Do not put locals into registers when debugging
                arguments += "--optimize=-linears ";
            }

            arguments += "--aot=full,asmonly,";

            if (initDebugging)
            {
                arguments += "write-symbols,";
            }

            if ((crossCompileOptions & CrossCompileOptions.Debugging) != 0)
            {
                arguments += "soft-debug,";
            }
            else if (!initDebugging)
            {
                arguments += "nodebug,";
            }

            if (target != BuildTarget.iOS)
            {
                //arguments += "fail-if-methods-are-skipped,";
                arguments += "print-skipped,";
            }

            if (additionalOptions != null && additionalOptions.Trim().Length > 0)
            {
                arguments += additionalOptions.Trim() + ",";
            }

            string outputFileName = Path.GetFileName(output);
            // Mono outfile parameter doesnt take absolute paths,
            // So we temporarily write into the assembliesAbsoluteDirectory and move it away afterwards
            string outputTempPath = Path.Combine(assembliesAbsoluteDirectory, outputFileName);

            if ((crossCompileOptions & CrossCompileOptions.FastICall) != 0)
            {
                arguments += "ficall,";
            }
            if ((crossCompileOptions & CrossCompileOptions.Static) != 0)
            {
                arguments += "static,";
            }
            arguments += "outfile=\"" + outputFileName + "\" \"" + input + "\" ";


            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName  = crossCompilerAbsolutePath;
            process.StartInfo.Arguments = arguments;
            process.StartInfo.EnvironmentVariables["MONO_PATH"]  = assembliesAbsoluteDirectory;
            process.StartInfo.EnvironmentVariables["GAC_PATH"]   = assembliesAbsoluteDirectory;
            process.StartInfo.EnvironmentVariables["GC_DONT_GC"] = "yes please";
            if ((crossCompileOptions & CrossCompileOptions.ExplicitNullChecks) != 0)
            {
                process.StartInfo.EnvironmentVariables["MONO_DEBUG"] = "explicit-null-checks";
            }
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.RedirectStandardOutput = true;

            if (ArtifactsPath != null)
            {
                if (!Directory.Exists(ArtifactsPath))
                {
                    Directory.CreateDirectory(ArtifactsPath);
                }
                File.AppendAllText(ArtifactsPath + "output.txt", process.StartInfo.FileName + "\n");
                File.AppendAllText(ArtifactsPath + "output.txt", process.StartInfo.Arguments + "\n");
                File.AppendAllText(ArtifactsPath + "output.txt", assembliesAbsoluteDirectory + "\n");
                File.AppendAllText(ArtifactsPath + "output.txt", outputTempPath + "\n");
                File.AppendAllText(ArtifactsPath + "output.txt", input + "\n");
                File.AppendAllText(ArtifactsPath + "houtput.txt", outputFileName + "\n\n");
                File.Copy(assembliesAbsoluteDirectory + "\\" + input, ArtifactsPath + "\\" + input, true);
            }

            process.StartInfo.WorkingDirectory = assembliesAbsoluteDirectory;
            MonoProcessUtility.RunMonoProcess(process, "AOT cross compiler", outputTempPath);
            // For some reason we can't pass a full path to outfile, so we move the .s file after compilation instead
            File.Move(outputTempPath, output);

            //handle .def files if present for dlls
            if ((crossCompileOptions & CrossCompileOptions.Static) == 0)
            {
                string defOutputTempPath = Path.Combine(assembliesAbsoluteDirectory, outputFileName + ".def");
                if (File.Exists(defOutputTempPath))
                {
                    File.Move(defOutputTempPath, output + ".def");
                }
            }
        }
示例#12
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  str2 = null;
            string  path = Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), StripperExe());
            string  str5 = Path.Combine(Path.GetDirectoryName(path), "link.xml");
            string  str6 = Path.Combine(managedLibrariesDirectory, "output");

            Directory.CreateDirectory(str6);
            process.StartInfo.Arguments = "\"" + path + "\" -l none -c link";
            foreach (string str7 in input)
            {
                ProcessStartInfo info1 = process.StartInfo;
                info1.Arguments = info1.Arguments + " -a \"" + str7 + "\"";
            }
            ProcessStartInfo startInfo = process.StartInfo;
            string           arguments = startInfo.Arguments;

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

            if (File.Exists(str8))
            {
                ProcessStartInfo info3 = process.StartInfo;
                info3.Arguments = info3.Arguments + " -x \"" + str8 + "\"";
            }
            string str9 = Path.Combine(Path.GetDirectoryName(path), "Core.xml");

            if (File.Exists(str9))
            {
                ProcessStartInfo info4 = process.StartInfo;
                info4.Arguments = info4.Arguments + " -x \"" + str9 + "\"";
            }
            foreach (string str10 in Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "Assets"), "link.xml", SearchOption.AllDirectories))
            {
                ProcessStartInfo info5 = process.StartInfo;
                info5.Arguments = info5.Arguments + " -x \"" + str10 + "\"";
            }
            if (usedClasses != null)
            {
                str2 = GenerateBlackList(managedLibrariesDirectory, usedClasses, allAssemblies);
                ProcessStartInfo info6 = process.StartInfo;
                info6.Arguments = info6.Arguments + " -x \"" + str2 + "\"";
            }
            MonoProcessUtility.RunMonoProcess(process, "assemblies stripper", Path.Combine(str6, "mscorlib.dll"));
            DeleteAllDllsFrom(managedLibrariesDirectory);
            CopyAllDlls(managedLibrariesDirectory, str6);
            foreach (string str11 in Directory.GetFiles(managedLibrariesDirectory))
            {
                if (str11.Contains(".mdb") && !File.Exists(str11.Replace(".mdb", string.Empty)))
                {
                    FileUtil.DeleteFileOrDirectory(str11);
                }
            }
            if (str2 != null)
            {
                FileUtil.DeleteFileOrDirectory(Path.Combine(managedLibrariesDirectory, str2));
            }
            FileUtil.DeleteFileOrDirectory(str6);
        }
        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);
        }