PrepareMonoProcess() публичный статический Метод

public static PrepareMonoProcess ( BuildTarget target, string workDir ) : Process
target BuildTarget
workDir string
Результат Process
Пример #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 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);
            }
        }
Пример #4
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);
        }