2021-04-13 01:16:43 +00:00
|
|
|
|
using System;
|
2018-08-14 22:02:42 +00:00
|
|
|
|
|
2019-09-19 00:45:11 +00:00
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
2018-08-14 22:02:42 +00:00
|
|
|
|
{
|
2021-04-13 01:16:43 +00:00
|
|
|
|
public class UserProfile
|
2018-08-14 22:02:42 +00:00
|
|
|
|
{
|
|
|
|
|
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
|
|
|
|
|
2021-04-13 01:16:43 +00:00
|
|
|
|
public UserId UserId { get; }
|
2018-08-14 22:02:42 +00:00
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
public long LastModifiedTimestamp { get; set; }
|
2021-04-13 01:16:43 +00:00
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
private string _name;
|
2018-08-14 22:02:42 +00:00
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get => _name;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_name = value;
|
|
|
|
|
|
|
|
|
|
UpdateLastModifiedTimestamp();
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-08-14 22:02:42 +00:00
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
private byte[] _image;
|
2018-08-14 22:02:42 +00:00
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
public byte[] Image
|
2018-08-14 22:02:42 +00:00
|
|
|
|
{
|
2021-04-23 20:26:31 +00:00
|
|
|
|
get => _image;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_image = value;
|
2018-08-14 22:02:42 +00:00
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
UpdateLastModifiedTimestamp();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private AccountState _accountState;
|
2021-04-13 01:16:43 +00:00
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
public AccountState AccountState
|
|
|
|
|
{
|
|
|
|
|
get => _accountState;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_accountState = value;
|
|
|
|
|
|
|
|
|
|
UpdateLastModifiedTimestamp();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AccountState _onlinePlayState;
|
|
|
|
|
|
|
|
|
|
public AccountState OnlinePlayState
|
|
|
|
|
{
|
|
|
|
|
get => _onlinePlayState;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_onlinePlayState = value;
|
|
|
|
|
|
|
|
|
|
UpdateLastModifiedTimestamp();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UserProfile(UserId userId, string name, byte[] image, long lastModifiedTimestamp = 0)
|
|
|
|
|
{
|
|
|
|
|
UserId = userId;
|
|
|
|
|
Name = name;
|
|
|
|
|
Image = image;
|
2018-08-14 22:02:42 +00:00
|
|
|
|
|
2019-06-15 22:35:38 +00:00
|
|
|
|
AccountState = AccountState.Closed;
|
|
|
|
|
OnlinePlayState = AccountState.Closed;
|
2018-08-14 22:02:42 +00:00
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
if (lastModifiedTimestamp != 0)
|
|
|
|
|
{
|
|
|
|
|
LastModifiedTimestamp = lastModifiedTimestamp;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
UpdateLastModifiedTimestamp();
|
|
|
|
|
}
|
2018-08-14 22:02:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-23 20:26:31 +00:00
|
|
|
|
private void UpdateLastModifiedTimestamp()
|
2018-08-14 22:02:42 +00:00
|
|
|
|
{
|
|
|
|
|
LastModifiedTimestamp = (long)(DateTime.Now - Epoch).TotalSeconds;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-14 19:04:38 +00:00
|
|
|
|
}
|