コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #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",
            });
        }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
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")));
 }