Example #1
0
        public Menu()
        {
            InitializeComponent();
            var cfg = new Config();
            cfg.ReadeFile();
            Text = cfg.NewTitle;
            var m = new Thread(BotFunction.BotThread);
            m.Start();
            while (true)
            {
                _gameHandle = FindWindow(null, "osu!");

                if (_gameHandle != IntPtr.Zero)
                    break;
                Thread.Sleep(1);
            }
            TimerSearch();
        }
Example #2
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            try
            {
                var length = GetWindowTextLength(_gameHandle);
                var sb = new StringBuilder(length + 1);
                GetWindowText(_gameHandle, sb, sb.Capacity);
                var title = sb.ToString();

                if ((title != "osu!") && (title != "") && (ReplayParsed))
                {
                    if (IsRun) return;
                    IsRun = true;
                    LTitle.ForeColor = Color.Chartreuse;
                }
                else
                {
                    IsRun = false;
                    LTitle.ForeColor = Color.Red;
                    if (BotFunction.GetAsyncKeyState(Keys.LControlKey) == 0 || BotFunction.GetAsyncKeyState(Keys.O) == 0)
                        return;
                    //open new form
                    if (!SettingOpen)
                    {
                        var thread = new Thread(NewForm);
                        thread.Start();
                        SettingOpen = true;
                        while (SettingOpen)
                        {
                            Thread.Sleep(5);
                        }
                        thread.Abort();
                    }
                    var cfg = new Config();
                    cfg.ReadeFile();
                    Text = cfg.NewTitle;
                }
            }
            catch
            {
                // ignored
            }
        }