Esempio n. 1
0
        public bool ConnectToProcess()
        {
            LogWindow.LogMessage("Connecting to process...");
            var pid = FindPoeProcess(out _offs);

            if (pid == 0)
            {
                LogWindow.LogError("Path of Exile is not running.");
                return(false);
            }

            try
            {
                _memory = new Memory(_offs, pid);
                _offs.DoPatternScans(_memory);
                _memorySectionsProcessor = new MemorySectionsProcessor();
                _memorySectionsProcessor.UpdateProcessInformations(_memory.procHandle);
            }
            catch (Exception e)
            {
                LogWindow.LogError($"Error while creating instance of GameController: {e}");
                return(false);
            }

            LogWindow.LogMessage("Connected to process");
            return(true);
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            Process process = Process.GetProcessesByName("PathOfExile").FirstOrDefault <Process>();

            if (process == null)
            {
                MessageBox.Show("Path of Exile is not running!");
                return;
            }
            Sounds.LoadSounds();
            if (!Settings.LoadSettings())
            {
                return;
            }
            using (Memory memory = new Memory(process.Id))
            {
                Offsets.DoPatternScans(memory);
                PathOfExile pathOfExile = new PathOfExile(memory);
                pathOfExile.Update();
                OverlayRenderer overlay = null;
                AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs exceptionArgs)
                {
                    if (overlay != null)
                    {
                        overlay.Detach();
                    }
                    MessageBox.Show("Program exited with message:\n " + exceptionArgs.ExceptionObject.ToString());
                    Environment.Exit(1);
                };
                try
                {
                    Console.WriteLine("Starting overlay");
                    TransparentDXOverlay transparentDXOverlay = new TransparentDXOverlay(pathOfExile.Window);
                    transparentDXOverlay.InitD3D();
                    overlay = new OverlayRenderer(pathOfExile, transparentDXOverlay.RC);
                    Application.Run(transparentDXOverlay);
                }
                finally
                {
                    if (overlay != null)
                    {
                        overlay.Detach();
                    }
                }
            }
        }