Exemplo n.º 1
0
        public override string Get(char[] key, int start, int length)
        {
            if (length == 0)
            {
                return(string.Empty);
            }
            int num = length + DefaultJsonNameTable.HashCodeRandomizer;

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

            for (int i = start + 1; i < num2; i++)
            {
                num += (num << 7 ^ (int)key[i]);
            }
            num -= num >> 17;
            num -= num >> 11;
            num -= num >> 5;
            int num3 = num & this._mask;

            for (DefaultJsonNameTable.Entry entry = this._entries[num3]; entry != null; entry = entry.Next)
            {
                if (entry.HashCode == num && DefaultJsonNameTable.TextEquals(entry.Value, key, start, length))
                {
                    return(entry.Value);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        // Token: 0x060009B6 RID: 2486 RVA: 0x0003DBE4 File Offset: 0x0003BDE4
        public string Add(string key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            int length = key.Length;

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

            for (int i = 0; i < key.Length; i++)
            {
                num += (num << 7 ^ (int)key[i]);
            }
            num -= num >> 17;
            num -= num >> 11;
            num -= num >> 5;
            for (DefaultJsonNameTable.Entry entry = this._entries[num & this._mask]; entry != null; entry = entry.Next)
            {
                if (entry.HashCode == num && entry.Value.Equals(key, StringComparison.Ordinal))
                {
                    return(entry.Value);
                }
            }
            return(this.AddEntry(key, num));
        }
Exemplo n.º 3
0
        public override string Get(char[] key, int start, int length)
        {
            if (length == 0)
            {
                return(string.Empty);
            }
            int num = length + DefaultJsonNameTable.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);
            int num2 = num & this._mask;

            for (DefaultJsonNameTable.Entry j = this._entries[num2]; j != null; j = j.Next)
            {
                if (j.HashCode == num && DefaultJsonNameTable.TextEquals(j.Value, key, start, length))
                {
                    return(j.Value);
                }
            }
            return(null);
        }
Exemplo n.º 4
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 + DefaultJsonNameTable.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 (DefaultJsonNameTable.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));
        }
Exemplo n.º 5
0
 internal Entry(string value, int hashCode, DefaultJsonNameTable.Entry next)
 {
     Class6.yDnXvgqzyB5jw();
     base();
     this.Value    = value;
     this.HashCode = hashCode;
     this.Next     = next;
 }
Exemplo n.º 6
0
        // Token: 0x060009B7 RID: 2487 RVA: 0x0003DCA8 File Offset: 0x0003BEA8
        private string AddEntry(string str, int hashCode)
        {
            int num = hashCode & this._mask;

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

            this._count = count + 1;
            if (count == this._mask)
            {
                this.Grow();
            }
            return(entry.Value);
        }
Exemplo n.º 7
0
        // Token: 0x060009B8 RID: 2488 RVA: 0x0003DD0C File Offset: 0x0003BF0C
        private void Grow()
        {
            DefaultJsonNameTable.Entry[] entries = this._entries;
            int num = this._mask * 2 + 1;

            DefaultJsonNameTable.Entry[] array = new DefaultJsonNameTable.Entry[num + 1];
            foreach (DefaultJsonNameTable.Entry entry in entries)
            {
                while (entry != null)
                {
                    int num2 = entry.HashCode & num;
                    DefaultJsonNameTable.Entry next = entry.Next;
                    entry.Next  = array[num2];
                    array[num2] = entry;
                    entry       = next;
                }
            }
            this._entries = array;
            this._mask    = num;
        }
Exemplo n.º 8
0
        private void Grow()
        {
            DefaultJsonNameTable.Entry   next       = null;
            DefaultJsonNameTable.Entry[] entryArray = this._entries;
            int num = this._mask * 2 + 1;

            DefaultJsonNameTable.Entry[] entryArray1 = new DefaultJsonNameTable.Entry[num + 1];
            for (int i = 0; i < (int)entryArray.Length; i++)
            {
                for (DefaultJsonNameTable.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;
        }
Exemplo n.º 9
0
 // Token: 0x06001780 RID: 6016 RVA: 0x00078348 File Offset: 0x00076548
 internal Entry(string value, int hashCode, DefaultJsonNameTable.Entry next)
 {
     this.Value    = value;
     this.HashCode = hashCode;
     this.Next     = next;
 }