mirror of https://github.com/icedream/npsharp.git
add validateticket call
parent
612fd05702
commit
ac7e1b1a78
|
@ -161,7 +161,12 @@ namespace NPSharp.NP
|
|||
return;
|
||||
|
||||
if (result.Result != 0)
|
||||
{
|
||||
tcs.SetResult(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
LoginId = result.NPID;
|
||||
SessionToken = result.SessionToken;
|
||||
tcs.SetResult(true);
|
||||
|
@ -171,6 +176,30 @@ namespace NPSharp.NP
|
|||
return await tcs.Task;
|
||||
}
|
||||
|
||||
public async Task<bool> ValidateTicket(uint clientIP, ulong npID, byte[] ticket)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
|
||||
_rpc.AttachHandlerForNextMessage(packet =>
|
||||
{
|
||||
var result = packet as AuthenticateValidateTicketResultMessage;
|
||||
if (result == null)
|
||||
return;
|
||||
|
||||
if (result.Result != 0)
|
||||
{
|
||||
tcs.SetResult(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
tcs.SetResult(true);
|
||||
}
|
||||
});
|
||||
_rpc.Send(new AuthenticateValidateTicketMessage { ClientIP = clientIP, Ticket = ticket, NPID = npID });
|
||||
|
||||
return await tcs.Task;
|
||||
}
|
||||
|
||||
// TODO: Try to use an exception for failed action instead
|
||||
/// <summary>
|
||||
/// Uploads a user file.
|
||||
|
|
Loading…
Reference in New Issue