Esempio n. 1
0
 public void SetDefaultIfNotExist()
 {
     if (!InternalDictionary.ContainsKey(string.Empty))
     {
         InternalDictionary.Add(string.Empty, LogLevel.None);
     }
 }
        public void AddRange(IDictionary <TKey, TValue> items)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            if (items.Count > 0)
            {
                if (InternalDictionary.Count > 0)
                {
                    if (items.Keys.Any((k) => InternalDictionary.ContainsKey(k)))
                    {
                        throw new ArgumentException("An item with the same key has already been added.");
                    }
                    else
                    {
                        foreach (var item in items)
                        {
                            InternalDictionary.Add(item);
                        }
                    }
                }
                else
                {
                    InternalDictionary = new Dictionary <TKey, TValue>(items);
                }

                OnPropertyChanged();
                CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, items.ToArray()));
            }
        }
Esempio n. 3
0
        public override ILanguageValue this[string accessKey]
        {
            get
            {
                ILanguageValue compValue;

                if (InternalDictionary.TryGetValue(accessKey, out compValue))
                {
                    return(compValue);
                }

                var dataMemberType = ValueStructureType.GetDataMemberType(accessKey);

                compValue = ValueStructureType.RootAst.CreateDefaultValue(dataMemberType);

                InternalDictionary.Add(accessKey, compValue);

                return(compValue);
            }
            set
            {
                //TODO: Should you verify that the structure type contains a data member with the name in 'access_key'?

                if (InternalDictionary.ContainsKey(accessKey))
                {
                    InternalDictionary[accessKey] = value;
                }

                else
                {
                    InternalDictionary.Add(accessKey, value);
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Adds the specified element to this set if it is not already present.
 /// </summary>
 /// <param name="o">The object to add to the set.</param>
 /// <returns><c>true</c> is the object was added, <c>false</c> if it was already present.</returns>
 public override bool Add(object o)
 {
     if (InternalDictionary[o] != null)
     {
         return(false);
     }
     //The object we are adding is just a placeholder.  The thing we are
     //really concerned with is 'o', the key.
     InternalDictionary.Add(o, _placeholderObject);
     return(true);
 }
Esempio n. 5
0
 /// <summary>
 /// Adds the specified element to this set if it is not already present.
 /// </summary>
 /// <param name="o">The object to add to the set.</param>
 /// <returns><c>true</c> is the object was added, <c>false</c> if it was already present.</returns>
 public override bool Add(T o)
 {
     //The object we are adding is just a placeholder.  The thing we are
     //really concerned with is 'o', the key.
     if (!InternalDictionary.ContainsKey(o))
     {
         InternalDictionary.Add(o, _placeholderObject);
         return(true);
     }
     return(false);
 }
Esempio n. 6
0
        /// <summary>
        /// Adds the specified element to this set if it is not already present.
        /// </summary>
        /// <param name="element">The object to add to the set.</param>
        /// <returns>
        /// <see langword="true"/> is the object was added,
        /// <see langword="false"/> if the object was already present.
        /// </returns>
        public override bool Add(T element)
        {
            if (InternalDictionary.ContainsKey(element))
            {
                return(false);
            }

            //The object we are adding is just a placeholder.  The thing we are
            //really concerned with is 'o', the key.
            InternalDictionary.Add(element, PlaceholderObject);
            return(true);
        }
Esempio n. 7
0
        /// <summary>
        ///     Adds the specified element to this set if it is not already present.
        /// </summary>
        /// <param name="element">The object to add to the set.</param>
        /// <returns>
        ///     <see langword="true" /> is the object was added,
        ///     <see langword="false" /> if the object was already present.
        /// </returns>
        public override bool Add(object element)
        {
            element = MaskNull(element);
            if (InternalDictionary[element] != null)
            {
                return(false);
            }

            //The object we are adding is just a placeholder.  The thing we are
            //really concerned with is 'o', the key.
            InternalDictionary.Add(element, _placeholderObject);
            return(true);
        }
 /// <summary>
 ///		Añade un elemmento
 /// </summary>
 public void Add(string key, TypeData value)
 {
     // Normaliza la clave
     key = Normalize(key);
     // Añade / modifica la clave
     if (!InternalDictionary.ContainsKey(key))
     {
         InternalDictionary.Add(key, value);
     }
     else if (ReplaceDuplicates)
     {
         this[key] = value;
     }
     else
     {
         throw new KeyNotFoundException();
     }
 }
 /// <summary>
 ///		Obtiene un valor
 /// </summary>
 public TypeData this[string key]
 {
     get
     {
         // Normaliza la clave
         key = Normalize(key);
         // Devuelve el valor
         return(InternalDictionary.ContainsKey(key) ? InternalDictionary[key] : null);
     }
     set
     {
         // Normaliza la clave
         key = Normalize(key);
         // Cambia el valor
         if (InternalDictionary.ContainsKey(key))
         {
             InternalDictionary.Remove(key);
         }
         InternalDictionary.Add(key, value);
     }
 }
 /// <summary>
 ///		Obtiene un valor
 /// </summary>
 public TypeData this[string key]
 {
     get
     {
         // Normaliza la clave
         key = Normalize(key);
         // Devuelve el valor
         return(InternalDictionary.ContainsKey(key) ? InternalDictionary[key] : null);
     }
     set
     {
         // Normaliza la clave
         key = Normalize(key);
         // Elimina el valor antiguo
         if (InternalDictionary.ContainsKey(key))
         {
             InternalDictionary.Remove(key);
         }
         // Añade el valor modificado
         InternalDictionary.Add(key, value);
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Process incoming avatar animations
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="sim"></param>
        private void AvatarAnimationHandler(Packet packet, Simulator sim)
        {
            if (OnAvatarAnimation != null)
            {
                AvatarAnimationPacket anims = (AvatarAnimationPacket)packet;

                InternalDictionary<UUID, int> signaledAnims = new InternalDictionary<UUID, int>();
                
                for(int i=0; i < anims.AnimationList.Length; i++)
                    signaledAnims.Add(anims.AnimationList[i].AnimID, anims.AnimationList[i].AnimSequenceID);

                try { OnAvatarAnimation(anims.Sender.ID, signaledAnims); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
            }
        }
Esempio n. 12
0
 void ICollection <KeyValuePair <EK, EV> > .Add(KeyValuePair <EK, EV> item)
 {
     InternalDictionary.Add(item);
 }
Esempio n. 13
0
 void IDictionary <EK, EV> .Add(EK key, EV value)
 {
     InternalDictionary.Add(key, value);
 }
Esempio n. 14
0
 public void Add(string key, LogLevel level)
 {
     InternalDictionary.Add(key, level);
 }
Esempio n. 15
0
        public void Add(ScoreNote scoreNote1, ScoreNote scoreNote2, NoteRelation relation)
        {
            var tuple = new TupleType(scoreNote1, scoreNote2);

            InternalDictionary.Add(tuple, relation);
        }
Esempio n. 16
0
 public void Add(TKey key, TValue value)
 {
     InternalDictionary.Add(key, value);
 }
Esempio n. 17
0
 public void Add(KeyValuePair <TKey, TValue> item)
 {
     InternalDictionary.Add(item);
 }