Esempio n. 1
0
        public void Process()
        {
            GameSummaryCollection summary = null;

            try
            {
                summary = this.Gsc.GetSummaryCollection(this.Date);
            }
            catch (Exception e)
            {
            }

            if (summary?.GameSummaries == null || summary.GameSummaries.Length == 0)
            {
                Logger.Log("Skipping " + this.Date);
                return;
            }

            var tempList = new List <HighlightSearchResult>();

            foreach (var gameSummary in summary.GameSummaries)
            {
                var gdc = new GameDetailCreator(gameSummary.GameDataDirectory);
                HighlightsCollection highlights = null;

                try
                {
                    highlights = gdc.GetHighlights();
                }
                catch (Exception e)
                {
                }

                if (highlights?.Highlights == null || highlights.Highlights.Length == 0)
                {
                    continue;
                }

                foreach (var highlight in highlights.Highlights)
                {
                    highlight.url = highlight.url != null && highlight.url.Length > 0
                                                ? highlight.url.Where(a => a.Contains(".mp4")).ToArray()
                                                : new string[0];

                    if (highlight.url.Length == 0)
                    {
                        continue;
                    }

                    var newLocalHighlight = new HighlightSearchResult
                    {
                        GameId     = gameSummary.GamePk,
                        Highlight  = highlight,
                        Thumbnails = HighlightThumbnails.Make(highlight)
                    };

                    highlight.thumbnails = new string[0];

                    tempList.Add(newLocalHighlight);
                }
            }

            this.TempList = tempList;

            if (this.TempList.Any())
            {
                this.JsonSaveAll();
            }
        }