Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filteredMatches"></param>
        /// <returns></returns>
        public List <MatchMetricGroup> AnalyzeMatches(FilteredMatches filteredMatches)
        {
            var broadcastDirectory = filteredMatches.GetDirectoryPath();

            List <Task <(string, string, string, string, string, string)> > tasks = new List <Task <(string, string, string, string, string, string)> >();

            foreach (var filteredMatch in filteredMatches.Matches)
            {
                var matchPath = broadcastDirectory + filteredMatch.GetFileName();
                tasks.Add(new Task <(string, string, string, string, string, string)>(() => RunAnalysisOnMatch(matchPath, filteredMatch)));
            }

            foreach (var task in tasks)
            {
                task.Start();
            }

            Task.WaitAll(tasks.ToArray());

            int counter = 0;
            List <MatchMetricGroup> matchMetrics = new List <MatchMetricGroup>();

            foreach (var filteredMatch in filteredMatches.Matches)
            {
                var taskOutcome = tasks[counter].Result;
                var result      = ParseMatch(taskOutcome.Item1, taskOutcome.Item2, taskOutcome.Item3,
                                             taskOutcome.Item4, taskOutcome.Item5, taskOutcome.Item6, filteredMatch);
                matchMetrics.Add(result);
                counter++;
            }

            return(matchMetrics);
        }
Beispiel #2
0
        public MatchMetricGroup AnalyzeMatch(Match match, FilteredMatches matches)
        {
            var broadcastDirectory = matches.GetDirectoryPath();
            var matchPath          = broadcastDirectory + match.GetFileName();
            var outcome            = RunAnalysisOnMatch(matchPath, match);

            return(ParseMatch(outcome.Item1, outcome.Item2, outcome.Item3, outcome.Item4, outcome.Item5, outcome.Item6, match));
        }
Beispiel #3
0
 /// <summary>
 /// Adds filteredMatch to the filteredMatch list and creates a JSON copy for offline use.
 /// </summary>
 /// <param name="filteredMatch"></param>
 public static void AddFilteredMatch(FilteredMatches filteredMatch)
 {
     // Ensure no duplicate objects exist.
     if (!FilteredMatches.Contains(filteredMatch))
     {
         FilteredMatches.Add(filteredMatch);
         File.WriteAllText(BroadcastPath + FilteredMatchesJson, JsonConvert.SerializeObject(FilteredMatches));
     }
     else
     {
         throw new Exception($"filteredMatch was added where a duplicate already exists. duplicate ID: {filteredMatch.Broadcast.Id}");
     }
 }