Exemplo n.º 1
0
            public static EDSMResponse <StarSystem> Convert(this SystemJSON json, int?HTMLStatus, string HTMLStatusMessage)
            {
                var wrapper = new EDSMResponse <StarSystem> {
                    HTMLStatus         = HTMLStatus ?? -1,
                    HTMLStatusResponse = HTMLStatusMessage
                };

                if (json == null)
                {
                    wrapper.Message       = "Empty response. This probably means that EDSM could not find said System.";
                    wrapper.MessageNumber = 1;
                    return(wrapper);
                }

                var returnObj = new StarSystem {
                    Id         = (uint?)json.id ?? 0,
                    Name       = json.name,
                    PermitName = json.permitName
                };

                if (json.coords != null)
                {
                    returnObj.Coordinate = new Orcabot.Types.Coordinate {
                        X = json.coords.x,
                        Y = json.coords.y,
                        Z = json.coords.z
                    };
                }
                if (json.primaryStar != null)
                {
                    returnObj.IsScoopable = json.primaryStar.isScoopable;
                }
                if (json.information != null)
                {
                    var info = json.information;
                    returnObj.ControllingFactionName  = info.faction;
                    returnObj.ControllingFactionState = info.factionState;
                    returnObj.Population = (ulong?)info.population ?? 0;
                    returnObj.Security   = GetSecurityFromEDSMString(info.security);
                    returnObj.Economy    = GetEconomyFromEDSMString(info.economy);
                }
                wrapper.Data = returnObj;
                return(wrapper);
            }
Exemplo n.º 2
0
 private void Awake()
 {
     _instance = this;
     Load();
 }