Bozza progetto dataFiller x interclays
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
using YamlDotNet.Serialization;
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
namespace MapoDataFiller
|
||||
{
|
||||
public class MConf
|
||||
{
|
||||
public string DaySetupFile { get; set; } = "";
|
||||
public string FillMode { get; set; } = "";
|
||||
public bool HasHeader { get; set; } = false;
|
||||
|
||||
public MConf()
|
||||
{
|
||||
this.DaySetupFile = @"C:\temp\Interclays\Interclays02.csv";
|
||||
this.FillMode = "NONE";
|
||||
this.HasHeader = false;
|
||||
}
|
||||
}
|
||||
public class CMan
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserializza dato filePath
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
public static MConf readConf(string filePath)
|
||||
{
|
||||
MConf retObj = new MConf();
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
var deserializer = new DeserializerBuilder()
|
||||
.WithNamingConvention(new PascalCaseNamingConvention())
|
||||
.Build();
|
||||
string rawData = File.ReadAllText(filePath);
|
||||
|
||||
var input = new StringReader(rawData);
|
||||
retObj = deserializer.Deserialize<MConf>(input);
|
||||
}
|
||||
return retObj;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Spectre.Console" Version="0.45.0" />
|
||||
<PackageReference Include="YamlDotNet" Version="12.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
using MapoDataFiller;
|
||||
using Spectre.Console;
|
||||
|
||||
|
||||
AnsiConsole.Write(
|
||||
new FigletText("MapoDataFiller")
|
||||
.LeftAligned()
|
||||
.Color(Color.Blue1));
|
||||
var rule = new Rule("[green]Setup data[/]");
|
||||
rule.Alignment = Justify.Left;
|
||||
AnsiConsole.Write(rule);
|
||||
|
||||
// recupero configurazione...
|
||||
MConf currConf = new MConf();
|
||||
if (File.Exists("conf.yaml"))
|
||||
{
|
||||
currConf = CMan.readConf("conf.yaml");
|
||||
}
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.MarkupLineInterpolated($"Conf FillMode: [yellow]{currConf.FillMode}[/]");
|
||||
var typeOk = AnsiConsole.Confirm("Confermi FillMode?");
|
||||
while (!typeOk)
|
||||
{
|
||||
currConf.FillMode = AnsiConsole.Ask<string>("Inserisci il modo desiderato:");
|
||||
AnsiConsole.WriteLine(currConf.FillMode);
|
||||
typeOk = AnsiConsole.Confirm("Confermi FillMode?");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
DaySetupFile: C:\temp\Interclays
|
||||
FillMode: Interclays-02
|
||||
HasHeader: true
|
||||
Reference in New Issue
Block a user