Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue