NScumm.Sword1.ResMan.OpenCptResourceLittleEndian C# (CSharp) Метод

OpenCptResourceLittleEndian() приватный Метод

private OpenCptResourceLittleEndian ( uint id ) : void
id uint
Результат void
        private void OpenCptResourceLittleEndian(uint id)
        {
            bool needByteSwap = false;
            if (_isBigEndian)
            {
                // Cluster files are in big endian fomat.
                // If the resource are not in memory anymore, and therefore will be read
                // from disk, they will need to be byte swaped.
                MemHandle memHandle = ResHandle(id);
                if (memHandle != null)
                    needByteSwap = (memHandle.cond == MemMan.MEM_FREED);
            }
            ResOpen(id);
            if (needByteSwap)
            {
                MemHandle handle = ResHandle(id);
                if (handle == null)
                    return;
                uint totSize = handle.size;
                var data = Header.Size;
                totSize -= Header.Size;
                if ((totSize & 3) != 0)
                    throw new InvalidOperationException($"Illegal compact size for id {id}: {totSize}");
                totSize /= 4;
                for (uint cnt = 0; cnt < totSize; cnt++)
                {
                    handle.data.WriteUInt32(data, handle.data.ToUInt32BigEndian(data));
                    data++;
                }
            }
        }