Example #1
0
        private static void Dump(Metadata metadata, Il2Cpp il2Cpp)
        {
            Console.WriteLine("Dumping...");
            var writer     = new StreamWriter(new FileStream("dump.cs", FileMode.Create), new UTF8Encoding(false));
            var decompiler = new Il2CppDecompiler(metadata, il2Cpp);

            decompiler.Decompile(writer, config);
            Console.WriteLine("Done!");
            Console.WriteLine("Generate script...");
            var scriptwriter    = new StreamWriter(new FileStream("script.py", FileMode.Create), new UTF8Encoding(false));
            var scriptGenerator = new ScriptGenerator(decompiler);

            scriptGenerator.WriteScript(scriptwriter, config);
            Console.WriteLine("Done!");
            if (config.DummyDll)
            {
                Console.WriteLine("Generate dummy dll...");
                if (Directory.Exists("DummyDll"))
                {
                    Directory.Delete("DummyDll", true);
                }
                Directory.CreateDirectory("DummyDll");
                Directory.SetCurrentDirectory("DummyDll");
                var dummy = new DummyAssemblyGenerator(metadata, il2Cpp);
                foreach (var assembly in dummy.Assemblies)
                {
                    using (var stream = new MemoryStream())
                    {
                        assembly.Write(stream);
                        File.WriteAllBytes(assembly.MainModule.Name, stream.ToArray());
                    }
                }
                Console.WriteLine("Done!");
            }
        }
Example #2
0
        private static void Dump(Metadata metadata, Il2Cpp il2Cpp)
        {
            Console.WriteLine("Dumping...");
            var writer     = new StreamWriter(new FileStream("dump.cs", FileMode.Create), new UTF8Encoding(false));
            var decompiler = new Il2CppDecompiler(metadata, il2Cpp);

            decompiler.Decompile(writer, config);
            Console.WriteLine("Done!");
            Console.WriteLine("Generate script...");
            var scriptwriter    = new StreamWriter(new FileStream("script.py", FileMode.Create), new UTF8Encoding(false));
            var scriptGenerator = new ScriptGenerator(metadata, il2Cpp);

            scriptGenerator.WriteScript(scriptwriter, config);
            Console.WriteLine("Done!");
            if (config.DummyDll)
            {
                Console.WriteLine("Generate dummy dll...");
                Console.WriteLine("Select style: 1.Original 2.Original+NET_SDK");
                string netSDKPath = "";
                switch (int.Parse(Console.ReadKey(true).KeyChar.ToString()))
                {
                case 2:
                    Console.WriteLine("Enter path to NET_SDK.dll: ");
                    netSDKPath = Console.ReadLine().Trim();
                    break;
                }
                if (Directory.Exists("DummyDll"))
                {
                    Directory.Delete("DummyDll", true);
                }
                Directory.CreateDirectory("DummyDll");
                Directory.SetCurrentDirectory("DummyDll");
                var dummy = new DummyAssemblyGenerator(metadata, il2Cpp, netSDKPath);
                foreach (var assembly in dummy.Assemblies)
                {
                    using (var stream = new MemoryStream())
                    {
                        assembly.Write(stream);
                        File.WriteAllBytes(assembly.MainModule.Name, stream.ToArray());
                    }
                }
                Console.WriteLine("Done!");
            }
        }
        public static void Export(Metadata metadata, Il2Cpp il2Cpp)
        {
            if (Directory.Exists("DummyDll"))
            {
                Directory.Delete("DummyDll", true);
            }
            Directory.CreateDirectory("DummyDll");
            Directory.SetCurrentDirectory("DummyDll");
            var dummy = new DummyAssemblyGenerator(metadata, il2Cpp);

            foreach (var assembly in dummy.Assemblies)
            {
                using (var stream = new MemoryStream())
                {
                    assembly.Write(stream);
                    File.WriteAllBytes(assembly.MainModule.Name, stream.ToArray());
                }
            }
        }
        public static void Export(Il2CppExecutor il2CppExecutor, string outputDir, bool addToken)
        {
            Directory.SetCurrentDirectory(outputDir);
            if (Directory.Exists("DummyDll"))
            {
                Directory.Delete("DummyDll", true);
            }
            Directory.CreateDirectory("DummyDll");
            Directory.SetCurrentDirectory("DummyDll");
            var dummy = new DummyAssemblyGenerator(il2CppExecutor, addToken);

            foreach (var assembly in dummy.Assemblies)
            {
                using (var stream = new MemoryStream())
                {
                    assembly.Write(stream);
                    File.WriteAllBytes(assembly.MainModule.Name, stream.ToArray());
                }
            }
        }
Example #5
0
        public static void Export(Il2CppExecutor il2CppExecutor, string outputDir)
        {
            string dummyDllPath = Path.Combine(outputDir, "DummyDll");

            if (Directory.Exists(dummyDllPath))
            {
                Directory.Delete(dummyDllPath, true);
            }
            Directory.CreateDirectory(dummyDllPath);

            var dummy = new DummyAssemblyGenerator(il2CppExecutor);

            foreach (var assembly in dummy.Assemblies)
            {
                string path = Path.Combine(dummyDllPath, assembly.MainModule.Name);

                using (var stream = new FileStream(path, FileMode.Create))
                {
                    assembly.Write(stream);
                    assembly.Dispose();
                }
            }
        }