/* Get the offsets, lengths, and filenames of all the files */ public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the number of files */ uint files = data.ReadUInt(0x0); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* Now we can get the file offsets, lengths, and filenames */ for (uint i = 0; i < files; i++) { fileList.Entries[i] = new ArchiveFileList.Entry( data.ReadUInt(0x4 + (i * 0x2C)), // Offset data.ReadUInt(0x8 + (i * 0x2C)), // Length data.ReadString(0xC + (i * 0x2C), 36) // Filename ); } return fileList; } catch { return null; } }
/* Get the offsets, lengths, and filenames of all the files */ public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the number of files */ uint files = data.ReadUInt(0x4); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* Now we can get the file offsets, lengths, and filenames */ for (uint i = 0; i < files; i++) { /* Get filename and extension */ string filename = data.ReadString(0x20 + (i * 0x30), 32, Encoding.GetEncoding("Shift_JIS")); // Name string fileext = data.ReadString(0x10 + (i * 0x30), 4); // Extension fileList.Entries[i] = new ArchiveFileList.Entry( data.ReadUInt(0x14 + (i * 0x30)), // Offset data.ReadUInt(0x18 + (i * 0x30)), // Length (filename == String.Empty ? String.Empty : filename) + (fileext == string.Empty ? string.Empty : '.' + fileext) // Filename ); } return fileList; } catch { /* Something went wrong, so return nothing */ return null; } }
/* Get the offsets, lengths, and filenames of all the files */ public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the number of files */ uint files = data.ReadUInt(0x4); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* Find the metadata location */ uint metadataLocation = data.ReadUInt((files * 0x8) + 0x8); if (metadataLocation == 0x0) metadataLocation = data.ReadUInt(data.ReadUInt(0x8) - 0x8); /* Now we can get the file offsets, lengths, and filenames */ for (uint i = 0; i < files; i++) { fileList.Entries[i] = new ArchiveFileList.Entry( data.ReadUInt(0x8 + (i * 0x8)), // Offset data.ReadUInt(0xC + (i * 0x8)), // Length (metadataLocation == 0x0 ? String.Empty : data.ReadString(metadataLocation + (i * 0x30), 32)) // Filename ); } return fileList; } catch { /* Something went wrong, so return nothing */ return null; } }
/* Get the offsets, lengths, and filenames of all the files */ public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the number of files */ uint files = data.ReadUInt(0x4).SwapEndian(); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* Now we can get the file offsets, lengths, and filenames */ for (uint i = 0; i < files; i++) { string filename = data.ReadString(0x10 + (i * 0x28), 32); fileList.Entries[i] = new ArchiveFileList.Entry( data.ReadUInt(0x08 + (i * 0x28)).SwapEndian(), // Offset data.ReadUInt(0x0C + (i * 0x28)).SwapEndian(), // Length (filename == String.Empty ? String.Empty : filename + (filename.IsAllUpperCase() ? ".GVR" : ".gvr")) // Filename ); } return fileList; } catch { /* Something went wrong, so return nothing */ return null; } }
/* Get the offsets, lengths, and filenames of all the files */ public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the number of files */ ushort files = data.ReadUShort(0x0); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* Now we can get the file offsets, lengths, and filenames */ for (int i = 0; i < files; i++) { /* Get the filename */ string filename = data.ReadString(0xA + (i * 0x24), 28); fileList.Entries[i] = new ArchiveFileList.Entry( data.ReadUInt(0x2 + (i * 0x24)), // Offset data.ReadUInt(0x6 + (i * 0x24)), // Length (filename == String.Empty ? String.Empty : filename + (filename.IsAllUpperCase() ? ".PVR" : ".pvr")) // Filename ); } return fileList; } catch { /* Something went wrong, so return nothing */ return null; } }
private void populateList(ArchiveFileList fileList) { /* Erase the current list */ fileListView.Items.Clear(); /* Make sure the file list contains entries */ if (fileList == null || fileList.Entries.Length == 0) return; /* If we are not at the base level, we need to add some extra crap */ if (level > 0) { /* Add the Parent Archive link */ ListViewItem item = new ListViewItem(new string[] { "..", "Parent Archive", null, }); item.Font = new Font(SystemFonts.DialogFont.FontFamily.Name, SystemFonts.DialogFont.Size, FontStyle.Bold); fileListView.Items.Add(item); } for (int i = 0; i < fileList.Entries.Length; i++) { /* Add the file information */ ListViewItem item = new ListViewItem(new string[] { (i + 1).ToString("#,0"), (fileList.Entries[i].Filename == String.Empty ? " -- No Filename -- " : fileList.Entries[i].Filename), String.Format("{0} ({1} bytes)", FormatFileSize(fileList.Entries[i].Length), fileList.Entries[i].Length.ToString("#,0")), }); fileListView.Items.Add(item); } }
/* Get the offsets, lengths, and filenames of all the files */ public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the offset of each section of the NARC file */ uint offset_fatb = data.ReadUShort(0xC); uint offset_fntb = offset_fatb + data.ReadUInt(offset_fatb + 0x4); uint offset_fimg = offset_fntb + data.ReadUInt(offset_fntb + 0x4); /* Stuff for filenames */ bool containsFilenames = (data.ReadUInt(offset_fntb + 0x8) == 8); uint offset_filename = offset_fntb + 0x10; /* Get the number of files */ uint files = data.ReadUInt(offset_fatb + 0x8); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* Now we can get the file offsets, lengths, and filenames */ for (uint i = 0; i < files; i++) { /* Get the offset & length */ uint offset = data.ReadUInt(offset_fatb + 0x0C + (i * 0x8)); uint length = data.ReadUInt(offset_fatb + 0x10 + (i * 0x8)) - offset; /* Get the filename, if the NARC contains filenames */ string filename = String.Empty; if (containsFilenames) { /* Ok, since the NARC contains filenames, let's go grab it now */ byte filename_length = data.ReadByte(offset_filename); filename = data.ReadString(offset_filename + 1, filename_length); offset_filename += (uint)(filename_length + 1); } fileList.Entries[i] = new ArchiveFileList.Entry( offset + offset_fimg + 0x8, // Offset length, // Length filename // Filename ); } return fileList; } catch { /* Something went wrong, so return nothing */ return null; } }
// Get file list containing the entries in the archive public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the number of files */ uint files = data.ReadUInt(0x4).SwapEndian(); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* See if the archive contains filenames */ bool containsFilenames = (files > 0 && data.ReadUInt(0x8) != 0x8 + (files * 0x8) && data.ReadString(0x8 + (files * 0x8), 4) == "FLST"); /* Now we can get the file offsets, lengths, and filenames */ for (int i = 0; i < files; i++) { fileList.Entries[i] = new ArchiveFileList.Entry( data.ReadUInt(0x8 + (i * 0x8)).SwapEndian(), // Offset data.ReadUInt(0xC + (i * 0x8)).SwapEndian(), // Length (containsFilenames ? data.ReadString(0xC + (files * 0x8) + (i * 0x40), 64) : string.Empty) // Filename ); } return fileList; } catch { /* Something went wrong, so return nothing */ return null; } }
/* Get the offsets, lengths, and filenames of all the files */ public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the number of files */ uint files = data.ReadUInt(0x0); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* Now we can get the file offsets, lengths, and filenames */ for (int i = 0; i < files; i++) { fileList.Entries[i] = new ArchiveFileList.Entry( data.ReadUInt(0x14 + (i * 0x18)) * 0x800, // Offset data.ReadUInt(0x18 + (i * 0x18)), // Length data.ReadString(0x04 + (i * 0x18), 16) // Filename ); } return fileList; } catch { /* Something went wrong, so return nothing */ return null; } }
/* Get the offsets, lengths, and filenames of all the files */ public override ArchiveFileList GetFileList(ref Stream data) { try { /* Get the number of files */ uint files = data.ReadUInt(0x30); /* Create the array of files now */ ArchiveFileList fileList = new ArchiveFileList(files); /* See if the archive contains filenames */ bool containsFilenames = (files > 0 && data.ReadUInt(0x3C + (files * 0x14)) + 0x20 != 0x3C + (files * 0x1C) && data.ReadString(0x3C + (files * 0x1C), 4) == "FLST"); /* Now we can get the file offsets, lengths, and filenames */ for (uint i = 0; i < files; i++) { /* Get the offset & length */ uint offset = data.ReadUInt(0x40 + (files * 0x14) + (i * 0x8)) + 0x20; uint length = data.ReadUInt(0x3C + (files * 0x14) + (i * 0x8)); /* Check for filenames */ string filename = String.Empty; if (containsFilenames) filename = data.ReadString(0x40 + (files * 0x1C) + (i * 0x40), 64); /* GIM files can also contain their original filename in the footer */ if (filename == string.Empty && length > 40 && data.ReadString(offset, 12, false) == GraphicHeader.MIG) { uint filenameOffset = data.ReadUInt(offset + 0x24) + 0x30; if (filenameOffset < length) filename = Path.GetFileNameWithoutExtension(data.ReadString(offset + filenameOffset, (int)(length - filenameOffset))); if (filename != String.Empty) filename += (filename.IsAllUpperCase() ? ".GIM" : ".gim"); } fileList.Entries[i] = new ArchiveFileList.Entry( offset, // Offset length, // Length filename // Filename ); } return fileList; } catch { /* Something went wrong, so return nothing */ return null; } }