Beispiel #1
0
        /// <summary>
        /// Creates an auth ticket.
        /// Which you can send to a server to authenticate that you are who you say you are.
        /// </summary>
        public unsafe Ticket GetAuthSessionTicket()
        {
            var data = new byte[1024];

            fixed(byte *b = data)
            {
                uint ticketLength = 0;

                client.RegisterCallback <GetAuthSessionTicketResponse_t>(AuthResponse);
                uint ticket = client.native.user.GetAuthSessionTicket((IntPtr)b, data.Length, out ticketLength);

                while (!_responded)
                {
                    client.RunCallbacks();
                }
                if (ticket == 0)
                {
                    return(null);
                }

                return(new Ticket()
                {
                    client = client,
                    Data = data.Take((int)ticketLength).ToArray(),
                    Handle = ticket
                });
            }
        }