mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-24 20:48:03 +03:00
Remove unused Auth
This commit is contained in:
parent
8107297262
commit
c19982f3b1
@ -59,23 +59,6 @@ namespace Facepunch.Steamworks.Test
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AuthSessionTicket()
|
||||
{
|
||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
||||
{
|
||||
var ticket = client.Auth.GetAuthSessionTicket();
|
||||
|
||||
Assert.IsTrue( ticket != null );
|
||||
Assert.IsTrue( ticket.Handle != 0 );
|
||||
Assert.IsTrue( ticket.Data.Length > 0 );
|
||||
|
||||
ticket.Cancel();
|
||||
|
||||
Assert.IsTrue( ticket.Handle == 0 );
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Update()
|
||||
{
|
||||
|
@ -1,81 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Client : IDisposable
|
||||
{
|
||||
Auth _auth;
|
||||
|
||||
public Auth Auth
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _auth == null )
|
||||
_auth = new Auth{ client = this };
|
||||
|
||||
return _auth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Auth
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public class Ticket : IDisposable
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public byte[] Data;
|
||||
public uint Handle;
|
||||
|
||||
/// <summary>
|
||||
/// Cancels a ticket.
|
||||
/// You should cancel your ticket when you close the game or leave a server.
|
||||
/// </summary>
|
||||
public void Cancel()
|
||||
{
|
||||
if ( client.IsValid && Handle != 0 )
|
||||
{
|
||||
client.native.user.CancelAuthTicket( Handle );
|
||||
Handle = 0;
|
||||
Data = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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;
|
||||
uint ticket = client.native.user.GetAuthSessionTicket( (IntPtr) b, data.Length, out ticketLength );
|
||||
|
||||
if ( ticket == 0 )
|
||||
return null;
|
||||
|
||||
return new Ticket()
|
||||
{
|
||||
client = client,
|
||||
Data = data.Take( (int)ticketLength ).ToArray(),
|
||||
Handle = ticket
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user