Exemplo n.º 1
0
        public void InjectDefaultAndBackup()
        {
            string           path            = Directory.GetCurrentDirectory();
            ModuleDefinition onionModule     = CecilHelper.GetModule("ONI-Common.dll", path);
            ModuleDefinition csharpModule    = CecilHelper.GetModule("Assembly-CSharp.dll", path);
            ModuleDefinition firstPassModule = CecilHelper.GetModule("Assembly-CSharp-firstpass.dll", path);

            InjectorOnion injection = new InjectorOnion(onionModule, csharpModule, firstPassModule);

            injection.Inject();

            this.BackupAndSaveCSharpModule(csharpModule);
            this.BackupAndSaveFirstPassModule(firstPassModule);
        }
Exemplo n.º 2
0
        public bool InjectDefaultAndBackup(InjectorState injectorState)
        {
            var coreModule     = CecilHelper.GetModule(Paths.DefaultCoreAssemblyPath, Paths.ManagedDirectoryPath);
            var materialModule = CecilHelper.GetModule(Paths.DefaultMaterialAssemblyPath, Paths.ManagedDirectoryPath);
            var onionModule    = CecilHelper.GetModule(Paths.DefaultOnionAssemblyPath, Paths.ManagedDirectoryPath);

            var csharpModule    = CecilHelper.GetModule(Paths.DefaultAssemblyCSharpPath, Paths.ManagedDirectoryPath);
            var firstPassModule = CecilHelper.GetModule(Paths.DefaultAssemblyFirstPassPath, Paths.ManagedDirectoryPath);

            var injection = new Injection(coreModule, materialModule, onionModule, csharpModule, firstPassModule)
            {
                Logger = Logger
            };

            injection.Inject(injectorState);

            BackupAndSaveCSharpModule(csharpModule);
            BackupAndSaveFirstPassModule(firstPassModule);

            return(injection.Failed);
        }
Exemplo n.º 3
0
        public void InjectDefaultAndBackup()
        {
            string path = Directory.GetCurrentDirectory();

            try
            {
                //ModuleDefinition onionModule = CecilHelper.GetModule("\\ONI-Common.dll", path);
                ModuleDefinition csharpModule    = CecilHelper.GetModule("\\Assembly-CSharp.dll", path);
                ModuleDefinition firstPassModule = CecilHelper.GetModule("\\Assembly-CSharp-firstpass.dll", path);

                try
                {
                    //InjectorOnion injection = new InjectorOnion(onionModule, csharpModule, firstPassModule);
                    //injection.Inject();

                    //InjectPatchedSign(csharpModule, firstPassModule);
                }
                catch (Exception ex)
                {
                    ModLogger.WriteLine(ConsoleColor.Red, "Onion injector errored: " + ex);
                    throw;
                }

                try
                {
                    this.BackupAndSaveCSharpModule(csharpModule, path);
                    this.BackupAndSaveFirstPassModule(firstPassModule, path);
                }
                catch (Exception ex)
                {
                    ModLogger.WriteLine(ConsoleColor.Red, "Backup errored: " + ex);
                    throw;
                }
            }
            catch (Exception ex)
            {
                ModLogger.WriteLine(ConsoleColor.Red, "ModuleDefinition errored: " + ex);
                throw;
            }
        }
Exemplo n.º 4
0
        public void InjectDefaultAndBackup()
        {
            string path = Directory.GetCurrentDirectory();

            try
            {
                ModuleDefinition onionModule     = CecilHelper.GetModule("\\ONI-Common.dll", path);
                ModuleDefinition csharpModule    = CecilHelper.GetModule("\\Assembly-CSharp.dll", path);
                ModuleDefinition firstPassModule = CecilHelper.GetModule("\\Assembly-CSharp-firstpass.dll", path);

                try
                {
                    InjectorOnion injection = new InjectorOnion(onionModule, csharpModule, firstPassModule);
                    injection.Inject();
                }
                catch
                {
                    Console.Error.WriteLine("Onion injector errored: \n");
                    throw;
                }
                try
                {
                    this.BackupAndSaveCSharpModule(csharpModule, path);
                    this.BackupAndSaveFirstPassModule(firstPassModule, path);
                }
                catch
                {
                    Console.Error.WriteLine("Backup errored: \n");
                    throw;
                }
            }
            catch
            {
                Console.Error.WriteLine("ModuleDefinition errored: \n");
                throw;
            }
        }
Exemplo n.º 5
0
 public bool IsCurrentAssemblyFirstpassPatched()
 => CecilHelper.GetModule(Paths.DefaultAssemblyFirstPassPath, Paths.ManagedDirectoryPath).Types.Any(TypePatched);