/// <summary>
 /// Add a <see cref="LevelMappingEntry"/> to this mapping
 /// </summary>
 /// <param name="entry">the entry to add</param>
 /// <remarks>
 /// <para>
 /// If a <see cref="LevelMappingEntry"/> has previously been added
 /// for the same <see cref="Level"/> then that entry will be
 /// overwritten.
 /// </para>
 /// </remarks>
 public void Add(LevelMappingEntry entry)
 {
     if (m_entriesMap.ContainsKey(entry.Level))
     {
         m_entriesMap.Remove(entry.Level);
     }
     m_entriesMap.Add(entry.Level, entry);
 }
		/// <summary>
		/// Add a <see cref="LevelMappingEntry"/> to this mapping
		/// </summary>
		/// <param name="entry">the entry to add</param>
		/// <remarks>
		/// <para>
		/// If a <see cref="LevelMappingEntry"/> has previously been added
		/// for the same <see cref="Level"/> then that entry will be 
		/// overwritten.
		/// </para>
		/// </remarks>
		public void Add(LevelMappingEntry entry)
		{
			if (m_entriesMap.ContainsKey(entry.Level))
			{
				m_entriesMap.Remove(entry.Level);
			}
			m_entriesMap.Add(entry.Level, entry);
		}
Esempio n. 3
0
 public void ActivateOptions()
 {
     Level[]             array      = new Level[this.m_entriesMap.Count];
     LevelMappingEntry[] entryArray = new LevelMappingEntry[this.m_entriesMap.Count];
     this.m_entriesMap.Keys.CopyTo(array, 0);
     this.m_entriesMap.Values.CopyTo(entryArray, 0);
     Array.Sort <Level, LevelMappingEntry>(array, entryArray, 0, array.Length, null);
     Array.Reverse(entryArray, 0, entryArray.Length);
     foreach (LevelMappingEntry entry in entryArray)
     {
         entry.ActivateOptions();
     }
     this.m_entries = entryArray;
 }
        /// <summary>
        /// Initialize options
        /// </summary>
        /// <remarks>
        /// <para>
        /// Caches the sorted list of <see cref="LevelMappingEntry"/> in an array
        /// </para>
        /// </remarks>
        public void ActivateOptions()
        {
            Level[]             sortKeys   = new Level[m_entriesMap.Count];
            LevelMappingEntry[] sortValues = new LevelMappingEntry[m_entriesMap.Count];

            m_entriesMap.Keys.CopyTo(sortKeys, 0);
            m_entriesMap.Values.CopyTo(sortValues, 0);

            // Sort in level order
            Array.Sort(sortKeys, sortValues, 0, sortKeys.Length, null);

            // Reverse list so that highest level is first
            Array.Reverse(sortValues, 0, sortValues.Length);

            foreach (LevelMappingEntry entry in sortValues)
            {
                entry.ActivateOptions();
            }

            m_entries = sortValues;
        }
Esempio n. 5
0
        /// <summary>
        /// Initialize options
        /// </summary>
        /// <remarks>
        /// <para>
        /// Caches the sorted list of <see cref="LevelMappingEntry"/> in an array
        /// </para>
        /// </remarks>
        public void ActivateOptions()
        {
            var sortKeys = new Level[m_entriesMap.Count];
            var sortValues = new LevelMappingEntry[m_entriesMap.Count];

            m_entriesMap.Keys.CopyTo(sortKeys, 0);
            m_entriesMap.Values.CopyTo(sortValues, 0);

            // Sort in level order
            Array.Sort(sortKeys, sortValues, 0, sortKeys.Length, null);

            // Reverse list so that highest level is first
            Array.Reverse(sortValues, 0, sortValues.Length);

            foreach (var entry in sortValues)
            {
                entry.ActivateOptions();
            }

            m_entries = sortValues;
        }