コード例 #1
0
ファイル: PageInfo.cs プロジェクト: branan/PlasmaDotNet
        public void Read(hsStream s)
        {
            // Magically figure out what version we have...
            uint prpVer = s.ReadUInt();
            switch (prpVer) {
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                    s.Version = new plVersion(2, 0, 0, 0);
                    break;
                case 6:
                    s.Version = plVersion.MystOnline;
                    break;
                default:
                    // Must be some sort of Myst 5 variant...
                    s.Rewind();
                    prpVer = (uint)s.ReadUShort();
                    switch (prpVer) {
                        case 6:
                            s.Version = plVersion.EndOfAges;
                            break;
                        case 9:
                            s.Version = plVersion.HexIsle;
                            break;
                        default:
                            throw new plVersionException(prpVer);
                    }
                    break;
            }

            if (s.Version.IsPlasma21)
                IReadClassVersions(s);

            fLocation.Read(s);
            fAge = s.ReadSafeString();
            if (s.Version.IsPreMystOnline) fChapter = s.ReadSafeString();
            else if (s.Version.IsMystOnline) fChapter = "District";
            fPage = s.ReadSafeString();

            // Some more versioning stuff for Uru...
            if (s.Version.IsMystOnline)
                s.Version = new plVersion(2, 0, s.ReadUShort(), 0);
            else if (s.Version.IsPreMystOnline)
                s.Version = new plVersion(2, 0, s.ReadUShort(), s.ReadUShort());

            if (prpVer < 6) {
                if (prpVer < 5) // IndexChecksum -- deprecated...
                    s.ReadUInt();
                if (prpVer >= 2)
                    fReleaseVersion = s.ReadInt();
                if (prpVer >= 3)
                    fFlags = (Flags)s.ReadInt();
            }

            if (prpVer >= 4)
                fChecksum = s.ReadUInt();
            if (prpVer >= 5) {
                fDataStart = s.ReadUInt();
                fIndexStart = s.ReadUInt();
            } else {
                //prm/prx???
                fDataStart = 0;
                fIndexStart = s.ReadByte();
            }

            // Garbage
            if (s.Version.IsMystOnline)
                IReadClassVersions(s);
        }