コード例 #1
0
        public ISpiderBuilder AddService(string name, IList <SpiderServiceEntry> serviceEntries)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (serviceEntries == null || !serviceEntries.Any())
            {
                throw new ArgumentNullException(nameof(serviceEntries));
            }
            var service = _spiderOptions.Services.Where(o => o.ServiceName.Equals(name)).FirstOrDefault();

            if (service != null)
            {
                service = new SpiderService(name);
            }

            foreach (var item in serviceEntries)
            {
                service.ServiceEntryies.Add(item);
            }
            _spiderOptions.Services.Add(service);
            return(this);
        }