コード例 #1
0
        public void Add(KeyValuePair <uint, T> item)
        {
            var entry = new ResourceHashMapEntry <T>()
            {
                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;
            }
        }
コード例 #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.Unknown_4h  = reader.ReadUInt32();
            this.DataPointer = reader.ReadUInt64();
            this.NextPointer = reader.ReadUInt64();
            this.Unknown_18h = reader.ReadUInt32();
            this.Unknown_1Ch = reader.ReadUInt32();

            // read reference data
            this.Data = reader.ReadBlockAt <T>(
                this.DataPointer // offset
                );
            this.Next = reader.ReadBlockAt <ResourceHashMapEntry <T> >(
                this.NextPointer // offset
                );
        }