Beispiel #1
0
        /// <summary>
        /// Checks if psarc is not truncated
        /// </summary>
        /// <returns>The psarc size</returns>
        private long RequiredPsarcSize()
        {
            // get lastEntry.offset and it's size
            if (TableOfContent.Count > 0)
            {
                PsarcEntry lastEntry = TableOfContent.Last();
                return(lastEntry.Offset + lastEntry.BlockSizes.Sum());
            }

            return(header.TotalTableOfContentSize); // already read
        }
Beispiel #2
0
        /// <summary>
        /// Reads file names from the manifest
        /// </summary>
        private void ReadManifest()
        {
            PsarcEntry toc = TableOfContent.First();

            toc.Name = "NamesBlock.bin";

            //InflateEntry(toc);

            using StreamReader bReader = new(toc.Data, true);
            int count = TableOfContent.Count;

            string[] data = bReader.ReadToEnd().Split('\n'); //0x0A

            Parallel.For(0, data.Length, i =>
            {
                if (i + 1 != count)
                {
                    TableOfContent[i + 1].Name = data[i];
                }
            });

            // commented out to leave NamesXblock.bin for debugging
            // TableOfContent.RemoveAt(0);
        }
Beispiel #3
0
 public void AddEntry(PsarcEntry entry)
 {
     // important hierarchy
     TableOfContent.Add(entry);
     entry.Id = TableOfContent.Count - 1;
 }