Пример #1
0
        public override void Read(byte[] destination, int bytesToRead) //0x14
        {
            lock (StaticDiscFileData.Lock)
            {
                if (IsCustomDiscFile)
                {
                    DiscFile.Read(destination, bytesToRead);
                    return;
                }

                if (IsFromLooseFile && F24Offset < F32Size)
                {
                    var fileOffset = DiscFile.GetOffset();
                    var calcOffset = F24Offset + F16FileOffset;
                    if (fileOffset != calcOffset)
                    {
                        DiscFile.Seek(calcOffset, SeekOrigin.Begin);
                    }

                    long toRead = bytesToRead;
                    if (toRead > F32Size - F24Offset)
                    {
                        toRead = F32Size - F24Offset;
                    }

                    DiscFile.Read(destination, (int)toRead);

                    F24Offset += toRead;
                }
            }
        }
Пример #2
0
        public override void Seek(long destOffset, SeekOrigin type) // 0x1C
        {
            lock (StaticDiscFileData.Lock)
            {
                if (IsCustomDiscFile)
                {
                    DiscFile.Seek(destOffset, type);
                    return;
                }

                switch (type)
                {
                case SeekOrigin.Begin:
                    F24Offset = destOffset;
                    break;

                case SeekOrigin.Current:
                    F24Offset += destOffset;
                    break;

                case SeekOrigin.End:
                    F24Offset  = F32Size;
                    F24Offset += destOffset;
                    break;
                }
            }
        }