-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.cs
More file actions
74 lines (71 loc) · 2.82 KB
/
Copy pathPlayer.cs
File metadata and controls
74 lines (71 loc) · 2.82 KB
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
68
69
70
71
72
73
74
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OlyCommonClasses
{
public class Player
{
public int _FactionId { get; set; }
public string _FactionId_Conv { get; set; }
public String _First_Line { get; set; }
public string _Name { get; set; }
public string _Player_Type { get; set; }
public string _Full_Name { get; set; }
public string _Email_Address { get; set; }
public int _Fast_Study_Points { get; set; }
public int _Noble_Points { get; set; }
public int _First_Turn { get; set; }
public int _Last_Turn { get; set; }
public List<int> _Known { get; set; }
public List<int> _Unit_List { get; set; }
public List<int> _Unformed_Unit_List { get; set; }
public string _Password { get; set; }
public static void Add(string InputKey, string InputString, List<Player> _players)
{
JObject j1 = JObject.Parse(InputString);
JArray myna;
JArray myfl;
string myplayertype;
if (j1.SelectToken("na") != null && j1.SelectToken("na").HasValues)
{
myna = (JArray)j1.SelectToken("na");
}
else
{
myna = null;
}
if (j1.SelectToken("firstline") != null && j1.SelectToken("firstline").HasValues)
{
myfl = (JArray)j1.SelectToken("firstline");
string[] type_array = myfl[0].ToString().Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);
myplayertype = type_array[2];
}
else
{
myfl = null;
myplayertype = null;
}
_players.Add(new Player
{
_FactionId = Convert.ToInt32(InputKey),
_FactionId_Conv = Utilities.To_Oid(InputKey),
_First_Line = myfl[0].ToString(),
_Name = myna[0].ToString(),
_Player_Type = myplayertype,
_Email_Address = JSON.string_Token(j1, "PL.em"),
_Fast_Study_Points = JSON.int_Token(j1, "PL.fs"),
_First_Turn = JSON.int_Token(j1, "PL.ft"),
_Full_Name = JSON.string_Token(j1,"PL.fn"),
_Known = JSON.list_Token(j1, "PL.kn"),
_Last_Turn = JSON.int_Token(j1, "PL.lt"),
_Noble_Points = JSON.int_Token(j1, "PL.np"),
_Password = JSON.string_Token(j1, "PL.pw"),
_Unformed_Unit_List = JSON.list_Token(j1, "PL.uf"),
_Unit_List = JSON.list_Token(j1, "PL.un")
});
}
}
}