Пример #1
0
 public TesCellGrid(TesFileReader fr) : base()
 {
     Y = new TesInt16(fr);
     X = new TesInt16(fr);
     OutputItems.Add(Y);
     OutputItems.Add(X);
 }
Пример #2
0
 public TesNPC(TesFileReader fr) : base(fr, false)
 {
     while (!fr.EOF)
     {
         Records.Add(new TesRecordNPC(fr.GetRecord()));
     }
 }
Пример #3
0
 public Tes3DPos(TesFileReader fr)
 {
     X = new TesFloat(fr);
     Y = new TesFloat(fr);
     Z = new TesFloat(fr);
     Initialize();
 }
Пример #4
0
 public TesRecordWorldspaceMain(TesFileReader fr) : base(fr, false)
 {
     while (!fr.EOF)
     {
         string id = fr.GetTypeID();
         if (id.Equals("CELL"))
         {
             Cell = new TesRecordCell(fr.GetCell());
             OutputItems.Add(Cell);
         }
         else if (id.Equals("GRUP"))
         {
             if (Blocks == null)
             {
                 Blocks = new TesList <TesCellBlock>();
                 OutputItems.Add(Blocks);
             }
             Blocks.Add(new TesCellBlock(fr.GetGroup()));
         }
         else
         {
             throw new Exception();
         }
     }
 }
Пример #5
0
 public TesRecordWorldspace(TesFileReader fr)
 {
     WRLD = new TesRecord(fr.GetRecord());
     Main = new TesRecordWorldspaceMain(fr.GetGroup());
     OutputItems.Add(WRLD);
     OutputItems.Add(Main);
 }
Пример #6
0
 public TesCellMainSub(TesFileReader fr) : base(fr, false)
 {
     while (!fr.EOF)
     {
         AddRecord(new TesRecord(fr.GetRecord()));
     }
 }
Пример #7
0
 public TesCellSubBlock(TesFileReader fr) : base(fr, false)
 {
     while (!fr.EOF)
     {
         Cells.Add(new TesRecordCell(fr.GetCell()));
     }
     OutputItems.Add(Cells);
 }
Пример #8
0
 public TesCellMain(TesFileReader fr) : base(fr, false)
 {
     while (!fr.EOF)
     {
         Subs.Add(new TesCellMainSub(fr.GetGroup()));
     }
     OutputItems.Add(Subs);
 }
Пример #9
0
 public TesCellBlock(TesFileReader fr) : base(fr, false)
 {
     while (!fr.EOF)
     {
         SubBlocks.Add(new TesCellSubBlock(fr.GetGroup()));
     }
     OutputItems.Add(SubBlocks);
 }
Пример #10
0
 public TesWorldspace(TesFileReader fr) : base(fr, false)
 {
     while (!fr.EOF)
     {
         Records.Add(new TesRecordWorldspace(fr.GetCell()));
     }
     OutputItems.Add(Records);
 }
Пример #11
0
            public TES4_HEDR(TesFileReader fr) : base(fr, false)
            {
                Version         = new TesFloat(fr);
                NumberOfRecords = new TesUInt32(fr);
                NextObjectID    = new TesUInt32(fr);

                Values.Add(Version);
                Values.Add(NumberOfRecords);
                Values.Add(NextObjectID);
            }
Пример #12
0
        public TesFileReader GetCopyReader(uint count, bool next = true)
        {
            TesFileReader result = new TesFileReader(br, pos, pos + count);

            if (next)
            {
                pos += count;
            }
            return(result);
        }
Пример #13
0
 public TesHeader(TesFileReader fr)
 {
     Signature           = new TesString(fr);
     DataSize            = new TesUInt32(fr);
     RecordFlags         = new TesUInt32(fr);
     FormID              = new TesUInt32(fr);
     VersionControlInfo1 = new TesUInt32(fr);
     FormVersion         = new TesUInt16(fr);
     VersionControlInfo2 = new TesUInt16(fr);
     Initialize();
 }
Пример #14
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);
            }
        }
Пример #15
0
 public TesTableStrings(string path)
 {
     fr       = new TesFileReader(path);
     count    = fr.GetUInt32();
     dataSize = fr.GetUInt32();
     for (int i = 0; i < count; i++)
     {
         de.Add(fr.GetUInt32(), fr.GetUInt32());
     }
     pos = fr.Position;
 }
Пример #16
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);
        }
Пример #17
0
        public TesFileReader GetRecord(bool next = true)
        {
            long          count  = GetUInt32(4, false) + 24;
            TesFileReader result = new TesFileReader(br, pos, pos + count);

            if (next)
            {
                pos += count;
            }

            return(result);
        }
Пример #18
0
        public TesFileReader GetField(bool next = true)
        {
            long          count  = GetUInt16(4, false) + 6;
            TesFileReader result = new TesFileReader(br, pos, pos + count);

            if (next)
            {
                pos += count;
            }

            return(result);
        }
Пример #19
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);
        }
Пример #20
0
        public override TesField ReadField(TesFileReader fr)
        {
            TesField result = base.ReadField(fr);

            if (result == null)
            {
                string id = fr.GetTypeID();
                switch (id)
                {
                case "HEDR":
                    HEDR   = new TES4_HEDR(fr.GetField());
                    result = HEDR;
                    break;
                }
            }

            return(result);
        }
Пример #21
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);
        }
Пример #22
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);
                    }
                }
            }
        }
Пример #23
0
        /// <summary>
        /// Cellは CELL レコードと、その直後のGRUPを範囲とする
        /// </summary>
        /// <param name="next"></param>
        /// <returns></returns>
        public TesFileReader GetCell(bool next = true)
        {
            //CELLレコードのサイズ
            long count = GetUInt32(4, false) + 24;

            //読込みサイズがファイルサイズと一致する場合、GRUPなし
            if (pos + count < len && GetTypeID(count).Equals("GRUP"))
            {
                //CELLレコード後のGROUPのサイズを加算
                count += GetUInt32(count + 4, false);
            }

            TesFileReader result = new TesFileReader(br, pos, pos + count);

            if (next)
            {
                pos += count;
            }

            return(result);
        }
Пример #24
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;
                }
            }
        }
Пример #25
0
 public TesRotation(TesFileReader fr)
 {
     X = fr.GetBytes(4);
     Y = fr.GetBytes(4);
     Z = fr.GetBytes(4);
 }
Пример #26
0
 public TesRecordNPC(TesFileReader fr) : base(fr, false)
 {
     OutputItems.Add(fr.GetBytes(Header.DataSize));
 }
Пример #27
0
 public TesUInt16(TesFileReader fr)
 {
     this.Value = fr.GetUInt16();
 }
Пример #28
0
 public TesFloat(TesFileReader fr)
 {
     this.Value = fr.GetFloat();
 }
Пример #29
0
 public TesTES4(TesFileReader fr) : base(fr)
 {
 }
Пример #30
0
 public TesString(TesFileReader fr)
 {
     this.Value            = fr.GetString(4);
     this.isNullTerminated = false;
 }