示例#1
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);
        }
示例#2
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);
            }
        }
示例#3
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;
            }
        }
示例#4
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]);
        }
示例#5
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;
         }
     }
 }
示例#6
0
 public bool ContainsKey(ushort tokenId)
 {
     //return Attributes.ContainsKey(tokenId);
     return(InnerKeys.Contains(tokenId));
 }
示例#7
0
 public bool ContainsKey(string key)
 {
     //return Attributes.ContainsKey(DomData.TokenID(key, true));
     return(InnerKeys.Contains(DomData.TokenID(key, true)));
 }
示例#8
0
 public void Clear()
 {
     //Attributes.Clear();
     InnerKeys.Clear();
     InnerValues.Clear();
 }