public void ProcessData(IPackedFileDescriptor pfd, IPackageFile package, IPackedFile file, bool catchex) { changed = false; if (pfd == null) { return; } if (package == null) { return; } if (catchex) { try { if (file != null) { this.pfd = pfd; this.package = package; file = package.Read(pfd); System.IO.MemoryStream ms = new System.IO.MemoryStream(file.UncompressedData); if (ms.Length > 0) { Unserialize(new System.IO.BinaryReader(ms)); processed = true; } } else { ProcessData(pfd, package); } } catch (Exception ex) { ExceptionMessage(Localization.Manager.GetString("erropenfile"), ex); } } else { if (file != null) { this.pfd = pfd; this.package = package; file = package.Read(pfd); System.IO.MemoryStream ms = new System.IO.MemoryStream(file.UncompressedData); if (ms.Length > 0) { Unserialize(new System.IO.BinaryReader(ms)); processed = true; } } else { ProcessData(pfd, package); } } }
/// <summary> /// Extracts the Content of a Packed File and returs them as a MemoryStream /// </summary> /// <param name="pfd">The PackedFileDescriptor</param> /// <returns>The MemoryStream representing the PackedFile</returns> public System.IO.MemoryStream Extract(PackedFileDescriptor pfd) { IPackedFile pf = base.Read(pfd); return(new MemoryStream(pf.UncompressedData)); }
public void ProcessData(IPackedFileDescriptor pfd, IPackageFile package, IPackedFile file) { ProcessData(pfd, package, file, true); }
/// <summary> /// Returns the the name of the function with the given Opcode /// </summary> /// <param name="opcode">The opcode of the Instruction</param> /// <returns>The Alias of the Sim</returns> public string FindName(ushort opcode) { if (opcode >= 0x2000) { return("Unknown Semi Global"); } LoadPackage(); if (opcode >= 0x0100) { if (BasePackage == null) { return("Unknown Global"); } //IPackedFileDescriptor pfd = BasePackage.FindFile(Data.MetaData.BHAV_FILE, 0x0, 0x7FD46CD0, opcode); FileTable.FileIndex.Load(); SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = FileTable.FileIndex.FindFile(Data.MetaData.BHAV_FILE, 0x7FD46CD0, (ulong)opcode, null); foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item in items) { if (item.FileDescriptor != null) { byte[] data = new byte[0]; IPackedFile pf = item.Package.Read(item.FileDescriptor); if (pf.IsCompressed) { data = pf.Decompress(0x40); } else { data = pf.Data; } return(Helper.ToString(data)); } } return("Unknown Global"); } if (names == null) { LoadOpcodes(); } object o = null; if (opcode < names.Count) { o = names[opcode]; } if (o != null) { return((string)o); } else { return(Localization.Manager.GetString("unknown")); } }