コード例 #1
0
        /// <summary>
        /// Enumerates through the entry list and fires a callback for each entry.
        /// When the callback is fired, the SaveReader will be positioned 4 bytes from the start of the entry.
        /// </summary>
        /// <param name="reader">The SaveReader to read from</param>
        /// <param name="callback">The callback to call for each entry</param>
        public void EnumEntries(SaveIO.SaveReader reader, EnumEntriesCallback callback)
        {
            for (uint i = 0; i < _nextFree; i++)
            {
                long offset = _entryListStart + i * _entrySize;
                reader.Seek(offset, SeekOrigin.Begin);

                ushort salt       = reader.ReadUInt16();
                ushort flags      = reader.ReadUInt16();
                uint   datumIndex = ((uint)salt << 16) | i;
                bool   active     = (salt != 0);
                if (!callback(reader, active, datumIndex, flags, _entrySize, offset))
                {
                    break;
                }
            }
        }
コード例 #2
0
ファイル: XDBF.cs プロジェクト: XboxChaos/halosigner
 /// <summary>
 /// Scans through the entry table and calls a callback function for each entry.
 /// </summary>
 /// <param name="callback">The EnumEntriesCallback to call</param>
 public void EnumEntries(EnumEntriesCallback callback)
 {
     foreach (XDBFEntry entry in _entries)
     {
         callback(this, entry, _stream);
     }
 }