Beispiel #1
0
        public void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            string loginID = MainWindow.Instance.comboBoxLoginID.Text;

            loginID = loginID.Trim();
            if (string.IsNullOrEmpty(loginID))
            {
                MessageBox.Show("Enter valid Login ID");
                return;
            }

            if (ServerAddressRegistry.AddLoginID(loginID))
            {
                UpdateLoginIDUI();
            }

            OnClearLog(sender, e);
            m_NetTestUser.CloseAllConnections();

            m_NetTestUser.m_LoginID = loginID;

            SimpleTestGameID     = MainWindow.GetGameIDFromUI(MainWindow.Instance.comboBoxGameID);
            m_NetTestUser.gameID = SimpleTestGameID;

            ServerAddressRegistry.SaveGameID(100, SimpleTestGameID);

            NetAddress serverAddress = MainWindow.Instance.GetServerAddressFromUI(0, MainWindow.Instance.comboBoxIPAddress, UpdateServerAddressUI);

            m_NetTestUser.RunConnect(serverAddress);
        }
        public void StartTest()
        {
            string loginID = MainWindow.Instance.RankDataUserIDs.Text;

            loginID = loginID.Trim();
            if (string.IsNullOrEmpty(loginID))
            {
                MessageBox.Show("Enter valid Login ID");
                return;
            }

            if (ServerAddressRegistry.AddLoginID(loginID))
            {
                UpdateLoginIDUI();
            }

            MainWindow.Instance.textOutput1.Text = "";
            m_RankTestUser.CloseAllConnections();

            m_RankTestUser.m_LoginID = loginID;

            SimpleTestGameID      = MainWindow.GetGameIDFromUI(MainWindow.Instance.RankTest_GameID);
            m_RankTestUser.gameID = SimpleTestGameID;

            ServerAddressRegistry.SaveGameID(100, SimpleTestGameID);

            NetAddress serverAddress = MainWindow.Instance.GetServerAddressFromUI(0, MainWindow.Instance.stress_comboBoxIPAddress, UpdateServerAddressUI);

            m_RankTestUser.CloseAllConnections();
            m_RankTestUser.Dispose();

            m_RankingConnectedUser = 0;

            m_RankTestUser.RunConnect(serverAddress,
                                      (StressTest_RankTestUser user) =>
            {
                m_RankingConnectedUser++;
                UpdateRankingTestStatueUI();
            },
                                      (StressTest_RankTestUser user, SF.Net.SendMessageLogin l) =>
            {
                if (l != null)
                {
                    m_RankingConnectedUser--;
                }

                UpdateRankingTestStatueUI();
            });
        }
Beispiel #3
0
        protected override void OnClosed(EventArgs e)
        {
            mSimpleTestWin.OnClosed(e);
            mStressTestWin.OnClosed();

            SF.GlobalEngine.Stop();

            var StresssTestGameID1 = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_10KB);
            var StresssTestGameID2 = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_Match);
            var StresssTestGameID3 = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_Matced10KB);
            var StresssTestGameID4 = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_TestLogin);


            ServerAddressRegistry.SaveGameID(0, StresssTestGameID1);
            ServerAddressRegistry.SaveGameID(1, StresssTestGameID2);
            ServerAddressRegistry.SaveGameID(2, StresssTestGameID3);
            ServerAddressRegistry.SaveGameID(3, StresssTestGameID4);

            ServerAddressRegistry.AddServerAddress(1, stress_comboBoxIPAddress.Text);
            ServerAddressRegistry.AddServerAddress(0, comboBoxIPAddress.Text);

            ServerAddressRegistry.SaveServerAddressToRegistry();
            ServerAddressRegistry.SaveLoginIDFromRegistry();

            ServerAddressRegistry.SaveValue(SAVE_PREFIX_KEY_ID, PreFixUserID.Text);

            ServerAddressRegistry.SaveValue(SAVE_USER_BEGIN_NUM_KEY_ID, UserBeginIdNum.Text);
            ServerAddressRegistry.SaveValue(SAVE_TENKBGRUCOUNT_KEY_ID, TenKBInGroupUserCount.Text);
            ServerAddressRegistry.SaveValue(SAVE_TENKBMAXUSERCOUNT_KEY_ID, TenKBMaxUserNumber.Text);
            ServerAddressRegistry.SaveValue(SAVE_MATCHGRUCOUNT_KEY_ID, MatchInGroupUserCount.Text);
            ServerAddressRegistry.SaveValue(SAVE_MATCHMAXUSERCOUNT_ID, MatchKBMaxUserNumber.Text);

            ServerAddressRegistry.SaveValue(SAVE_LOGINTGRUCOUNT_KEY_ID, TestLoginInGroupUserCount.Text);
            ServerAddressRegistry.SaveValue(SAVE_LOGINTMAXUSERCOUNT_ID, TestLoginMaxUserNumber.Text);


            ServerAddressRegistry.SaveValue(SAVE_TAB_INDEX_ID, StressTestTab.SelectedIndex.ToString());

            mStressTestWin = null;

            base.OnClosed(e);
        }
Beispiel #4
0
        protected override void OnClosed(EventArgs e)
        {
            mStressTestWin.OnClosed();

            if (m_Engine != null)
            {
                m_Engine.StopEngine();
            }
            m_Engine = null;

            var StresssTestGameID1 = MainWindow.GetGameIDFromUI(MainWindow.Instance.RankTest_GameID);
            var StresssTestGameID2 = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_Match);
            var StresssTestGameID3 = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_Matced10KB);


            ServerAddressRegistry.SaveGameID(0, StresssTestGameID1);
            ServerAddressRegistry.SaveGameID(1, StresssTestGameID2);
            ServerAddressRegistry.SaveGameID(2, StresssTestGameID3);


            ServerAddressRegistry.AddServerAddress(1, stress_comboBoxIPAddress.Text);
//            ServerAddressRegistry.AddServerAddress(0, comboBoxIPAddress.Text);

            ServerAddressRegistry.SaveServerAddressToRegistry();
            ServerAddressRegistry.SaveLoginIDFromRegistry();

            ServerAddressRegistry.SaveValue(SAVE_PREFIX_KEY_ID, PreFixUserID.Text);

            ServerAddressRegistry.SaveValue(SAVE_USER_BEGIN_NUM_KEY_ID, UserBeginIdNum.Text);
            ServerAddressRegistry.SaveValue(SAVE_MATCHGRUCOUNT_KEY_ID, MatchInGroupUserCount.Text);
            ServerAddressRegistry.SaveValue(SAVE_MATCHMAXUSERCOUNT_ID, MatchKBMaxUserNumber.Text);



            mStressTestWin = null;

            base.OnClosed(e);
        }
Beispiel #5
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();
        }
        // Matched And 10KB Chat 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 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;
            }

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

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

            CloseAllConnections();
            InitStatusValue();

            UpdateMatchedChatTestStatueUI();

            MainWindow.Instance.textOutput3.Text = string.Empty;
            var StresssTestGameID = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_Matced10KB);


            for (int i = 0; i < 4; i++)
            {
                StressTest_Matched_Chat TestMatchedChatUser = new StressTest_Matched_Chat();
                TestMatchedChatUser.InitEngine();
                TestMatchedChatUser.SetPrintHanlde(PrintStatus);

                TestMatchedChatUser.m_LoginID = MakeStreesTestUserID(PrefixStartID, PreFixUserID, i);

                if (i == 0)
                {
                    TestMatchedChatUser.IsPartyBoss = true;
                    mCurPartyBossName = TestMatchedChatUser.m_LoginID;

                    this.mPartyBoss = TestMatchedChatUser;
                }
                else
                {
                    TestMatchedChatUser.IsPartyBoss = false;
                }

                TestMatchedChatUser.gameID = StresssTestGameID;
                mTestMatchedChatUsers.Add(TestMatchedChatUser);
            }


            UpdateMatchedChatTestStatueUI();

            ServerAddressRegistry.SaveGameID(2, StresssTestGameID);
            NetAddress serverAddress = MainWindow.Instance.GetServerAddressFromUI(1, MainWindow.Instance.stress_comboBoxIPAddress,
                                                                                  () =>
            {
                MainWindow.InitIPAdressComboBox(MainWindow.Instance.stress_comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(1));
            });

            //mLoginCurrectConnectedUser

            for (int i = 0; i < mTestMatchedChatUsers.Count; i++)
            {
                mTestMatchedChatUsers[i].RunConnect(serverAddress,
                                                    (StressTest_Matched_Chat user) =>
                {
                    mLoginCurrectConnectedUser++;
                    UpdateMatchedChatTestStatueUI();
                },
                                                    (StressTest_Matched_Chat user, SF.Net.SendMessageLogin l) =>
                {
                    if (l != null)
                    {
                        mLoginCurrectConnectedUser--;
                    }

                    UpdateMatchedChatTestStatueUI();
                },
                                                    (StressTest_Matched_Chat user, int FailedIndex) =>
                {
                    mLoginFailedUserCount++;
                    UpdateMatchedChatTestStatueUI();
                },
                                                    (StressTest_Matched_Chat user) =>
                {
                    mPartyGameSvrCurrectConnectedUser++;
                    UpdateMatchedChatTestStatueUI();
                },
                                                    (StressTest_Matched_Chat user, SF.Net.SendMessageGame l) =>
                {
                    if (l != null)
                    {
                        mPartyGameSvrCurrectConnectedUser--;
                    }

                    UpdateMatchedChatTestStatueUI();
                },
                                                    (StressTest_Matched_Chat user) =>
                {
                    mPartyGameSvrFailedConnectUser++;
                    UpdateMatchedChatTestStatueUI();
                },

                                                    ///
                                                    (StressTest_Matched_Chat user, bool Success) =>
                {
                    if (Success)
                    {
                        mPartyGameSuccessJoinCount++;
                    }

                    UpdateMatchedChatTestStatueUI();
                },

                                                    // Party Create Res
                                                    (StressTest_Matched_Chat user) =>
                {
                    if (!user.IsPartyBoss)
                    {
                        return;
                    }

                    if (mWaitFullJoin != null)
                    {
                        MessageBox.Show("WaitFullJoin did not Stop!!");
                        return;
                    }

                    mPartyGameJoinedCount++;
                    UpdateMatchedChatTestStatueUI();

                    DateTime StartWaitTime = DateTime.Now;

                    mWaitFullJoin = new Thread(new ThreadStart(() =>
                    {
                        bool IsFullReadyJoin = false;
                        while (!IsFullReadyJoin)
                        {
                            if ((StartWaitTime - DateTime.Now).Seconds > 10)
                            {
                                PrintStatus(1, "Plz Retry Chat Test!!");
                                break;
                            }

                            if (mPartyGameSuccessJoinCount == 4)
                            {
                                int FreeUserCount = 0;
                                for (int j = 0; j < mTestMatchedChatUsers.Count; j++)
                                {
                                    if (mTestMatchedChatUsers[j].IsPartyBoss)
                                    {
                                        if (mTestMatchedChatUsers[j].CurState == StressTest_Matched_Chat.eTesterState.PARTY_MATCING)
                                        {
                                            FreeUserCount++;
                                        }
                                    }
                                    else
                                    {
                                        if (mTestMatchedChatUsers[j].CurState == StressTest_Matched_Chat.eTesterState.PARTY_WAIT_INVITE)
                                        {
                                            FreeUserCount++;
                                        }
                                    }
                                }

                                if (FreeUserCount == 4)
                                {
                                    IsFullReadyJoin = true;
                                    break;
                                }
                            }
                            Thread.Sleep(1000);
                        }

                        if (IsFullReadyJoin)    // == 4)
                        {
                            PrintStatus(1, "FullJoin!! Do it Test Invite");
                            OnTestPartyChatInvite();
                        }
                    }));

                    mWaitFullJoin.Start();
                },
                                                    // Party Joined
                                                    (StressTest_Matched_Chat user, bool success) =>
                {
                    if (success)
                    {
                        mPartyGameJoinedCount++;
                        UpdateMatchedChatTestStatueUI();

                        if (mPartyGameJoinedCount == 4)
                        {
                            //-- for..
                            for (int j = 0; j < mTestMatchedChatUsers.Count; j++)
                            {
                                if (mTestMatchedChatUsers[j].IsPartyBoss)
                                {
                                    mTestMatchedChatUsers[j].NextState = StressTest_Matched_Chat.eTesterState.SEND_CHATING;
                                }
                                else
                                {
                                    mTestMatchedChatUsers[j].NextState = StressTest_Matched_Chat.eTesterState.WAIT_RECV_CHATING;
                                }
                            }

                            // Send 1KB Chat Repeat 10
                            for (int scc = 0; scc < SendChatRepeatCount; scc++)
                            {
                                if (mPartyBoss.m_Game.PartyChatMessageCmd(0, mTestSend1KBData[scc]) == 0)
                                {
                                    mPartyOneKBChatSendCount++;

                                    mPartyChatSendTime[scc] = DateTime.Now;
                                    PrintStatus(1, "Send 1KB Chat Repeat {0} Time = {1}  / {2}", scc, mPartyChatSendTime[scc].ToString("hh/mm/ss.fff"), mPartyBoss.m_LoginID);
                                }
                            }

                            //PrintStatus(1, "Send 1KB Chat Repeat {0} Time = {1} ", SendChatRepeatCount, mPartyChatSendTime.ToString("hh/mm/ss.fff"));
                            UpdateMatchedChatTestStatueUI();
                        }
                    }
                    else
                    {
                    }
                },
                                                    (StressTest_Matched_Chat user, bool success) =>
                {
                    if (!user.IsPartyBoss)
                    {
                        return;
                    }

                    if (success)
                    {
                        mPartyOneKBChatSendSuccessCount++;
                        UpdateMatchedChatTestStatueUI();
                    }
                },
                                                    (StressTest_Matched_Chat user) =>
                {
                    mPartyChatRecevice_FinishUserCount++;

                    if (!user.IsPartyBoss)
                    {
                        // 1KB Recved 10
                        mPartyChatLAverageValue = user.GetChatRecved_AverageValue(mPartyChatSendTime[0]);
                        PrintStatus(1, "Receviced 10KB Average Speed = {0}ms / ID ={1}", mPartyChatLAverageValue, user.m_LoginID);
                        UpdateMatchedChatTestStatueUI();
                    }

                    if (mPartyChatRecevice_FinishUserCount == 4)
                    {
                        if (MainWindow.Instance.InfiniteRepeatCheck.IsChecked == true)
                        {
                            System.Threading.Tasks.Task.Delay(3000).ContinueWith(t =>
                            {
                                MainWindow.Instance.btnStressTestMatched_Cp_Chat.Dispatcher.Invoke(new UpdateButtonPress_Delegate(delegate()
                                {
                                    mReTryCount++;
                                    MainWindow.Instance.btnStressTestMatched_Cp_Chat.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                                }));
                            });
                        }
                    }
                }
                                                    );
            }

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

                if (IsProgressFailed() && MainWindow.Instance.InfiniteReTryFailedRepeattCheck_MatchChat.IsChecked == true)
                {
                    mCurDealyReTryTime += UpdateTick;
                    if (mCurDealyReTryTime >= 1000)
                    {
                        mTickCount++;
                        mCurDealyReTryTime = 0;
                        PrintStatus(1, "Plz ReTry Test!! {0}..", 3 - mTickCount);
                        if (mTickCount == 3)
                        {
                            this.StartTest(true, 2);
                        }
                    }
                }
            });

            m_MatchedChatTestTimer.Interval = new TimeSpan(0, 0, 0, 0, UpdateTick);
            m_MatchedChatTestTimer.Start();
        }
Beispiel #7
0
        // Matching 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.MatchKBMaxUserNumber.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.TestMatcingAutoCheck.IsChecked == true;
                //  MainWindow.Instance.buttonManual_Matcing.IsEnabled = false;
                // MainWindow.Instance.buttonManual_Matcing.Visibility = Visibility.Hidden;
            }

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

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

            mTestSendDataStatus.Clear();

            CloseAllConnections();
            mCurrectMaxUser = MaxConnectionUser;

            InitStatusValue();
            UpdateMatchingTestStatueUI();

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

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

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

                TestMatchingUser.m_LoginID = MakeStreesTestUserID(PrefixStartID, PreFixUserID, i);
                TestMatchingUser.gameID    = StresssTestGameID;
                mTestMatchingBUsers.Add(TestMatchingUser);
            }

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


            CreateGroup();

            RunConnectGroup(0, mServerAddress);

            m_MatchingTestTimer       = new DispatcherTimer();
            m_MatchingTestTimer.Tick += new EventHandler(UpdateTickProcess);

            m_MatchingTestTimer.Interval = new TimeSpan(0, 0, 0, 0, UpdateTickTime);
            m_MatchingTestTimer.Start();
        }
Beispiel #8
0
        // Matched And 10KB Chat 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 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;
            }

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

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

            CloseAllConnections();
            InitStatusValue();

            UpdateMatchedChatTestStatueUI();

            MainWindow.Instance.textOutput3.Text = string.Empty;
            var StresssTestGameID = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_Matced10KB);


            for (int i = 0; i < MaxMatchedTestUserCount; i++)
            {
                StressTest_Matched_Chat TestMatchedChatUser = new StressTest_Matched_Chat();
                TestMatchedChatUser.InitEngine();
                TestMatchedChatUser.SetPrintHanlde(PrintStatus);

                TestMatchedChatUser.m_LoginID = MakeStreesTestUserID(PrefixStartID, PreFixUserID, i);

                if (i == 0)
                {
                    TestMatchedChatUser.IsPartyBoss = true;
                    mCurPartyBossName = TestMatchedChatUser.m_LoginID;

                    this.mPartyBoss = TestMatchedChatUser;

                    TestMatchedChatUser.IsPutRecvChatLog = bPutBossChatLog;
                }
                else
                {
                    TestMatchedChatUser.IsPartyBoss = false;
                }

                TestMatchedChatUser.gameID = StresssTestGameID;
                mTestMatchedChatUsers.Add(TestMatchedChatUser);
            }


            UpdateMatchedChatTestStatueUI();

            ServerAddressRegistry.SaveGameID(2, StresssTestGameID);
            NetAddress serverAddress = MainWindow.Instance.GetServerAddressFromUI(1, MainWindow.Instance.stress_comboBoxIPAddress,
                                                                                  () =>
            {
                MainWindow.InitIPAdressComboBox(MainWindow.Instance.stress_comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(1));
            });

            //mLoginCurrectConnectedUser

            RunTestAction(serverAddress);


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

                if (IsProgressFailed() && MainWindow.Instance.InfiniteReTryFailedRepeattCheck_MatchChat.IsChecked == true)
                {
                    mCurDealyReTryTime += UpdateTick;
                    if (mCurDealyReTryTime >= 1000)
                    {
                        mTickCount++;
                        mCurDealyReTryTime = 0;
                        PrintStatus(1, "Plz ReTry Test!! {0}..", 3 - mTickCount);
                        if (mTickCount == 3)
                        {
                            this.StartTest(true, 2);
                        }
                    }
                }
            });

            m_MatchedChatTestTimer.Interval = new TimeSpan(0, 0, 0, 0, UpdateTick);
            m_MatchedChatTestTimer.Start();
        }
        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.TestLoginMaxUserNumber.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;
            }

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

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

            CloseAllConnections();
            mCurrectMaxUser = MaxConnectionUser;

            InitStatusValue();
            UpdateStatueUI();

            MainWindow.Instance.textOutput4.Text = string.Empty;
            var StresssTestGameID = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_TestLogin);

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

                TestUser.m_LoginID = MakeStreesTestUserID(PrefixStartID, PreFixUserID, i);
                TestUser.gameID    = StresssTestGameID;
                mLoginTesterUsers.Add(TestUser);
            }

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

            CreateGroup();

            RunConnectGroup(0, mServerAddress);

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

                if (IsProgressFailed() && MainWindow.Instance.InfiniteReTryFailedRepeattCheck_LoginTest.IsChecked == true)
                {
                    mCurDealyReTryTime += 1000;
                    PrintStatus(1, "Plz ReTry Test!! {0}..", 3 - (mCurDealyReTryTime / 1000));
                    if (mCurDealyReTryTime >= 3000)
                    {
                        this.StartTest(true, 2);
                    }
                }
            });

            m_LoginTestTimer.Interval = new TimeSpan(0, 0, 1);
            m_LoginTestTimer.Start();
        }