static public bool SendToEDDN(HistoryEntry he) { EDDNClass eddn = new EDDNClass(); if (he.Commander != null) { eddn.commanderName = he.Commander.EdsmName; if (string.IsNullOrEmpty(eddn.commanderName)) { eddn.commanderName = he.Commander.Name; } if (he.Commander.Name.StartsWith("[BETA]", StringComparison.InvariantCultureIgnoreCase)) { eddn.isBeta = true; } } if (he.IsBetaMessage) { eddn.isBeta = true; } JournalEntry je = he.journalEntry; if (je == null) { je = JournalEntry.Get(he.Journalid); } JObject msg = null; if (je.EventTypeID == JournalTypeEnum.FSDJump) { msg = eddn.CreateEDDNMessage(je as JournalFSDJump); } else if (je.EventTypeID == JournalTypeEnum.Docked) { msg = eddn.CreateEDDNMessage(je as JournalDocked, he.System.x, he.System.y, he.System.z); } else if (je.EventTypeID == JournalTypeEnum.Scan) { msg = eddn.CreateEDDNMessage(je as JournalScan, he.System.name, he.System.x, he.System.y, he.System.z); } if (msg != null) { if (eddn.PostMessage(msg)) { he.SetEddnSync(); return(true); } } return(false); }
// (verified with EDSM 29/9/2016, seen UTC time being sent, and same UTC time on ESDM). public static bool SendEDDNEvent(HistoryEntry he) { Task taskEDSM = Task.Factory.StartNew(() => { // LOCAL time, there is a UTC converter inside this call if (SendToEDDN(he)) he.SetEddnSync(); }); return true; }
public static bool SendEDDNEvent(HistoryEntry he) // (verified with EDSM 29/9/2016, seen UTC time being sent, and same UTC time on ESDM). { Task taskEDSM = Task.Factory.StartNew(() => { // LOCAL time, there is a UTC converter inside this call if (SendToEDDN(he)) { he.SetEddnSync(); } }); return(true); }
static public bool SendToEDDN(HistoryEntry he) { EDDNClass eddn = new EDDNClass(); if (he.Commander != null) { eddn.commanderName = he.Commander.EdsmName; if (string.IsNullOrEmpty(eddn.commanderName)) { eddn.commanderName = he.Commander.Name; } if (he.Commander.Name.StartsWith("[BETA]", StringComparison.InvariantCultureIgnoreCase)) { eddn.isBeta = true; } } if (he.IsBetaMessage) { eddn.isBeta = true; } JournalEntry je = he.journalEntry; if (je == null) { je = JournalEntry.Get(he.Journalid); } JObject msg = null; JObject msg2 = null; if (je.EventTypeID == JournalTypeEnum.FSDJump) { msg = eddn.CreateEDDNMessage(je as JournalFSDJump); } else if (je.EventTypeID == JournalTypeEnum.Location) { msg = eddn.CreateEDDNMessage(je as JournalLocation); } else if (je.EventTypeID == JournalTypeEnum.Docked) { msg = eddn.CreateEDDNMessage(je as JournalDocked, he.System); } else if (je.EventTypeID == JournalTypeEnum.Scan) { msg = eddn.CreateEDDNMessage(je as JournalScan, he.System); } else if (je.EventTypeID == JournalTypeEnum.Outfitting) { //Removed - not in EDDN spec to send this msg2 = eddn.CreateEDDNJournalMessage(je as JournalOutfitting, he.System.X, he.System.Y, he.System.Z, he.System.SystemAddress); msg = eddn.CreateEDDNOutfittingMessage(je as JournalOutfitting, he.System); } else if (je.EventTypeID == JournalTypeEnum.Shipyard) { //Removed - not in EDDN spec to send this msg2 = eddn.CreateEDDNJournalMessage(je as JournalShipyard, he.System.X, he.System.Y, he.System.Z, he.System.SystemAddress); msg = eddn.CreateEDDNShipyardMessage(je as JournalShipyard, he.System); } else if (je.EventTypeID == JournalTypeEnum.Market) { JournalMarket jm = je as JournalMarket; //Removed - not in EDDN spec to send this msg2 = eddn.CreateEDDNJournalMessage(jm, he.System.X, he.System.Y, he.System.Z, he.System.SystemAddress); msg = eddn.CreateEDDNCommodityMessage(jm.Commodities, jm.StarSystem, jm.Station, jm.MarketID, DateTime.UtcNow); // if its devoid of data, null returned } if (msg != null) { if (eddn.PostMessage(msg)) { if (msg2 != null) { eddn.PostMessage(msg2); } he.SetEddnSync(); return(true); } } return(false); }
public static bool SendToEDDN(HistoryEntry he) { EDDNClass eddn = new EDDNClass(); if (he.Commander != null) { eddn.commanderName = he.Commander.EdsmName; } JournalEntry je = JournalEntry.Get(he.Journalid); JObject msg = null; if (je.EventTypeID == JournalTypeEnum.FSDJump) { msg = eddn.CreateEDDNMessage(je as JournalFSDJump); } else if (je.EventTypeID == JournalTypeEnum.Docked) { msg = eddn.CreateEDDNMessage(je as JournalDocked, he.System.x, he.System.y, he.System.z); } else if (je.EventTypeID == JournalTypeEnum.Scan) { msg = eddn.CreateEDDNMessage(je as JournalScan, he.System.name, he.System.x, he.System.y, he.System.z); } if (msg != null) { if (eddn.PostMessage(msg)) { he.SetEddnSync(); return true; } } return false; }