fix(network): Adds ConnectUO (#551)
- [X] Adds ability to create new protocol extension packets - [X] Adds freeshard protocol extension support (packet 0xF1) - [X] Adds ConnectUO support - [X] Adds arbitrary read for `CircularBufferReader` and `SpanReader`
This commit is contained in:
parent
76970325a3
commit
5e3b42bf9c
11 changed files with 381 additions and 162 deletions
|
|
@ -374,5 +374,21 @@ namespace Server.Network
|
|||
SeekOrigin.End => Length + offset,
|
||||
_ => Position + offset // Current
|
||||
};
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Read(Span<byte> bytes)
|
||||
{
|
||||
if (bytes.Length < Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(bytes));
|
||||
}
|
||||
|
||||
if (_first.Length > 0 && !_first.TryCopyTo(bytes))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _second.Length <= 0 || _second.TryCopyTo(bytes.Slice(_first.Length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,5 +278,16 @@ namespace System.Buffers
|
|||
_ => offset // Begin
|
||||
});
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Read(Span<byte> bytes)
|
||||
{
|
||||
if (bytes.Length < Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(bytes));
|
||||
}
|
||||
|
||||
return _buffer.TryCopyTo(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue