/// <inheritdoc /> public async Task <PinResult> PinAsync(Context context, ContentHash contentHash) { StructResult <int> sessionResult = await _sessionState.GetIdAsync(); if (!sessionResult.Succeeded) { return(new PinResult(sessionResult)); } int sessionId = sessionResult.Data; DateTime startTime = DateTime.UtcNow; PinResponse response = await RunClientActionAndThrowIfFailedAsync( context, async() => await _client.PinAsync( new PinRequest { HashType = (int)contentHash.HashType, ContentHash = contentHash.ToByteString(), Header = new RequestHeader(context.Id, sessionId) })); long ticksWaited = response.Header.ServerReceiptTimeUtcTicks - startTime.Ticks; _tracer.TrackClientWaitForServerTicks(ticksWaited); await ResetOnUnknownSessionAsync(context, response.Header, sessionId); return(UnpackPinResult(response.Header)); }
private void RespondPin(PinResponse inPacket) { using (Packet outPacket = new Packet(MapleServerOperationCode.PinOperation)) { outPacket.WriteByte((byte)inPacket); this.Send(outPacket); } }
private void RespondPin(PinResponse response) { if (response == PinResponse.Valid) { this.User.IsAssigned = true; } using (Packet p = new Packet(ServerMessages.PinOperation)) { p.WriteByte((byte)response); this.Send(p); } }