blob: 6e62dc80b78f0ccf7da1d76586661c8e4dea5d04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace DSACore.Models.Network
{
public class Group
{
private int _online;
public Group(string name, string password)
{
Name = name;
Password = password;
}
public Group(string name, int userCount)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
UserCount = userCount;
}
public string Name { get; set; }
public string Password { get; set; }
public List<User> Users { get; set; } = new List<User>();
public int UserCount
{
get { return _online; RefreshOnline();}
set { _online = value; RefreshOnline();}
}
private void RefreshOnline()
{
_online = Users.Count;
}
public Group SendGroup()
{
return new Group( Name, UserCount);
}
}
}
|