Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieSinn committed Apr 23, 2019
1 parent 4e93a4d commit f016bab
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions CSAUSBTool/FrcSeason.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ public FrcSeason(int year)
Year = year;
Software = GetWebList(year);
}

public FrcSeason(int year, List<ControlSystemsSoftware> software)
{
Year = year;
Software = software;
}

public static List<ControlSystemsSoftware> GetWebList(int year)
{
return GetWebList(
Expand All @@ -44,27 +46,26 @@ public static List<ControlSystemsSoftware> GetWebList(string uri)

public static List<ControlSystemsSoftware> GetLocalList(string uri)
{

var file = new StreamReader(uri);
string line;
var lines = new List<string>();
while ((line = file.ReadLine()) != null)
{
lines.Add(line);
lines.Add(line);
}

return GetFromCsv(lines);
}

private static List<ControlSystemsSoftware> GetFromCsv(List<string> lines)
{
List<ControlSystemsSoftware> ret = new List<ControlSystemsSoftware>();

foreach (var line in lines)
var ret = new List<ControlSystemsSoftware>();
lines.ForEach(line =>
{
if (line.Equals("") || line.StartsWith("#")) continue;
if (line.Equals("") || line.StartsWith("#")) return;
var args = line.Split(',');
ret.Add(new ControlSystemsSoftware(args[0], args[1], args[2], args[3], bool.Parse(args[4])));
}
});

return ret;
}
Expand All @@ -73,6 +74,5 @@ public override string ToString()
{
return Year + "";
}

}
}

0 comments on commit f016bab

Please sign in to comment.