Exemplo n.º 1
0
        private void FovChanger()
        {
            while (!_ct.IsCancellationRequested)
            {
                if (_memory.IsRunning())
                {
                    if (btnStart.Enabled)
                    {
                        SetStartButtonStatus(false);
                    }

                    try
                    {
                        if (!_cod.FovPointer.IsPointingCorrectly(_addrFoV) || !_cod.FovScalePointer.IsPointingCorrectly(_addrFoVScale))
                        {
                            _addrFoV      = _memory.ReadPointerAddress(_cod.FovPointer);
                            _addrFoVScale = _memory.ReadPointerAddress(_cod.FovScalePointer);
                            if (_cod.FovPointer.IsPointingCorrectly(_addrFoV) && _cod.FovScalePointer.IsPointingCorrectly(_addrFoVScale))
                            {
                                Beeper.BeepActivated();
                            }
                        }
                        else
                        {
                            if (!_memory.ReadFloat(_addrFoV).Equals(_desiredFoV))
                            {
                                _memory.WriteFloat(_addrFoV, _desiredFoV);
                            }
                            if (!_memory.ReadFloat(_addrFoVScale).Equals(_desiredFoVScale))
                            {
                                _memory.WriteFloat(_addrFoVScale, _desiredFoVScale);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Thread.CurrentThread.Abort();
                        Beeper.BeepDeactivated();
                        MessageBox.Show(ex.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Application.Exit();
                    }
                }
                else
                {
                    if (!btnStart.Enabled)
                    {
                        SetStartButtonStatus(true);
                    }

                    _addrFoV          = IntPtr.Zero;
                    _addrFoVScale     = IntPtr.Zero;
                    _memory.ProcessId = 0;

                    Beeper.BeepDeactivated();
                }

                Thread.Sleep(1000);
            }
        }
Exemplo n.º 2
0
        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_cod == null)
            {
                return;
            }

            Settings.Default.FieldOfView      = nudFov.Value;
            Settings.Default.FieldOfViewScale = nudFovScale.Value;
            Settings.Default.Beep             = chkBeep.Checked;
            Settings.Default.AutoSelect       = chkAutoSelect.Checked;
            Settings.Default.AutoStart        = chkAutoStart.Checked;
            Settings.Default.Save();

            _tokenSource?.Cancel();
            Beeper.BeepDeactivated();
        }