Ejemplo n.º 1
0
        public Task UpdateServerListAsync(IEnumerable <ServerRecord> endpoints)
        {
            if (endpoints == null)
            {
                ASF.ArchiLogger.LogNullError(nameof(endpoints));
                return(Task.CompletedTask);
            }

            HashSet <ServerRecordEndPoint> newServerRecords = endpoints.Select(ep => new ServerRecordEndPoint(ep.GetHost(), (ushort)ep.GetPort(), ep.ProtocolTypes)).ToHashSet();

            if (!ServerRecords.ReplaceIfNeededWith(newServerRecords))
            {
                return(Task.CompletedTask);
            }

            ServerListUpdated?.Invoke(this, EventArgs.Empty);
            return(Task.CompletedTask);
        }