Beispiel #1
0
        public void Remove(params string[] keys)
        {
            string undoEntry = null;

            undoEntry = string.Format("Remove '{0}'", string.Join(",", keys));

            m_controller.WorldModel.UndoLogger.StartTransaction(undoEntry);
            foreach (string key in keys)
            {
                m_source.Remove(key, UpdateSource.User);
            }
            m_controller.WorldModel.UndoLogger.EndTransaction();
        }
Beispiel #2
0
        public void Remove(params string[] keys)
        {
            string undoEntry = null;

            if (typeof(T) == typeof(string))
            {
                undoEntry = string.Format("Remove '{0}'", string.Join(",", keys));
            }

            if (undoEntry == null)
            {
                throw new InvalidOperationException("Unknown list type");
            }

            m_controller.WorldModel.UndoLogger.StartTransaction(undoEntry);
            foreach (string key in keys)
            {
                m_source.Remove(key, UpdateSource.User);
            }
            m_controller.WorldModel.UndoLogger.EndTransaction();
        }
Beispiel #3
0
        internal void RemoveReferencesTo(Element e)
        {
            List <string> nullifyAttributes = new List <string>();

            foreach (var attribute in m_attributes)
            {
                Element elementValue = attribute.Value as Element;
                if (elementValue != null)
                {
                    if (elementValue == e)
                    {
                        nullifyAttributes.Add(attribute.Key);
                    }
                    continue;
                }

                QuestList <Element> listValue = attribute.Value as QuestList <Element>;
                if (listValue != null)
                {
                    while (listValue.Contains(e))
                    {
                        listValue.Remove(e);
                    }
                    continue;
                }

                QuestDictionary <Element> dictionaryValue = attribute.Value as QuestDictionary <Element>;
                if (dictionaryValue != null)
                {
                    List <string> keysToRemove = new List <string>();
                    foreach (var item in dictionaryValue)
                    {
                        if (item.Value == e)
                        {
                            keysToRemove.Add(item.Key);
                        }
                    }
                    foreach (string key in keysToRemove)
                    {
                        dictionaryValue.Remove(key);
                    }
                    continue;
                }
            }

            foreach (string attribute in nullifyAttributes)
            {
                Set(attribute, null);
            }
        }