コード例 #1
0
        public Core(string clientChooserTitle, string mutexName, bool proxy, bool useWPF)
        {
            KeyboardHook.Enable();

            do
            {
                ClientChooserOptions clientChooserOptions = new ClientChooserOptions();
                clientChooserOptions.Title        = clientChooserTitle;
                clientChooserOptions.ShowOTOption = true;
                clientChooserOptions.OfflineOnly  = proxy;

                if (useWPF)
                {
                    Client = ClientChooserWPF.ShowBox(clientChooserOptions);
                }
                else
                {
                    Client = ClientChooser.ShowBox(clientChooserOptions);
                }

                if (Client != null)
                {
                    kedrahMutex = new Mutex(true, "Kedrah_" + mutexName + Client.Process.Id.ToString());

                    if (!kedrahMutex.WaitOne(0, false))
                    {
                        Client = null;
                        continue;
                    }

                    System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal;
                    Client.Process.Exited += new EventHandler(ClientClosed);

                    if (proxy)
                    {
                        Client.IO.StartProxy();
                        Proxy = Client.IO.Proxy;

                        Proxy.PlayerLogin  += new EventHandler(OnLogin);
                        Proxy.PlayerLogout += new EventHandler(OnLogout);
                    }
                    else
                    {
                        loginChecker.Execute += new Tibia.Util.Timer.TimerExecution(loginChecker_Execute);
                        loginChecker.Start();
                    }

                    Modules = new HModules(this);
                    Kedrah.Extensions.Core = this;
                }
            } while (Client == null);
        }
コード例 #2
0
ファイル: Core.cs プロジェクト: Tomaszber93/kedrahcore
        public Core(string clientChooserTitle, string mutexName, bool proxy, bool useWPF)
        {
            KeyboardHook.Enable();

            do
            {
                ClientChooserOptions clientChooserOptions = new ClientChooserOptions();
                clientChooserOptions.Title = clientChooserTitle;
                clientChooserOptions.ShowOTOption = true;
                clientChooserOptions.OfflineOnly = proxy;

                if (useWPF)
                {
                    Client = ClientChooserWPF.ShowBox(clientChooserOptions);
                }
                else
                {
                    Client = ClientChooser.ShowBox(clientChooserOptions);
                }

                if (Client != null)
                {
                    kedrahMutex = new Mutex(true, "Kedrah_" + mutexName + Client.Process.Id.ToString());

                    if (!kedrahMutex.WaitOne(0, false))
                    {
                        Client = null;
                        continue;
                    }

                    System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal;
                    Client.Process.Exited += new EventHandler(ClientClosed);

                    if (proxy)
                    {
                        Client.IO.StartProxy();
                        Proxy = Client.IO.Proxy;

                        Proxy.PlayerLogin += new EventHandler(OnLogin);
                        Proxy.PlayerLogout += new EventHandler(OnLogout);
                    }
                    else
                    {
                        loginChecker.Execute += new Tibia.Util.Timer.TimerExecution(loginChecker_Execute);
                        loginChecker.Start();
                    }

                    Modules = new HModules(this);
                    Kedrah.Extensions.Core = this;
                }
            } while (Client == null);
        }