|
|
@ -3,23 +3,55 @@ using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Stim
|
|
|
|
namespace Stim
|
|
|
|
{
|
|
|
|
{
|
|
|
|
internal class User
|
|
|
|
internal class User
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static int nbUser=0;
|
|
|
|
static int nbUser=0;
|
|
|
|
public int Id { get; }
|
|
|
|
private int id;
|
|
|
|
public string Username { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public string Username
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return Username; }
|
|
|
|
|
|
|
|
private set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
username = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private string username;
|
|
|
|
|
|
|
|
|
|
|
|
public string Biographie { get; set; }
|
|
|
|
public string Biographie { get; set; }
|
|
|
|
public string Email { get; set; }
|
|
|
|
|
|
|
|
public string Password { get; set; }
|
|
|
|
public string Email
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return email; }
|
|
|
|
|
|
|
|
private set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//check email
|
|
|
|
|
|
|
|
email = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private string email;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Password
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return password; }
|
|
|
|
|
|
|
|
private set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Regex rg = new Regex("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$");
|
|
|
|
|
|
|
|
if (!rg.IsMatch(password)) return;
|
|
|
|
|
|
|
|
password = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private string password;
|
|
|
|
public List<Game> Games { get; set; }
|
|
|
|
public List<Game> Games { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public User(string username, string biographie, string email, string password)
|
|
|
|
public User(string username, string biographie, string email, string password)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nbUser++;
|
|
|
|
nbUser++;
|
|
|
|
Id = nbUser;
|
|
|
|
id = nbUser;
|
|
|
|
|
|
|
|
|
|
|
|
Username = username;
|
|
|
|
Username = username;
|
|
|
|
Biographie = biographie;
|
|
|
|
Biographie = biographie;
|
|
|
@ -27,15 +59,5 @@ namespace Stim
|
|
|
|
Password = password;
|
|
|
|
Password = password;
|
|
|
|
Games = new List<Game>();
|
|
|
|
Games = new List<Game>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddGame(Game game)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Games.Add(game);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void RemoveGame(Game game)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Games.Remove(game);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|