You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
54 lines
1.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Model
|
|
{
|
|
/// <summary>
|
|
/// define a player
|
|
/// attributes :
|
|
/// id : identifier in the database
|
|
/// nickname : nickname for the player
|
|
/// hashedPassword : hashed of the password of the player
|
|
/// </summary>
|
|
public class Player
|
|
{
|
|
private uint id;
|
|
private string? nickname;
|
|
private string? hashedPassword;
|
|
|
|
// getters and setters for attributes
|
|
public uint Id
|
|
{
|
|
get => id;
|
|
private set { id = value; }
|
|
}
|
|
public string Nickname
|
|
{
|
|
get => nickname == null ? "" : nickname;
|
|
private set { nickname = value == "" ? null : nickname; }
|
|
}
|
|
public string HashedPassword
|
|
{
|
|
get => hashedPassword == null ? "" : hashedPassword;
|
|
set { hashedPassword = value == "" ? null : value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// constructor of a player
|
|
/// </summary>
|
|
/// <param name="nickname">nickname of the player</param>
|
|
/// <param name="hashedPassword">hash of the password of the player</param>
|
|
/// <param name="id">id of the player</param>
|
|
public Player(string nickname, string hashedPassword = "", uint id = 0)
|
|
{
|
|
Nickname = nickname;
|
|
HashedPassword = hashedPassword;
|
|
Id = id;
|
|
}
|
|
}
|
|
}
|