Fix up parsers
This commit is contained in:
@@ -140,7 +140,7 @@ namespace LeafWeb.Core.Tests.Parsers
|
||||
{
|
||||
var dir = @"C:\Users\poprhythm\Documents\code\LeafWeb\Notes\leafweb database work\newcurves\RemovableDisk\curves";
|
||||
var files = Directory.GetFiles(dir, "*.csv").Select(f => new FileInfo(f)).ToList();
|
||||
var leafInputs = new List<LeafInputInfo>();
|
||||
var leafInputs = new List<LeafInputData>();
|
||||
var num = 1;
|
||||
foreach (var file in files)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -25,14 +25,10 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
||||
<PublishDatabaseSettings>
|
||||
<Objects xmlns="">
|
||||
<ObjectGroup Name="LeafWebContext" Order="1" Enabled="False">
|
||||
<Destination Path="" Name="" />
|
||||
<Object Type="DbDacFx">
|
||||
<PreSource Path="Data Source=.\SQLEXPRESS;Initial Catalog=LeafWeb;Integrated Security=True;Connect Timeout=60" includeData="False" />
|
||||
<Source Path="$(IntermediateOutputPath)AutoScripts\LeafWebContext_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
|
||||
<Destination Path="" />
|
||||
<Object Type="DbCodeFirst">
|
||||
<Source Path="DBContext" DbContext="LeafWeb.Core.DAL.LeafWebContext, Core" Origin="Configuration" />
|
||||
</Object>
|
||||
<UpdateFrom Type="Web.Config">
|
||||
<Source MatchValue="Data Source=.\SQLEXPRESS;Initial Catalog=LeafWeb;Integrated Security=True;Connect Timeout=60" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
|
||||
</UpdateFrom>
|
||||
</ObjectGroup>
|
||||
</Objects>
|
||||
</PublishDatabaseSettings>
|
||||
|
||||
Reference in New Issue
Block a user