Esempio n. 1
0
        public void SetResourceKey(object key, object value)
        {
            if (ekKey == null || ekKey == key)
            {
                ekKey   = key;
                ekValue = value;
                return;
            }

            if (this is BNode)
            {
                throw new InvalidOperationException("Only one resource key can be set for a BNode.");
            }

            if (extraKeys == null)
            {
                extraKeys = new ArrayList();
            }

            foreach (Resource.ExtraKey ekey in extraKeys)
            {
                if (ekey.Key == key)
                {
                    ekey.Value = value; return;
                }
            }

            Resource.ExtraKey k = new Resource.ExtraKey(key, value);
            extraKeys.Add(k);
        }
		internal void SetResourceKey(object key, object value) {
			if (ekKey == null || ekKey == key) {
				ekKey = key;
				ekValue = value;
				return;
			}
			
			if (this is BNode) throw new InvalidOperationException("Only one resource key can be set for a BNode.");
		
			if (extraKeys == null) extraKeys = new ArrayList();
			
			foreach (Resource.ExtraKey ekey in extraKeys)
				if (ekey.Key == key) { ekey.Value = value; return; }
			
			Resource.ExtraKey k = new Resource.ExtraKey(key, value);
			extraKeys.Add(k);
		}
Esempio n. 3
0
 public object GetResourceKey(object key)
 {
     if (ekKey == key)
     {
         return(ekValue);
     }
     if (extraKeys == null)
     {
         return(null);
     }
     for (int i = 0; i < extraKeys.Count; i++)
     {
         Resource.ExtraKey ekey = (Resource.ExtraKey)extraKeys[i];
         if (ekey.Key == key)
         {
             return(ekey.Value);
         }
     }
     return(null);
 }