示例#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);
            }
        }
示例#2
0
        public LeagueTable GetTable()
        {
            if (_table != null)
            {
                return(_table);
            }

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