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 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 files = Directory.GetFiles(dir, "*.csv").Select(f => new FileInfo(f)).ToList();
|
||||||
var leafInputs = new List<LeafInputInfo>();
|
var leafInputs = new List<LeafInputData>();
|
||||||
var num = 1;
|
var num = 1;
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace LeafWeb.Core.DAL
|
|||||||
public DbSet<LeafInputStatus> LeafInputStatus { get; set; }
|
public DbSet<LeafInputStatus> LeafInputStatus { get; set; }
|
||||||
public DbSet<FluxnetSite> FluxnetSites { get; set; }
|
public DbSet<FluxnetSite> FluxnetSites { get; set; }
|
||||||
public DbSet<PhotosynthesisType> PhotosynthesisTypes { get; set; }
|
public DbSet<PhotosynthesisType> PhotosynthesisTypes { get; set; }
|
||||||
|
public DbSet<LeafOutputFile> LeafOutputFiles { get; set; }
|
||||||
|
|
||||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace LeafWeb.Core.Parsers
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public LeafInputInfo Parse()
|
public LeafInputData Parse()
|
||||||
{
|
{
|
||||||
// First 10 lines
|
// First 10 lines
|
||||||
var leafInput = ParseLeafInput();
|
var leafInput = ParseLeafInput();
|
||||||
@@ -33,7 +33,7 @@ namespace LeafWeb.Core.Parsers
|
|||||||
return leafInput;
|
return leafInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LeafInputInfo ParseLeafInput()
|
private LeafInputData ParseLeafInput()
|
||||||
{
|
{
|
||||||
var items = new List<string>();
|
var items = new List<string>();
|
||||||
for (var i = 0; i < 10; i++)
|
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);
|
throw new ParseException("Could not read first field on line number " + CsvReader.Row);
|
||||||
items.Add(field);
|
items.Add(field);
|
||||||
}
|
}
|
||||||
return ParsedObjectFactory<LeafInputInfo>.Create(items.ToArray());
|
return ParsedObjectFactory<LeafInputData>.Create(items.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private LeafInputSite ParseLeafInputSite()
|
private LeafInputDataSite ParseLeafInputSite()
|
||||||
{
|
{
|
||||||
var titles = GetNextCsvRowValues();
|
var titles = GetNextCsvRowValues();
|
||||||
if (titles == null)
|
if (titles == null)
|
||||||
@@ -67,10 +67,10 @@ namespace LeafWeb.Core.Parsers
|
|||||||
var item = Tuple.Create(titles[i], values[i]);
|
var item = Tuple.Create(titles[i], values[i]);
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
return ParsedObjectFactory<LeafInputSite>.Create(items.ToArray());
|
return ParsedObjectFactory<LeafInputDataSite>.Create(items.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private LeafInputPhotosynthetic ParseLeafInputPhotosynthetic()
|
private LeafInputDataPhotosynthetic ParseLeafInputPhotosynthetic()
|
||||||
{
|
{
|
||||||
var titles = GetNextCsvRowValues();
|
var titles = GetNextCsvRowValues();
|
||||||
if (titles == null)
|
if (titles == null)
|
||||||
@@ -88,10 +88,10 @@ namespace LeafWeb.Core.Parsers
|
|||||||
var item = Tuple.Create(titles[i], values[i]);
|
var item = Tuple.Create(titles[i], values[i]);
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
return ParsedObjectFactory<LeafInputPhotosynthetic>.Create(items.ToArray());
|
return ParsedObjectFactory<LeafInputDataPhotosynthetic>.Create(items.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private LeafInputData[] ParseLeafInputData()
|
private LeafInputDataCurve[] ParseLeafInputData()
|
||||||
{
|
{
|
||||||
var titles = GetNextCsvRowValues();
|
var titles = GetNextCsvRowValues();
|
||||||
if (titles == null)
|
if (titles == null)
|
||||||
@@ -108,10 +108,10 @@ namespace LeafWeb.Core.Parsers
|
|||||||
break;
|
break;
|
||||||
valueArrays.Add(values);
|
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))
|
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>
|
<PublishDatabaseSettings>
|
||||||
<Objects xmlns="">
|
<Objects xmlns="">
|
||||||
<ObjectGroup Name="LeafWebContext" Order="1" Enabled="False">
|
<ObjectGroup Name="LeafWebContext" Order="1" Enabled="False">
|
||||||
<Destination Path="" Name="" />
|
<Destination Path="" />
|
||||||
<Object Type="DbDacFx">
|
<Object Type="DbCodeFirst">
|
||||||
<PreSource Path="Data Source=.\SQLEXPRESS;Initial Catalog=LeafWeb;Integrated Security=True;Connect Timeout=60" includeData="False" />
|
<Source Path="DBContext" DbContext="LeafWeb.Core.DAL.LeafWebContext, Core" Origin="Configuration" />
|
||||||
<Source Path="$(IntermediateOutputPath)AutoScripts\LeafWebContext_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
|
|
||||||
</Object>
|
</Object>
|
||||||
<UpdateFrom Type="Web.Config">
|
|
||||||
<Source MatchValue="Data Source=.\SQLEXPRESS;Initial Catalog=LeafWeb;Integrated Security=True;Connect Timeout=60" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
|
|
||||||
</UpdateFrom>
|
|
||||||
</ObjectGroup>
|
</ObjectGroup>
|
||||||
</Objects>
|
</Objects>
|
||||||
</PublishDatabaseSettings>
|
</PublishDatabaseSettings>
|
||||||
|
|||||||
Reference in New Issue
Block a user