public void AddRecent(MissionBase mission) { var recentModSet = new RecentMission(mission); RecentMissions.AddLocked(recentModSet); mission.RefreshLastJoinedOn(); SaveSettings(); }
void OnDeserialized(StreamingContext context) { if (!string.IsNullOrWhiteSpace(_gameUuid)) { _realGameUuid = FindGameUuidMatch(_gameUuid).GetValueOrDefault(); _gameUuid = null; } if (EnabledMods == null) { EnabledMods = new Mod[0]; } if (_realGameUuid == default(Guid)) { _realGameUuid = DefaultGameUuid; } if (_Mods == null) { _Mods = new List <string>(); } if (_additionalMods == null) { _additionalMods = new List <string>(); } if (_optionalMods == null) { _optionalMods = new List <string>(); } if (_disabledItems == null) { _disabledItems = new List <string>(); } if (RequiredMods == null) { RequiredMods = new List <string>(); } if (Items == null) { Items = new ReactiveList <IContent>(); } if (Versions == null) { Versions = new Dictionary <string, string>(); } if (Orders == null) { Orders = new Dictionary <string, int>(); } // WORKAROUND F'ING DATALOSS POSSIBILITIES if (_recentMission != null && _recentMission.Key == null) { _recentMission = null; } if (_recentServer != null && _recentServer.Address == null) { _recentServer = null; } }
MissionBase FindInGameFolder(RecentMission recent) => _gameFolders == null ? null : _gameFolders.SelectMany(x => x.Model.Items.Cast <MissionBase>()) .FirstOrDefault(recent.Matches);
MissionBase FindMission(RecentMission x) => _game.Lists.Missions.Cast <MissionBase>().FirstOrDefault(x.Matches) ?? FindInGameFolder(x);