Esempio n. 1
0
        /// <summary>
        /// Changes ID by which an entity is registered. Do not call this directly, it is called automatically when
        /// EntityID changes.
        /// </summary>
        /// <param name="entity">Entity whose ID has changed.</param>
        /// <param name="oldId">Old ID of the entity.</param>
        /// <param name="newId">New ID of the entity.</param>
        public static void SwapRegisteredEntityId(IMyEntity entity, long oldId, long newId)
        {
            //Debug.Assert(m_entityList.ContainsKey(oldId), "Old ID of the entity does not exist. This can't happen.");
            //Debug.Assert(!m_entityList.ContainsKey(newId), "New ID of the entity already exists. This can't happen.");
            //Debug.Assert(entity != null, "Entity is null. This can't happen.");
            //Debug.Assert(m_entityList[oldId] == entity, "Entity assigned to old ID is different. This can't happen.");
            //Debug.Assert(m_entityList.ContainsValue(entity), "Entity is not in the list. This can't happen.");

            var result = m_entityList.ChangeKey(oldId, newId);

            Debug.Assert(result == entity, "Entity had different EntityId");
        }