protected override void RemoveItem(int index) { if (isTicking) { throw new InvalidOperationException("Can't modify collection inside Tick() method."); } IChronon item = this[index]; if (_enabledParticles.Contains(item)) { _enabledParticles.Remove(item); } base.RemoveItem(index); }
public void Save() { try { EnsureProfileDirectory(); NewJSON jsonStructure = new NewJSON() { DisabledList = new List <string>(DisabledList), Operation = Operation }; if (Operation == SetOperation.Expert) { // Update the EnabledList based on currently installed mods. if (EnabledList == null) { EnabledList = new HashSet <string>(); } foreach (string name in ModSelectorService.Instance._allExpertMods) { if (DisabledList.Contains(name)) { EnabledList.Remove(name); } else { EnabledList.Add(name); } } jsonStructure.EnabledList = new List <string>(EnabledList); } string jsonOutput = JsonConvert.SerializeObject(jsonStructure, Formatting.Indented); File.WriteAllText(FullPath, jsonOutput); } catch (Exception ex) { Debug.LogException(ex); } }