Fixing typos and AuthenticateWithToken handler.

feature-npv2
Icedream 2014-05-08 11:06:34 +02:00
parent f2e648f18b
commit e508906e2b
3 changed files with 7 additions and 4 deletions

View File

@ -108,7 +108,10 @@ namespace NPSharp
_rpc.AttachCallback(packet =>
{
var result = (AuthenticateResultMessage) packet;
var result = packet as AuthenticateResultMessage;
if (result == null)
return;
if (result.Result != 0)
tcs.SetResult(false);
LoginId = result.NPID;

View File

@ -17,7 +17,7 @@ namespace NPSharp.RPC.Messages
public byte[] Serialize(uint id)
{
#if DEBUG
Log.DebugFormat("Packet[ID={0},Type={1},TypeName={2}] {{", id, GetTypeId(), GetType().Name);
Log.DebugFormat("RPCClientMessage[ID={0},Type={1},TypeName={2}] {{", id, GetTypeId(), GetType().Name);
foreach (var prop in GetType().GetProperties())
{
Log.DebugFormat("\t{0} = {1}", prop.Name, prop.GetValue(this));

View File

@ -91,8 +91,8 @@ namespace NPSharp.RPC.Messages
packet.MessageId = pid;
#if DEBUG
Log.DebugFormat("ServerMessage[ID={0},Type={1},TypeName={2}] {{", pid, packet.GetTypeId(), packet.GetType().Name);
foreach (var prop in packet.GetType().GetProperties())
Log.DebugFormat("RPCServerMessage[ID={0},Type={1},TypeName={2}] {{", pid, packet.GetTypeId(), packet.GetType().Name);
foreach (var prop in packet.GetType().GetProperties().Where(p => !(p.DeclaringType is RPCServerMessage)))
{
Log.DebugFormat("\t{0} = {1}", prop.Name, prop.GetValue(packet));
}