Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -44,18 +44,11 @@ namespace Server.Network
/// </summary>
private MemoryStream m_Stream;
/// <summary>
/// Instantiates a new PacketWriter instance with the default capacity of 4 bytes.
/// </summary>
public PacketWriter() : this(32)
{
}
/// <summary>
/// Instantiates a new PacketWriter instance with a given capacity.
/// </summary>
/// <param name="capacity">Initial capacity for the internal stream.</param>
public PacketWriter(int capacity)
public PacketWriter(int capacity = 32)
{
m_Stream = new MemoryStream(capacity);
m_Capacity = capacity;
@ -103,10 +96,7 @@ namespace Server.Network
}
}
if (pw == null)
pw = new PacketWriter(capacity);
return pw;
return pw ?? new PacketWriter(capacity);
}
public static void ReleaseInstance(PacketWriter pw)
@ -456,4 +446,4 @@ namespace Server.Network
return m_Stream.ToArray();
}
}
}
}