Bootstrap() 공개 메소드

Initializes jZm onto a certain game process. Make sure the game is the correct process, This function doesn't check if the process is correct.
DO NOT CALL FROM A PLUGIN. This function is called from the jZm frontend and you should not call it from a plugin.
public Bootstrap ( Process Game ) : void
Game System.Diagnostics.Process The game process jZm reads/writes to (must be a valid CODBOII zombies process)
리턴 void
예제 #1
0
파일: Program.cs 프로젝트: jariz/jZm
        static void Main(string[] args)
        {
            string gameName;
            if (args.Length > 0)
                gameName = args[0];
            else gameName = "t6zm";

            Process[] games = Process.GetProcessesByName(gameName);
            Process gameProcess = null;
            if (games.Length > 1)
            {
                TaskDialog diag = new TaskDialog();
                diag.Caption = "Woops!";
                diag.InstructionText = "I found more than 2 running games!";
                diag.Icon = TaskDialogStandardIcon.Warning;
                diag.Text = "jZm has found more than just one game.\r\nWhat would you like to do?";
                foreach (Process game in games)
                {
                    TaskDialogCommandLink link = new TaskDialogCommandLink(game.ProcessName, game.ProcessName, "PID " + game.Id);
                    link.Click += delegate(object sender, EventArgs argz)
                    {
                        gameProcess = game;
                        diag.Close();
                    };
                    diag.Controls.Add(link);
                }
                TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart", "Restart jZm");
                linkz.ShowElevationIcon = true;
                linkz.Click += delegate(object sender, EventArgs argz)
                {
                    diag.Close();
                    Application.Restart();
                    //mare sure we're dead
                    Environment.Exit(-1);
                };
                diag.Controls.Add(linkz);
                linkz = new TaskDialogCommandLink("r", "Exit", "Exit jZm");
                linkz.ShowElevationIcon = true;
                linkz.Click += delegate(object sender, EventArgs argz)
                {
                    diag.Close();
                    Environment.Exit(-1);
                };
                diag.Controls.Add(linkz);

                diag.Show();
            }
            else if (games.Length == 0)
            {
                TaskDialog diag = new TaskDialog();
                diag.Caption = "Woops!";
                diag.InstructionText = "I was unable to find any games";
                diag.Icon = TaskDialogStandardIcon.Error;
                diag.Text = "jZm was unable to find any processes matching the name '" + gameName + "'.\r\nWhat would you like to do?";
                TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart jZm", "Restart and look for the game again");
                linkz.ShowElevationIcon = true;
                linkz.Click += delegate(object sender, EventArgs argz)
                {
                    diag.Close();
                    Application.Restart();
                    //mare sure we're dead
                    Environment.Exit(-1);
                };
                diag.Controls.Add(linkz);
                linkz = new TaskDialogCommandLink("r", "Exit jZm");
                linkz.Click += delegate(object sender, EventArgs argz)
                {
                    diag.Close();
                    Environment.Exit(-1);
                };
                diag.Controls.Add(linkz);
                diag.Show();
            }
            else gameProcess = games[0];

            API = new ZombieAPI.ZombieAPI();

            MainForm = new Main();
            MainForm.Show();

            try
            {
                API.Bootstrap(gameProcess);
            }
            catch (Exception z)
            {
                Crash(z);
            }

            Application.Run();
        }
예제 #2
0
파일: Program.cs 프로젝트: jariz/jZm
        static void Main(string[] args)
        {
            Console.Clear();
            Console.Title = "jZm";
            string gameName;
            if (args.Length > 0)
                gameName = args[0];
            else gameName = "t6zm";

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(ZombieAPI.ZombieAPI.Header);
            Console.ForegroundColor = ConsoleColor.Gray;

            API = new ZombieAPI.ZombieAPI();
            API.OnWrite += new WriteHandler(API_OnWrite);
            API.OnPluginCrash += new OnPluginCrashHandler(API_OnPluginCrash);
            API.OnCrash += new OnCrashHandler(Crash);
            API.OnDebugWrite += new WriteHandler(API_OnDebugWrite);
            API.OnFrame += new OnFrameHandler(API_OnFrame);

            Process[] games = Process.GetProcessesByName(gameName);

            if (games.Length == 0)
                Anim(gameName);
            if (games.Length > 1)
                Crash(new jZmException("More than 1 game process found. Use the GUI if you want to use multiple games."));

            API.Bootstrap(games[0]);

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\r\nPress enter to exit jZm\r\n");

            //Application.Run();
            Console.ReadLine();
            API.Shutdown(true);
        }