Update SARC comments

This commit is contained in:
Chev 2021-06-02 19:40:36 -07:00
parent e401feaf34
commit 3ab86ea5d9

View file

@ -39,7 +39,7 @@ namespace BOTWToolset.IO.SARC
/// <summary>
/// Gets a <see cref="SARC"/> from an array of bytes.
/// </summary>
/// <param name="stream">Array of bytes to get <see cref="SARC"/> info from.</param>
/// <param name="bytes">Array of bytes to get <see cref="SARC"/> info from.</param>
/// <returns><see cref="SARC"/> with the stream's data.</returns>
public static SARC FromBytes(byte[] bytes)
{
@ -49,7 +49,8 @@ namespace BOTWToolset.IO.SARC
{
// SARC header
s.Magic = new string(r.ReadChars(4));
if (s.Magic != "SARC") // TODO: raise an exception here instead of returning null
if (s.Magic != "SARC")
// TODO: raise an exception here instead of returning null
return null;
s.HeaderLength = r.ReadUInt16();
@ -58,11 +59,13 @@ namespace BOTWToolset.IO.SARC
s.DataOffset = r.ReadUInt32();
s.Version = r.ReadUInt16();
r.Advance(2); // Skip 2 reserved bytes
// Skip 2 reserved bytes
r.Advance(2);
// SFAT header
string sfat_magic = new string(r.ReadChars(4));
if (sfat_magic != "SFAT") // TODO: raise an exception here instead of returning null
if (sfat_magic != "SFAT")
// TODO: raise an exception here instead of returning null
return null;
ushort sfat_headerlen = r.ReadUInt16();
@ -95,7 +98,8 @@ namespace BOTWToolset.IO.SARC
// SFNT header
var sfnt_magic = new string(r.ReadChars(4));
if (sfnt_magic != "SFNT") // TODO: raise an exception here instead of returning null
if (sfnt_magic != "SFNT")
// TODO: raise an exception here instead of returning null
return null;
var sfnt_headerlen = r.ReadUInt16();
@ -166,7 +170,6 @@ namespace BOTWToolset.IO.SARC
/// <returns>byte[] containg the <see cref="SARC"/> data.</returns>
public static byte[] ToBytes(SARC sarc)
{
// TODO: Make this an actual function
List<byte> bytes = new List<byte>();
// SARC header