public void Missions(JournalMissions m) { List <string> toresurrect = new List <string>(); foreach (var mi in m.ActiveMissions) { string kn = MissionList.Key(mi.MissionID, mi.Name); if (missionlist.Missions.ContainsKey(kn)) { MissionState ms = missionlist.Missions[kn]; if (ms.State == MissionState.StateTypes.Died) // if marked died... { System.Diagnostics.Debug.WriteLine("Missions in active list but marked died" + kn); toresurrect.Add(kn); } } } if (toresurrect.Count > 0) // if any.. { missionlist = new MissionList(missionlist); // shallow copy missionlist.Resurrect(toresurrect); } }
public void Redirected(JournalMissionRedirected m) { if (missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so { missionlist = new MissionList(missionlist); // shallow copy missionlist.Redirected(m); } else { System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m)); } }
public void Accepted(JournalMissionAccepted m, ISystem sys, string body) { if (!missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so { missionlist = new MissionList(missionlist); // shallow copy missionlist.Add(m, sys, body); } else { System.Diagnostics.Debug.WriteLine("Missions: Duplicate " + MissionList.Key(m)); } }
public void Failed(JournalMissionFailed m) { if (current.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so { current = new MissionList(current); // shallow copy current.Failed(m); } else { System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m)); } }
public void Failed(JournalMissionFailed m) { if (missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so { missionlist = new MissionList(missionlist); // shallow copy missionlist.Failed(m); // System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Missions Failed " + MissionList.Key(m)); } else { System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m)); } }
public void CargoDepot(JournalCargoDepot m) { string key = missionlist.GetExistingKeyFromID(m.MissionId); if (key != null) { missionlist = new MissionList(missionlist); // shallow copy missionlist.CargoDepot(key, m); } else { System.Diagnostics.Debug.WriteLine("Missions: Unknown " + m.MissionId); } }
public void Died(DateTime diedtime) { missionlist = new MissionList(missionlist); // shallow copy missionlist.Died(diedtime); }
public MissionListAccumulator() { missionlist = new MissionList(); }
public MissionList(MissionList other) { Missions = new Dictionary <string, MissionState>(other.Missions); }
public void UpdateMissionList(MissionList ml) { MissionList = ml; }
public MissionListAccumulator() { current = new MissionList(); }
public void Missions(JournalMissions m) { List <string> toresurrect = new List <string>(); HashSet <string> active = new HashSet <string>(); List <string> failed = new List <string>(); List <string> completed = new List <string>(); List <string> disappeared = new List <string>(); foreach (var mi in m.ActiveMissions) { string kn = MissionList.Key(mi.MissionID, mi.Name); active.Add(kn); //System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Mission " + kn + " is active"); if (missionlist.Missions.ContainsKey(kn)) { MissionState ms = missionlist.Missions[kn]; if (ms.State == MissionState.StateTypes.Died) // if marked died... { System.Diagnostics.Debug.WriteLine("Missions in active list but marked died" + kn); toresurrect.Add(kn); } } } foreach (var mi in m.FailedMissions) { string kn = MissionList.Key(mi.MissionID, mi.Name); failed.Add(kn); } foreach (var mi in m.CompletedMissions) { string kn = MissionList.Key(mi.MissionID, mi.Name); completed.Add(kn); } foreach (var kvp in missionlist.Missions) { if (!active.Contains(kvp.Key) && !failed.Contains(kvp.Key) && !completed.Contains(kvp.Key) && kvp.Value.State == MissionState.StateTypes.InProgress) { System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Mission " + kvp.Value.Mission.EventTimeUTC.ToStringZulu() + " " + kvp.Key + " disappeared ****"); disappeared.Add(kvp.Key); } } if (toresurrect.Count > 0) // if any.. { missionlist = new MissionList(missionlist); // shallow copy missionlist.Resurrect(toresurrect); } if (disappeared.Count > 0) { missionlist = new MissionList(missionlist); missionlist.Disappeared(disappeared, m.EventTimeUTC); } if (failed.Count > 0) { missionlist = new MissionList(missionlist); missionlist.ChangeStateIfInProgress(failed, MissionState.StateTypes.Failed, m.EventTimeUTC); } if (completed.Count > 0) { missionlist = new MissionList(missionlist); missionlist.ChangeStateIfInProgress(failed, MissionState.StateTypes.Completed, m.EventTimeUTC); } }