0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-10-19 16:21:40 +00:00
ryujinx-fork/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserProfile.cs
Ac_K c46f6879ff
account: add Custom User Profiles support (#2227)
* Initial Impl

* Fix names

* remove useless ContentManager

* Support backgrounds and improve avatar loading

* Fix firmware checks

* Addresses gdkchan feedback
2021-04-23 22:26:31 +02:00

89 lines
No EOL
2 KiB
C#

using System;
namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
public class UserProfile
{
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public UserId UserId { get; }
public long LastModifiedTimestamp { get; set; }
private string _name;
public string Name
{
get => _name;
set
{
_name = value;
UpdateLastModifiedTimestamp();
}
}
private byte[] _image;
public byte[] Image
{
get => _image;
set
{
_image = value;
UpdateLastModifiedTimestamp();
}
}
private AccountState _accountState;
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;
AccountState = AccountState.Closed;
OnlinePlayState = AccountState.Closed;
if (lastModifiedTimestamp != 0)
{
LastModifiedTimestamp = lastModifiedTimestamp;
}
else
{
UpdateLastModifiedTimestamp();
}
}
private void UpdateLastModifiedTimestamp()
{
LastModifiedTimestamp = (long)(DateTime.Now - Epoch).TotalSeconds;
}
}
}