/// <summary> /// Add all Files that could be borrowed from the current package by the passed one, to the passed package /// </summary> /// <param name="orgmodelnames">List of available modelnames in this package</param> /// <param name="pkg">The package that should receive the Files</param> /// <remarks>Simply Copies MMAT, LIFO, TXTR and TXMT Files</remarks> public void AddParentFiles(string[] orgmodelnames, SimPe.Interfaces.Files.IPackageFile pkg) { if (WaitingScreen.Running) { WaitingScreen.UpdateMessage("Loading Parent Files"); } ArrayList names = new ArrayList(); foreach (string s in orgmodelnames) { names.Add(s); } ArrayList types = new ArrayList(); types.Add(Data.MetaData.MMAT); types.Add(Data.MetaData.TXMT); types.Add(Data.MetaData.TXTR); types.Add(Data.MetaData.LIFO); foreach (uint type in types) { SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(type); foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds) { if (pkg.FindFile(pfd) != null) { continue; } SimPe.Interfaces.Files.IPackedFile file = package.Read(pfd); pfd.UserData = file.UncompressedData; //Update the modeName in the MMAT if ((pfd.Type == Data.MetaData.MMAT) && (names.Count > 0)) { SimPe.Plugin.MmatWrapper mmat = new MmatWrapper(); mmat.ProcessData(pfd, package); string n = mmat.ModelName.Trim().ToLower(); if (!n.EndsWith("_cres")) { n += "_cres"; } if (!names.Contains(n)) { n = names[0].ToString(); //n = n.Substring(0, n.Length-5); mmat.ModelName = n; mmat.SynchronizeUserData(); } } pkg.Add(pfd); } } //foreach type }
//all covered by AbstractWrapper protected override string GetResourceName(Data.TypeAlias ta) { if (!SimPe.Helper.FileFormat) { return(base.GetResourceName(ta)); } SimPe.Interfaces.Files.IPackedFile pf = Package.Read(FileDescriptor); byte[] ab = pf.GetUncompressedData(0x42); return((ab.Length > 0x41 ? "0x" + Helper.HexString(ab[0x41]) + Helper.HexString(ab[0x40]) + ": " : "") + Helper.ToString(pf.GetUncompressedData(0x40))); }
/// <summary> /// Returns the 64 Character Long embedded Filename /// </summary> /// <param name="ta">The Current Type</param> /// <returns></returns> string GetEmbeddedFileName(Data.TypeAlias ta) { if (Package == null) { return(null); } if (FileDescriptor == null) { return(null); } if (ta.containsfilename) { SimPe.Interfaces.Files.IPackedFile pf = Package.Read(FileDescriptor); return(Helper.ToString(pf.GetUncompressedData(0x40))); } else { return(null); } }