Fix up parsers

This commit is contained in:
2016-02-17 11:11:43 -05:00
parent e6ad04cf2b
commit 6534fc142b
4 changed files with 15 additions and 18 deletions
+1
View File
@@ -11,6 +11,7 @@ namespace LeafWeb.Core.DAL
public DbSet<LeafInputStatus> LeafInputStatus { get; set; }
public DbSet<FluxnetSite> FluxnetSites { get; set; }
public DbSet<PhotosynthesisType> PhotosynthesisTypes { get; set; }
public DbSet<LeafOutputFile> LeafOutputFiles { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
+10 -10
View File
@@ -13,7 +13,7 @@ namespace LeafWeb.Core.Parsers
{
}
public LeafInputInfo Parse()
public LeafInputData Parse()
{
// First 10 lines
var leafInput = ParseLeafInput();
@@ -33,7 +33,7 @@ namespace LeafWeb.Core.Parsers
return leafInput;
}
private LeafInputInfo ParseLeafInput()
private LeafInputData ParseLeafInput()
{
var items = new List<string>();
for (var i = 0; i < 10; i++)
@@ -46,10 +46,10 @@ namespace LeafWeb.Core.Parsers
throw new ParseException("Could not read first field on line number " + CsvReader.Row);
items.Add(field);
}
return ParsedObjectFactory<LeafInputInfo>.Create(items.ToArray());
return ParsedObjectFactory<LeafInputData>.Create(items.ToArray());
}
private LeafInputSite ParseLeafInputSite()
private LeafInputDataSite ParseLeafInputSite()
{
var titles = GetNextCsvRowValues();
if (titles == null)
@@ -67,10 +67,10 @@ namespace LeafWeb.Core.Parsers
var item = Tuple.Create(titles[i], values[i]);
items.Add(item);
}
return ParsedObjectFactory<LeafInputSite>.Create(items.ToArray());
return ParsedObjectFactory<LeafInputDataSite>.Create(items.ToArray());
}
private LeafInputPhotosynthetic ParseLeafInputPhotosynthetic()
private LeafInputDataPhotosynthetic ParseLeafInputPhotosynthetic()
{
var titles = GetNextCsvRowValues();
if (titles == null)
@@ -88,10 +88,10 @@ namespace LeafWeb.Core.Parsers
var item = Tuple.Create(titles[i], values[i]);
items.Add(item);
}
return ParsedObjectFactory<LeafInputPhotosynthetic>.Create(items.ToArray());
return ParsedObjectFactory<LeafInputDataPhotosynthetic>.Create(items.ToArray());
}
private LeafInputData[] ParseLeafInputData()
private LeafInputDataCurve[] ParseLeafInputData()
{
var titles = GetNextCsvRowValues();
if (titles == null)
@@ -108,10 +108,10 @@ namespace LeafWeb.Core.Parsers
break;
valueArrays.Add(values);
}
return ParsedObjectFactory<LeafInputData>.Create(titles, valueArrays.ToArray());
return ParsedObjectFactory<LeafInputDataCurve>.Create(titles, valueArrays.ToArray());
}
public static void ExportCsv(string filename, IEnumerable<LeafInputInfo> leafInputs)
public static void ExportCsv(string filename, IEnumerable<LeafInputData> leafInputs)
{
using (var textWriter = new StreamWriter(filename))
{