Exemplo n.º 1
0
        public void Add(KeyValuePair <uint, uint> item)
        {
            var entry = new HashMapEntry()
            {
                Hash        = item.Key,
                Data        = item.Value,
                Next        = null,
                NextPointer = 0,
            };

            var bucket = (int)(entry.Hash % BucketsCount);

            if (Buckets[bucket] == null)
            {
                Buckets[bucket] = entry;
            }
            else
            {
                var current = Buckets[bucket];

                while (current.Next != null)
                {
                    current = current.Next;
                }

                current.Next = entry;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads the data-block from a stream.
        /// </summary>
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            // read structure data
            this.Hash        = reader.ReadUInt32();
            this.Data        = reader.ReadUInt32();
            this.NextPointer = reader.ReadUInt64();

            // read reference data
            this.Next = reader.ReadBlockAt <HashMapEntry>(
                this.NextPointer // offset
                );
        }