-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUser.cs
55 lines (47 loc) · 1.3 KB
/
User.cs
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
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Windows.Forms;
namespace WalkieTalkie
{
public class User
{
private string userName;
private string statusMessage;
private IPAddress ipAddress;
public string UserName
{
get { return userName; }
set { userName = value; }
}
public string StatusMessage
{
get { return statusMessage; }
set { statusMessage = value; }
}
public IPAddress IP
{
get { return ipAddress; }
set { ipAddress = value; }
}
public User(string name, string status, IPAddress ip)
{
userName = name;
statusMessage = status;
ipAddress = ip;
}
public override string ToString()
{
return userName + ((statusMessage.Length > 0) ? " - " + statusMessage : "");
}
public static User FindUserWithIP(List<User> userList, IPAddress ipToCompare)
{
foreach (User user in userList)
if (user.IP.ToString() == ipToCompare.ToString())
return userList[userList.IndexOf(user)];
return null;
}
}
}