コード例 #1
0
        public TesFile(string path, List <string> idList = null)
        {
            TesFileReader fr = new TesFileReader(path);

            TES4 = new TesTES4(fr.GetRecord());
            OutputItems.Add(TES4);

            string id = null;

            while (!fr.EOF)
            {
                id = fr.GetTypeID(8);

                if (idList != null && !idList.Contains(id))
                {
                    fr.Seek(fr.GetUInt32(4, false));
                    continue;
                }

                switch (id)
                {
                case "NPC_":
                    TesNPC npc_ = new TesNPC(fr.GetGroup());
                    OutputItems.Add(npc_);
                    Groups.Add(id, npc_);
                    break;

                case "CELL":
                    TesCell cell = new TesCell(fr.GetGroup());
                    OutputItems.Add(cell);
                    Groups.Add(id, cell);
                    break;

                case "WRLD":
                    TesWorldspace wrld = new TesWorldspace(fr.GetGroup());
                    OutputItems.Add(wrld);
                    Groups.Add(id, wrld);
                    break;

                case "DIAL":
                    OutputItems.Add(new TesBytes(fr.GetBytes(fr.GetUInt32(4, false))));
                    break;

                case "HAZD":
                    string id2 = fr.GetTypeID(24);
                    if (id2.Equals("HAZD"))
                    {
                        OutputItems.Add(new TesBytes(fr.GetBytes(fr.GetUInt32(4, false))));
                    }
                    else if (id2.Equals("GRUP"))
                    {
                        OutputItems.Add(new TesBytes(fr.GetBytes(fr.GetUInt32(4, false))));
                    }
                    break;

                default:
                    TesGroup grup = new TesGroup(fr.GetGroup());
                    OutputItems.Add(grup);
                    Groups.Add(id, grup);
                    break;
                }
            }
        }