mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-09-19 22:28:55 +02:00
37d27c4c99
* Replace Array.Clear(x, 0, x.Length) with Array.Clear(x) * Use DateTime.UnixEpoch field * Replace SHA256.ComputeHash calls with static SHA256.HashData call More performant and avoids the need to initialize a SHA256 instance.
87 lines
No EOL
1.9 KiB
C#
87 lines
No EOL
1.9 KiB
C#
using System;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
|
{
|
|
public class UserProfile
|
|
{
|
|
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 - DateTime.UnixEpoch).TotalSeconds;
|
|
}
|
|
}
|
|
} |