/// <summary> /// Add Element to wrapper cache/list - Does not commit addition - Run saveCacheChanges() to do this /// </summary> /// <param name="tmpNewClass"></param> public void addElementToTempCache(MagiElement tmpNewElement) { int index = -1; foreach (MagiElement tmpElement in _listOfElements) { if (tmpElement.ElementID == tmpNewElement.ElementID) { index = _listOfElements.IndexOf(tmpElement); } } if (index != -1) { _listOfElements[index] = tmpNewElement; } else { _listOfElements.Add(tmpNewElement); } }
/// <summary> /// Removes specified element and ID from cache of used IDs /// </summary> /// <param name="tmpClass"></param> private void removeElementFromTempCache(MagiElement tmpElement) { if(_listOfElements.Contains(tmpElement)){ _listOfElements.Remove(tmpElement); _usedIDs.Remove(tmpElement.ElementID); } }