public static void SendTravelLog(HistoryEntry he) // (verified with EDSM 29/9/2016, seen UTC time being sent, and same UTC time on ESDM). { EDSMClass edsm = new EDSMClass(); if (!edsm.IsApiKeySet) { return; } string errmsg; bool firstdiscover; int edsmid; Task taskEDSM = Task.Factory.StartNew(() => { // LOCAL time, there is a UTC converter inside this call if (edsm.SendTravelLog(he.System.name, he.EventTimeUTC, he.System.HasCoordinate, he.System.x, he.System.y, he.System.z, out errmsg, out firstdiscover, out edsmid)) { if (edsmid != 0 && he.System.id_edsm <= 0) { he.System.id_edsm = edsmid; EDDiscovery.EliteDangerous.JournalEntry.UpdateEDSMIDPosJump(he.Journalid, he.System, false, -1); } if (firstdiscover) { he.SetFirstDiscover(); } he.SetEdsmSync(); } }); }
// (verified with EDSM 29/9/2016, seen UTC time being sent, and same UTC time on ESDM). public static void SendTravelLog(HistoryEntry he) { if (!EDDConfig.Instance.CheckCommanderEDSMAPI) return; EDSMClass edsm = new EDSMClass(); string errmsg; Task taskEDSM = Task.Factory.StartNew(() => { // LOCAL time, there is a UTC converter inside this call if (edsm.SendTravelLog(he.System.name, he.EventTimeUTC, he.System.HasCoordinate, he.System.x, he.System.y, he.System.z, out errmsg)) he.SetEdsmSync(); }); }
// (verified with EDSM 29/9/2016, seen UTC time being sent, and same UTC time on ESDM). public static void SendTravelLog(HistoryEntry he) { EDSMClass edsm = new EDSMClass(); if (!edsm.IsApiKeySet) return; string errmsg; Task taskEDSM = Task.Factory.StartNew(() => { // LOCAL time, there is a UTC converter inside this call if (edsm.SendTravelLog(he.System.name, he.EventTimeUTC, he.System.HasCoordinate, he.System.x, he.System.y, he.System.z, out errmsg)) he.SetEdsmSync(); }); }
public static void SendTravelLog(HistoryEntry he) // (verified with EDSM 29/9/2016, seen UTC time being sent, and same UTC time on ESDM). { EDSMClass edsm = new EDSMClass(); if (!edsm.IsApiKeySet) { return; } string errmsg; Task taskEDSM = Task.Factory.StartNew(() => { // LOCAL time, there is a UTC converter inside this call if (edsm.SendTravelLog(he.System.name, he.EventTimeUTC, he.System.HasCoordinate, he.System.x, he.System.y, he.System.z, out errmsg)) { he.SetEdsmSync(); } }); }
static private bool SendToEDSM(List <HistoryEntry> hl, EDCommander cmdr, out string errmsg) { EDSMClass edsm = new EDSMClass(cmdr); // Ensure we use the commanders EDSM credentials. errmsg = null; List <JObject> entries = new List <JObject>(); foreach (HistoryEntry he in hl) { JournalEntry je = he.journalEntry; if (je == null) { je = JournalEntry.Get(he.Journalid); } JObject json = je.GetJson(); RemoveCommonKeys(json); if (je.EventTypeID == JournalTypeEnum.FSDJump && json["FuelUsed"].Empty()) { json["_convertedNetlog"] = true; } if (json["StarPosFromEDSM"].Bool(false)) // Remove star pos from EDSM { json.Remove("StarPos"); } json.Remove("StarPosFromEDSM"); json["_systemName"] = he.System.Name; json["_systemCoordinates"] = new JArray(he.System.X, he.System.Y, he.System.Z); if (he.System.SystemAddress != null) { json["_systemAddress"] = he.System.SystemAddress; } if (he.IsDocked) { json["_stationName"] = he.StationName; if (he.MarketID != null) { json["_stationMarketId"] = he.MarketID; } } json["_shipId"] = he.ShipId; entries.Add(json); } List <JObject> results = edsm.SendJournalEvents(entries, out errmsg); if (results == null) { return(false); } else { using (var cn = new SQLiteConnectionUser(utc: true)) { using (var txn = cn.BeginTransaction()) { for (int i = 0; i < hl.Count && i < results.Count; i++) { HistoryEntry he = hl[i]; JObject result = results[i]; int msgnr = result["msgnum"].Int(); int systemId = result["systemId"].Int(); bool systemCreated = result["systemCreated"].Bool(); if ((msgnr >= 100 && msgnr < 200) || msgnr == 500) { if (he.EntryType == JournalTypeEnum.FSDJump || he.EntryType == JournalTypeEnum.Location) { if (systemId != 0) { he.System.EDSMID = systemId; JournalEntry.UpdateEDSMIDPosJump(he.Journalid, he.System, false, 0, cn, txn); } if (systemCreated) { he.SetFirstDiscover(true); } } he.SetEdsmSync(cn, txn); if (msgnr == 500) { System.Diagnostics.Trace.WriteLine($"Warning submitting event {he.Journalid} \"{he.EventSummary}\": {msgnr} {result["msg"].Str()}"); } } else { System.Diagnostics.Trace.WriteLine($"Error submitting event {he.Journalid} \"{he.EventSummary}\": {msgnr} {result["msg"].Str()}"); } } txn.Commit(); } } return(true); } }