コード例 #1
0
        public string GetString(long count, long offset = 0, bool next = true)
        {
            TesBytes b      = GetBytes(count, offset, next);
            string   result = b.ToString();

            return(result);
        }
コード例 #2
0
 public TesRotation(int x, int y, int z)
 {
     X = IntToByte(x);
     Y = IntToByte(y);
     Z = IntToByte(z);
     Initialize();
 }
コード例 #3
0
        public void Overwrite(ITesBase bytes, int pos = 0)
        {
            TesBytes b = bytes.ToBytes();

            this.RemoveRange(pos, b.Count);
            this.InsertRange(pos, b);
        }
コード例 #4
0
 public TesRotation(TesBytes x, TesBytes y, TesBytes z)
 {
     X = x;
     Y = y;
     Z = z;
     Initialize();
 }
コード例 #5
0
 public TesBytes this[int index]
 {
     get
     {
         TesBytes result = (TesBytes)Values[index];
         return(result);
     }
 }
コード例 #6
0
        public ushort GetUInt16(long offset = 0, bool next = true)
        {
            long     count  = 2;
            TesBytes b      = GetBytes(count, offset, next);
            ushort   result = b.ToUInt16();

            return(result);
        }
コード例 #7
0
        public uint GetUInt32(long offset = 0, bool next = true)
        {
            long     count  = 4;
            TesBytes b      = GetBytes(count, offset, next);
            uint     result = b.ToUInt32();

            return(result);
        }
コード例 #8
0
        public float GetFloat(long offset = 0, bool next = true)
        {
            long     count  = 4;
            TesBytes b      = GetBytes(count, offset, next);
            float    result = b.ToFloat();

            return(result);
        }
コード例 #9
0
        public TesString(TesBytes value)
        {
            if (value[value.Count() - 1] == 0x00)
            {
                isNullTerminated = true;
            }

            this.Value = value.ToString();
        }
コード例 #10
0
        public TesBytes ToBytes()
        {
            TesBytes result = new TesBytes();

            foreach (var x in this)
            {
                result.AddRange(x.ToBytes());
            }
            return(result);
        }
コード例 #11
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);
        }
コード例 #12
0
        public TesBytes GetOffset(long offset, long count)
        {
            if (Int32.MaxValue < offset + count)
            {
                throw new Exception();
            }

            TesBytes result = new TesBytes(this.GetRange((int)offset, (int)count).ToArray());

            return(result);
        }
コード例 #13
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);
            }
        }
コード例 #14
0
                public Property()
                {
                    PropertyNameDataSize = new TesUInt16(0);
                    PropertyName         = new TesString("");
                    Type          = new TesBytes(new byte[] { 0x01, 0x01, 0x00, 0x00, 0xff, 0xff });
                    PropertyValue = new TesBytes();

                    OutputItems.Add(PropertyNameDataSize);
                    OutputItems.Add(PropertyName);
                    OutputItems.Add(Type);
                    OutputItems.Add(PropertyValue);
                }
コード例 #15
0
            public Script()
            {
                ScriptNameDataSize = new TesUInt16(0);
                ScriptName         = new TesString("");
                Flags         = new TesBytes(new byte[] { 0x01 });
                PropertyCount = new TesUInt16(0);

                OutputItems.Add(ScriptNameDataSize);
                OutputItems.Add(ScriptName);
                OutputItems.Add(Flags);
                OutputItems.Add(PropertyCount);
                OutputItems.Add(Propertys);
            }
コード例 #16
0
        public static int ByteToInt(TesBytes bytes)
        {
            int result = 0;

            if (bytes.SequenceEqual(new byte[] { 0xdb, 0x0f, 0xc9, 0x3f }))
            {
                result = 90;
            }
            else if (bytes.SequenceEqual(new byte[] { 0xdb, 0x0f, 0x49, 0x40 }))
            {
                result = 180;
            }
            else if (bytes.SequenceEqual(new byte[] { 0xdb, 0x0f, 0xc9, 0xbf }))
            {
                result = 270;
            }
            return(result);
        }
コード例 #17
0
        public TesBytes GetBytes(long count, long offset = 0, bool next = true)
        {
            if (len < pos + count + offset)
            {
                throw new Exception();
            }

            TesBytes result = Read(offset + count, next);

            if (0 < offset)
            {
                result = result.GetOffset(offset, count);
            }

            if (next)
            {
                pos += count;
            }

            return(result);
        }
コード例 #18
0
        private TesBytes Read(long count, bool next)
        {
            if (pos != br.BaseStream.Position)
            {
                br.BaseStream.Seek(pos, SeekOrigin.Begin);
            }

            if (Int32.MaxValue < count)
            {
                throw new Exception();
            }

            TesBytes result = new TesBytes(br.ReadBytes((int)count));

            if (!next)
            {
                br.BaseStream.Seek(-count, SeekOrigin.Current);
            }

            return(result);
        }
コード例 #19
0
        public string GetNullTerminatedString(long pos)
        {
            this.pos = pos;
            if (pos != br.BaseStream.Position)
            {
                br.BaseStream.Seek(pos, SeekOrigin.Begin);
            }

            TesBytes bytes = new TesBytes();
            byte     b;

            do
            {
                b = br.ReadByte();
                bytes.Add(b);
                ++pos;
            }while (b != 0x00 && pos < len);

            string result = bytes.ToString();

            return(result);
        }
コード例 #20
0
        public static TesBytes IntToByte(int value)
        {
            TesBytes result = null;

            switch (value)
            {
            case 90:
                result = new TesBytes(new byte[] { 0xdb, 0x0f, 0xc9, 0x3f });
                break;

            case 180:
                result = new TesBytes(new byte[] { 0xdb, 0x0f, 0x49, 0x40 });
                break;

            case 270:
                result = new TesBytes(new byte[] { 0xdb, 0x0f, 0xc9, 0xbf });
                break;

            default:
                result = new TesBytes(new byte[] { 0x00, 0x00, 0x00, 0x00 });
                break;
            }
            return(result);
        }
コード例 #21
0
 public TesRotation(TesFileReader fr)
 {
     X = fr.GetBytes(4);
     Y = fr.GetBytes(4);
     Z = fr.GetBytes(4);
 }
コード例 #22
0
 public TesBytes(TesBytes value)
 {
     this.AddRange(value);
 }
コード例 #23
0
        public TesBytes ToBytes()
        {
            TesBytes result = new TesBytes(Value, isNullTerminated);

            return(result);
        }
コード例 #24
0
        public TesBytes ToBytes()
        {
            TesBytes result = new TesBytes(Value);

            return(result);
        }