Exemplo n.º 1
0
        void auth()
        {
            MainForm.IsEnabled = false;
            var result = NetworkUtil.Auth(TLogin.Text);

            MainForm.IsEnabled = true;
            if (!result.Item1)
            {
                showMessage(StaticData.ErrorCodes[result.Item2], "ОК", "error_msg");
                return;
            }

            if (ProgramData.UserInfo.version != ProgramData.LastUpdate)
            {
                updateRequested();
                return;
            }

            LoginInfoLabel.Content = TLogin.Text;
            LoginInfoText.Text     = StaticData.UserInfoText;

            AdsInfoLabel.Content = StaticData.AdLable;
            AdsInfoText.Text     = StaticData.AdText;

            TLogin.Visibility = Visibility.Hidden;

            BLogin.IsEnabled  = false;
            BLogin.Visibility = Visibility.Hidden;

            BLogout.IsEnabled     = true;
            BLogout.Visibility    = Visibility.Visible;
            BActionBtn.Visibility = Visibility.Visible;

            if (ProgramData.UserInfo.subscribe)
            {
                BShowWebsite.Content = UnixTimeStampToDateTime(ProgramData.UserInfo.dateEnd);
            }

            BActionBtn.IsEnabled = true;
            _checkSub            = new Thread(checkSub)
            {
                IsBackground = true, Priority = ThreadPriority.Lowest
            };
            _checkSub.Start();
            IntPtr hwnd = WinApi.FindWindowA(IntPtr.Zero, "Counter-Strike: Global Offensive");

            if (hwnd != IntPtr.Zero)
            {
                IntPtr lResult = WinApi.SendMessage(hwnd, 0, IntPtr.Zero, (IntPtr)0x103);
                if (lResult == (IntPtr)0x605)
                {
                    _injected          = true;
                    _isEnabled         = true;
                    BActionBtn.Content = "Turn off bunnyhop";
                    return;
                }

                if (lResult == (IntPtr)0x604)
                {
                    _injected          = true;
                    _isEnabled         = false;
                    BActionBtn.Content = "Turn on bunnyhop";
                }
            }
        }