Esempio n. 1
0
        public override void storeChunk(Chunk_Base chunk)
        {
            if (chunk is IChunkSoup)
            {
                if (groupRoot != null)
                {
                    groupRoot.addChunk(chunk);
                }
                else
                {
                    Log.Write("WMO: MOGP sub-chunk found before the MOGP chunk? Darkness! Madness!");
                }
            }
            else
            {
                Chunks.Add(chunk);

                if (chunk is Chunk_MOGP)
                {
                    groupRoot = (Chunk_MOGP)chunk;
                }
            }
        }
Esempio n. 2
0
        public new void parse()
        {
            base.parse();

            if (isRoot)
            {
                // Check version
                Chunk_Base version = getChunksByID(Chunk_MVER.Magic).FirstOrDefault();

                if (version == null || !(version is Chunk_MVER))
                {
                    throw new WMOException("File is not a valid WMO file (missing version header).");
                }

                // WMOv4 required.
                if (((Chunk_MVER)version).fileVersion != 17)
                {
                    throw new WMOException("Unsupported WMO version!");
                }

                // Root file needs to be a root file.
                if (!Chunks.Any(c => c.ChunkID == Chunk_MOHD.Magic))
                {
                    throw new WMOException("File is not a valid WMO file (missing root header).");
                }

                // Parse all group files and import their chunks.
                foreach (WMOFile groupFile in groupFiles)
                {
                    groupFile.parse();
                    Chunks.AddRange(groupFile.getChunks().Where(c => c.ChunkID != Chunk_MVER.Magic));
                    groupFile.flush();
                }

                Log.Write("WMO: Root file loaded with {0} group file children.", groupFiles.Count);
            }
        }
Esempio n. 3
0
        public override void storeChunk(Chunk_Base chunk)
        {
            if (chunk is IChunkSoup)
            {
                if (groupRoot != null)
                    groupRoot.addChunk(chunk);
                else
                    Log.Write("WMO: MOGP sub-chunk found before the MOGP chunk? Darkness! Madness!");
            }
            else
            {
                Chunks.Add(chunk);

                if (chunk is Chunk_MOGP)
                    groupRoot = (Chunk_MOGP)chunk;
            }
        }
Esempio n. 4
0
        public override void storeChunk(Chunk_Base chunk)
        {
            if (chunk is IChunkSoup)
            {
                if (CurrentSub != null)
                    CurrentSub.addChunk(chunk);
                else
                    Log.Write("ADT: Sub-chunk found before MCNK chunk? Shun the demons!");
            }
            else
            {
                Chunks.Add(chunk);

                if (chunk is Chunk_MCNK)
                    CurrentSub = (Chunk_MCNK)chunk;
            }
        }
Esempio n. 5
0
 public abstract void storeChunk(Chunk_Base chunk);
Esempio n. 6
0
 public override void storeChunk(Chunk_Base chunk)
 {
     Chunks.Add(chunk);
 }