コード例 #1
0
        public ISystem FindSystem(string name, EDSM.GalacticMapping glist = null) // in system or name
        {
            ISystem ds1 = SystemCache.FindSystem(name);                           // now go thru the cache..

            if (ds1 == null)
            {
                HistoryEntry vs = FindByName(name);

                if (vs != null)
                {
                    ds1 = vs.System;
                }
                else if (glist != null)
                {
                    EDSM.GalacticMapObject gmo = glist.Find(name, true, true);

                    if (gmo != null && gmo.points.Count > 0)
                    {
                        ds1 = SystemClassDB.GetSystem(gmo.galMapSearch);

                        if (ds1 != null)
                        {
                            return(new EDSM.GalacticMapSystem(ds1, gmo));
                        }
                        else
                        {
                            return(new EDSM.GalacticMapSystem(gmo));
                        }
                    }
                }
            }

            return(ds1);
        }
コード例 #2
0
        // Checks Cache, Database, History, Galactic map if required, and EDSM directly if required

        public ISystem FindSystem(string name, EDSM.GalacticMapping glist, bool checkedsm) // in system or name
        {
            ISystem ds1 = SystemCache.FindSystem(name, checkedsm);                         // go thru the cache and edsm if required

            if (ds1 == null)
            {
                HistoryEntry vs = FindByName(name);         // else try and find in our list

                if (vs != null)
                {
                    ds1 = vs.System;
                }
                else if (glist != null)                     // if we have a galmap
                {
                    EDSM.GalacticMapObject gmo = glist.Find(name, true);

                    if (gmo != null && gmo.points.Count > 0)                // valid item, and has position
                    {
                        ds1 = SystemCache.FindSystem(gmo.galMapSearch);     // only thru the db/cache, as we checked above for edsm direct, may be null

                        return(gmo.GetSystem(ds1));                         // and return a ISystem.  If ds1=null, we use the points pos, if ds1 is found, we use the cache position
                    }
                }
            }

            return(ds1);
        }