private void AddOrRemoveHistoryRecorderGroups() { if (autoRecorderGroups.RemoveAll((HistoryAutoRecorderGroup x) => x == null) != 0) { Log.Warning("Some history auto recorder groups were null."); } foreach (HistoryAutoRecorderGroupDef def in DefDatabase <HistoryAutoRecorderGroupDef> .AllDefs) { if (!autoRecorderGroups.Any((HistoryAutoRecorderGroup x) => x.def == def)) { HistoryAutoRecorderGroup historyAutoRecorderGroup = new HistoryAutoRecorderGroup(); historyAutoRecorderGroup.def = def; historyAutoRecorderGroup.AddOrRemoveHistoryRecorders(); autoRecorderGroups.Add(historyAutoRecorderGroup); } } autoRecorderGroups.RemoveAll((HistoryAutoRecorderGroup x) => x.def == null); }
private void AddOrRemoveHistoryRecorderGroups() { if (this.autoRecorderGroups.RemoveAll((HistoryAutoRecorderGroup x) => x == null) != 0) { Log.Warning("Some history auto recorder groups were null.", false); } using (IEnumerator <HistoryAutoRecorderGroupDef> enumerator = DefDatabase <HistoryAutoRecorderGroupDef> .AllDefs.GetEnumerator()) { while (enumerator.MoveNext()) { HistoryAutoRecorderGroupDef def = enumerator.Current; if (!this.autoRecorderGroups.Any((HistoryAutoRecorderGroup x) => x.def == def)) { HistoryAutoRecorderGroup historyAutoRecorderGroup = new HistoryAutoRecorderGroup(); historyAutoRecorderGroup.def = def; historyAutoRecorderGroup.AddOrRemoveHistoryRecorders(); this.autoRecorderGroups.Add(historyAutoRecorderGroup); } } } this.autoRecorderGroups.RemoveAll((HistoryAutoRecorderGroup x) => x.def == null); }