public void Process(JournalEntry je) { if (je.EventTypeID == JournalTypeEnum.Shipyard) { JournalEvents.JournalShipyard js = je as JournalEvents.JournalShipyard; if (js.Yard.Ships != null) // just in case we get a bad shipyard with no ship data or EDD did not see a matching shipyard.json vs the journal entry { AllowCobraMkIV = js.AllowCobraMkIV; // set the flag //System.Diagnostics.Debug.WriteLine("Add yard data for " + js.Yard.StarSystem + ":" + js.Yard.StationName); ShipYards.Add(js.Yard); } } }
public List <ShipYard> GetFilteredList(bool nolocrepeats = false, int timeout = 60 *5) // latest first.. { ShipYard last = null; List <ShipYard> yards = new List <ShipYard>(); foreach (var yard in ShipYards.AsEnumerable().Reverse()) // give it to me in lastest one first.. { if (!nolocrepeats || yards.Find(x => x.Location.Equals(yard.Location)) == null) // allow yard repeats or not in list { // if no last or different name or time is older.. if (last == null || !yard.Location.Equals(last.Location) || (last.Datetime - yard.Datetime).TotalSeconds >= timeout) { yards.Add(yard); last = yard; //System.Diagnostics.Debug.WriteLine("return " + yard.Ident(true) + " " + yard.Datetime.ToString()); } } } return(yards); }