You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 07:36:32 +09:00
NetConnection.LocalHailMessage exposed. WriteVariableInt64 and ReadVariableInt64 added.
This commit is contained in:
@@ -363,6 +363,29 @@ namespace Lidgren.Network
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a Int64 written using WriteVariableInt64()
|
||||
/// </summary>
|
||||
public Int64 ReadVariableInt64()
|
||||
{
|
||||
Int64 num1 = 0;
|
||||
int num2 = 0;
|
||||
while (true)
|
||||
{
|
||||
if (num2 == 0x23)
|
||||
throw new FormatException("Bad 7-bit encoded integer");
|
||||
|
||||
byte num3 = this.ReadByte();
|
||||
num1 |= (Int64)((Int64)(num3 & 0x7f) << (num2 & 0x1f));
|
||||
num2 += 7;
|
||||
if ((num3 & 0x80) == 0)
|
||||
{
|
||||
Int64 sign = (num1 << 63) >> 63;
|
||||
return sign ^ (num1 >> 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a UInt32 written using WriteVariableInt64()
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user