-
Notifications
You must be signed in to change notification settings - Fork 1
/
MockDraftPick.cs
215 lines (206 loc) · 6.76 KB
/
MockDraftPick.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
using System;
using System.Collections.Generic;
using CsvHelper.Configuration;
using CsvHelper;
using System.IO;
using System.Linq;
namespace mockdraft_2020
{
public class MockDraftPick
{
public int round;
public string teamCity;
public string pickNumber;
public string playerName;
public string school;
public string position;
public string reachValue;
public int leagifyPoints;
public string pickDate;
public string state;
public MockDraftPick(){}
public MockDraftPick(string pick, string team, string name, string school, string pos, string relativeVal, string pickDate)
{
this.pickNumber = pick;
this.teamCity = team;
this.round = convertPickToRound(pick);
this.playerName = name;
this.school = school;
this.position = pos;
this.reachValue = relativeVal;
this.leagifyPoints = convertPickToPoints(pick, this.round);
this.pickDate = pickDate;
this.state = getState(school);
}
public static int convertPickToRound(string pick)
{
// Compensatory picks added on 2/1/20
int intpick = 0;
var canParse = int.TryParse(pick, out intpick);
if (canParse)
{
/*
Pick numbers without comp picks:
Picks 1-32 : Round 1
Picks 33-64: Round 2
Picks 65-96: Round 3
Picks 97-128: Round 4
Picks 129-159: Round 5
Picks 160-191: Round 6
Picks 192-223: Round 7
Pick numbers with comp picks:
Round 1 = picks 1-32
Round 2 = picks 33-64
Round 3 = picks 65-103
Round 4 = picks 104-146
Round 5 = picks 147-179
Round 6 = picks 180-214
Round 7 = picks 215-255
*/
if(intpick >= 1 && intpick <= 32)
{
return 1;
} else if (intpick >= 33 && intpick <= 64)
{
return 2;
} else if (intpick >= 65 && intpick <=103)
{
return 3;
} else if (intpick >= 104 && intpick <= 146)
{
return 4;
} else if (intpick >= 147 && intpick <= 179)
{
return 5;
} else if (intpick >= 180 && intpick <= 214)
{
return 6;
} else if (intpick >= 215 && intpick <= 255)
{
return 7;
}
return 0;
}
else
{
return 0;
}
}
public static int convertPickToPoints(string pick, int round)
{
int intpick = 0;
var canParse = int.TryParse(pick, out intpick);
if (canParse)
{
/*
Top Pick: 40 Points
Picks 2-10: 35 Points
Picks 11-20: 30 Points
Picks 21-32: 25 Points
Picks 33-48: 20 Points
Picks 49-64: 15 Points
Round 3: 10 Points
Round 4: 8 Points
Round 5: 7 Points
Round 6: 6 Points
Round 7: 5 Points
*/
if(intpick == 1)
{
return 40;
}
else if (intpick >= 2 && intpick <= 10)
{
return 35;
}
else if (intpick >= 11 && intpick <= 20)
{
return 30;
}
else if (intpick >= 21 && intpick <= 32)
{
return 25;
}
else if (intpick >= 33 && intpick <= 48)
{
return 20;
}
else if (intpick >= 49 && intpick <= 64)
{
return 15;
}
else if (round == 3)
{
return 10;
}
else if (round == 4)
{
return 8;
}
else if (round == 5)
{
return 7;
}
else if (round == 6)
{
return 6;
}
else if (round == 7)
{
return 5;
}
}
return 0;
}
public static string getState(string school)
{
// Get Schools and the States where they are located.
List<School> schoolsAndConferences;
using (var reader = new StreamReader($"info{Path.DirectorySeparatorChar}SchoolStatesAndConferences.csv"))
using (var csv = new CsvReader(reader))
{
csv.Configuration.RegisterClassMap<SchoolCsvMap>();
schoolsAndConferences = csv.GetRecords<School>().ToList();
}
var stateResult = from s in schoolsAndConferences
where s.schoolName == school
select s.state;
var srfd = stateResult.FirstOrDefault();
string sr = "";
if (srfd != null)
{
sr = srfd.ToString();
}
else
{
Console.WriteLine("Error matching school!");
}
if(sr.Length > 0)
{
return sr;
}
else
{
return "";
}
//return stateResult.FirstOrDefault().ToString();
}
}
public sealed class MockDraftPickCsvMap : ClassMap<MockDraftPick>
{
public MockDraftPickCsvMap()
{
//Pick,Round,Player,School,Position,Team,ReachValue,Points,Date
Map(m => m.pickNumber).Name("Pick");
Map(m => m.round).Name("Round");
Map(m => m.playerName).Name("Player");
Map(m => m.school).Name("School");
Map(m => m.position).Name("Position");
Map(m => m.teamCity).Name("Team");
Map(m => m.reachValue).Name($"ReachValue");
Map(m => m.leagifyPoints).Name("Points");
Map(m => m.pickDate).Name("Date");
Map(m => m.state).Name("State");
}
}
}