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);
        }
Beispiel #3
0
        private void AddTestData()
        {
            NamedSystemFinder.SetSystems(new List <string>
            {
                "sol", "colonia", "shinrarta dezhra", "achenar", "quince",
            });

            NamedSectorFinder.SetSectors(new List <string>
            {
                "coalsack dark", "north america", "madeup",
            });
        }
Beispiel #4
0
 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")));
 }
Beispiel #5
0
 public List <string> FindNamedSystemCandidates(string text)
 {
     return(NamedSystemFinder.FindCandidates(text));
 }