Exemplo n.º 1
0
        public static OffsetObject ReadOffsetFile()
        {
            string       jsonfile = File.ReadAllText($@"{System.AppDomain.CurrentDomain.BaseDirectory}\csgo.json");
            OffsetObject offsets  = JsonConvert.DeserializeObject <OffsetObject>(jsonfile);

            return(offsets);
        }
Exemplo n.º 2
0
        public void StartMainLoop(CancellationToken cancelToken)
        {
            if (this.isRunning)
            {
                return;
            }
            this.isRunning = true;
            Debugging.Log("Core started");

            Debugging.Log("Downloading offset dump");
            HazeDownloader.DownloadDump();
            OffsetObject o = HazeDownloader.ReadOffsetFile();

            Globals.Offsets = o;

            Debugging.Log("Attaching to process");
            bool attached = false;

            for (int i = 0; i < 5; i++)
            {
                attached = Memory.Attach();
                if (attached)
                {
                    Debugging.Log("Attached successfully!");
                    Debugging.Log(String.Format("Client Hex: {0} Int: {1}", Memory.client.ToString("x"), Memory.client));
                    Debugging.Log(String.Format("Engine Hex: {0} Int: {1}", Memory.engine.ToString("x"), Memory.client));
                    break;
                }
                else
                {
                    Debugging.Log(String.Format("Failed to attach! (Attempt #{0})", i + 1));
                    if (i != 4)
                    {
                        Debugging.Log("Retrying...");
                        Thread.Sleep(2000);
                    }
                }
            }

            if (!attached)
            {
                Debugging.Log("Failed to attach after retries! Closing program!");
                mainWindow.AttachFailed();
                return;
            }

            MainLoop(cancelToken);
        }