Exemple #1
0
        public static HeaderType Find(string name)
        {
            HeaderType type;
            long       id = HeaderType.GetNameCode(name);

            if (mHeaderTypes.TryGetValue(id, out type))
            {
                return(type);
            }
            HeaderType[] items;
            lock (mHeaderTypes)
            {
                if (mHeaderTypes.TryGetValue(id, out type))
                {
                    return(type);
                }
                items = mHeaderTypes.Values.ToArray();
                foreach (var item in items)
                {
                    if (item.Compare(name))
                    {
                        type = item;
                    }
                }
            }
            if (type == null)
            {
                type = new HeaderType(name);
            }
            Add(name, type);
            return(type);
        }
Exemple #2
0
        private HeaderValue FindOnly(string name)
        {
            HeaderValue result;
            long        id = HeaderType.GetNameCode(name);

            mValues.TryGetValue(id, out result);
            return(result);
        }
Exemple #3
0
 private static void Add(string name, HeaderType type)
 {
     if (mCount < 5000)
     {
         lock (mHeaderTypes)
         {
             long id = HeaderType.GetNameCode(name);
             mHeaderTypes[id] = type;
         }
         System.Threading.Interlocked.Increment(ref mCount);
     }
 }
Exemple #4
0
        public static HeaderType Find(string name)
        {
            HeaderType type;
            long       id = HeaderType.GetNameCode(name);

            if (mHeaderTypes.TryGetValue(id, out type))
            {
                return(type);
            }
            foreach (var item in mHeaderTypes.Values)
            {
                if (item.Compare(name))
                {
                    Add(name, item);
                    return(item);
                }
            }
            type = new HeaderType(name);
            Add(name, type);
            return(type);
        }
Exemple #5
0
        public void Remove(string name)
        {
            long id = HeaderType.GetNameCode(name);

            mValues.Remove(id);
        }