public override void BuildMatch() { IList <ITeam> list1 = new List <ITeam>(TeamList); IList <ITeam> list2 = new List <ITeam>(TeamList); MatchList.Clear(); foreach (var team1 in list1) { foreach (var team2 in list2) { if (team1 == team2 || MatchList.Count(item => item.Team1 == team1 && item.Team2 == team2 || item.Team1 == team2 && item.Team2 == team1) != 0) { continue; } CreateMatch(team1, team2); if (!MatchWithRevenge) { continue; } CreateMatch(team2, team1); } } }
public void MatchSearch(object obj = null) => Task.Factory.StartNew(() => { MatchResetInput(); if (!String.IsNullOrEmpty(MatchSearchText)) { var searchList = MatchSearchText.Split(' '); if (searchList.Count() > 0) { foreach (var item in searchList) { if (!String.IsNullOrEmpty(item)) { var text = item?.ToUpper()?.Trim(' ') ?? ""; MatchList = MatchList.Where( x => (x.CustomerGln?.ToUpper()?.Contains(text) ?? false) || (x.IdPriceType?.ToUpper()?.Contains(text) ?? false) || (x.InsertDatetime?.ToUpper()?.Contains(text) ?? false) || (x.PriceTypeName?.ToUpper()?.Contains(text) ?? false) ).ToList(); } } } } });
public void Remove_Team_Test() { // arrange string name = "TestName"; int scoreA = 6; int scoreB = 9; int id = 98; //act Match testMatch = new Match() { Name = name, ID = id, TeamAScore = scoreA, TeamBScore = scoreB }; MatchList testmatchList = new MatchList(); testmatchList.Add(testMatch); //testmatchList.Remove(30); //assert Match lookingMatch = testmatchList.FindByID(id); Assert.AreEqual(null, lookingMatch, "Incompatibility in Remove Match from list"); }
public string LastRank(string accountId, string server) { MatchList matchList = _client.GetMatchListByAccountIdAsync(accountId, null, null, null, null, null, null, null, server).Result; if (matchList == null) { return(null); } Match match = _client.GetMatchAsync(matchList.Matches[0].GameId, server).Result; if (match == null) { return(null); } int partId = -1; foreach (MatchParticipantIdentity identity in match.ParticipantIdentities) { if (identity.Player.AccountId == accountId) { partId = identity.ParticipantId; } } foreach (MatchParticipant participant in match.Participants) { if (participant.ParticipantId == partId) { return(participant.HighestAchievedSeasonTier); } } return(null); }
public void FirstTimeAStringArrives(Actor sender, ActorMatch address, object message) { // 4. reconfigure this actor to have the SecondTimeAStringArrives function to respond when strings are sent. MessageBox.Show((string)message, @"First time"); MatchList.Clear(); MatchList.Add(new ActorMatch(typeof(string), SecondTimeAStringArrives)); }
public async Task GetMatchListByAccountIdAsyncTest_WithFilters() { IRiotClient client = new RiotClient(); IEnumerable <long> championIds = new[] { 19L, 107L }; // Warwick, Rengar IEnumerable <QueueType> rankedQueues = new[] { QueueType.TEAM_BUILDER_DRAFT_UNRANKED_5x5, QueueType.TEAM_BUILDER_RANKED_SOLO }; IEnumerable <Season> seasons = new[] { Season.PRESEASON2018, Season.SEASON2018 }; MatchList matchList = await client.GetMatchListByAccountIdAsync(encryptedAccountId, championIds, rankedQueues, seasons); Assert.That(matchList, Is.Not.Null); Assert.That(matchList.Matches, Is.Not.Null.And.Not.Empty); Assert.That(matchList.Matches.All(m => championIds.Contains(m.Champion)), "Unexpected Champion ID: " + matchList.Matches.FirstOrDefault(m => !championIds.Contains(m.Champion))?.Champion); Assert.That(matchList.Matches.All(m => rankedQueues.Contains(m.Queue)), "Unexpected Queue ID: " + matchList.Matches.FirstOrDefault(m => !rankedQueues.Contains(m.Queue))?.Queue); Assert.That(matchList.Matches.All(m => seasons.Contains(m.Season)), "Unexpected Season ID: " + matchList.Matches.FirstOrDefault(m => !seasons.Contains(m.Season))?.Season); foreach (var id in championIds) { Assert.That(matchList.Matches.Any(m => m.Champion == id), "Champion ID not found: " + id); } foreach (var id in rankedQueues) { Assert.That(matchList.Matches.Any(m => m.Queue == id), "Queue ID not found: " + id); } foreach (var id in seasons.Except(new[] { Season.PRESEASON2018 })) { Assert.That(matchList.Matches.Any(m => m.Season == id), "Season ID not found: " + id); } }
public void ProcessMatchTiles() { var output = new StringBuilder(); _nSendDeleteSignal = 0; // 생성과 제거가 공동으로 처리될 예정 var matches = _matchingChecker.GetMatchInfo(); for (int i = 0; i < matches.Count; i++) { output.AppendFormat($"{i}:"); MatchList list = matches[i].matchlist; // 특수 타일 생성 if (matches[i].isCreationTile) { CreateSpecialTile(output, matches[i]); } else { DeleteMatch3Tiles(output, list); } } if (matches.Count > 0) { Debug.LogFormat(output.ToString()); CalculateScore(matches); } }
protected override void OnInitialized() { base.OnInitialized(); ImportService.MatchUpdated = match => { var existing = MatchList.FirstOrDefault(m => m.Id == match.Id); if (existing == null) { MatchList.Add(match); } else { existing.Group = match.Group; existing.LocalizedNames = match.LocalizedNames; existing.MatchTeams = match.MatchTeams; existing.Number = match.Number; existing.PlaceHolderAway = match.PlaceHolderAway; existing.PlaceHolderHome = match.PlaceHolderHome; } StateHasChanged(); }; Resources.CultureChanged += (e, a) => { StateHasChanged(); }; }
public async Task GetMatchListByAccountIdAsyncTest_WithFilters() { IRiotClient client = new RiotClient(); IEnumerable <long> championIds = new[] { 143L, 412L }; // Zyra, Thresh IEnumerable <QueueType> rankedQueues = new[] { QueueType.RANKED_FLEX_SR, QueueType.TEAM_BUILDER_RANKED_SOLO }; IEnumerable <Season> seasons = new[] { Season.PRESEASON2017, Season.SEASON2017 }; MatchList matchList = await client.GetMatchListByAccountIdAsync(48555045L, championIds, rankedQueues, seasons); Assert.That(matchList, Is.Not.Null); Assert.That(matchList.Matches, Is.Not.Null.And.Not.Empty); Assert.That(matchList.Matches.All(m => championIds.Contains(m.Champion)), "Unexpected Champion ID: " + matchList.Matches.FirstOrDefault(m => !championIds.Contains(m.Champion))?.Champion); Assert.That(matchList.Matches.All(m => rankedQueues.Contains(m.Queue)), "Unexpected Queue ID: " + matchList.Matches.FirstOrDefault(m => !rankedQueues.Contains(m.Queue))?.Queue); Assert.That(matchList.Matches.All(m => seasons.Contains(m.Season)), "Unexpected Season ID: " + matchList.Matches.FirstOrDefault(m => !seasons.Contains(m.Season))?.Season); foreach (var id in championIds) { Assert.That(matchList.Matches.Any(m => m.Champion == id), "Champion ID not found: " + id); } foreach (var id in rankedQueues) { Assert.That(matchList.Matches.Any(m => m.Queue == id), "Queue ID not found: " + id); } foreach (var id in seasons.Except(new[] { Season.SEASON2016 })) { Assert.That(matchList.Matches.Any(m => m.Season == id), "Season ID not found: " + id); } }
public void Add_Match_Test() { //arrange string name = "TestName"; int scoreA = 6; int scoreB = 9; int id = 98; //act Match testMatch = new Match() { Name = name, ID = id, TeamAScore = scoreA, TeamBScore = scoreB }; MatchList testmatchList = new MatchList(); testmatchList.Add(testMatch); //assert Match lookingMatch = testmatchList.FindByID(id); Assert.AreEqual(name, lookingMatch.Name, "Incompatibility in Add Match to List"); Assert.AreEqual(id, lookingMatch.ID, "Incompatibility in Add Match to List"); Assert.AreEqual(scoreA, lookingMatch.TeamAScore, "Incompatibility in Add Match to List"); Assert.AreEqual(scoreB, lookingMatch.TeamBScore, "Incompatibility in Add Match to List"); }
private MatchList GetMatchListOfSummoner(string accountId, string region, int?startIndex = null, int?endIndex = null) { var pathBuilder = new UrlPathBuilder(); var matchList = new MatchList(); using (var client = new HttpClient()) { try { client.DefaultRequestHeaders.Add("X-Riot-Token", ConfigWrapper.ApiKey); Task <HttpResponseMessage> response; if (startIndex.HasValue && endIndex.HasValue) { response = client.GetAsync(new Uri(pathBuilder.GetMatchListOfSummonerByAccountIdUrl(accountId, startIndex.Value, endIndex.Value, region))); } else { response = client.GetAsync(new Uri(pathBuilder.GetMatchListOfSummonerByAccountIdUrl(accountId, region))); } response.Wait(); var result = response.Result; if (result.IsSuccessStatusCode) { var readData = result.Content.ReadAsStringAsync(); readData.Wait(); matchList = JsonConvert.DeserializeObject <MatchList>(readData.Result); } } catch (Exception) {} } return(matchList); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { XmlDocument doc = new XmlDocument(); if (File.Exists(Application.StartupPath + "\\scholarbowl.dat")) { File.Move(Application.StartupPath + "\\scholarbowl.dat", Application.StartupPath + "\\Statistics.xml"); } if (File.Exists(Application.StartupPath + "\\Statistics.xml")) { doc.Load(Application.StartupPath + "\\Statistics.xml"); } else { doc.LoadXml("<scholarbowl><schools></schools><scholars></scholars><matches></matches></scholarbowl>"); } Schools = School.FromXmlNode(doc); Players = Player.FromXmlNode(doc, Schools); AllMatches = MatchList.FromXml(doc, Schools, Players); PlayerControlList listView1 = new PlayerControlList(groupBox1); PlayerControlList listView2 = new PlayerControlList(groupBox2); BeginInvoke(new MethodInvoker(delegate { playerList1 = listView1; playerList2 = listView2; reload(); })); }
public override List <Team> Play() { List <Team> roundResult = new List <Team>(); DividedIntoGroup(); List <Match> matchesInGroup = new List <Match>(); foreach (string groupID in groups) { matchesInGroup = MatchList.Where(match => match.Tag == groupID).ToList(); foreach (Match match in matchesInGroup) { match.RandomPlay(rand); } // Create 3rd match Match final = new Match() { TeamA = matchesInGroup[0].Winner, TeamB = matchesInGroup[1].Winner, Date = DateTime.Now, Tag = groupID }; final.RandomPlay(rand); roundResult.Add(final.Winner); } return(roundResult); }
void dataDownloader() { var api = RiotSharp.RiotApi.GetInstance("82d252ad-f7a4-4a28-8c3a-0f679dcf2ea5"); if (matchIDsDownloading.Count > 0) { MatchDetail Y = null; try { Y = api.GetMatch(RiotSharp.Region.kr, matchIDsDownloading[0], includeTimeline: true); } catch (RiotSharp.RiotSharpException e) { } //TODO:save match detail as json //TODO:transport match detail to SQL Console.WriteLine("Excellent! New match: " + Y.MatchId); for (int i = 0; i < 10; i++) { long tempID = Y.ParticipantIdentities[i].Player.SummonerId; if (!summonerIDsDownloading.Contains(tempID)) { summonerIDsDownloading.Add(tempID); } } matchIDsDownloaded.Add(matchIDsDownloading[0]); matchIDsDownloading.RemoveAt(0); } else if (summonerIDsDownloading.Count > 0) { DateTime startTime = DateTime.Today.AddDays(-60); MatchList Z = api.GetMatchList(RiotSharp.Region.kr, summonerId: summonerIDsDownloading[0], rankedQueues: a, beginTime: startTime); Console.WriteLine("Excellent! New summoner: " + summonerIDsDownloading[0]); if (Z != null && Z.Matches != null && Z.Matches.Count > 0) { for (int i = 0; i < Z.Matches.Count; i++) { long tempMatchID = Z.Matches[i].MatchID; if (!matchIDsDownloading.Contains(tempMatchID) && !matchIDsDownloaded.Contains(tempMatchID)) { matchIDsDownloading.Add(tempMatchID); } } } summonerIDsDownloaded.Add(summonerIDsDownloading[0]); summonerIDsDownloading.RemoveAt(0); } else { Console.WriteLine("Panic!No match or summoner!"); return; } }
/// <summary> /// Initializes a new instance of the <see cref="RiotClient"/> class. /// </summary> /// <param name="apiKey">The API key.</param> public RiotClient(string apiKey) { IChampion champion = new Champion(apiKey); ICurrentGame currentGame = new CurrentGame(apiKey); IFeaturedGames featuredGames = new FeaturedGames(apiKey); IGame game = new Game(apiKey); ILeague league = new League(apiKey); ILolStaticData lolStaticData = new LolStaticData(apiKey); ILolStatus lolStatus = new LolStatus(); IMatch match = new Match(apiKey); IMatchList matchList = new MatchList(apiKey); IStats stats = new Stats(apiKey); ISummoner summoner = new Summoner(apiKey); ITeam team = new Team(apiKey); IChampionMastery championMastery = new ChampionMastery(apiKey); this.Champion = champion; this.CurrentGame = currentGame; this.FeaturedGames = featuredGames; this.Game = game; this.League = league; this.LolStaticData = lolStaticData; this.LolStatus = lolStatus; this.Match = match; this.MatchList = matchList; this.Stats = stats; this.Summoner = summoner; this.Team = team; this.ChampionMastery = championMastery; }
public void GetMatchList() { ApiService.ApiKey = APIKEY;//you must add your project, if you dont use ninject NonStaticApi api = new NonStaticApi(new Api.Cache.ApiCache()); MatchList data = api.GetMatchList(summonerId1, region.tr, null, null, null, null, null, null, null, true); Assert.IsNotNull(data); }
public MatchInfo(MatchInfo info) { matchlist = new MatchList(info.matchlist); isMatch = info.isMatch; direction = info.direction; matchType = info.matchType; creationPos = info.creationPos; }
public Matches(MatchList planned, MatchList history) { Planned = planned; History = history; InitializeComponent(); PlannedMatches.ItemsSource = Planned.List; MatchHistory.ItemsSource = History.List; }
public override void BuildMatch() { MatchList.Clear(); for (var i = 0; i < TeamList.Count; i += 2) { CreateMatch(TeamList[i], TeamList[i + 1]); } }
public static void LoadMatches(ref MatchList currentMatchList, string playerName, long summonerID) { var matchList = new List <Match>(); int partID = 0; string localFileName = $"{mainDirectoryName}\\{region}\\{playerName}\\matchDB.txt"; LoL_DB.Clear(); LoL_DB.ReadXml(localFileName); foreach (var match in LoL_DB.Match) { Match baseMatch = new Match(); ParticipantIdent participantIdentity = new ParticipantIdent(); PlayerAsParticipant player = new PlayerAsParticipant(); Participant participant = new Participant(); ParticipantStats stats = new ParticipantStats(); baseMatch.GameID = match.GameID; baseMatch.QueueID = match.QueueID; baseMatch.GameCreation = match.GameCreation; baseMatch.GameDuration = match.GameDuration; for (int i = 0; i < match.SummonerID.Length; i++) { if (match.SummonerID[i] == summonerID) { participantIdentity.ParticipantID = match.ParticipantID[i]; player.SummonerId = summonerID; participantIdentity.Player = player; partID = i; } } List <ParticipantIdent> identificatioList = new List <ParticipantIdent>(); identificatioList.Add(participantIdentity); baseMatch.ParticipantIdentities = identificatioList; participant.ChampionID = match.ChampionID[partID]; stats.Win = match.Win[partID]; stats.ParticipantID = match.ParticipantID[partID]; stats.Kills = match.Kills[partID]; stats.Deaths = match.Deaths[partID]; stats.Assists = match.Assists[partID]; stats.GoldEarned = match.GoldEarned[partID]; stats.TotalMinionsKilled = match.TotalMinionsKilled[partID]; participant.Stats = stats; List <Participant> participantList = new List <Participant>(); participantList.Add(participant); baseMatch.Participants = participantList; matchList.Add(baseMatch); } matchList.Reverse(); currentMatchList.Matches = matchList; LoadDetailedMatches(playerName); }
public static void ShowLeaderboard(MatchList mm) { mm.SortByPoints(); for (int i = 0; i < mm.teams.Count; i++) { Console.Write(mm.teams[i].Name + " " + mm.teams[i].ChampionshipPoints); Console.WriteLine(" " + mm.teams[i].GoalsScored); } }
public async Task <MatchListDto> GetRecentMatchListAsync(RegionDto regionDto, string summonerName) { Region region = Mapper.Map <Region>(regionDto); Summoner summoner = await _riotApi.Summoner.GetSummonerByNameAsync(region, summonerName); MatchList matchList = await _riotApi.Match.GetMatchListAsync(region, summoner.AccountId); return(Mapper.Map <MatchListDto>(matchList)); }
public void TestFindPreventDeleteRelationships() { //List<List<string>> listOfPaths; MatchList listOfPaths = DeleteHelper.FindPreventDeleteRelationships(_baseClassDef.RelationshipDefCol); //Assert.AreEqual(3, listOfPaths.Count, "There should be 3 prevent delete relationships found"); string relationshipPath = listOfPaths.ToString("."); Assert.AreEqual("MyBO2.{MyBO3.MyBO4.{MyBO5.MyBO6.MyPreventBO7,MyPreventBO5},MyPreventBO3}", relationshipPath); }
public static void Edit(MatchList matches, bool readOnly) { fGroupEditor form = new fGroupEditor(); form.SetMatches(matches); form.ReadOnly = readOnly; form.Height = Math.Min(form.pictMain.Picture.Height + 100, Screen.PrimaryScreen.WorkingArea.Height - 100); form.ShowDialog(); }
public Counter(string keyWord, string userSentence) { string lowerCaseKeyWord = keyWord.ToLower(); KeyWord = lowerCaseKeyWord; UserSentence = userSentence; Matches = this.RepeatCounter(); MatchList.Add(this); Id = MatchList.Count; }
public static void ShowMatchList(MatchList mm) { for (int i = 0; i < mm.Count; i++) { Console.Write(mm[i].ID + " " + mm[i].Date + " " + mm[i].HomeTeam.Name + " "); Console.Write(mm[i].AwayTeam.Name + " " + mm[i].Result.HomeScore + " "); Console.Write(mm[i].Result.AwayScore); Console.WriteLine(); } }
public void ExtensionGetMatchList() { ApiService.ApiKey = APIKEY;//you must add your project, if you dont use ninject Summoner data = new Summoner() { Id = summonerId1, Region = Region }; MatchList data1 = data.GetMatchList();//extension Assert.IsNotNull(data1); }
public MatchProgression(Match match, MatchList planned, MatchList history) { InitializeComponent(); Match = match; Planned = planned; History = history; MatchRank.Text = Match.MatchRanks.ToString(); TeamA.Text = Match.TeamA.Name.ToString(); TeamB.Text = Match.TeamB.Name.ToString(); TeamAPlayers.ItemsSource = match.TeamA.PlayersList.List; TeamBPlayers.ItemsSource = match.TeamB.PlayersList.List; }
/// <summary> /// Sets the false discovery rate by creating a histogram of the mass errors and comparing the proportion above a threshhold to the area below. /// </summary> private void SetMassErrorHistogramFdr() { // Populate the mass error list and create the histogram. var massErrorList = MatchList.Select(match => match.DifferenceVector[1, 1]).ToList(); var histogramList = MathUtilities.GetHistogramValues(massErrorList, m_matchParameters.HistogramBinWidth); var peakIndex = 0; var peakValue = 0.0; var upperBound = 0.0; var lowerBound = 0.0; var meanValue = 0.0; // Find the maximum and average values. for (var i = 0; i < histogramList.Count; i++) { var bin = histogramList[i]; if (bin.Y > peakValue) { peakValue = bin.Y; peakIndex = i; } meanValue += bin.Y; } meanValue /= histogramList.Count; // Set the threshold to a value between the peak and the average value. var threshold = meanValue + m_matchParameters.HistogramMultiplier * (peakValue - meanValue); // Find the upper bound. for (var i = peakIndex; i < histogramList.Count; i++) { var bin = histogramList[i]; var lowerBin = histogramList[i - 1]; if (bin.Y < threshold && lowerBin.Y >= threshold) { upperBound = lowerBin.X + (lowerBin.Y - threshold) / (lowerBin.Y - bin.Y) * (bin.X - lowerBin.X); } } // Find the lower bound. for (var i = peakIndex; i >= 0; i--) { var bin = histogramList[i]; var upperBin = histogramList[i + 1]; if (bin.Y < threshold && upperBin.Y >= threshold) { lowerBound = bin.X + (threshold - bin.Y) / (upperBin.Y - bin.Y) * (upperBin.X - bin.X); } } // Count the number of matches within the bounds and calculate the FDR. var countInBounds = massErrorList.Count(massDifference => massDifference >= lowerBound && massDifference <= upperBound); ErrorHistogramFdr = countInBounds / ((upperBound - lowerBound) * threshold); }
private void AddBet() { string bet = dbOperations.CreateBet(SelectedMatch.ID, Bet); if (bet == "") { MatchList.Remove(SelectedMatch); } else { MessageBox.Show("your bet " + bet); } }
private void GetMatches() { foreach (var url in UserGameProfile.MatchUrls) { DispatcherHelper.CheckBeginInvokeOnUI(async() => MatchList.Add(await _scrapper.GetPersonalGameDetails(UserGameProfile.Nickname, url))); if (MatchListHome.Count < 5 && MatchList.Any()) { DispatcherHelper.CheckBeginInvokeOnUI(() => MatchListHome.Add(MatchList.Last())); } Thread.Sleep(TimeSpan.FromSeconds(1)); } }