NScumm.Scumm.ScummEngine.LoadInfos C# (CSharp) Метод

LoadInfos() статический приватный Метод

static private LoadInfos ( BinaryReader reader ) : SaveStateMetaInfos
reader BinaryReader
Результат NScumm.Scumm.IO.SaveStateMetaInfos
        static SaveStateMetaInfos LoadInfos(BinaryReader reader)
        {
            var stuff = new SaveStateMetaInfos();
            var section = new SaveInfoSection();
            section.Type = ScummHelper.SwapBytes(reader.ReadUInt32());
            if (section.Type != ScummHelper.MakeTag('I', 'N', 'F', 'O'))
            {
                return null;
            }

            section.Version = ScummHelper.SwapBytes(reader.ReadUInt32());
            section.Size = ScummHelper.SwapBytes(reader.ReadUInt32());

            // If we ever extend this we should add a table containing the sizes corresponding to each
            // version, so that we are able to properly verify their correctness.
            if (section.Version == InfoSectionVersion && section.Size != SaveInfoSectionSize)
            {
                //warning("Info section is corrupt");
                reader.BaseStream.Seek(section.Size, SeekOrigin.Current);
                return null;
            }

            section.TimeTValue = ScummHelper.SwapBytes(reader.ReadUInt32());
            section.PlayTime = ScummHelper.SwapBytes(reader.ReadUInt32());

            // For header version 1, we load the data in with our old method
            if (section.Version == 1)
            {
                //time_t tmp = section.timeTValue;
                //tm *curTime = localtime(&tmp);
                //stuff->date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF;
                //stuff->time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF;
                stuff.Date = 0;
                stuff.Time = 0;
            }

            if (section.Version >= 2)
            {
                section.Date = ScummHelper.SwapBytes(reader.ReadUInt32());
                section.Time = ScummHelper.SwapBytes(reader.ReadUInt16());

                stuff.Date = section.Date;
                stuff.Time = section.Time;
            }

            stuff.PlayTime = section.PlayTime;

            // Skip over the remaining (unsupported) data
            if (section.Size > SaveInfoSectionSize)
                reader.BaseStream.Seek(section.Size - SaveInfoSectionSize, SeekOrigin.Current);

            return stuff;
        }
ScummEngine