Skip to content

Commit

Permalink
xbfs: Print flavor and filesize
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxuser committed Aug 9, 2023
1 parent 91d7cd1 commit c1c3bc7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions LibXboxOne/NAND/XbfsFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class XbfsFile
public List<XbfsHeader> XbfsHeaders;

public readonly string FilePath;
public long FileSize => _io.Stream.Length;

public XbfsFile(string path)
{
Expand Down Expand Up @@ -148,12 +149,12 @@ public static int GetFileindexForName(string name)

public bool Load()
{
Flavor = FlavorFromSize(_io.Stream.Length);
Flavor = FlavorFromSize(FileSize);

HeaderOffsets = Flavor switch {
XbfsFlavor.XboxOne => XbfsOffsetsXboxOne,
XbfsFlavor.XboxSeries => XbfsOffsetsXboxSeries,
_ => throw new InvalidDataException($"Invalid xbfs filesize: {_io.Stream.Length:X}"),
_ => throw new InvalidDataException($"Invalid xbfs filesize: {FileSize:X}"),
};

// read each XBFS header
Expand Down Expand Up @@ -286,6 +287,8 @@ public string ToString(bool formatted)
{
var b = new StringBuilder();
b.AppendLine("XbfsFile");
b.AppendLine($"Flavor: {Flavor}");
b.AppendLine($"Size: 0x{FileSize:X} ({FileSize / 1024 / 1024} MB)");
b.AppendLine();
for (int i = 0; i < XbfsHeaders.Count; i++)
{
Expand Down

0 comments on commit c1c3bc7

Please sign in to comment.