private void PatchBtn_Click(object sender, RoutedEventArgs e)
        {
            Program.bytePatchManager.DisabledGroups.Clear();
            if (RemoveExtWarning.IsChecked == false)
            {
                Program.bytePatchManager.DisabledGroups.Add(0);
            }
            if (RemoveDebugWarning.IsChecked == false)
            {
                Program.bytePatchManager.DisabledGroups.Add(1);
            }
            if (RemoveElision.IsChecked == false)
            {
                Program.bytePatchManager.DisabledGroups.Add(2);
            }

            foreach (CheckBox installationBox in InstallationList.Items)
            {
                if (installationBox.IsChecked == true)
                {
                    string path = installationBox.Content.ToString();

                    new Thread(() => {
                        try {
                            DllPatcher patcher = new DllPatcher(path);
                            patcher.Patch(Log);
                        } catch (Exception ex) {
                            Log("Error while patching " + path + ":" + ex.Message);
                        }
                    }).Start();
                }
            }
        }
Example #2
0
        private void PatchBtn_Click(object sender, RoutedEventArgs e)
        {
            Program.bytePatchManager.DisabledGroups.Clear();
            foreach (CustomCheckBox patchBox in PatchGroupList.Items)
            {
                if (patchBox.IsChecked == false)
                {
                    Program.bytePatchManager.DisabledGroups.Add(patchBox.Group);
                }
            }

            foreach (CheckBox installationBox in InstallationList.Items)
            {
                if (installationBox.IsChecked == true)
                {
                    string path = installationBox.Content.ToString();

                    new Thread(() => {
                        try {
                            DllPatcher patcher = new DllPatcher(path);
                            if (patcher.Patch(Log))
                            {
                                installationBox.Dispatcher.Invoke(new Action(() => {
                                    installationBox.Foreground = installationBox.BorderBrush = new SolidColorBrush(Color.FromRgb(72, 207, 133));
                                }));
                            }
                        } catch (Exception ex) {
                            Log("Error while patching " + path + ":" + ex.Message);
                        }
                    }).Start();
                }
            }
        }
Example #3
0
        public static void Main(string[] args)
        {
            CommandLineOptions clOptions = null;

            if (args.Length > 0)
            {
                ParserResult <CommandLineOptions> result = Parser.Default.ParseArguments <CommandLineOptions>(args).WithParsed(options => {
                    clOptions = options;
                });

                if (result.Tag == ParserResultType.NotParsed)
                {
                    HelpText.AutoBuild(result);
                    return;
                }
            }
            else
            {
                FreeConsole();
                bytePatchManager     = new BytePatchManager(MessageBox.Show);
                guiApp               = new Application();
                guiApp.Run(guiWindow = new PatcherGui());
                return;
            }

            if (clOptions == null)
            {
                return;
            }
            bytePatchManager = new BytePatchManager(CustomConsoleWrite);

            List <string> applicationPaths = new List <string>();
            List <int>    groups           = new List <int>(clOptions.Groups);

            if (groups.Count == 0)
            {
                Console.WriteLine("Groups need to be defined. Use --help for help.");
                return;
            }

            if (clOptions.CustomPath != null && clOptions.CustomPath.Length > 0)
            {
                if (!Directory.Exists(clOptions.CustomPath))
                {
                    Console.WriteLine("CustomPath not found");
                    return;
                }

                applicationPaths.AddRange(new CustomPath(clOptions.CustomPath).FindDllFiles());
            }
            else
            {
                applicationPaths.AddRange(new InstallationFinder.InstallationManager().FindAllChromiumInstallations());
            }

            foreach (GuiPatchGroupData patchData in bytePatchManager.PatchGroups)
            {
                if (!groups.Contains(patchData.Group))
                {
                    bytePatchManager.DisabledGroups.Add(patchData.Group);
                }
            }

            if (applicationPaths.Count == 0)
            {
                Console.WriteLine("Error: No patchable dll file found!");
            }

            foreach (string path in applicationPaths)
            {
                try {
                    DllPatcher patcher = new DllPatcher(path);
                    patcher.Patch(Console.WriteLine);
                } catch (Exception ex) {
                    Console.WriteLine("Error while patching " + path + ":" + ex.Message);
                }
            }

            if (!clOptions.NoWait)
            {
                Thread.Sleep(5000); // Wait a bit to let the user see the result
            }
        }