Skip to content

Commit

Permalink
Removing unused method
Browse files Browse the repository at this point in the history
  • Loading branch information
tpill90 committed May 21, 2024
1 parent b694c2e commit 58690e0
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions EpicPrefill/Extensions/MiscExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,5 @@ public static string ToHexStringUpper(this byte[] input)
return HexMate.Convert.ToHexString(input);
}

//TODO document + rename
public static string ReadFstring(this BinaryReader br)
{
var stringLength = br.ReadInt32();

// If the length is negative the string is UTF-16 encoded
if (stringLength < 0)
{
// utf-16 chars are (generally) 2 bytes wide, but the length is # of characters, not bytes.
// 4-byte wide chars exist, but best I can tell Epic's (de)serializer doesn't support those.
stringLength *= -2;

// Read bytes representing string
var bytes = br.ReadBytes(stringLength - 2);
// Reading utf-16 two byte null terminators
br.ReadBytes(2);

return Encoding.Unicode.GetString(bytes);
}

// Handling ASCII
if (stringLength > 0)
{
// Read bytes representing string
var bytes = br.ReadBytes(stringLength - 1);
// Read null delimiter
br.ReadBytes(1);

return Encoding.ASCII.GetString(bytes);
}

return "";
}

//TODO document
public static void SkipReadingFstring(this BinaryReader br)
{
int stringLength = br.ReadInt32();
br.BaseStream.Seek(stringLength, SeekOrigin.Current);
}
}
}

0 comments on commit 58690e0

Please sign in to comment.