Example #1
0
        public bool Install()
        {
            if (!Exists())
            {
                return(false);
            }

            try
            {
                pd = new ProcessDebugger(process.Id);
                pd.Run();

                var now = DateTime.Now;
                while (!pd.WaitForComeUp(50) && now.MSecToNow() < 1000)
                {
                }

                foreach (ProcessThread pT in process.Threads)
                {
                    if (pd.GetThreadStartAddress(pT.Id) == pd.GetAddress(D2Pointers.Game.mainThread))
                    {
                        mainThreadId = pT.Id;
                        break;
                    }
                }

                ApplySettings();
            }
            catch
            {
                return(false);
            }

            CheckInGame(true);

            overlay      = new OverlayWindow();
            overlay.game = this;
            overlay.PostCreate();
            overlay.InGameStateChanged(InGame);

            AutoTeleport = new AutoTeleHandler(this);
            Pickit       = new Pickit(this);
            PlayerInfo   = new PlayerInfo(this);
            MapHandler   = new MapHandler(this);

            syncTimer.Start();
            gameCheckTimer.Start();
            selectedUnitTimer.Start();

            return(true);
        }