public static void Handle_ttex(TBinary _toshi, TFile _file, BinaryReader _reader, string _path) { // TODO: Figure out more of the header _reader.BaseStream.Seek(48, SeekOrigin.Begin); string _ttexName = _reader.ReadStringNT(); while (_reader.PeekByte() == 0x00) { _reader.BaseStream.Seek(1, SeekOrigin.Current); } _reader.BaseStream.Seek(24, SeekOrigin.Current); File.WriteAllBytes(_path + "\\" + _ttexName, _reader.ReadBytes((int)(_file.Length - _reader.BaseStream.Position))); }
public void DumpFiles(string _path) { if (Directory.Exists(_path) == false) { Directory.CreateDirectory(_path); } for (int i = 0; i < this.Files.Count; i++) { TFile _toshiFile = this.Files[i]; this.Reader.BaseStream.Seek(_toshiFile.Origin + _toshiFile.Offset, SeekOrigin.Begin); using (BinaryReader _fileReader = new BinaryReader(new MemoryStream(this.Reader.ReadBytes(_toshiFile.Length)))) { MethodInfo _fileHandler = Assembly.GetExecutingAssembly().GetType("trb_explorer.FileHandler").GetMethod("Handle_" + _toshiFile.Symbol.Name); if (_fileHandler != null) { _fileHandler.Invoke(null, new object[] { this, _toshiFile, _fileReader, _path }); } else { FileHandler.Handle_Unknown(this, _toshiFile, _fileReader, _path); } } } }
public static void Handle_Unknown(TBinary _toshi, TFile _file, BinaryReader _reader, string _path) { File.WriteAllBytes(_path + "\\" + _toshi.Name + "_asset" + _file.Symbol.Index + "." + _file.Symbol.Name, _reader.ReadBytes(_file.Length)); }