aw7152: open source, moved lib to sub folder, added console app
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
This commit is contained in:
30
CarbonConsoleApp/Program.cs
Normal file
30
CarbonConsoleApp/Program.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using CarbonService.Models;
|
||||
using FarmMapsAPI.Carbon;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace CarbonConsoleApp
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var configPath = "config25";
|
||||
ICarbonCalculation carbonCalc = new FarmMapsAPI.Carbon.CarbonCalculation25(configPath);
|
||||
var request = new CarbonRequest();
|
||||
using (var reader = new StreamReader("input.txt"))
|
||||
{
|
||||
var filecontent = reader.ReadToEnd();
|
||||
request = JsonConvert.DeserializeObject<CarbonRequest>(filecontent);
|
||||
}
|
||||
|
||||
var result = carbonCalc.CalculateClimateScenario(request);
|
||||
|
||||
using (var writer = new StreamWriter("output.txt"))
|
||||
{
|
||||
var resultText = JsonConvert.SerializeObject(result, Formatting.Indented);
|
||||
writer.WriteLine(resultText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user