mirror of
https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies.git
synced 2026-07-25 06:14:31 +00:00
ef8e12e20d
- Mafile version was updated (3), new property SteamId added - MafileSerializer was refactored to adjust compability and code readability. - Serialization work moved from Storage to new class NebulaSerializer
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using SteamLib.Core.Enums;
|
|
using SteamLib.Core.Interfaces;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using Newtonsoft.Json;
|
|
using SteamLib.Core.Models;
|
|
|
|
namespace SteamLib.Account;
|
|
|
|
//WARNING: Any changes here should be reflected in MafileSerializer.cs
|
|
|
|
public sealed class MobileSessionData : SessionData, IMobileSessionData
|
|
{
|
|
public SteamAuthToken? MobileToken { get; private set; }
|
|
|
|
public SteamAuthToken? GetMobileToken() => MobileToken;
|
|
|
|
|
|
[MemberNotNull(nameof(MobileToken))]
|
|
public void SetMobileToken(SteamAuthToken token)
|
|
{
|
|
if (token.Type != SteamAccessTokenType.Mobile)
|
|
throw new ArgumentException("Token must be of type MobileAccess", nameof(token))
|
|
{
|
|
Data = { { "ActualType", token.Type } }
|
|
};
|
|
|
|
MobileToken = token;
|
|
}
|
|
|
|
[JsonConstructor]
|
|
public MobileSessionData(string sessionId, SteamId steamId, SteamAuthToken refreshToken,
|
|
SteamAuthToken? mobileToken, IDictionary<SteamDomain, SteamAuthToken>? tokens)
|
|
: base(sessionId, steamId, refreshToken, tokens)
|
|
{
|
|
MobileToken = mobileToken;
|
|
}
|
|
|
|
public MobileSessionData(string sessionId, SteamId steamId, SteamAuthToken refreshToken,
|
|
SteamAuthToken? mobileToken, IEnumerable<SteamAuthToken>? tokensCollection)
|
|
: base(sessionId, steamId, refreshToken, tokensCollection)
|
|
{
|
|
MobileToken = mobileToken;
|
|
}
|
|
|
|
public override MobileSessionData Clone() => (MobileSessionData)((ISessionData)this).Clone();
|
|
object ICloneable.Clone()
|
|
{
|
|
return new MobileSessionData(SessionId, SteamId, RefreshToken, MobileToken, Tokens);
|
|
}
|
|
} |