mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* Fartwhifs "Removing unused pattern from CryptoSystem for slightly better performance." PR
* PacketHeader Improved Efficiency
* Improve ClientPacket.ParsePacketData() efficiency
* Packet.Data does not need to be disposed()
See here: ac99a1b716/src/Common/src/CoreLib/System/IO/MemoryStream.cs (L124)
Disposing simply sets _isOpen, _writable, _expandable to false. It doesn't even release the reference to the buffer passed in to the ctor.
* WIP
* revert the RangeAdvance stuff
* More improvements
* More improvements
* More naming improvements
29 lines
779 B
C#
29 lines
779 B
C#
using System;
|
|
|
|
using ACE.Common.Cryptography;
|
|
|
|
namespace ACE.Server.Network
|
|
{
|
|
public class ServerPacketFragment : PacketFragment
|
|
{
|
|
public ServerPacketFragment(byte[] data)
|
|
{
|
|
Data = data;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the Hash32 of the payload added to buffer
|
|
/// </summary>
|
|
public uint PackAndReturnHash32(byte[] buffer, ref int offset)
|
|
{
|
|
Header.Size = (ushort)(PacketFragmentHeader.HeaderSize + Data.Length);
|
|
|
|
var headerHash32 = Header.PackAndReturnHash32(buffer, ref offset);
|
|
|
|
Buffer.BlockCopy(Data, 0, buffer, offset, Data.Length);
|
|
offset += Data.Length;
|
|
|
|
return headerHash32 + Hash32.Calculate(Data, Data.Length);
|
|
}
|
|
}
|
|
}
|