public string GetString(long count, long offset = 0, bool next = true) { TesBytes b = GetBytes(count, offset, next); string result = b.ToString(); return(result); }
public TesRotation(int x, int y, int z) { X = IntToByte(x); Y = IntToByte(y); Z = IntToByte(z); Initialize(); }
public void Overwrite(ITesBase bytes, int pos = 0) { TesBytes b = bytes.ToBytes(); this.RemoveRange(pos, b.Count); this.InsertRange(pos, b); }
public TesRotation(TesBytes x, TesBytes y, TesBytes z) { X = x; Y = y; Z = z; Initialize(); }
public TesBytes this[int index] { get { TesBytes result = (TesBytes)Values[index]; return(result); } }
public ushort GetUInt16(long offset = 0, bool next = true) { long count = 2; TesBytes b = GetBytes(count, offset, next); ushort result = b.ToUInt16(); return(result); }
public uint GetUInt32(long offset = 0, bool next = true) { long count = 4; TesBytes b = GetBytes(count, offset, next); uint result = b.ToUInt32(); return(result); }
public float GetFloat(long offset = 0, bool next = true) { long count = 4; TesBytes b = GetBytes(count, offset, next); float result = b.ToFloat(); return(result); }
public TesString(TesBytes value) { if (value[value.Count() - 1] == 0x00) { isNullTerminated = true; } this.Value = value.ToString(); }
public TesBytes ToBytes() { TesBytes result = new TesBytes(); foreach (var x in this) { result.AddRange(x.ToBytes()); } return(result); }
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); }
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); }
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); } }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
public TesRotation(TesFileReader fr) { X = fr.GetBytes(4); Y = fr.GetBytes(4); Z = fr.GetBytes(4); }
public TesBytes(TesBytes value) { this.AddRange(value); }
public TesBytes ToBytes() { TesBytes result = new TesBytes(Value, isNullTerminated); return(result); }
public TesBytes ToBytes() { TesBytes result = new TesBytes(Value); return(result); }