Ejemplo n.º 1
0
        void RunSendGroup(int GroupIndex)
        {
            if (IsAutoTest)
            {
                return;
            }

            if (GroupIndex >= mTestTenKBUserGroups.Count)
            {
                return;
            }


            List <StressTest_TenKBUser> TestUsers = mTestTenKBUserGroups[GroupIndex];

            for (int i = 0; i < TestUsers.Count; i++)
            {
                StressTest_TenKBUser user = TestUsers[i];

                user.NextState = StressTest_TenKBUser.eTesterState.SENDING;

                for (int tk = 0; tk < 10; tk++)
                {
                    var result = user.m_Login.DataTestCmd(0, mTestSendData);
                    if (result == 0)
                    {
                        mMainStatus.m_TenKBSendCount++;
                        mTestGroupStatus[user.GroupID].m_TenKBSendCount++;
                    }
                }
            }

            UpdateTestUserStateUI();
        }
Ejemplo n.º 2
0
        //-- Login And 10KB Test..
        public void StartTest(bool bAutoClick, int ClickIndex)
        {
            string PreFixUserID = MainWindow.Instance.PreFixUserID.Text.Trim();

            if (string.IsNullOrEmpty(PreFixUserID))
            {
                MessageBox.Show("Enter valid PreFixUserID");
                return;
            }

            int MaxConnectionUser = Convert.ToInt32(MainWindow.Instance.TenKBMaxUserNumber.Text);

            if (MaxConnectionUser > MaxUser)
            {
                MessageBox.Show(string.Format("{0} users limit!!", MaxUser));
                return;
            }

            int PrefixStartID = Convert.ToInt32(MainWindow.Instance.UserBeginIdNum.Text);

            if (PrefixStartID <= 0)
            {
                MessageBox.Show("Enter valid StartID!! be Higher than Zero");
                return;
            }

            if (bAutoClick == false)
            {
                mReTryCount       = 0;
                mFailedReTryCount = 0;
                IsAutoTest        = MainWindow.Instance.TenKBTestAutoCheck.IsChecked == true;

                MainWindow.Instance.buttonSendData_Manaul.IsEnabled  = false;
                MainWindow.Instance.buttonSendData_Manaul.Visibility = Visibility.Hidden;
            }

            if (bAutoClick == true && ClickIndex == 1)
            {
                PrintStatus(1, "ReTry Data Test!!");
            }

            if (bAutoClick == true && ClickIndex == 2)
            {
                mFailedReTryCount++;
            }

            CloseAllConnections();

            mCurrectMaxUser = MaxConnectionUser;

            InitStatusValue();
            UpdateTestUserStateUI();

            MainWindow.Instance.textOutput1.Text = string.Empty;

            var StresssTestGameID = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_10KB);

            for (int i = 0; i < MaxConnectionUser; i++)
            {
                StressTest_TenKBUser Testuser = new StressTest_TenKBUser();
                Testuser.InitEngine();
                Testuser.SetPrintHanlde(PrintStatus);

                Testuser.m_LoginID = MakeStreesTestUserID(PrefixStartID, PreFixUserID, i);
                Testuser.gameID    = StresssTestGameID;
                mTestTenKBUsers.Add(Testuser);
            }

            ServerAddressRegistry.SaveGameID(0, StresssTestGameID);

            mServerAddress = MainWindow.Instance.GetServerAddressFromUI(1, MainWindow.Instance.stress_comboBoxIPAddress,
                                                                        () =>
            {
                MainWindow.InitIPAdressComboBox(MainWindow.Instance.stress_comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(1));
            });


            CreateGroup();

            RunConnectGroup(mCurTestLoginSuccessfulGroupCount, mServerAddress);

            m_TenKBTimer       = new DispatcherTimer();
            m_TenKBTimer.Tick += new EventHandler((object ts, EventArgs te) =>
            {
                for (int i = 0; i < mTestTenKBUsers.Count; i++)
                {
                    mTestTenKBUsers[i].OnTimerTick(UpdateTick);
                }

                if (IsAutoTest)
                {
                    if (IsProgressFailed() && MainWindow.Instance.InfiniteReTryFailedRepeatCheck_10KBTest.IsChecked == true)
                    {
                        mCurDealyReTryTime += UpdateTick;

                        if (mCurDealyReTryTime >= 1000)
                        {
                            mCurDealyReTryTime = 0;
                            mTickCount++;
                            PrintStatus(1, "Plz ReTry Test!! {0}..", 3 - mTickCount);

                            if (mTickCount >= 3)
                            {
                                this.StartTest(true, 2);
                            }
                        }
                    }
                }
                else
                {
                    if (mMainStatus.mLoginSuccessCount != 0 && mMainStatus.mLoginSuccessCount == mTestTenKBUsers.Count)
                    {
                        if (mbStartSend == false)
                        {
                            MainWindow.Instance.buttonSendData_Manaul.IsEnabled  = true;
                            MainWindow.Instance.buttonSendData_Manaul.Visibility = Visibility.Visible;
                        }
                        //PrintStatus(1, "{0} User Login Success Plz SendData Push!!", mTestTenKBUsers.Count);
                    }
                    else
                    {
                        MainWindow.Instance.buttonSendData_Manaul.IsEnabled  = false;
                        MainWindow.Instance.buttonSendData_Manaul.Visibility = Visibility.Hidden;
                    }
                }
            });

            m_TenKBTimer.Interval = new TimeSpan(0, 0, 0, 0, UpdateTick);//, 0, UpdateTick);
            m_TenKBTimer.Start();
        }