You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-18 16:16:35 +09:00
Changed how ReadAllFields determines available write methods
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Lidgren.Network
|
|||||||
{
|
{
|
||||||
public partial class NetBuffer
|
public partial class NetBuffer
|
||||||
{
|
{
|
||||||
private const int c_overAllocateAmount = 4;
|
protected const int c_overAllocateAmount = 4;
|
||||||
|
|
||||||
private static readonly Dictionary<Type, MethodInfo> s_readMethods;
|
private static readonly Dictionary<Type, MethodInfo> s_readMethods;
|
||||||
private static readonly Dictionary<Type, MethodInfo> s_writeMethods;
|
private static readonly Dictionary<Type, MethodInfo> s_writeMethods;
|
||||||
@@ -75,14 +75,9 @@ namespace Lidgren.Network
|
|||||||
MethodInfo[] methods = typeof(NetIncomingMessage).GetMethods(BindingFlags.Instance | BindingFlags.Public);
|
MethodInfo[] methods = typeof(NetIncomingMessage).GetMethods(BindingFlags.Instance | BindingFlags.Public);
|
||||||
foreach (MethodInfo mi in methods)
|
foreach (MethodInfo mi in methods)
|
||||||
{
|
{
|
||||||
if (mi.GetParameters().Length == 0 && mi.Name.StartsWith("Read", StringComparison.InvariantCulture))
|
if (mi.GetParameters().Length == 0 && mi.Name.StartsWith("Read", StringComparison.InvariantCulture) && mi.Name.Substring(4) == mi.ReturnType.Name)
|
||||||
{
|
{
|
||||||
string n = mi.Name.Substring(4);
|
s_readMethods[mi.ReturnType] = mi;
|
||||||
foreach (Type it in integralTypes)
|
|
||||||
{
|
|
||||||
if (it.Name == n)
|
|
||||||
s_readMethods[it] = mi;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user