Esempio n. 1
0
        private string GetDebugInfoVersion16(NefsItem item, Nefs16Header h, NefsItemList items)
        {
            var p1         = h.Part1.EntriesByGuid[item.Guid];
            var p2         = h.Part2.EntriesByIndex[(int)p1.IndexPart2];
            var p6         = h.Part6.EntriesByGuid[item.Guid];
            var p7         = h.Part7.EntriesByIndex[(int)p1.IndexPart2];
            var numChunks  = h.TableOfContents.ComputeNumChunks(p2.ExtractedSize);
            var chunkSize  = h.TableOfContents.BlockSize;
            var attributes = p6.CreateAttributes();

            return($@"Item Info
-----------------------------------------------------------
Item name:                  {item.FileName}
Item path:                  {items.GetItemFilePath(item.Id)}

Part 1
-----------------------------------------------------------
Offset to data:             {p1.OffsetToData.ToString("X")}
Index in part 2:            {p1.IndexPart2.ToString("X")}
Index in part 4:            {p1.IndexPart4.ToString("X")}
Id:                         {p1.Id.Value.ToString("X")}

Part 2
-----------------------------------------------------------
Directory id:               {p2.DirectoryId.Value.ToString("X")}
First child id:             {p2.FirstChildId.Value.ToString("X")}
Offset in part 3:           {p2.OffsetIntoPart3.ToString("X")}
Extracted size:             {p2.ExtractedSize.ToString("X")}
Id:                         {p2.Id.Value.ToString("X")}

Part 4
-----------------------------------------------------------
Chunks                      {this.PrintChunkSizesToString(h.Part4.CreateChunksList(p1.IndexPart4, numChunks, chunkSize, h.Intro.GetAesKey()))}

Part 6
-----------------------------------------------------------
0x00:                       {p6.Volume.ToString("X")}
0x02:                       {((byte)p6.Flags).ToString("X")}
0x03:                       {p6.Unknown0x3.ToString("X")}

IsTransformed:              {attributes.V16IsTransformed}
IsDirectory:                {attributes.IsDirectory}
IsDuplicated:               {attributes.IsDuplicated}
IsCacheable:                {attributes.IsCacheable}
Unknown 0x10:               {attributes.V16Unknown0x10}
IsPatched:                  {attributes.IsPatched}
Unknown 0x40:               {attributes.V16Unknown0x40}
Unknown 0x80:               {attributes.V16Unknown0x80}

Part 7
-----------------------------------------------------------
Sibling id:                 {p7.SiblingId.Value.ToString("X")}
Item id:                    {p7.Id.Value.ToString("X")}
");
        }
        private string GetDebugInfoVersion16(Nefs16Header h, NefsArchiveSource source)
        {
            var headerPart1String = new StringBuilder();

            foreach (var entry in h.Part1.EntriesByIndex)
            {
                headerPart1String.Append($"0x{entry.OffsetToData.ToString("X")}".PadRight(20));
                headerPart1String.Append($"0x{entry.IndexPart2.ToString("X")}".PadRight(20));
                headerPart1String.Append($"0x{entry.IndexPart4.ToString("X")}".PadRight(20));
                headerPart1String.Append($"0x{entry.Id.Value.ToString("X")}".PadRight(20));
                headerPart1String.Append("\n");
            }

            var headerPart2String = new StringBuilder();

            foreach (var entry in h.Part2.EntriesByIndex)
            {
                headerPart2String.Append($"0x{entry.DirectoryId.Value.ToString("X")}".PadRight(20));
                headerPart2String.Append($"0x{entry.FirstChildId.Value.ToString("X")}".PadRight(20));
                headerPart2String.Append($"0x{entry.OffsetIntoPart3.ToString("X")}".PadRight(20));
                headerPart2String.Append($"0x{entry.ExtractedSize.ToString("X")}".PadRight(20));
                headerPart2String.Append($"0x{entry.Id.Value.ToString("X")}".PadRight(20));
                headerPart2String.Append("\n");
            }

            var headerPart3String = new StringBuilder();

            foreach (var s in h.Part3.FileNames)
            {
                headerPart3String.AppendLine(s);
            }

            var headerPart6String = new StringBuilder();

            foreach (var entry in h.Part6.EntriesByIndex)
            {
                headerPart6String.Append($"0x{entry.Volume.ToString("X")}".PadRight(20));
                headerPart6String.Append($"0x{((byte)entry.Flags).ToString("X")}".PadRight(20));
                headerPart6String.Append($"0x{entry.Unknown0x3.ToString("X")}".PadRight(20));
                headerPart6String.Append("\n");
            }

            var headerPart7String = new StringBuilder();

            foreach (var entry in h.Part7.EntriesByIndex)
            {
                headerPart7String.Append($"0x{entry.SiblingId.Value.ToString("X")}".PadRight(20));
                headerPart7String.Append($"0x{entry.Id.Value.ToString("X")}".PadRight(20));
                headerPart7String.Append("\n");
            }

            return($@"Archive Source
-----------------------------------------------------------
Header source file:         {source.HeaderFilePath}
Header offset:              {source.HeaderOffset.ToString("X")}
Data file path:             {source.DataFilePath}
Is header/data separate:    {source.IsHeaderSeparate}

General Info
-----------------------------------------------------------
Archive Size:               {h.Part5.ArchiveSize.ToString("X")}
Is Header Encrypted?        {h.Intro.IsEncrypted}

Header size:                {h.Intro.HeaderSize.ToString("X")}
Intro size:                 {NefsHeaderIntro.Size.ToString("X")}
Toc size:                   {Nefs16HeaderIntroToc.Size.ToString("X")}
Part 1 size:                {h.TableOfContents.Part1Size.ToString("X")}
Part 2 size:                {h.TableOfContents.Part2Size.ToString("X")}
Part 3 size:                {h.TableOfContents.Part3Size.ToString("X")}
Part 4 size:                {h.TableOfContents.Part4Size.ToString("X")}
Part 8 size:                {(h.Intro.HeaderSize - h.TableOfContents.OffsetToPart8).ToString("X")}

Header Intro
-----------------------------------------------------------
Magic Number:               {h.Intro.MagicNumber.ToString("X")}
Expected SHA-256 hash:      {StringHelper.ByteArrayToString(h.Intro.ExpectedHash)}
AES 256 key hex string:     {StringHelper.ByteArrayToString(h.Intro.AesKeyHexString)}
Header size:                {h.Intro.HeaderSize.ToString("X")}
NeFS version:               {h.Intro.NefsVersion.ToString("X")}
Number of items:            {h.Intro.NumberOfItems.ToString("X")}
Unknown 0x70:               {h.Intro.Unknown0x70zlib.ToString("X")}
Unknown 0x78:               {h.Intro.Unknown0x78.ToString("X")}

Header Table of Contents
-----------------------------------------------------------
Offset to Part 1:           {h.TableOfContents.OffsetToPart1.ToString("X")}
Offset to Part 2:           {h.TableOfContents.OffsetToPart2.ToString("X")}
Offset to Part 3:           {h.TableOfContents.OffsetToPart3.ToString("X")}
Offset to Part 4:           {h.TableOfContents.OffsetToPart4.ToString("X")}
Offset to Part 5:           {h.TableOfContents.OffsetToPart5.ToString("X")}
Offset to Part 6:           {h.TableOfContents.OffsetToPart6.ToString("X")}
Offset to Part 7:           {h.TableOfContents.OffsetToPart7.ToString("X")}
Offset to Part 8:           {h.TableOfContents.OffsetToPart8.ToString("X")}
Num Volumes:                {h.TableOfContents.NumVolumes.ToString("X")}
Hash Block Size (<< 15):    {h.TableOfContents.HashBlockSize.ToString("X")}
Block Size (<< 15):         {h.TableOfContents.BlockSize.ToString("X")}
Split Size (<< 15):         {h.TableOfContents.SplitSize.ToString("X")}
Unknown 0x28:               {StringHelper.ByteArrayToString(h.TableOfContents.Unknown0x28)}

Header Part 1
-----------------------------------------------------------
Data Offset         Index Part 2       Index Part 4        Id
{headerPart1String.ToString()}
Header Part 2
-----------------------------------------------------------
Directory Id        First child Id      Part 3 offset       Extracted size      Id
{headerPart2String.ToString()}
Header Part 3
-----------------------------------------------------------
{headerPart3String.ToString()}
Header Part 4
-----------------------------------------------------------
Number of entries:          {h.Part4.EntriesByIndex.Count.ToString("X")}

Header Part 5
-----------------------------------------------------------
Archive size:               {h.Part5.ArchiveSize.ToString("X")}
First data offset:          {h.Part5.FirstDataOffset.ToString("X")}
Archive name string offset: {h.Part5.ArchiveNameStringOffset.ToString("X")}

Header Part 6
-----------------------------------------------------------
{headerPart6String.ToString()}
Header Part 7
-----------------------------------------------------------
{headerPart7String.ToString()}
");
        }