コード例 #1
0
        new public static CommodityDefinition FromName(string name)
        {
            if (name == null)
            {
                return(null);
            }

            string normalizedName = NormalizedName(name);

            if (ignoredCommodity(normalizedName))
            {
                return(null);
            }

            // Now try to fetch the commodity by either ED or real name
            CommodityDefinition result = null;

            if (normalizedName != null)
            {
                result = ResourceBasedLocalizedEDName <CommodityDefinition> .FromName(normalizedName);
            }
            if (result == null)
            {
                result = ResourceBasedLocalizedEDName <CommodityDefinition> .FromEDName(normalizedName);
            }
            return(result);
        }
コード例 #2
0
        public new static PlanetClass FromName(string name)
        {
            if (name == null)
            {
                return(null);
            }

            var normalizedName = name
                                 .Replace("ammonia-based", "ammonia based")
                                 .Replace("water-based", "water based");

            return(ResourceBasedLocalizedEDName <PlanetClass> .FromName(normalizedName));
        }
コード例 #3
0
ファイル: AtmosphereClass.cs プロジェクト: Deekfoz/EDDI
        new public static AtmosphereClass FromName(string name)
        {
            if (name == null)
            {
                return(FromName("None"));
            }

            // Temperature and pressure are defined separately so we remove them from this string (if descriptors are present)
            string normalizedName = name
                                    .ToLowerInvariant()
                                    .Replace("thick ", "")
                                    .Replace("thin ", "")
                                    .Replace("hot ", "");

            return(ResourceBasedLocalizedEDName <AtmosphereClass> .FromName(normalizedName));
        }
コード例 #4
0
        new public static StationModel FromName(string from)
        {
            if (from == null)
            {
                return(null);
            }

            // Translate from EDSM / EDDB station model names if these are present
            Dictionary <string, string> modelTranslations = new Dictionary <string, string>()
            {
                { "Coriolis Starport", "Coriolis" },
                // Ocellus starports are described by the journal as either "Bernal" or "Ocellus"
                { "Bernal Starport", "Bernal" },
                { "Ocellus Starport", "Ocellus" },
                { "Orbis Starport", "Orbis" },
                // The journal doesn't provide details on the type of outpost (military, civilian, scientific, etc.)
                // Types are likely derived from the station primary economy, but mixing these into the model name does not add value.
                { "Outpost", "Outpost" },
                { "Civilian Outpost", "Outpost" },
                { "Commercial Outpost", "Outpost" },
                { "Industrial Outpost", "Outpost" },
                { "Military Outpost", "Outpost" },
                { "Mining Outpost", "Outpost" },
                { "Scientific Outpost", "Outpost" },
                { "Unknown Outpost", "Outpost" },
                // Planetary ports are assigned by EDSM via marketID, from a list given to EDSM by FDev long ago.
                // The journal doesn't distinguish between planetary ports and outposts.
                { "Planetary Outpost", "SurfaceStation" },
                { "Planetary Port", "SurfaceStation" },
                // Planetary settlements are not dockable and require manual edits on ROSS to add to EDDB
                { "Planetary Settlement", "SurfaceStation" },
                { "Planetary Engineer Base", "SurfaceStation" },
                { "Unknown Planetary", "SurfaceStation" },
                { "Asteroid base", "AsteroidBase" },
                { "Mega ship", "Megaship" },
            };

            foreach (KeyValuePair <string, string> model in modelTranslations)
            {
                if (from == model.Key)
                {
                    return(FromEDName(model.Value));
                }
            }

            return(ResourceBasedLocalizedEDName <StationModel> .FromName(from));
        }