示例#1
0
        private static void Main(string[] args)
        {
            System.Console.Clear();

            bool IsElevated = new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);

            if (!IsElevated)
            {
                System.Console.WriteLine("\r\nSharpMonoInjector 2.3 wh0am1 Mod\r\n\r\nWARNING: You are running this in an unpriveleged process, try from an Elevated Command Prompt.\r\n");
                System.Console.WriteLine("\t As an alternative, right-click Game .exe and uncheck the Compatibility\r\n\t setting 'Run this program as Administrator'.\r\n\r\n");
                //System.Console.ReadKey();
                //return;
            }

            if (args.Length == 0)
            {
                PrintHelp();
                return;
            }

            CommandLineArguments cla = new CommandLineArguments(args);

            bool inject = cla.IsSwitchPresent("inject");
            bool eject  = cla.IsSwitchPresent("eject");

            if (!inject && !eject)
            {
                System.Console.WriteLine("No operation (inject/eject) specified");
                return;
            }

            Injector injector;

            if (cla.GetIntArg("-p", out int pid))
            {
                injector = new Injector(pid);
            }
            else if (cla.GetStringArg("-p", out string pname))
            {
                injector = new Injector(pname);
            }
            else
            {
                System.Console.WriteLine("No process id/name specified");
                return;
            }

            if (inject)
            {
                Inject(injector, cla);
            }
            else
            {
                Eject(injector, cla);
            }
        }
示例#2
0
        private static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                PrintHelp();
                return;
            }

            CommandLineArguments cla = new CommandLineArguments(args);

            bool inject = cla.IsSwitchPresent("inject");
            bool eject  = cla.IsSwitchPresent("eject");

            if (!inject && !eject)
            {
                System.Console.WriteLine("No operation (inject/eject) specified");
                return;
            }

            Injector injector;

            if (cla.GetIntArg("-p", out int pid))
            {
                injector = new Injector(pid);
            }
            else if (cla.GetStringArg("-p", out string pname))
            {
                injector = new Injector(pname);
            }
            else
            {
                System.Console.WriteLine("No process id/name specified");
                return;
            }

            if (inject)
            {
                Inject(injector, cla);
            }
            else
            {
                Eject(injector, cla);
            }
        }