public static async Task <IServiceProvider> LoadMatcherDataAsync(this IServiceProvider serviceProvider) { var sectorStorage = serviceProvider.GetRequiredService <NamedSectorStorage>(); var systemStorage = serviceProvider.GetRequiredService <NamedSystemStorage>(); NamedSystemFinder.SetSystems(await systemStorage.GetAllSystems()); NamedSectorFinder.SetSectors(await sectorStorage.GetAllSectors()); return(serviceProvider); }
public static IServiceProvider LoadMatcherData(this IServiceProvider serviceProvider) { var sectorStorage = serviceProvider.GetRequiredService <NamedSectorStorage>(); var systemStorage = serviceProvider.GetRequiredService <NamedSystemStorage>(); // Not made async, as it'll be called in Startup.Configure, which is a sync method. NamedSystemFinder.SetSystems(systemStorage.GetAllSystems().GetAwaiter().GetResult()); NamedSectorFinder.SetSectors(sectorStorage.GetAllSectors().GetAwaiter().GetResult()); return(serviceProvider); }
private void AddTestData() { NamedSystemFinder.SetSystems(new List <string> { "sol", "colonia", "shinrarta dezhra", "achenar", "quince", }); NamedSectorFinder.SetSectors(new List <string> { "coalsack dark", "north america", "madeup", }); }
private static async Task CheckAndSave(CsvSystem system) { if (system.EDSystemAddress != null && !CatalogFinder.IsCatalogSystem(system.Name) && !ProcGenFinder.IsProcGen(system.Name)) { var possiblySector = NamedSectorFinder.ExtractSectorName(system.Name); if (possiblySector == null) { await AddNamedSystems(new SystemMatch(system.Name, system.EDSystemAddress ?? 0)); } else { await AddNamedSector(possiblySector); } } }
public IActionResult Get(string name) { if (ProcGenFinder.IsProcGen(name)) { return(Ok(new ClassifyOutput("ProcGen"))); } if (CatalogFinder.IsCatalogSystem(name)) { return(Ok(new ClassifyOutput("Catalog"))); } if (NamedSectorFinder.ExtractSectorName(name) != null) { return(Ok(new ClassifyOutput("ProcGenNamedSector"))); } if (NamedSystemFinder.IsNamedSystem(name)) { return(Ok(new ClassifyOutput("Named"))); } return(Ok(new ClassifyOutput("Unknown"))); }