fix(core): Updates slice with range selectors (#583)
- [X] Replaces Span slicing with range selection - [X] Replaces string slicing with range selection
This commit is contained in:
parent
9f9d990f85
commit
a0893b68c0
62 changed files with 363 additions and 382 deletions
|
|
@ -858,7 +858,7 @@ namespace Server.Multis
|
|||
|
||||
if (e.Speech.Length > 8)
|
||||
{
|
||||
Rename(e.Speech.Substring(8).Trim().DefaultIfNullOrEmpty(null));
|
||||
Rename(e.Speech[8..].Trim().DefaultIfNullOrEmpty(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -871,7 +871,7 @@ namespace Server.Multis
|
|||
|
||||
if (newName?.Length > 40)
|
||||
{
|
||||
newName = newName.Substring(0, 40);
|
||||
newName = newName[..40];
|
||||
}
|
||||
|
||||
if (m_ShipName == newName)
|
||||
|
|
@ -1005,7 +1005,7 @@ namespace Server.Multis
|
|||
|
||||
if (start != -1)
|
||||
{
|
||||
var sNumber = navPoint.Substring(start);
|
||||
var sNumber = navPoint[start..];
|
||||
|
||||
if (!int.TryParse(sNumber, out number))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ namespace Server.Multis
|
|||
private static void WritePacked(ReadOnlySpan<byte> source, ref SpanWriter writer, out int length)
|
||||
{
|
||||
var size = source.Length;
|
||||
var dest = writer.RawBuffer.Slice(writer.Position + 3);
|
||||
var dest = writer.RawBuffer[(writer.Position + 3)..];
|
||||
length = dest.Length;
|
||||
|
||||
var ce = Zlib.Pack(dest, ref length, source, ZlibQuality.Default);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue