Exemple #1
0
        private void UpdateInternal(IModel remote, string org, string comp, Action <string> log, bool getTables)
        {
            var localCards = GetMatchCards(org, comp);
            var cards      = remote.GetMatchCards(org, comp).ToArray();

            if (localCards != null && localCards.Data.Length > cards.Length)
            {
                throw new InvalidDataException("Cards went missing");
            }
            PutMatchCards(org, comp, cards);

            var localEvents = GetEvents(org, comp);
            var events      = remote.GetEvents(org, comp).ToArray();

            if (localEvents != null && localEvents.Data.Length > events.Length)
            {
                throw new InvalidDataException("Events went missing");
            }
            PutEvents(org, comp, events);

            if (getTables)
            {
                LeagueTable lt         = remote.GetTable(org, comp);
                var         localTable = GetTable(org, comp);

                if (lt.Data.Length == 0)
                {
                    throw new InvalidDataException("Empty league table");
                }

                PutTable(org, comp, lt);
            }
        }
Exemple #2
0
        public LeagueTable GetTable()
        {
            if (_table != null)
            {
                return(_table);
            }

            _table             = _org.GetTableInternal(InternalName);
            _table.Competition = this;
            return(_table);
        }
Exemple #3
0
 private void PutTable(string org, string name, LeagueTable table)
 => Write("table", org, name, table);