-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUser.cs
67 lines (53 loc) · 1.38 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
56
57
58
59
60
61
62
63
64
65
66
67
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ScreepsAPI_NET
{
public class User
{
/// <summary>
/// The uniquie Id of the user
/// </summary>
public String _Id { get; set; }
/// <summary>
/// The username
/// </summary>
public String Username { get; set; }
/// <summary>
/// The badge information
/// </summary>
public Badge Badge { get; set; }
/// <summary>
/// The Global Control Level
/// </summary>
public long GCL { get; set; }
public User()
{
}
public User(String _Id, String Username, Badge Badge, long GCL)
{
this._Id = _Id;
this.Username = Username;
this.Badge = Badge;
this.GCL = GCL;
}
public static User Parse(JObject obj)
{
try
{
User u = new User();
u._Id = obj.GetValue<String>("_id");
u.Username = obj.GetValue<String>("username");
u.Badge = Badge.Parse(obj.GetValue<JObject>("badge"));
u.GCL = obj.GetValue<long>("gcl");
return u;
}
catch
{
}
return null;
}
}
}