RunManagedProgram() 정적인 개인적인 메소드

static private RunManagedProgram ( string exe, string args ) : void
exe string
args string
리턴 void
예제 #1
0
        internal static void GenerateInternalCallSummaryFile(string icallSummaryPath, string managedAssemblyFolderPath, string strippedDLLPath)
        {
            string exe  = Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), "Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe");
            string args = string.Format("-assembly=\"{0}\" -output=\"{1}\" -summary=\"{2}\"", Path.Combine(strippedDLLPath, "UnityEngine.dll"), Path.Combine(managedAssemblyFolderPath, "UnityICallRegistration.cpp"), icallSummaryPath);

            Runner.RunManagedProgram(exe, args);
        }
예제 #2
0
        private void RunIl2CppWithArguments(List <string> arguments, Action <ProcessStartInfo> setupStartInfo, string workingDirectory)
        {
            var args = arguments.Aggregate(String.Empty, (current, arg) => current + arg + " ");

            var    useNetCore = ShouldUseIl2CppCore();
            string il2CppPath = useNetCore ? GetIl2CppCoreExe() : GetIl2CppExe();

            Console.WriteLine("Invoking il2cpp with arguments: " + args);

            CompilerOutputParserBase il2cppOutputParser = m_PlatformProvider.CreateIl2CppOutputParser();

            if (il2cppOutputParser == null)
            {
                il2cppOutputParser = new Il2CppOutputParser();
            }

            if (useNetCore)
            {
                Runner.RunNetCoreProgram(il2CppPath, args, workingDirectory, il2cppOutputParser, setupStartInfo);
            }
            else
            {
                Runner.RunManagedProgram(il2CppPath, args, workingDirectory, il2cppOutputParser, setupStartInfo);
            }
        }
예제 #3
0
        private void RunIl2CppWithArguments(List <string> arguments, Action <ProcessStartInfo> setupStartInfo, string workingDirectory)
        {
            string il2CppExe = this.GetIl2CppExe();
            string text      = arguments.Aggregate(string.Empty, (string current, string arg) => current + arg + " ");

            Console.WriteLine("Invoking il2cpp with arguments: " + text);
            Runner.RunManagedProgram(il2CppExe, text, workingDirectory, new Il2CppOutputParser(), setupStartInfo);
        }
예제 #4
0
        private void ConvertPlayerDlltoCpp(ICollection <string> userAssemblies, string outputDirectory, string workingDirectory)
        {
            if (userAssemblies.Count == 0)
            {
                Directory.CreateDirectory(outputDirectory);
                return;
            }
            string        il2CppExe = this.GetIl2CppExe();
            List <string> list      = new List <string>();

            list.Add("--copy-level=None");
            list.Add("--enable-generic-sharing");
            list.Add("--enable-unity-event-support");
            if (this.m_PlatformProvider.usePrecompiledHeader)
            {
                list.Add("--use-precompiled-header");
            }
            if (this.m_PlatformProvider.emitNullChecks)
            {
                list.Add("--emit-null-checks");
            }
            if (this.m_PlatformProvider.enableStackTraces)
            {
                list.Add("--enable-stacktrace");
            }
            if (this.m_PlatformProvider.enableArrayBoundsCheck)
            {
                list.Add("--enable-array-bounds-check");
            }
            if (this.m_PlatformProvider.compactMode)
            {
                list.Add("--output-format=Compact");
            }
            if (this.m_PlatformProvider.loadSymbols)
            {
                list.Add("--enable-symbol-loading");
            }
            string empty = string.Empty;

            if (PlayerSettings.GetPropertyOptionalString("additionalIl2CppArgs", ref empty))
            {
                list.Add(empty);
            }
            List <string> source = new List <string>(userAssemblies)
            {
                outputDirectory
            };

            list.AddRange(
                from arg in source
                select "\"" + Path.GetFullPath(arg) + "\"");
            string text = list.Aggregate(string.Empty, (string current, string arg) => current + arg + " ");

            Console.WriteLine("Invoking il2cpp with arguments: " + text);
            Runner.RunManagedProgram(il2CppExe, text, workingDirectory, new Il2CppOutputParser());
        }
예제 #5
0
        private static bool RunAssemblyLinker(IEnumerable <string> args, out string @out, out string err, string linkerPath, string workingDirectory)
        {
            string args1 = args.Aggregate <string>((Func <string, string, string>)((buff, s) => buff + " " + s));

            Console.WriteLine("Invoking UnusedByteCodeStripper2 with arguments: " + args1);
            Runner.RunManagedProgram(linkerPath, args1, workingDirectory, (CompilerOutputParserBase)null);
            @out = string.Empty;
            err  = string.Empty;
            return(true);
        }
예제 #6
0
        private static bool RunAssemblyLinker(IEnumerable <string> args, out string @out, out string err, string linkerPath, string workingDirectory)
        {
            string text = args.Aggregate((string buff, string s) => buff + " " + s);

            Console.WriteLine("Invoking UnusedByteCodeStripper2 with arguments: " + text);
            Runner.RunManagedProgram(linkerPath, text, workingDirectory, null, null);
            @out = "";
            err  = "";
            return(true);
        }
예제 #7
0
        internal static void GenerateInternalCallSummaryFile(string icallSummaryPath, string managedAssemblyFolderPath, string strippedDLLPath)
        {
            string exe = Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), "Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe");
            IEnumerable <string> source = Directory.GetFiles(strippedDLLPath, "UnityEngine.*Module.dll").Concat(new string[]
            {
                Path.Combine(strippedDLLPath, "UnityEngine.dll")
            });
            string args = string.Format("-output=\"{0}\" -summary=\"{1}\" -assembly=\"{2}\"", Path.Combine(managedAssemblyFolderPath, "UnityICallRegistration.cpp"), icallSummaryPath, source.Aggregate((string dllArg, string next) => dllArg + ";" + next));

            Runner.RunManagedProgram(exe, args);
        }
예제 #8
0
        private static bool RunAssemblyLinker(IEnumerable <string> args, out string @out, out string err, string linkerPath, string workingDirectory)
        {
            var argString = args.Aggregate((buff, s) => buff + " " + s);

            Console.WriteLine("Invoking UnityLinker with arguments: " + argString);
            Runner.RunManagedProgram(linkerPath, argString, workingDirectory, null, null);

            @out = "";
            err  = "";

            return(true);
        }
예제 #9
0
        private void PatchAssemblies()
        {
            string fullPath = Path.GetFullPath(this.m_StagingAreaData + "/Managed");
            string text     = fullPath + "/mscorlib.dll";
            string text2    = fullPath + "/mscorlib.unpatched.dll";

            File.Move(text, text2);
            File.Copy(this.m_PlatformProvider.il2CppFolder + "/replacements.dll", fullPath + "/replacements.dll");
            Runner.RunManagedProgram(this.m_PlatformProvider.il2CppFolder + "/AssemblyPatcher/AssemblyPatcher.exe", string.Format("-a \"{0}\" -o \"{1}\" -c \"{2}\" --log-config \"{3}\" -s \"{4}\"", new object[]
            {
                text2,
                text,
                this.m_PlatformProvider.il2CppFolder + "/assemblypatcher_config.txt",
                this.m_PlatformProvider.il2CppFolder + "/AssemblyPatcher.Log.Config.xml",
                Path.GetFullPath(this.m_StagingAreaData + "/Managed")
            }));
            File.Delete(text2);
        }
예제 #10
0
        private void RunIl2CppWithArguments(List <string> arguments, Action <ProcessStartInfo> setupStartInfo, string workingDirectory)
        {
            string text = arguments.Aggregate(string.Empty, (string current, string arg) => current + arg + " ");
            bool   flag = this.ShouldUseIl2CppCore();
            string exe  = (!flag) ? this.GetIl2CppExe() : this.GetIl2CppCoreExe();

            Console.WriteLine("Invoking il2cpp with arguments: " + text);
            CompilerOutputParserBase compilerOutputParserBase = this.m_PlatformProvider.CreateIl2CppOutputParser();

            if (compilerOutputParserBase == null)
            {
                compilerOutputParserBase = new Il2CppOutputParser();
            }
            if (flag)
            {
                Runner.RunNetCoreProgram(exe, text, workingDirectory, compilerOutputParserBase, setupStartInfo);
            }
            else
            {
                Runner.RunManagedProgram(exe, text, workingDirectory, compilerOutputParserBase, setupStartInfo);
            }
        }
예제 #11
0
        private static void RunAssemblyStripper(string stagingAreaData, IEnumerable assemblies, string managedAssemblyFolderPath, string[] assembliesToStrip, string[] searchDirs, string monoLinkerPath, IIl2CppPlatformProvider platformProvider, RuntimeClassRegistry rcr, bool developmentBuild)
        {
            bool flag1 = rcr != null && PlayerSettings.stripEngineCode && platformProvider.supportsEngineStripping;
            IEnumerable <string> blacklists = (IEnumerable <string>)AssemblyStripper.Il2CppBlacklistPaths;

            if (rcr != null)
            {
                blacklists = blacklists.Concat <string>((IEnumerable <string>) new string[2]
                {
                    AssemblyStripper.WriteMethodsToPreserveBlackList(stagingAreaData, rcr),
                    MonoAssemblyStripping.GenerateLinkXmlToPreserveDerivedTypes(stagingAreaData, managedAssemblyFolderPath, rcr)
                });
            }
            if (!flag1)
            {
                foreach (string file in Directory.GetFiles(platformProvider.moduleStrippingInformationFolder, "*.xml"))
                {
                    blacklists = blacklists.Concat <string>((IEnumerable <string>) new string[1] {
                        file
                    });
                }
            }
            string fullPath1 = Path.GetFullPath(Path.Combine(managedAssemblyFolderPath, "tempStrip"));
            bool   flag2;

            do
            {
                flag2 = false;
                if (EditorUtility.DisplayCancelableProgressBar("Building Player", "Stripping assemblies", 0.0f))
                {
                    throw new OperationCanceledException();
                }
                string output;
                string error;
                if (!AssemblyStripper.StripAssembliesTo(assembliesToStrip, searchDirs, fullPath1, managedAssemblyFolderPath, out output, out error, monoLinkerPath, platformProvider, blacklists, developmentBuild))
                {
                    throw new Exception("Error in stripping assemblies: " + (object)assemblies + ", " + error);
                }
                string icallsListFile = Path.Combine(managedAssemblyFolderPath, "ICallSummary.txt");
                Runner.RunManagedProgram(Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), "Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe"), string.Format("-assembly=\"{0}\" -output=\"{1}\" -summary=\"{2}\"", (object)Path.Combine(fullPath1, "UnityEngine.dll"), (object)Path.Combine(managedAssemblyFolderPath, "UnityICallRegistration.cpp"), (object)icallsListFile));
                if (flag1)
                {
                    HashSet <string> nativeClasses;
                    HashSet <string> nativeModules;
                    CodeStrippingUtils.GenerateDependencies(fullPath1, icallsListFile, rcr, out nativeClasses, out nativeModules);
                    flag2 = AssemblyStripper.AddWhiteListsForModules((IEnumerable <string>)nativeModules, ref blacklists, platformProvider.moduleStrippingInformationFolder);
                }
            }while (flag2);
            string fullPath2 = Path.GetFullPath(Path.Combine(managedAssemblyFolderPath, "tempUnstripped"));

            Directory.CreateDirectory(fullPath2);
            foreach (string file in Directory.GetFiles(managedAssemblyFolderPath))
            {
                string extension = Path.GetExtension(file);
                if (string.Equals(extension, ".dll", StringComparison.InvariantCultureIgnoreCase) || string.Equals(extension, ".mdb", StringComparison.InvariantCultureIgnoreCase))
                {
                    File.Move(file, Path.Combine(fullPath2, Path.GetFileName(file)));
                }
            }
            foreach (string file in Directory.GetFiles(fullPath1))
            {
                File.Move(file, Path.Combine(managedAssemblyFolderPath, Path.GetFileName(file)));
            }
            Directory.Delete(fullPath1);
        }
예제 #12
0
 internal static void RunManagedProgram(string exe, string args)
 {
     Runner.RunManagedProgram(exe, args, Application.dataPath + "/..", null, null);
 }
예제 #13
0
        private static void RunAssemblyStripper(string stagingAreaData, IEnumerable assemblies, string managedAssemblyFolderPath, string[] assembliesToStrip, string[] searchDirs, string monoLinkerPath, IIl2CppPlatformProvider platformProvider, RuntimeClassRegistry rcr, bool developmentBuild)
        {
            bool flag = rcr != null && PlayerSettings.stripEngineCode && platformProvider.supportsEngineStripping;
            IEnumerable <string> enumerable = AssemblyStripper.Il2CppBlacklistPaths;

            if (rcr != null)
            {
                enumerable = enumerable.Concat(new string[]
                {
                    AssemblyStripper.WriteMethodsToPreserveBlackList(stagingAreaData, rcr)
                });
            }
            if (!flag)
            {
                string[] files = Directory.GetFiles(platformProvider.moduleStrippingInformationFolder, "*.xml");
                for (int i = 0; i < files.Length; i++)
                {
                    string text = files[i];
                    enumerable = enumerable.Concat(new string[]
                    {
                        text
                    });
                }
            }
            string fullPath = Path.GetFullPath(Path.Combine(managedAssemblyFolderPath, "tempStrip"));
            string text3;

            while (true)
            {
                bool flag2 = false;
                if (EditorUtility.DisplayCancelableProgressBar("Building Player", "Stripping assemblies", 0f))
                {
                    break;
                }
                string text2;
                if (!AssemblyStripper.StripAssembliesTo(assembliesToStrip, searchDirs, fullPath, managedAssemblyFolderPath, out text2, out text3, monoLinkerPath, platformProvider, enumerable, developmentBuild))
                {
                    goto Block_6;
                }
                string text4 = Path.Combine(managedAssemblyFolderPath, "ICallSummary.txt");
                string exe   = Path.Combine(MonoInstallationFinder.GetFrameWorksFolder(), "Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe");
                string args  = string.Format("-assembly=\"{0}\" -output=\"{1}\" -summary=\"{2}\"", Path.Combine(fullPath, "UnityEngine.dll"), Path.Combine(managedAssemblyFolderPath, "UnityICallRegistration.cpp"), text4);
                Runner.RunManagedProgram(exe, args);
                if (flag)
                {
                    HashSet <string> hashSet;
                    HashSet <string> nativeModules;
                    CodeStrippingUtils.GenerateDependencies(fullPath, text4, rcr, out hashSet, out nativeModules);
                    flag2 = AssemblyStripper.AddWhiteListsForModules(nativeModules, ref enumerable, platformProvider.moduleStrippingInformationFolder);
                }
                if (!flag2)
                {
                    goto Block_8;
                }
            }
            throw new OperationCanceledException();
Block_6:
            throw new Exception(string.Concat(new object[]
            {
                "Error in stripping assemblies: ",
                assemblies,
                ", ",
                text3
            }));
Block_8:
            string fullPath2 = Path.GetFullPath(Path.Combine(managedAssemblyFolderPath, "tempUnstripped"));

            Directory.CreateDirectory(fullPath2);
            string[] files2 = Directory.GetFiles(managedAssemblyFolderPath);
            for (int j = 0; j < files2.Length; j++)
            {
                string text5     = files2[j];
                string extension = Path.GetExtension(text5);
                if (string.Equals(extension, ".dll", StringComparison.InvariantCultureIgnoreCase) || string.Equals(extension, ".mdb", StringComparison.InvariantCultureIgnoreCase))
                {
                    File.Move(text5, Path.Combine(fullPath2, Path.GetFileName(text5)));
                }
            }
            string[] files3 = Directory.GetFiles(fullPath);
            for (int k = 0; k < files3.Length; k++)
            {
                string text6 = files3[k];
                File.Move(text6, Path.Combine(managedAssemblyFolderPath, Path.GetFileName(text6)));
            }
            Directory.Delete(fullPath);
        }
예제 #14
0
 internal static void RunManagedProgram(string exe, string args)
 {
     Runner.RunManagedProgram(exe, args, Application.dataPath + "/..", (CompilerOutputParserBase)null);
 }
예제 #15
0
        private void ConvertPlayerDlltoCpp(ICollection <string> userAssemblies, string outputDirectory, string workingDirectory)
        {
            if (userAssemblies.Count == 0)
            {
                return;
            }
            string[] array = (from s in Directory.GetFiles("Assets", "il2cpp_extra_types.txt", SearchOption.AllDirectories)
                              select Path.Combine(Directory.GetCurrentDirectory(), s)).ToArray <string>();
            string        il2CppExe = this.GetIl2CppExe();
            List <string> list      = new List <string>();

            list.Add("--convert-to-cpp");
            if (this.m_PlatformProvider.emitNullChecks)
            {
                list.Add("--emit-null-checks");
            }
            if (this.m_PlatformProvider.enableStackTraces)
            {
                list.Add("--enable-stacktrace");
            }
            if (this.m_PlatformProvider.enableArrayBoundsCheck)
            {
                list.Add("--enable-array-bounds-check");
            }
            if (this.m_PlatformProvider.enableDivideByZeroCheck)
            {
                list.Add("--enable-divide-by-zero-check");
            }
            if (this.m_PlatformProvider.loadSymbols)
            {
                list.Add("--enable-symbol-loading");
            }
            if (this.m_PlatformProvider.developmentMode)
            {
                list.Add("--development-mode");
            }
            Il2CppNativeCodeBuilder il2CppNativeCodeBuilder = this.m_PlatformProvider.CreateIl2CppNativeCodeBuilder();

            if (il2CppNativeCodeBuilder != null)
            {
                string fullUnityVersion = InternalEditorUtility.GetFullUnityVersion();
                Il2CppNativeCodeBuilderUtils.ClearCacheIfEditorVersionDiffers(il2CppNativeCodeBuilder, fullUnityVersion);
                Il2CppNativeCodeBuilderUtils.PrepareCacheDirectory(il2CppNativeCodeBuilder, fullUnityVersion);
                list.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths));
            }
            if (array.Length > 0)
            {
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string arg2 = array2[i];
                    list.Add(string.Format("--extra-types.file=\"{0}\"", arg2));
                }
            }
            string text = Path.Combine(this.m_PlatformProvider.il2CppFolder, "il2cpp_default_extra_types.txt");

            if (File.Exists(text))
            {
                list.Add(string.Format("--extra-types.file=\"{0}\"", text));
            }
            string text2 = string.Empty;

            if (PlayerSettings.GetPropertyOptionalString("additionalIl2CppArgs", ref text2))
            {
                list.Add(text2);
            }
            text2 = Environment.GetEnvironmentVariable("IL2CPP_ADDITIONAL_ARGS");
            if (!string.IsNullOrEmpty(text2))
            {
                list.Add(text2);
            }
            List <string> source = new List <string>(userAssemblies);

            list.AddRange(from arg in source
                          select "--assembly=\"" + Path.GetFullPath(arg) + "\"");
            list.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(outputDirectory)));
            string text3 = list.Aggregate(string.Empty, (string current, string arg) => current + arg + " ");

            Console.WriteLine("Invoking il2cpp with arguments: " + text3);
            if (EditorUtility.DisplayCancelableProgressBar("Building Player", "Converting managed assemblies to C++", 0.3f))
            {
                throw new OperationCanceledException();
            }
            Action <ProcessStartInfo> setupStartInfo = null;

            if (il2CppNativeCodeBuilder != null)
            {
                setupStartInfo = new Action <ProcessStartInfo>(il2CppNativeCodeBuilder.SetupStartInfo);
            }
            Runner.RunManagedProgram(il2CppExe, text3, workingDirectory, new Il2CppOutputParser(), setupStartInfo);
        }
예제 #16
0
        private void ConvertPlayerDlltoCpp(ICollection <string> userAssemblies, string outputDirectory, string workingDirectory)
        {
            FileUtil.CreateOrCleanDirectory(outputDirectory);
            if (userAssemblies.Count == 0)
            {
                return;
            }
            string[]      array     = ((IEnumerable <string>)Directory.GetFiles("Assets", "il2cpp_extra_types.txt", SearchOption.AllDirectories)).Select <string, string>((Func <string, string>)(s => Path.Combine(Directory.GetCurrentDirectory(), s))).ToArray <string>();
            string        il2CppExe = this.GetIl2CppExe();
            List <string> source1   = new List <string>();

            source1.Add("--convert-to-cpp");
            if (this.m_PlatformProvider.emitNullChecks)
            {
                source1.Add("--emit-null-checks");
            }
            if (this.m_PlatformProvider.enableStackTraces)
            {
                source1.Add("--enable-stacktrace");
            }
            if (this.m_PlatformProvider.enableArrayBoundsCheck)
            {
                source1.Add("--enable-array-bounds-check");
            }
            if (this.m_PlatformProvider.loadSymbols)
            {
                source1.Add("--enable-symbol-loading");
            }
            if (this.m_PlatformProvider.developmentMode)
            {
                source1.Add("--development-mode");
            }
            if (array.Length > 0)
            {
                foreach (string str in array)
                {
                    source1.Add(string.Format("--extra-types.file=\"{0}\"", (object)str));
                }
            }
            string path = Path.Combine(this.m_PlatformProvider.il2CppFolder, "il2cpp_default_extra_types.txt");

            if (File.Exists(path))
            {
                source1.Add(string.Format("--extra-types.file=\"{0}\"", (object)path));
            }
            string empty = string.Empty;

            if (PlayerSettings.GetPropertyOptionalString("additionalIl2CppArgs", ref empty))
            {
                source1.Add(empty);
            }
            string environmentVariable = Environment.GetEnvironmentVariable("IL2CPP_ADDITIONAL_ARGS");

            if (!string.IsNullOrEmpty(environmentVariable))
            {
                source1.Add(environmentVariable);
            }
            List <string> source2 = new List <string>((IEnumerable <string>)userAssemblies);

            source1.AddRange(source2.Select <string, string>((Func <string, string>)(arg => "--assembly=\"" + Path.GetFullPath(arg) + "\"")));
            source1.Add(string.Format("--generatedcppdir=\"{0}\"", (object)Path.GetFullPath(outputDirectory)));
            string args = source1.Aggregate <string, string>(string.Empty, (Func <string, string, string>)((current, arg) => current + arg + " "));

            Console.WriteLine("Invoking il2cpp with arguments: " + args);
            if (EditorUtility.DisplayCancelableProgressBar("Building Player", "Converting managed assemblies to C++", 0.3f))
            {
                throw new OperationCanceledException();
            }
            Runner.RunManagedProgram(il2CppExe, args, workingDirectory, (CompilerOutputParserBase) new Il2CppOutputParser());
        }