Files

38 lines
844 B
C#

using System;
namespace HotUpdate.Net
{
[Serializable]
public class AuthResponse
{
public string token;
public long pid;
}
[Serializable]
public class AuthError
{
public string error;
}
public sealed class SessionData
{
public string Username;
public string Token;
public long Pid;
public string DeviceId;
public bool IsValid => !string.IsNullOrEmpty(Token) && Pid > 0;
public string BuildWsUrl(string template = null)
{
var tpl = string.IsNullOrEmpty(template)
? AuthApi.DefaultWsTemplate
: template;
return tpl
.Replace("{pid}", Pid.ToString())
.Replace("{token}", Uri.EscapeDataString(Token ?? string.Empty));
}
}
}