Beispiel #1
0
        public string Get(char[] key, int start, int length)
        {
            if (length == 0)
            {
                return(string.Empty);
            }
            int num = length + PropertyNameTable.HashCodeRandomizer;

            num = num + (num << 7 ^ key[start]);
            int num1 = start + length;

            for (int i = start + 1; i < num1; i++)
            {
                num = num + (num << 7 ^ key[i]);
            }
            num = num - (num >> 17);
            num = num - (num >> 11);
            num = num - (num >> 5);
            for (PropertyNameTable.Entry j = this._entries[num & this._mask]; j != null; j = j.Next)
            {
                if (j.HashCode == num && PropertyNameTable.TextEquals(j.Value, key, start, length))
                {
                    return(j.Value);
                }
            }
            return(null);
        }
Beispiel #2
0
        public string Add(string key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            int length = key.Length;

            if (length == 0)
            {
                return(string.Empty);
            }
            int hashCodeRandomizer = length + PropertyNameTable.HashCodeRandomizer;

            for (int i = 0; i < key.Length; i++)
            {
                hashCodeRandomizer = hashCodeRandomizer + (hashCodeRandomizer << 7 ^ key[i]);
            }
            hashCodeRandomizer = hashCodeRandomizer - (hashCodeRandomizer >> 17);
            hashCodeRandomizer = hashCodeRandomizer - (hashCodeRandomizer >> 11);
            hashCodeRandomizer = hashCodeRandomizer - (hashCodeRandomizer >> 5);
            for (PropertyNameTable.Entry j = this._entries[hashCodeRandomizer & this._mask]; j != null; j = j.Next)
            {
                if (j.HashCode == hashCodeRandomizer && j.Value.Equals(key))
                {
                    return(j.Value);
                }
            }
            return(this.AddEntry(key, hashCodeRandomizer));
        }
        public string Add(string key)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            int length = key.Length;

            if (length == 0)
            {
                return(string.Empty);
            }
            int num1 = length + PropertyNameTable.HashCodeRandomizer;

            for (int index = 0; index < key.Length; ++index)
            {
                num1 += num1 << 7 ^ (int)key[index];
            }
            int num2     = num1 - (num1 >> 17);
            int num3     = num2 - (num2 >> 11);
            int hashCode = num3 - (num3 >> 5);

            for (PropertyNameTable.Entry entry = this._entries[hashCode & this._mask]; entry != null; entry = entry.Next)
            {
                if (entry.HashCode == hashCode && entry.Value.Equals(key))
                {
                    return(entry.Value);
                }
            }
            return(this.AddEntry(key, hashCode));
        }
        public string Get(char[] key, int start, int length)
        {
            if (length == 0)
            {
                return(string.Empty);
            }
            int num1 = length + PropertyNameTable.HashCodeRandomizer;
            int num2 = num1 + (num1 << 7 ^ (int)key[start]);
            int num3 = start + length;

            for (int index = start + 1; index < num3; ++index)
            {
                num2 += num2 << 7 ^ (int)key[index];
            }
            int num4 = num2 - (num2 >> 17);
            int num5 = num4 - (num4 >> 11);
            int num6 = num5 - (num5 >> 5);

            for (PropertyNameTable.Entry entry = this._entries[num6 & this._mask]; entry != null; entry = entry.Next)
            {
                if (entry.HashCode == num6 && PropertyNameTable.TextEquals(entry.Value, key, start, length))
                {
                    return(entry.Value);
                }
            }
            return((string)null);
        }
        private string AddEntry(string str, int hashCode)
        {
            int index = hashCode & this._mask;

            PropertyNameTable.Entry entry = new PropertyNameTable.Entry(str, hashCode, this._entries[index]);
            this._entries[index] = entry;
            if (this._count++ == this._mask)
            {
                this.Grow();
            }
            return(entry.Value);
        }
Beispiel #6
0
        private string AddEntry(string str, int hashCode)
        {
            int num = hashCode & this._mask;

            PropertyNameTable.Entry entry = new PropertyNameTable.Entry(str, hashCode, this._entries[num]);
            this._entries[num] = entry;
            int num1 = this._count;

            this._count = num1 + 1;
            if (num1 == this._mask)
            {
                this.Grow();
            }
            return(entry.Value);
        }
Beispiel #7
0
        private void Grow()
        {
            PropertyNameTable.Entry   next       = null;
            PropertyNameTable.Entry[] entryArray = this._entries;
            int num = this._mask * 2 + 1;

            PropertyNameTable.Entry[] entryArray1 = new PropertyNameTable.Entry[num + 1];
            for (int i = 0; i < (int)entryArray.Length; i++)
            {
                for (PropertyNameTable.Entry j = entryArray[i]; j != null; j = next)
                {
                    int hashCode = j.HashCode & num;
                    next   = j.Next;
                    j.Next = entryArray1[hashCode];
                    entryArray1[hashCode] = j;
                }
            }
            this._entries = entryArray1;
            this._mask    = num;
        }
        private void Grow()
        {
            PropertyNameTable.Entry[] entries = this._entries;
            int num = this._mask * 2 + 1;

            PropertyNameTable.Entry[] entryArray = new PropertyNameTable.Entry[num + 1];
            PropertyNameTable.Entry   next;
            for (int index1 = 0; index1 < entries.Length; ++index1)
            {
                for (PropertyNameTable.Entry entry = entries[index1]; entry != null; entry = next)
                {
                    int index2 = entry.HashCode & num;
                    next               = entry.Next;
                    entry.Next         = entryArray[index2];
                    entryArray[index2] = entry;
                }
            }
            this._entries = entryArray;
            this._mask    = num;
        }
Beispiel #9
0
 internal Entry(string value, int hashCode, PropertyNameTable.Entry next)
 {
     this.Value    = value;
     this.HashCode = hashCode;
     this.Next     = next;
 }
 // Token: 0x06000CB2 RID: 3250
 // RVA: 0x0000D8C4 File Offset: 0x0000BAC4
 internal Entry(string value, int hashCode, PropertyNameTable.Entry next)
 {
     this.Value = value;
     this.HashCode = hashCode;
     this.Next = next;
 }
 // Token: 0x06000CB0 RID: 3248
 // RVA: 0x00048F54 File Offset: 0x00047154
 private void Grow()
 {
     PropertyNameTable.Entry[] entries = this._entries;
     int num = this._mask * 2 + 1;
     PropertyNameTable.Entry[] array = new PropertyNameTable.Entry[num + 1];
     for (int i = 0; i < entries.Length; i++)
     {
         PropertyNameTable.Entry next;
         for (PropertyNameTable.Entry entry = entries[i]; entry != null; entry = next)
         {
             int num2 = entry.HashCode & num;
             next = entry.Next;
             entry.Next = array[num2];
             array[num2] = entry;
         }
     }
     this._entries = array;
     this._mask = num;
 }
 // Token: 0x06000CAF RID: 3247
 // RVA: 0x00048F00 File Offset: 0x00047100
 private string AddEntry(string str, int hashCode)
 {
     int num = hashCode & this._mask;
     PropertyNameTable.Entry entry = new PropertyNameTable.Entry(str, hashCode, this._entries[num]);
     this._entries[num] = entry;
     if (this._count++ == this._mask)
     {
         this.Grow();
     }
     return entry.Value;
 }