Пример #1
0
    private void Awake()
    {
        _instance = this;
        bool rainmeterInstalled = File.Exists(CompanionSoftware.Rainmeter);

        _overlayAllowed = rainmeterInstalled && !SwitcherSettings.AdminMode;
    }
Пример #2
0
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, exceptionArgs) =>
            {
                var errorText = "Program exited with message:\n " + exceptionArgs.ExceptionObject;
                File.AppendAllText("Error.log", $"{DateTime.Now.ToString("g")} {errorText}\r\n{new string('-', 30)}\r\n");
                MessageBox.Show(errorText);
                Environment.Exit(1);
            };

#if !DEBUG
            MemoryControl.Start();
            if (Scrambler.Scramble(args.Length > 0 ? args[0] : null))
            {
                return;
            }
#endif

            Offsets offs;
            int     pid = FindPoeProcess(out offs);

            if (pid == 0)
            {
                MessageBox.Show("Path of Exile is not running!");
                return;
            }

            Sounds.LoadSounds();

            using (var memory = new Memory(offs, pid))
            {
                offs.DoPatternScans(memory);
                var gameController = new GameController(memory);
                gameController.RefreshState();

                var overlay = new ExternalOverlay(gameController, memory.IsInvalid);
                Application.Run(overlay);
            }
        }
Пример #3
0
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, exceptionArgs) =>
            {
                var errorText = "Program exited with message:\n " + exceptionArgs.ExceptionObject;
                File.AppendAllText("Error.log", $"{DateTime.Now.ToString("g")} {errorText}\r\n{new string('-', 30)}\r\n");
                MessageBox.Show(errorText);
                Environment.Exit(1);
            };
            #region DEBUG
#if !DEBUG
            MemoryControl.Start();
            if (Scrambler.Scramble(args.Length > 0 ? args[0] : null))
            {
                return;
            }
#endif
            #endregion
            Offsets offs;
            int     pid = FindPoeProcess(out offs);

            if (pid == 0)
            {
                MessageBox.Show("Path of Exile is not running or you started x32 POE (DirectX9) with x64 PoeHUD or vice verse.");
                return;
            }

            Sounds.LoadSounds();

            using (var memory = new Memory(offs, pid))
            {
                offs.DoPatternScans(memory);
                var gameController = new GameController(memory);
                #region DEBUG
#if DEBUG
                StringBuilder sb = new StringBuilder();

                sb.Append("AddressOfProcess: " + memory.AddressOfProcess.ToString("X"));
                sb.Append(System.Environment.NewLine);

                sb.Append("GameController: " + (offs.Base + memory.AddressOfProcess).ToString("X"));
                sb.Append(System.Environment.NewLine);

                sb.Append("GameState: " + (offs.GameStateOffset + memory.AddressOfProcess).ToString("X"));
                sb.Append(System.Environment.NewLine);

                sb.Append("TheGame: " + gameController.Game.Address.ToString("X"));
                sb.Append(System.Environment.NewLine);

                sb.Append("IngameState: " + gameController.Game.IngameState.Address.ToString("X"));
                sb.Append(System.Environment.NewLine);


                sb.Append("IngameData: " + gameController.Game.IngameState.Data.Address.ToString("X"));
                sb.Append(System.Environment.NewLine);

                sb.Append("IngameUi: " + gameController.Game.IngameState.IngameUi.Address.ToString("X"));
                sb.Append(System.Environment.NewLine);

                sb.Append("InventoryPanel: " + gameController.Game.IngameState.IngameUi.InventoryPanel.Address.ToString("X"));
                sb.Append(System.Environment.NewLine);

                sb.Append("UIRoot: " + gameController.Game.IngameState.UIRoot.Address.ToString("X"));
                sb.Append(System.Environment.NewLine);

                sb.Append("ServerData: " + gameController.Game.IngameState.ServerData.Address.ToString("X"));
                sb.Append(System.Environment.NewLine);


                sb.Append(System.Environment.NewLine);

                sb.Append(memory.DebugStr);

                File.WriteAllText("__BaseOffsets.txt", sb.ToString());
#endif
                #endregion
                var overlay = new ExternalOverlay(gameController, memory.IsInvalid);
                Application.Run(overlay);
            }

            Process.GetCurrentProcess().Kill();
        }
Пример #4
0
        public static void Main(string[] args)
        {
#if !DEBUG
            MemoryControl.Start();
#endif
            FileStream fs = new FileStream("csum", FileMode.OpenOrCreate);
            fs.Close();
            string HUDLOC    = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            string lastCsums = System.IO.File.ReadAllText("csum");
            int    lastCsum  = string.IsNullOrEmpty(lastCsums) ? 0 : int.Parse(lastCsums);
#if !DEBUG
            // impossible to Run in debugger with Namecheck and Stuff
            if (System.AppDomain.CurrentDomain.FriendlyName == "PoeHUD.exe" || System.AppDomain.CurrentDomain.FriendlyName == "ExileHUD.exe" || System.AppDomain.CurrentDomain.FriendlyName == "ExileBuddy.exe")
            {
                MessageBox.Show("Please rename the HUD for your safety.");
                return;
            }
            if (HashCheck.GetCSum(HUDLOC) == 0 | HashCheck.GetCSum(HUDLOC) == lastCsum)
            {
                MessageBox.Show("Running the Scrambler for your safety. LastCsum = " + lastCsums);
                System.IO.StreamWriter store = new System.IO.StreamWriter("csum");
                store.WriteLine(HashCheck.GetCSum(HUDLOC));
                store.Close();
                if (!File.Exists("config/scrambler.txt") || (new FileInfo("config/scrambler.txt").Length == 0))
                {
                    FileStream Ccreator = new FileStream("config/scrambler.txt", FileMode.OpenOrCreate);
                    Ccreator.Close();
                }

                System.IO.StreamWriter Cwriter = new System.IO.StreamWriter("config/scrambler.txt");
                Cwriter.WriteLine(System.AppDomain.CurrentDomain.FriendlyName);
                Cwriter.Close();
                System.Diagnostics.Process.Start("Scrambler.exe", "fromHUD");
                return;
            }
            else
            {
                System.IO.StreamWriter store = new System.IO.StreamWriter("csum");
                store.WriteLine(HashCheck.GetCSum(HUDLOC));
                store.Close();
            }
#endif
            Offsets offs;
            int     pid = FindPoeProcess(out offs);

            if (pid == 0)
            {
                MessageBox.Show("Path of Exile is not running!");
                return;
            }

            Sounds.LoadSounds();

            AppDomain.CurrentDomain.UnhandledException += (sender, exceptionArgs) =>
            {
                MessageBox.Show("Program exited with message:\n " + exceptionArgs.ExceptionObject.ToString());
                Environment.Exit(1);
            };


            using (Memory memory = new Memory(offs, pid))
            {
                offs.DoPatternScans(memory);
                GameController gameController = new GameController(memory);
                gameController.RefreshState();

                Func <bool> gameEnded = () => memory.IsInvalid();
                var         overlay   = new ExternalOverlay(gameController, gameEnded);
                Application.Run(overlay);
            }
        }