Beispiel #1
0
        public ISystem FindSystem(string name, EDSM.GalacticMapping glist = null)        // in system or name
        {
            ISystem ds1 = SystemClass.GetSystem(name);

            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)
                    {
                        return(new SystemClass(gmo.name, gmo.points[0].X, gmo.points[0].Y, gmo.points[0].Z));        // fudge it into a system
                    }
                }
            }

            return(ds1);
        }
 public GalacticMapSystem(ISystem sys, GalacticMapObject gmo)
 {
     this.allegiance      = sys.allegiance;
     this.CommanderCreate = sys.CommanderCreate;
     this.CommanderUpdate = sys.CommanderUpdate;
     this.cr              = sys.cr;
     this.CreateDate      = sys.CreateDate;
     this.eddb_updated_at = sys.eddb_updated_at;
     this.faction         = sys.faction;
     this.government      = sys.government;
     this.gridid          = sys.gridid;
     this.id_eddb         = sys.id_eddb;
     this.id_edsm         = sys.id_edsm;
     this.name            = sys.name;
     this.needs_permit    = sys.needs_permit;
     this.population      = sys.population;
     this.primary_economy = sys.primary_economy;
     this.randomid        = sys.randomid;
     this.security        = sys.security;
     this.state           = sys.state;
     this.status          = sys.status;
     this.UpdateDate      = sys.UpdateDate;
     this.x            = sys.x;
     this.y            = sys.y;
     this.z            = sys.z;
     this.GalMapObject = gmo;
 }
 public GalacticMapSystem(GalacticMapObject gmo)
 {
     this.name         = gmo.galMapSearch;
     this.x            = gmo.points[0].X;
     this.y            = gmo.points[0].Y;
     this.z            = gmo.points[0].Z;
     this.GalMapObject = gmo;
 }
Beispiel #4
0
        public bool ParseData()
        {
            galacticMapObjects = new List <GalacticMapObject>();

            try
            {
                string json = Tools.TryReadAllTextFromFile(GalacticMappingFile);

                if (json != null)
                {
                    JArray galobjects = (JArray)JArray.Parse(json);
                    foreach (JObject jo in galobjects)
                    {
                        GalacticMapObject galobject = new GalacticMapObject(jo);

                        GalMapType ty = galacticMapTypes.Find(x => x.Typeid.Equals(galobject.type));

                        if (ty == null)
                        {
                            ty = galacticMapTypes[galacticMapTypes.Count - 1];      // last one is default..
                            Console.WriteLine("Unknown Gal Map object " + galobject.type);
                        }

                        galobject.galMapType = ty;
                        galacticMapObjects.Add(galobject);
                    }

                    return(true);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("GalacticMapping.parsedata exception:" + ex.Message);
            }

            return(false);
        }
Beispiel #5
0
        public bool ParseData()
        {
            galacticMapObjects = new List<GalacticMapObject>();

            try
            {
                string json = EDDiscoveryForm.LoadJsonFile(GalacticMappingFile);

                if (json != null)
                {
                    JArray galobjects = (JArray)JArray.Parse(json);
                    foreach (JObject jo in galobjects)
                    {
                        GalacticMapObject galobject = new GalacticMapObject(jo);

                        GalMapType ty = galacticMapTypes.Find(x => x.Typeid.Equals(galobject.type));

                        if (ty == null)
                        {
                            ty = galacticMapTypes[galacticMapTypes.Count - 1];      // last one is default..
                            Console.WriteLine("Unknown Gal Map object " + galobject.type);
                        }

                        galobject.galMapType = ty;
                        galacticMapObjects.Add(galobject);
                    }

                    return true;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("GalacticMapping.parsedata exception:" + ex.Message);
            }

            return false;
        }