ConfMan.IOB:
- aggiunto conf YAML x default
This commit is contained in:
+22
-18
@@ -3,6 +3,7 @@ using ConfMan.IOB.CApp;
|
||||
using Spectre.Console;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
AnsiConsole.Write(
|
||||
new FigletText("ConfMan.IOB")
|
||||
@@ -12,50 +13,53 @@ var rule = new Rule("[green]IOB configuration file manager[/]");
|
||||
rule.Alignment = Justify.Left;
|
||||
AnsiConsole.Write(rule);
|
||||
|
||||
// recupero configurazione...
|
||||
CAConf currConf = new CAConf();
|
||||
if (File.Exists("conf.yaml"))
|
||||
{
|
||||
currConf = CMan.readConf("conf.yaml");
|
||||
}
|
||||
|
||||
AnsiConsole.WriteLine();
|
||||
var fileType = ".ini";
|
||||
AnsiConsole.MarkupLineInterpolated($"Conf file type: [yellow]{fileType}[/]");
|
||||
AnsiConsole.MarkupLineInterpolated($"Conf file type: [yellow]{currConf.FileType}[/]");
|
||||
var typeOk = AnsiConsole.Confirm("Confermi tipo file?");
|
||||
while (!typeOk)
|
||||
{
|
||||
fileType = AnsiConsole.Ask<string>("Inserisci il type desiderato:");
|
||||
AnsiConsole.WriteLine(fileType);
|
||||
currConf.FileType = AnsiConsole.Ask<string>("Inserisci il type desiderato:");
|
||||
AnsiConsole.WriteLine(currConf.FileType);
|
||||
typeOk = AnsiConsole.Confirm("Confermi tipo file?");
|
||||
}
|
||||
// aggiungo "*" se mancasse...
|
||||
if (fileType.Substring(0, 1) != "*")
|
||||
if (currConf.FileType.Substring(0, 1) != "*")
|
||||
{
|
||||
fileType = $"*{fileType}";
|
||||
currConf.FileType = $"*{currConf.FileType}";
|
||||
}
|
||||
AnsiConsole.MarkupLineInterpolated($"Confermato file type: [green]{fileType}[/]");
|
||||
AnsiConsole.MarkupLineInterpolated($"Confermato file type: [green]{currConf.FileType}[/]");
|
||||
|
||||
//var path = new TextPath(@"C:\Steamware\IOB-WIN-NEXT\DATA\CONF");
|
||||
string sPath = @"C:\temp\DATA\CONF";
|
||||
var path = new TextPath(sPath);
|
||||
var path = new TextPath(currConf.ConfDir);
|
||||
AnsiConsole.WriteLine($"Default conf path:");
|
||||
AnsiConsole.Write(path);
|
||||
//AnsiConsole.WriteLine();
|
||||
|
||||
var fileList = Directory.GetFiles(sPath, fileType);
|
||||
var fileList = Directory.GetFiles(currConf.ConfDir, currConf.FileType);
|
||||
AnsiConsole.MarkupLineInterpolated($"Trovati [yellow]{fileList.Count()}[/] file...");
|
||||
var pathOK = AnsiConsole.Confirm("Confermi il Path?");
|
||||
while (!pathOK)
|
||||
{
|
||||
sPath = AnsiConsole.Ask<string>("Inserisci il percorso completo:");
|
||||
if (!string.IsNullOrEmpty(sPath))
|
||||
currConf.ConfDir = AnsiConsole.Ask<string>("Inserisci il percorso completo:");
|
||||
if (!string.IsNullOrEmpty(currConf.ConfDir))
|
||||
{
|
||||
path = new TextPath(sPath);
|
||||
path = new TextPath(currConf.ConfDir);
|
||||
AnsiConsole.Write(path);
|
||||
// verifico esista la directory...
|
||||
if (!Directory.Exists(sPath))
|
||||
if (!Directory.Exists(currConf.ConfDir))
|
||||
{
|
||||
AnsiConsole.MarkupLine("Attenzione: path inserito [red]non[/] valido!");
|
||||
}
|
||||
else
|
||||
{
|
||||
// recupero il numero di file ini cercati
|
||||
fileList = Directory.GetFiles(sPath, fileType);
|
||||
fileList = Directory.GetFiles(currConf.ConfDir, currConf.FileType);
|
||||
AnsiConsole.MarkupLineInterpolated($"Trovati [yellow]{fileList.Count()}[/] file...");
|
||||
pathOK = AnsiConsole.Confirm("Confermi il Path?");
|
||||
}
|
||||
@@ -84,8 +88,8 @@ if (hostAddress != null)
|
||||
hostAddr = $"{hostAddress[0]}";
|
||||
}
|
||||
}
|
||||
var custName = AnsiConsole.Ask<string>("Inserisci valore per [yellow]Customer[/]:","SteamWare");
|
||||
var HostOS = AnsiConsole.Ask<string>("Inserisci valore per [yellow]OS[/]:","WIN");
|
||||
var custName = AnsiConsole.Ask<string>("Inserisci valore per [yellow]Customer[/]:", currConf.Customer);
|
||||
var HostOS = AnsiConsole.Ask<string>("Inserisci valore per [yellow]OS[/]:", currConf.OS);
|
||||
var HostName = AnsiConsole.Ask<string>("Inserisci valore per [yellow]HostName[/]:", hostName);
|
||||
var HostAddr = AnsiConsole.Ask<string>("Inserisci valore per [yellow]HostAddress (IP)[/]:", hostAddr);
|
||||
// salvo i tagList...
|
||||
|
||||
Reference in New Issue
Block a user