Пример #1
0
        bool ICollection <KeyValuePair <string, string> > .Remove(KeyValuePair <string, string> item)
        {
            //if (ContainsKey(item.Key)
            //    &&  Attributes[DomData.TokenID(item.Key,true)] == item.Value)
            //{
            //    return Remove(item.Key);
            //}
            //else
            //{
            //    return false;
            //}

            int index = InnerKeys.IndexOf(DomData.TokenID(item.Key, true));

            if (index < 0)
            {
                return(false);
            }
            else
            {
                if (InnerValues[index] == item.Value)
                {
                    return(Remove(item.Key));
                }
                else
                {
                    return(false);
                }
            }
        }
Пример #2
0
        public bool Unset(ushort tokenId)
        {
            //return Attributes.Remove(tokenId);
            int index = InnerKeys.IndexOf(tokenId);

            if (index >= 0)
            {
                InnerKeys.RemoveAt(index);
                InnerValues.RemoveAt(index);
                return(true);
            }
            return(false);
        }
Пример #3
0
        bool ICollection <KeyValuePair <string, string> > .Contains(KeyValuePair <string, string> item)
        {
            //return ContainsKey(item.Key)
            //&& Attributes[DomData.TokenID(item.Key,true)] == item.Value;

            int index = InnerKeys.IndexOf(DomData.TokenID(item.Key, true));

            if (index < 0)
            {
                return(false);
            }
            else
            {
                return(InnerValues[index] == item.Value);
            }
        }
Пример #4
0
        public void SetBoolean(ushort tokenId)
        {
            //Attributes[tokenId] = null;

            int index = InnerKeys.IndexOf(tokenId);

            if (index < 0)
            {
                index = InnerKeys.Count;
                InnerKeys.Add(tokenId);
                InnerValues.Add(null);
            }
            else
            {
                InnerValues[index] = null;
            }
        }
Пример #5
0
        protected string Get(ushort tokenId)
        {
            //string value;

            // if (Attributes.TryGetValue(tokenId, out value))
            //if (Attributes.TryGetValue(tokenId, out value))
            //{
            //    return value;
            //}
            //else
            //{
            //    return null;
            //}
            int index = InnerKeys.IndexOf(tokenId);

            return(index < 0 ? null : InnerValues[index]);
        }
Пример #6
0
 /// <summary>
 /// Used by DomElement to (finally) set the ID value
 /// </summary>
 /// <param name="tokenId"></param>
 /// <param name="value"></param>
 internal void SetRaw(ushort tokenId, string value)
 {
     if (value == null)
     {
         Unset(tokenId);
     }
     else
     {
         //Attributes[tokenId] = value;
         int index = InnerKeys.IndexOf(tokenId);
         if (index < 0)
         {
             index = InnerKeys.Count;
             InnerKeys.Add(tokenId);
             InnerValues.Add(value);
         }
         else
         {
             InnerValues[index] = value;
         }
     }
 }