Update conversione INI
This commit is contained in:
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace IobConf.Core
|
||||
{
|
||||
public class Enum
|
||||
public class EnumConf
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
using YamlDotNet.Serialization;
|
||||
using static IobConf.Core.Enum;
|
||||
using static IobConf.Core.EnumConf;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
@@ -56,6 +56,9 @@ namespace IobConf.Core
|
||||
newConfObj.Vendor = fIni.ReadString("MACHINE", "VENDOR", "STEAMWARE");
|
||||
newConfObj.Model = fIni.ReadString("MACHINE", "MODEL", "NONE");
|
||||
|
||||
// tipo adapter
|
||||
newConfObj.IobType = (AdapterType)Enum.Parse(typeof(AdapterType), fIni.ReadString("IOB", "CNCTYPE", "ND"));
|
||||
newConfObj.GeneralCom = (ComLayer)Enum.Parse(typeof(ComLayer), fIni.ReadString("IOB", "CNCFAMILY", "ND"));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<div class="px-2">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">
|
||||
<h1>Converter</h1>
|
||||
Conversione INI --> YAML / JSON
|
||||
</div>
|
||||
<div class="px-2 text-end">
|
||||
<h3>@CodIOB</h3>
|
||||
<button class="btn btn-sm btn-dark" @onclick="() => UpdateConf()">Update Conf</button>
|
||||
<div class="col-8 text-end align-bottom">
|
||||
<div class="input-group">
|
||||
<input class="form-control small" type="text" @bind="@iniPath" placeholder="Ini Path" aria-label="Ini Path" aria-describedby="basic-addon2" />
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => LoadINI()">Load INI</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -16,11 +18,6 @@
|
||||
<h2>INI</h2>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control small" type="text" @bind="@iniPath" placeholder="Ini Path" aria-label="Ini Path" aria-describedby="basic-addon2" />
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => LoadINI()">Load INI</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body small textConsensed">
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace IobConf.UI.Components
|
||||
rawFileContent = File.ReadAllText(iniPath);
|
||||
confINI=getMarkup(rawFileContent);
|
||||
CurrentConf = IobConfTree.LoadFromINI(iniPath);
|
||||
updateOutConf();
|
||||
updateConf();
|
||||
}
|
||||
public async Task SaveJson()
|
||||
{
|
||||
@@ -32,24 +32,11 @@ namespace IobConf.UI.Components
|
||||
CurrentConf.SaveYaml(fileName);
|
||||
}
|
||||
|
||||
public async Task UpdateConf()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
CodIOB = $"NewIOB_{DateTime.Now.Second:00}";
|
||||
CurrentConf = new IobConfTree()
|
||||
{
|
||||
CodIOB = CodIOB
|
||||
};
|
||||
updateOutConf();
|
||||
}
|
||||
|
||||
private void updateOutConf()
|
||||
private void updateConf()
|
||||
{
|
||||
// aggiorno conf JSON/YAML
|
||||
confJson = getMarkup(CurrentConf.GetJson());
|
||||
confYaml = getMarkup(CurrentConf.GetYaml());
|
||||
//confJson = (MarkupString)CurrentConf.GetJson().Replace("\n", "<br/>").Replace(" ", " ");
|
||||
//confYaml = (MarkupString)CurrentConf.GetYaml().Replace("\n", "<br/>").Replace(" ", " ");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -91,7 +78,7 @@ namespace IobConf.UI.Components
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await UpdateConf();
|
||||
await LoadINI();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
Reference in New Issue
Block a user