/// <summary> /// Request a single user or multipe users on the same platform and region /// </summary> /// <param name="PlayerID1">The first user to request</param> /// <param name="PlayerID2">The second user to request</param> /// <param name="PlayerID3">The thrid user to request</param> /// <param name="PlayerID4">The forth user to request</param> /// <param name="PlayerID5">The fifth user to request</param> /// <param name="PlayerID6">The sixth user to request</param> /// <param name="platformRegionShard">The Platform-Region shard to search in</param> /// <param name="userSearchType">The type of ID to search by</param> /// <returns></returns> public List <APIUser> RequestUser(string PlayerID1, PlatformRegionShard platformRegionShard = PlatformRegionShard.PC_NA, UserSearchType userSearchType = UserSearchType.PUBGName, string PlayerID2 = "", string PlayerID3 = "", string PlayerID4 = "", string PlayerID5 = "", string PlayerID6 = "") { List <string> IDsToSearch = new List <string>() { PlayerID1 }; if (PlayerID2 != "") { IDsToSearch.Add(PlayerID2); } if (PlayerID3 != "") { IDsToSearch.Add(PlayerID3); } if (PlayerID4 != "") { IDsToSearch.Add(PlayerID4); } if (PlayerID5 != "") { IDsToSearch.Add(PlayerID5); } if (PlayerID6 != "") { IDsToSearch.Add(PlayerID6); } APIRequest request = new APIRequest(); return(request.RequestUser(APIKey, GetEnumDescription(platformRegionShard), IDsToSearch, userSearchType)); }
private void Watchdog_Thread(string APIKey, List <string> IDsToWatch, string platformRegionShard, UserSearchType userSearchType = UserSearchType.PUBGName) { APIRequest request = new APIRequest(); //Create a request class we can reuse Random rnd = new Random(); //Createa a raqndom number generater to vary the requests int sleeptime = 0; OnWatchdogThreadStart(); while (true) { OnWatchdogLoopStart(); OnWatchdogRequest(); List <APIUser> firstRequest = request.RequestUser(APIKey, platformRegionShard, IDsToWatch, userSearchType);//Fecth all the users matches sleeptime = rnd.Next(10000, 60000); OnWatchdogSleep(sleeptime); Thread.Sleep(sleeptime); //Wait 10 to 60 seconds OnWatchdogRequest(); List <APIUser> secondRequest = request.RequestUser(APIKey, platformRegionShard, IDsToWatch, userSearchType); //Fetch them all again OnWatchdogCompare(); foreach (APIUser firstuser in firstRequest) //For each APIUser in the first request... { foreach (APIUser seconduser in secondRequest) //...go through all the users in the second request... { if (firstuser.AccountID == seconduser.AccountID) //if the firstuser and seconduser have the same account id, we know theyre the same { if (firstuser.ListOfMatches[0] != seconduser.ListOfMatches[0]) //if the list of matches from the first and second request are different... { OnUserMatchListUpdated(seconduser, seconduser.ListOfMatches[0]); } else { OnUserMatchListNotUpdated(seconduser); } } } } } }