80 lines
2.9 KiB
C#
80 lines
2.9 KiB
C#
using FraMan.Core.HwInOut.AGB;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FraMan.Test
|
|
{
|
|
internal class Program
|
|
{
|
|
#region Private Methods
|
|
|
|
private static void Main(string[] args)
|
|
{
|
|
// effettua chaimata x test lettura parametri
|
|
string separator = "---------------------------";
|
|
string defFile = "./Data/TestParamOpt.opt";
|
|
Console.WriteLine(separator);
|
|
Console.WriteLine("- Test lettura Parametri opzionali");
|
|
Console.WriteLine(separator);
|
|
Console.WriteLine();
|
|
Console.WriteLine("Premere un tasto per proseguire");
|
|
Console.ReadLine();
|
|
Console.WriteLine($"Inserire percorso oppure enter per default ({defFile}):");
|
|
var fPath = Console.ReadLine();
|
|
if (string.IsNullOrEmpty(fPath))
|
|
{
|
|
fPath = defFile;
|
|
}
|
|
var fullPath = Path.GetFullPath(fPath);
|
|
// preparo output
|
|
var parOpt = new ParametriOpzioni();
|
|
bool fatto = DataManager.ReadParamOpt(fullPath, ref parOpt);
|
|
if (!fatto)
|
|
{
|
|
Console.WriteLine("Errore in lettura dati");
|
|
}
|
|
else
|
|
{
|
|
int numPar = parOpt.Parametri.Count;
|
|
Console.WriteLine($"Effettuata lettura dati, trovati {numPar} parametri:");
|
|
Console.WriteLine(separator);
|
|
Console.WriteLine();
|
|
int idx = 1;
|
|
foreach (var item in parOpt.Parametri)
|
|
{
|
|
Console.WriteLine(separator);
|
|
Console.WriteLine($"N. {idx++:000} / {numPar}");
|
|
Console.WriteLine($"Nome: {item.NomeParametro}");
|
|
Console.WriteLine($"Descr: {item.DescrizioneParametro}");
|
|
Console.WriteLine($"Valore: {item.ValoreCorrente}");
|
|
Console.WriteLine($"Visibile: {item.Visible}");
|
|
Console.WriteLine($"Tipo: {item.Tipo}");
|
|
|
|
// se lista mostro opzioni:
|
|
if (item.Tipo.ToLower() == "list")
|
|
{
|
|
int j = 0;
|
|
Console.WriteLine($"# Opzioni ammesse: {item.Opzioni.Count}");
|
|
foreach (var opz in item.Opzioni)
|
|
{
|
|
Console.WriteLine($"{j++:00}) {opz.DescrizioneOpzione} --> {opz.Valore}");
|
|
}
|
|
}
|
|
// chiudo
|
|
Console.WriteLine(separator);
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("Premere un tasto per chiudere");
|
|
Console.ReadLine();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |