public LazyLoadedPatchedByteArray(FFTPack.Files file, long offset) : this((int)file, offset) { SectorEnum = file; }
public PatchedByteArray(FFTPack.Files file, long offset, byte[] bytes) : this((int)file, offset, bytes) { SectorEnum = file; }
public KnownPosition(FFTPack.Files sector, int startLocation, int length) : this((Enum)sector, startLocation, length) { FFTPack = sector; }
private static FileInfo GetFileInfo(Context context, XmlNode node) { string displayName = node.SelectSingleNode("DisplayName").InnerText; Guid guid = new Guid(node.SelectSingleNode("Guid").InnerText); int size = Int32.Parse(node.SelectSingleNode("Size").InnerText); FileType filetype = (FileType)Enum.Parse(typeof(FileType), node.Name); int sectionCount = Int32.Parse(node.SelectSingleNode("Sections/@count").InnerText); int[] sectionLengths = new int[sectionCount]; bool[] dteAllowed = new bool[sectionCount]; bool[] compressionAllowed = new bool[sectionCount]; for (int i = 0; i < sectionCount; i++) { XmlNode sectionNode = node.SelectSingleNode(string.Format("Sections/Section[@value='{0}']", i)); sectionLengths[i] = Int32.Parse(sectionNode.Attributes["entries"].InnerText); dteAllowed[i] = Boolean.Parse(sectionNode.Attributes["dte"].InnerText); if (filetype == FileType.CompressedFile) { compressionAllowed[i] = Boolean.Parse(sectionNode.Attributes["compressible"].InnerText); } } XmlNodeList sectors = node.SelectNodes("Sectors/*"); Dictionary <SectorType, IList <KeyValuePair <Enum, int> > > dict = new Dictionary <SectorType, IList <KeyValuePair <Enum, int> > >(3); bool first = true; IList <byte> bytes = null; KeyValuePair <Enum, int> primaryFile = new KeyValuePair <Enum, int>(); foreach (XmlNode sectorNode in sectors) { SectorType sectorType = (SectorType)Enum.Parse(typeof(SectorType), sectorNode.Name); if (!dict.ContainsKey(sectorType)) { dict.Add(sectorType, new List <KeyValuePair <Enum, int> >()); } int offset = Int32.Parse(sectorNode.Attributes["offset"].InnerText); Enum fileEnum = null; switch (sectorType) { case SectorType.BootBin: dict[sectorType].Add(new KeyValuePair <Enum, int>(PatcherLib.Iso.PspIso.Sectors.PSP_GAME_SYSDIR_BOOT_BIN, offset)); dict[sectorType].Add(new KeyValuePair <Enum, int>(PatcherLib.Iso.PspIso.Sectors.PSP_GAME_SYSDIR_EBOOT_BIN, offset)); fileEnum = PatcherLib.Iso.PspIso.Sectors.PSP_GAME_SYSDIR_BOOT_BIN; break; case SectorType.FFTPack: FFTPack.Files fftPackFile = (FFTPack.Files)Enum.Parse(typeof(FFTPack.Files), sectorNode.SelectSingleNode("@index").InnerText); dict[sectorType].Add(new KeyValuePair <Enum, int>(fftPackFile, offset)); fileEnum = fftPackFile; break; case SectorType.Sector: PatcherLib.Iso.PsxIso.Sectors file = (PatcherLib.Iso.PsxIso.Sectors)Enum.Parse(typeof(PatcherLib.Iso.PsxIso.Sectors), sectorNode.SelectSingleNode("@filename").InnerText); dict[sectorType].Add(new KeyValuePair <Enum, int>(file, offset)); fileEnum = file; break; } if (first) { //bytes = reader( iso, fileEnum, offset, size ); primaryFile = new KeyValuePair <Enum, int>(fileEnum, offset); first = false; } } IList <IList <string> > entryNames = GetEntryNames(node.SelectSingleNode("Sections"), node.SelectSingleNode("//Templates")); IList <string> sectionNames = GetSectionNames(node.SelectSingleNode("Sections")); IList <IList <int> > disallowedEntries; IList <IDictionary <int, string> > staticEntries; GetDisallowedEntries(node, sectionLengths.Length, out disallowedEntries, out staticEntries); FileInfo fi = new FileInfo { Context = context, DisplayName = displayName, DisallowedEntries = disallowedEntries.AsReadOnly(), StaticEntries = staticEntries.AsReadOnly(), EntryNames = entryNames.AsReadOnly(), FileType = filetype, Guid = guid, SectionLengths = sectionLengths.AsReadOnly(), Sectors = new ReadOnlyDictionary <SectorType, IList <KeyValuePair <Enum, int> > >(dict), SectionNames = sectionNames, Size = size, PrimaryFile = primaryFile, CompressionAllowed = compressionAllowed, DteAllowed = dteAllowed }; return(fi); }
public static byte[] GetFile(Stream stream, PspIsoInfo info, FFTPack.Files file) { return(FFTPack.GetFileFromIso(stream, info, file)); }
public static byte[] GetFile(Stream stream, PspIsoInfo info, FFTPack.Files file, int start, int length) { return(FFTPack.GetFileFromIso(stream, info, file, start, length)); }
public static IList <byte> GetFile(Stream stream, PspIsoInfo info, FFTPack.Files file, int start, int length) { byte[] result = FFTPack.GetFileFromIso(stream, info, file); return(result.Sub(start, start + length - 1)); }
public static string GetModifiedFileName(FFTPack.Files file) { return(ISOHelper.GetModifiedPathName(GetFileName(file))); }
public static string GetFileName(FFTPack.Files file) { string name = Enum.GetName(typeof(FFTPack.Files), file); return(name ?? "FFTPACK.BIN (" + ((int)file).ToString() + ")"); }