public static void Main(string[] args) { bool incompatibleArchitecture = !Environment.Is64BitOperatingSystem; if (args.Length == 0) { FreeConsole(); if (incompatibleArchitecture) { MessageBox.Show(archError, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } bytePatchManager = new BytePatchManager(MessageBox.Show); guiApp = new Application(); guiApp.Run(guiWindow = new PatcherGui()); } else { if (incompatibleArchitecture) { Console.WriteLine(archError); return; } MainCmd(args); } }
public static void Main(string[] args) { if (args.Length == 0) { FreeConsole(); bytePatchManager = new BytePatchManager(MessageBox.Show); guiApp = new Application(); guiApp.Run(guiWindow = new PatcherGui()); } else { MainCmd(args); } }
public static void Main(string[] args) { bytePatchManager = new BytePatchManager(); guiApp = new Application(); guiApp.Run(guiWindow = new PatcherGui()); /*if (ContainsArg(args, "noWarningPatch")) * RemovePatches(SHOULDINCLUDEEXTENSION_FUNCTION_PATTERN); * if (ContainsArg(args, "noWWWPatch")) * RemovePatches(SHOULDPREVENTELISION_FUNCTION_PATTERN); * if (ContainsArg(args, "noDebugPatch")) * RemovePatches(MAYBEADDINFOBAR_FUNCTION_PATTERN); * SetNewFolder(args); * * DirectoryInfo chromeFolder = new DirectoryInfo(CHROME_INSTALLATION_FOLDER); * * List<DirectoryInfo> chromeVersions = new List<DirectoryInfo>(chromeFolder.EnumerateDirectories()); * chromeVersions = chromeVersions.OrderByDescending(dirInfo => GetUnixTime(dirInfo.LastWriteTime)).ToList(); * foreach (DirectoryInfo dirs in chromeVersions) * { * if(dirs.Name.Contains(".")) * { * Console.WriteLine("Found chrome installation: " + dirs.Name); * * foreach(FileInfo file in dirs.EnumerateFiles()) * { * if(file.Name.Equals("chrome.dll")) * { * Console.WriteLine("Found chrome.dll: " + file.FullName); * Console.WriteLine("Patching successful?: " + BytePatchChrome(file)); * break; * } * } * * break; * } * } * * if(!ContainsArg(args, "noWait")) * Thread.Sleep(5000); // Wait a bit to let the user see the result*/ }
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 } }
public static void MainCmd(string[] args) { CommandLineOptions clOptions = null; ParserResult <CommandLineOptions> result = Parser.Default.ParseArguments <CommandLineOptions>(args).WithParsed(options => { clOptions = options; }); if (result.Tag == ParserResultType.NotParsed) { HelpText.AutoBuild(result); return; } if (clOptions == null) { return; } BytePatchManager = new BytePatchManager(CustomConsoleWrite); List <InstallationPaths> applicationPaths = new List <InstallationPaths>(); 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 (!string.IsNullOrEmpty(clOptions.CustomPath)) { if (!Directory.Exists(clOptions.CustomPath)) { Console.WriteLine("CustomPath not found"); return; } applicationPaths.AddRange(new CustomPath(clOptions.CustomPath).FindInstallationPaths()); } else { applicationPaths.AddRange(new 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 browser files found!"); } try { PatcherInstaller installer = new PatcherInstaller(applicationPaths); installer.Install(Console.WriteLine); } catch (Exception ex) { Console.WriteLine("Error while installing patches: " + ex.Message); } if (!clOptions.NoWait) { Thread.Sleep(5000); // Wait a bit to let the user see the result } }