public void InitStressTest() { MainWindow.InitIPAdressComboBox(MainWindow.Instance.stress_comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(1)); InputMethod.SetIsInputMethodEnabled(MainWindow.Instance.UserBeginIdNum, false); MainWindow.Instance.PreFixUserID.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_PREFIX_KEY_ID, "Braves"); MainWindow.Instance.UserBeginIdNum.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_USER_BEGIN_NUM_KEY_ID, "3000"); MainWindow.Instance.TenKBInGroupUserCount.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_TENKBGRUCOUNT_KEY_ID, "50"); MainWindow.Instance.TenKBMaxUserNumber.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_TENKBMAXUSERCOUNT_KEY_ID, "100"); MainWindow.Instance.MatchInGroupUserCount.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_MATCHGRUCOUNT_KEY_ID, "50"); MainWindow.Instance.MatchKBMaxUserNumber.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_MATCHMAXUSERCOUNT_ID, "100"); MainWindow.Instance.TestLoginInGroupUserCount.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_LOGINTGRUCOUNT_KEY_ID, "50"); MainWindow.Instance.TestLoginMaxUserNumber.Text = ServerAddressRegistry.ReadValue(MainWindow.SAVE_LOGINTMAXUSERCOUNT_ID, "100"); mDataTestWin.InitStressTest(); mMatcingTestWin.InitStressTest(); mMatched10KBTestWin.InitStressTest(); mLoginTestWin.InitStressTest(); }
void UpdateUI() { MainWindow.Instance.comboBoxGameID.SelectedItem = ServerAddressRegistry.ReadGameID(100, SimpleTestGameID).ToString(); UpdateLoginIDUI(); }
public void InitStressTest() { for (int i = 0; i < SendChatRepeatCount; i++) { // 65 A ~~~ char d = (char)(65 + i); mTestSend1KBData[i] = string.Empty; mTestSend1KBData[i] = mTestSend1KBData[i].PadRight(ChatDataTestSize, d); // mPartyChatSendTime[i] = DateTime.MaxValue; } //{ // char d = (char)(65); // mTestStatic1KBData = mTestStatic1KBData.PadRight(1024,d); // mTestStatic1KBData += '\0'; //} mPartyChatSendTime.Clear(); var StresssTestGameID = "MyTownHero"; MainWindow.InitGameIDComboBox(MainWindow.Instance.stress_comboBoxGameID_Matced10KB, StresssTestGameID); MainWindow.Instance.stress_comboBoxGameID_Matced10KB.SelectedItem = ServerAddressRegistry.ReadGameID(2, StresssTestGameID).ToString(); MainWindow.Instance.SendCountTitle_Copy.Content = string.Format("{0}KB Send Count", ChatDataTestSize / 1024); MainWindow.Instance.SendSuccessTitle_Copy.Content = string.Format("{0}KB Success Count", ChatDataTestSize / 1024); // UpdateTestUserStateUI(); }
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 InitSimpleTest() { MainWindow.InitGameIDComboBox(MainWindow.Instance.comboBoxGameID, SimpleTestGameID); MainWindow.InitIPAdressComboBox(MainWindow.Instance.comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(0)); m_NetTestUser.InitEngine(); m_NetTestUser.SetPrintHanlde(PrintStatus); UpdateUI(); }
public void InitStressTest() { InputMethod.SetIsInputMethodEnabled(MainWindow.Instance.TestLoginInGroupUserCount, false); InputMethod.SetIsInputMethodEnabled(MainWindow.Instance.TestLoginMaxUserNumber, false); var StresssTestGameID = "MyTownHero"; MainWindow.InitGameIDComboBox(MainWindow.Instance.stress_comboBoxGameID_TestLogin, StresssTestGameID); MainWindow.Instance.stress_comboBoxGameID_TestLogin.SelectedItem = ServerAddressRegistry.ReadGameID(3, StresssTestGameID).ToString(); UpdateStatueUI(); }
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(); }); }
public void InitStressTest() { InputMethod.SetIsInputMethodEnabled(MainWindow.Instance.MatchKBMaxUserNumber, false); InputMethod.SetIsInputMethodEnabled(MainWindow.Instance.MatchInGroupUserCount, false); var StresssTestGameID = "MyTownHero"; MainWindow.InitGameIDComboBox(MainWindow.Instance.stress_comboBoxGameID_Match, StresssTestGameID); MainWindow.Instance.stress_comboBoxGameID_Match.SelectedItem = ServerAddressRegistry.ReadGameID(1, StresssTestGameID).ToString(); // MainWindow.Instance.buttonManual_Matcing.IsEnabled = false; // MainWindow.Instance.buttonManual_Matcing.Visibility = Visibility.Hidden; UpdateMatchingTestStatueUI(); }
public NetAddress GetServerAddressFromUI(int KeyIndex, ComboBox comboBoxIPAddress, System.Action UpdateUI) { NetAddress curSelectedAddress = new NetAddress() { Address = "127.0.0.1", Port = 21001 }; if (!string.IsNullOrEmpty(comboBoxIPAddress.Text) && curSelectedAddress.Parse(comboBoxIPAddress.Text)) { if (ServerAddressRegistry.AddServerAddress(KeyIndex, comboBoxIPAddress.Text)) { UpdateUI(); } } return(curSelectedAddress); }
public MainWindow() { InitializeComponent(); Instance = this; SF.GlobalEngine.Start("TestNet.WInSharp"); using (RegistryKey key = Registry.CurrentUser.CreateSubKey(RegistryKeyName)) { } string IniFilePath = string.Format("{0}/default.ini", System.IO.Directory.GetCurrentDirectory()); if (!ServerAddressRegistry.ReadServerAddress(0)) { ServerAddressRegistry.SetDefaultServerAddress(0, IniFilePath); } if (!ServerAddressRegistry.ReadServerAddress(1)) { ServerAddressRegistry.SetDefaultServerAddress(1, IniFilePath); } ServerAddressRegistry.ReadLoginID(); int MaxUserValue = 400; if (ServerAddressRegistry.ReadMaxUser(IniFilePath, ref MaxUserValue)) { StressTestWindowDataTest.MaxUser = MaxUserValue; StressTestWindowMatchTest.MaxUser = MaxUserValue; StressTestWindowLoginTest.MaxUser = MaxUserValue; } mSimpleTestWin.InitSimpleTest(); mStressTestWin.InitStressTest(); int TabIndex = Convert.ToInt32(ServerAddressRegistry.ReadValue(SAVE_TAB_INDEX_ID, "0")); StressTestTab.SelectedIndex = TabIndex; }
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); }
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); }
public void InitStressTest() { int ChatDataTestSize = 1024 / 2; for (int i = 0; i < SendChatRepeatCount; i++) { // 65 A ~~~ char d = (char)(65 + i); mTestSend1KBData[i] = string.Empty; mTestSend1KBData[i] = mTestSend1KBData[i].PadRight(ChatDataTestSize, d); mPartyChatSendTime[i] = DateTime.MaxValue; } var StresssTestGameID = "MyTownHero"; MainWindow.InitGameIDComboBox(MainWindow.Instance.stress_comboBoxGameID_Matced10KB, StresssTestGameID); MainWindow.Instance.stress_comboBoxGameID_Matced10KB.SelectedItem = ServerAddressRegistry.ReadGameID(2, StresssTestGameID).ToString(); // UpdateTestUserStateUI(); }
public MainWindow() { InitializeComponent(); Instance = this; m_Engine = new Engine(); m_Engine.StartEngine(); using (RegistryKey key = Registry.CurrentUser.CreateSubKey(RegistryKeyName)) { } string IniFilePath = string.Format("{0}/default.ini", System.IO.Directory.GetCurrentDirectory()); if (!ServerAddressRegistry.ReadServerAddress(0)) { ServerAddressRegistry.SetDefaultServerAddress(0, IniFilePath); } if (!ServerAddressRegistry.ReadServerAddress(1)) { ServerAddressRegistry.SetDefaultServerAddress(1, IniFilePath); } ServerAddressRegistry.ReadLoginID(); int MaxUserValue = 400; if (ServerAddressRegistry.ReadMaxUser(IniFilePath, ref MaxUserValue)) { StressTestWindowMatchTest.MaxUser = MaxUserValue; } mStressTestWin.InitStressTest(); }
public void InitStressTest() { InputMethod.SetIsInputMethodEnabled(MainWindow.Instance.TenKBMaxUserNumber, false); InputMethod.SetIsInputMethodEnabled(MainWindow.Instance.TenKBInGroupUserCount, false); int DataTestSize = 1024; mTestSendData = new byte[DataTestSize]; for (int iData = 0; iData < DataTestSize; iData++) { mTestSendData[iData] = (byte)iData; } var StresssTestGameID = "MyTownHero"; MainWindow.InitGameIDComboBox(MainWindow.Instance.stress_comboBoxGameID_10KB, StresssTestGameID); MainWindow.Instance.stress_comboBoxGameID_10KB.SelectedItem = ServerAddressRegistry.ReadGameID(0, StresssTestGameID).ToString(); MainWindow.Instance.buttonSendData_Manaul.IsEnabled = false; MainWindow.Instance.buttonSendData_Manaul.Visibility = Visibility.Hidden; UpdateTestUserStateUI(); }
//-- 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(); }
void UpdateServerAddressUI() { MainWindow.InitIPAdressComboBox(MainWindow.Instance.stress_comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(0)); ServerAddressRegistry.SaveServerAddressToRegistry(); }
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(); }
// 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(); }
private void btnTestMatching_Click(object sender, RoutedEventArgs e) { ServerAddressRegistry.SaveValue(SAVE_MATCHGRUCOUNT_KEY_ID, MatchInGroupUserCount.Text); ServerAddressRegistry.SaveValue(SAVE_MATCHMAXUSERCOUNT_ID, MatchKBMaxUserNumber.Text); mStressTestWin.StartMatchingTest(false, 1); }
private void btnLoginTen10KB_Click(object sender, RoutedEventArgs e) { ServerAddressRegistry.SaveValue(SAVE_TENKBGRUCOUNT_KEY_ID, TenKBInGroupUserCount.Text); ServerAddressRegistry.SaveValue(SAVE_TENKBMAXUSERCOUNT_KEY_ID, TenKBMaxUserNumber.Text); mStressTestWin.StartDataTest(false, 1); }
// 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(); }
// 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(); }