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", }); }
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"))); }
public List <string> FindNamedSystemCandidates(string text) { return(NamedSystemFinder.FindCandidates(text)); }