Exemplo n.º 1
0
        public TesGroup(TesFileReader fr, bool readRecord = true)
        {
            GRUP     = new TesString(fr);
            DataSize = new TesUInt32(fr);
            OutputItems.Add(GRUP);
            OutputItems.Add(DataSize);

            //グループタイプ別
            uint type = fr.GetUInt32(4, false);

            switch (type)
            {
            case 0:
                Signature = new TesString(fr);
                OutputItems.Add(Signature);
                break;

            case 1:
            case 6:
            case 8:
            case 9:
                FormID = new TesUInt32(fr);
                OutputItems.Add(FormID);
                break;

            case 2:
            case 3:
                Index = new TesUInt32(fr);
                OutputItems.Add(Index);
                break;

            case 4:
            case 5:
                Grid = new TesCellGrid(fr);
                OutputItems.Add(Grid);
                break;

            default:
                throw new Exception();
            }
            GroupType = new TesUInt32(fr);
            Other     = new TesBytes(fr.GetBytes(8));
            OutputItems.Add(GroupType);
            OutputItems.Add(Other);

            if (readRecord)
            {
                while (!fr.EOF)
                {
                    Records.Add(new TesRecord(fr.GetRecord()));
                }
            }
            OutputItems.Add(Records);
        }
Exemplo n.º 2
0
        public TesRecordCell(TesFileReader fr) : base(fr, false)
        {
            CellInfo = new TesBytes(fr.GetBytes(Header.DataSize));
            OutputItems.Add(CellInfo);

            if (!fr.EOF)
            {
                CellMain = new TesCellMain(fr.GetGroup());
                OutputItems.Add(CellMain);
            }
        }
Exemplo n.º 3
0
        public TesField(TesFileReader fr, bool readValue = true)
        {
            Signature = new TesString(fr.GetString(4));
            DataSize  = new TesUInt16(fr);
            OutputItems.Add(Signature);
            OutputItems.Add(DataSize);

            if (readValue)
            {
                Values.Add(fr.GetBytes(DataSize.Value));
            }
            OutputItems.Add(Values);
        }
Exemplo n.º 4
0
        public virtual TesField ReadField(TesFileReader fr)
        {
            TesField result = null;

            string id = fr.GetTypeID();

            switch (id)
            {
            //ワールドデータ内にある"OFST"で、1箇所DataSizeが0になっており、以降のデータが書き出されている場所がある
            case "OFST":
                if (fr.GetInt16(4, false) == 0)
                {
                    result = new TesField(fr, false);
                    result.Values.Add(new TesBytes(fr.GetBytes(fr.Length - fr.Position)));
                }
                break;
            }
            return(result);
        }
Exemplo n.º 5
0
        public TesRecord(TesFileReader fr, bool readFiled = true)
        {
            Header = new TesHeader(fr);
            OutputItems.Add(Header);

            if (readFiled)
            {
                if (Header.Signature == "NAVM" || Header.Signature == "LAND")
                {
                    OutputItems.Add(new TesBytes(fr.GetBytes(Header.DataSize)));
                }
                else
                {
                    while (!fr.EOF)
                    {
                        TesField field = ReadField(fr) ?? new TesField(fr.GetField());
                        AddField(field);
                    }
                }
            }
        }
Exemplo n.º 6
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;
                }
            }
        }
Exemplo n.º 7
0
 public TesRecordNPC(TesFileReader fr) : base(fr, false)
 {
     OutputItems.Add(fr.GetBytes(Header.DataSize));
 }
Exemplo n.º 8
0
 public TesRotation(TesFileReader fr)
 {
     X = fr.GetBytes(4);
     Y = fr.GetBytes(4);
     Z = fr.GetBytes(4);
 }