1234567891011121314151617181920212223 |
- using IP2Region;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.DependencyInjection.Extensions;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using TEAMModelOS.SDK.DI;
- namespace TEAMModelOS.SDK
- {
- public static class IP2RegionExtensions
- {
- public static IServiceCollection AddIP2Region(this IServiceCollection services, string configPath)
- {
- if (services == null) throw new ArgumentNullException(nameof(services));
- if (configPath == null) throw new ArgumentNullException(nameof(configPath));
- services.TryAddSingleton(new IP2RegionFileSearcher($"{configPath}/ip2region.db"));
- return services;
- }
- }
- }
|