Skip to content

Commit fc87d54

Browse files
committed
Fixed ReadByteArray serialize error.
1 parent 6c95c92 commit fc87d54

File tree

12 files changed

+20
-230
lines changed

12 files changed

+20
-230
lines changed

sandbox/Dev/Client/Assets/Plugins/EuNet/Editor/EuNet.Editor.asmdef

Lines changed: 0 additions & 16 deletions
This file was deleted.

sandbox/Dev/Client/Assets/Plugins/EuNet/Editor/EuNet.Editor.asmdef.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

sandbox/Dev/Client/Assets/Plugins/EuNet/Editor/ExecutionOrderManager.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

sandbox/Dev/Client/Assets/Plugins/EuNet/Editor/NetViewHandler.cs

Lines changed: 0 additions & 158 deletions
This file was deleted.

src/EuNet.Core/Packet/NetDataBufferReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public NetDataBufferReader(NetDataReader reader)
1616

1717
_data = NetPool.BufferPool.Alloc(size);
1818

19-
reader.ReadBytesOnlyData(_data, size);
19+
reader.ReadByteArrayOnlyData(_data, size);
2020

2121
_endOffset = size;
2222
_offset = 0;

src/EuNet.Core/Packet/NetDataReader.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public IPEndPoint ReadIPEndPoint()
246246
{
247247
var addressLen = ReadByte();
248248
byte[] addressBytes = new byte[addressLen];
249-
ReadBytesOnlyData(addressBytes, addressLen);
249+
ReadByteArrayOnlyData(addressBytes, addressLen);
250250
var port = ReadInt32();
251251
return new IPEndPoint(new IPAddress(addressBytes), port);
252252
}
@@ -266,7 +266,7 @@ public TimeSpan ReadTimeSpan()
266266
public Guid ReadGuid()
267267
{
268268
byte count = ReadByte();
269-
var bytes = ReadBytes(count);
269+
var bytes = ReadByteArray(count);
270270
return new Guid(bytes);
271271
}
272272

@@ -438,7 +438,7 @@ public byte[] ReadRemainingBytes()
438438
return outgoingData;
439439
}
440440

441-
public byte[] ReadBytes(int count)
441+
public byte[] ReadByteArray(int count)
442442
{
443443
var value = new byte[count];
444444
Buffer.BlockCopy(_data, _position, value, 0, count);
@@ -447,7 +447,7 @@ public byte[] ReadBytes(int count)
447447
return value;
448448
}
449449

450-
public byte[] ReadBytes()
450+
public byte[] ReadByteArray()
451451
{
452452
int length = ReadInt32();
453453
byte[] outgoingData = new byte[length];
@@ -456,19 +456,19 @@ public byte[] ReadBytes()
456456
return outgoingData;
457457
}
458458

459-
public void ReadBytesOnlyData(byte[] destination, int start, int count)
459+
public void ReadByteArrayOnlyData(byte[] destination, int start, int count)
460460
{
461461
Buffer.BlockCopy(_data, _position, destination, start, count);
462462
_position += count;
463463
}
464464

465-
public void ReadBytesOnlyData(byte[] destination, int count)
465+
public void ReadByteArrayOnlyData(byte[] destination, int count)
466466
{
467467
Buffer.BlockCopy(_data, _position, destination, 0, count);
468468
_position += count;
469469
}
470470

471-
public sbyte[] ReadSBytes()
471+
public sbyte[] ReadSByteArray()
472472
{
473473
int length = ReadInt32();
474474
sbyte[] outgoingData = new sbyte[length];

src/EuNet.Core/Serializer/Formatter/CollectionFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void Serialize(NetDataWriter writer, ArraySegment<byte> value, NetDataSer
8282

8383
public ArraySegment<byte> Deserialize(NetDataReader reader, NetDataSerializerOptions options)
8484
{
85-
return new ArraySegment<byte>(reader.ReadBytes().ToArray());
85+
return new ArraySegment<byte>(reader.ReadByteArray().ToArray());
8686
}
8787
}
8888

src/EuNet.Core/Serializer/Formatter/StandardFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void Serialize(NetDataWriter writer, byte[] value, NetDataSerializerOptio
1818

1919
public byte[] Deserialize(NetDataReader reader, NetDataSerializerOptions options)
2020
{
21-
return reader.ReadBytes();
21+
return reader.ReadByteArray();
2222
}
2323
}
2424

src/EuNet.Unity/Assets/Plugins/EuNet/Runtime/EuNet.Core/Packet/NetDataBufferReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public NetDataBufferReader(NetDataReader reader)
1616

1717
_data = NetPool.BufferPool.Alloc(size);
1818

19-
reader.ReadBytesOnlyData(_data, size);
19+
reader.ReadByteArrayOnlyData(_data, size);
2020

2121
_endOffset = size;
2222
_offset = 0;

src/EuNet.Unity/Assets/Plugins/EuNet/Runtime/EuNet.Core/Packet/NetDataReader.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public IPEndPoint ReadIPEndPoint()
246246
{
247247
var addressLen = ReadByte();
248248
byte[] addressBytes = new byte[addressLen];
249-
ReadBytesOnlyData(addressBytes, addressLen);
249+
ReadByteArrayOnlyData(addressBytes, addressLen);
250250
var port = ReadInt32();
251251
return new IPEndPoint(new IPAddress(addressBytes), port);
252252
}
@@ -266,7 +266,7 @@ public TimeSpan ReadTimeSpan()
266266
public Guid ReadGuid()
267267
{
268268
byte count = ReadByte();
269-
var bytes = ReadBytes(count);
269+
var bytes = ReadByteArray(count);
270270
return new Guid(bytes);
271271
}
272272

@@ -438,7 +438,7 @@ public byte[] ReadRemainingBytes()
438438
return outgoingData;
439439
}
440440

441-
public byte[] ReadBytes(int count)
441+
public byte[] ReadByteArray(int count)
442442
{
443443
var value = new byte[count];
444444
Buffer.BlockCopy(_data, _position, value, 0, count);
@@ -447,7 +447,7 @@ public byte[] ReadBytes(int count)
447447
return value;
448448
}
449449

450-
public byte[] ReadBytes()
450+
public byte[] ReadByteArray()
451451
{
452452
int length = ReadInt32();
453453
byte[] outgoingData = new byte[length];
@@ -456,19 +456,19 @@ public byte[] ReadBytes()
456456
return outgoingData;
457457
}
458458

459-
public void ReadBytesOnlyData(byte[] destination, int start, int count)
459+
public void ReadByteArrayOnlyData(byte[] destination, int start, int count)
460460
{
461461
Buffer.BlockCopy(_data, _position, destination, start, count);
462462
_position += count;
463463
}
464464

465-
public void ReadBytesOnlyData(byte[] destination, int count)
465+
public void ReadByteArrayOnlyData(byte[] destination, int count)
466466
{
467467
Buffer.BlockCopy(_data, _position, destination, 0, count);
468468
_position += count;
469469
}
470470

471-
public sbyte[] ReadSBytes()
471+
public sbyte[] ReadSByteArray()
472472
{
473473
int length = ReadInt32();
474474
sbyte[] outgoingData = new sbyte[length];

0 commit comments

Comments
 (0)