Skip to content

Commit

Permalink
Merge pull request #400 from Svenskithesource/issue/typo
Browse files Browse the repository at this point in the history
delimeter -> delimiter
  • Loading branch information
Washi1337 authored Jan 16, 2023
2 parents 63ee031 + c6a143e commit 182b181
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/AsmResolver/IO/BinaryStreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,54 +350,54 @@ public byte[] ReadToEnd()
}

/// <summary>
/// Reads bytes from the input stream until the provided delimeter byte is reached.
/// Reads bytes from the input stream until the provided delimiter byte is reached.
/// </summary>
/// <param name="delimeter">The delimeter byte to stop at.</param>
/// <returns>The read bytes, including the delimeter if it was found.</returns>
public byte[] ReadBytesUntil(byte delimeter) => ReadBytesUntil(delimeter, true);
/// <param name="delimiter">The delimiter byte to stop at.</param>
/// <returns>The read bytes, including the delimiter if it was found.</returns>
public byte[] ReadBytesUntil(byte delimiter) => ReadBytesUntil(delimiter, true);

/// <summary>
/// Reads bytes from the input stream until the provided delimeter byte is reached.
/// Reads bytes from the input stream until the provided delimiter byte is reached.
/// </summary>
/// <param name="delimeter">The delimeter byte to stop at.</param>
/// <param name="includeDelimeterInReturn">
/// <c>true</c> if the final delimeter should be included in the return value, <c>false</c> otherwise.
/// <param name="delimiter">The delimiter byte to stop at.</param>
/// <param name="includeDelimiterInReturn">
/// <c>true</c> if the final delimiter should be included in the return value, <c>false</c> otherwise.
/// </param>
/// <returns>The read bytes.</returns>
/// <remarks>
/// This function always consumes the delimeter from the input stream if it is present, regardless of the value
/// of <paramref name="includeDelimeterInReturn"/>.
/// This function always consumes the delimiter from the input stream if it is present, regardless of the value
/// of <paramref name="includeDelimiterInReturn"/>.
/// </remarks>
public byte[] ReadBytesUntil(byte delimeter, bool includeDelimeterInReturn)
public byte[] ReadBytesUntil(byte delimiter, bool includeDelimiterInReturn)
{
var lookahead = Fork();
bool hasConsumedDelimeter = lookahead.AdvanceUntil(delimeter, includeDelimeterInReturn);
bool hasConsumedDelimiter = lookahead.AdvanceUntil(delimiter, includeDelimiterInReturn);

byte[] buffer = new byte[lookahead.RelativeOffset - RelativeOffset];
ReadBytes(buffer, 0, buffer.Length);

if (hasConsumedDelimeter)
if (hasConsumedDelimiter)
ReadByte();

return buffer;
}

/// <summary>
/// Advances the reader until the provided delimeter byte is reached.
/// Advances the reader until the provided delimiter byte is reached.
/// </summary>
/// <param name="delimeter">The delimeter byte to stop at.</param>
/// <param name="consumeDelimeter">
/// <c>true</c> if the final delimeter should be consumed if available, <c>false</c> otherwise.
/// <param name="delimiter">The delimiter byte to stop at.</param>
/// <param name="consumeDelimiter">
/// <c>true</c> if the final delimiter should be consumed if available, <c>false</c> otherwise.
/// </param>
/// <returns><c>true</c> if the delimeter byte was found and consumed, <c>false</c> otherwise.</returns>
public bool AdvanceUntil(byte delimeter, bool consumeDelimeter)
/// <returns><c>true</c> if the delimiter byte was found and consumed, <c>false</c> otherwise.</returns>
public bool AdvanceUntil(byte delimiter, bool consumeDelimiter)
{
while (RelativeOffset < Length)
{
byte b = ReadByte();
if (b == delimeter)
if (b == delimiter)
{
if (!consumeDelimeter)
if (!consumeDelimiter)
{
RelativeOffset--;
return true;
Expand Down

0 comments on commit 182b181

Please sign in to comment.