COmpleto commit con modifica gestione true/True
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>fffad4cf-0dec-4e9b-b7fd-7316ac12a809</ProjectGuid>
|
<ProjectGuid>{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>FraMan.Core</RootNamespace>
|
<RootNamespace>FraMan.Core</RootNamespace>
|
||||||
@@ -31,24 +31,24 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System"/>
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Core"/>
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Xml.Linq"/>
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Data.DataSetExtensions"/>
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="Microsoft.CSharp"/>
|
<Reference Include="System.Xml" />
|
||||||
|
|
||||||
<Reference Include="System.Data"/>
|
|
||||||
|
|
||||||
<Reference Include="System.Net.Http"/>
|
|
||||||
|
|
||||||
<Reference Include="System.Xml"/>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Class1.cs" />
|
<Compile Include="HwInOut\AGB\DataManager.cs" />
|
||||||
|
<Compile Include="HwInOut\AGB\Opzioni.cs" />
|
||||||
|
<Compile Include="HwInOut\AGB\Parametri.cs" />
|
||||||
|
<Compile Include="HwInOut\AGB\ParametriOpzioni.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="DTO\" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace FraMan.Core.HwInOut.AGB
|
||||||
|
{
|
||||||
|
public class DataManager
|
||||||
|
{
|
||||||
|
|
||||||
|
public static bool ReadParamOpt(string filePath, ref ParametriOpzioni decoded)
|
||||||
|
{
|
||||||
|
bool done = false;
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
string rawXml = File.ReadAllText(filePath);
|
||||||
|
// se ho dati procedo
|
||||||
|
if (!string.IsNullOrEmpty(rawXml))
|
||||||
|
{
|
||||||
|
// bonifica dati: es "True --> true
|
||||||
|
rawXml = rawXml.Replace(">True<", ">true<");
|
||||||
|
rawXml = rawXml.Replace(">False<", ">false<");
|
||||||
|
// deserializzo
|
||||||
|
XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni));
|
||||||
|
using (StringReader reader = new StringReader(rawXml))
|
||||||
|
{
|
||||||
|
decoded = (ParametriOpzioni)serializer.Deserialize(reader);
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return done;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ namespace FraMan.Core.HwInOut.AGB
|
|||||||
public string DescrizioneOpzione { get; set; }
|
public string DescrizioneOpzione { get; set; }
|
||||||
|
|
||||||
[XmlElement(ElementName = "Valore")]
|
[XmlElement(ElementName = "Valore")]
|
||||||
public DateTime Valore { get; set; }
|
public string Valore { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace FraMan.Core.HwInOut.AGB
|
|||||||
public string DescrizioneParametro { get; set; }
|
public string DescrizioneParametro { get; set; }
|
||||||
|
|
||||||
[XmlElement(ElementName = "ValoreCorrente")]
|
[XmlElement(ElementName = "ValoreCorrente")]
|
||||||
public int ValoreCorrente { get; set; }
|
public string ValoreCorrente { get; set; }
|
||||||
|
|
||||||
[XmlElement(ElementName = "Tipo")]
|
[XmlElement(ElementName = "Tipo")]
|
||||||
public string Tipo { get; set; }
|
public string Tipo { get; set; }
|
||||||
|
|||||||
@@ -3,10 +3,17 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
namespace FraMan.Core.HwInOut.AGB
|
namespace FraMan.Core.HwInOut.AGB
|
||||||
{
|
{
|
||||||
internal class Parametri
|
|
||||||
|
|
||||||
|
[XmlRoot(ElementName = "ParametriOpzioni")]
|
||||||
|
public class ParametriOpzioni
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "Parametri")]
|
||||||
|
public List<Parametri> Parametri { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>15ce1125-bace-45d6-aec5-cb65c2e5d1b6</ProjectGuid>
|
<ProjectGuid>{15CE1125-BACE-45D6-AEC5-CB65C2E5D1B6}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>FraMan.DataLayer</RootNamespace>
|
<RootNamespace>FraMan.DataLayer</RootNamespace>
|
||||||
@@ -31,24 +31,24 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System"/>
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Core"/>
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Xml.Linq"/>
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Data.DataSetExtensions"/>
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="Microsoft.CSharp"/>
|
<Reference Include="System.Xml" />
|
||||||
|
|
||||||
<Reference Include="System.Data"/>
|
|
||||||
|
|
||||||
<Reference Include="System.Net.Http"/>
|
|
||||||
|
|
||||||
<Reference Include="System.Xml"/>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Class1.cs" />
|
<Compile Include="Class1.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\FraMan.Core\FraMan.Core.csproj">
|
||||||
|
<Project>{fffad4cf-0dec-4e9b-b7fd-7316ac12a809}</Project>
|
||||||
|
<Name>FraMan.Core</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -48,6 +48,19 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
<None Include="Data\TestParamOpt.opt">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\FraMan.Core\FraMan.Core.csproj">
|
||||||
|
<Project>{fffad4cf-0dec-4e9b-b7fd-7316ac12a809}</Project>
|
||||||
|
<Name>FraMan.Core</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\FraMan.DataLayer\FraMan.DataLayer.csproj">
|
||||||
|
<Project>{15ce1125-bace-45d6-aec5-cb65c2e5d1b6}</Project>
|
||||||
|
<Name>FraMan.DataLayer</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
+55
-9
@@ -1,6 +1,9 @@
|
|||||||
using System;
|
using FraMan.Core.HwInOut.AGB;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -10,16 +13,59 @@ namespace FraMan.Test
|
|||||||
{
|
{
|
||||||
static void Main(string[] args)
|
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
|
||||||
|
{
|
||||||
|
Console.WriteLine("Effettuata lettura dati:");
|
||||||
|
Console.WriteLine(separator);
|
||||||
|
int idx = 0;
|
||||||
|
foreach (var item in parOpt.Parametri)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Par.{idx++:000}:");
|
||||||
|
Console.WriteLine($"Nome: {item.NomeParametro}");
|
||||||
|
Console.WriteLine($"Descr: {item.DescrizioneParametro}");
|
||||||
|
Console.WriteLine($"Valore: {item.ValoreCorrente}");
|
||||||
|
|
||||||
|
// 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");
|
||||||
// using System.Xml.Serialization;
|
Console.ReadLine();
|
||||||
// XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni));
|
|
||||||
// using (StringReader reader = new StringReader(xml))
|
|
||||||
// {
|
|
||||||
// var test = (ParametriOpzioni)serializer.Deserialize(reader);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
@@ -5,6 +5,10 @@ VisualStudioVersion = 17.11.35219.272
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FraMan.Core", "FraMan.Core\FraMan.Core.csproj", "{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FraMan.Core", "FraMan.Core\FraMan.Core.csproj", "{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FraMan.DataLayer", "FraMan.DataLayer\FraMan.DataLayer.csproj", "{15CE1125-BACE-45D6-AEC5-CB65C2E5D1B6}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FraMan.Test", "FraMan.Test\FraMan.Test.csproj", "{A224B6C9-6385-404C-B60F-C97209B65816}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -15,6 +19,14 @@ Global
|
|||||||
{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FFFAD4CF-0DEC-4E9B-B7FD-7316AC12A809}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{15CE1125-BACE-45D6-AEC5-CB65C2E5D1B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{15CE1125-BACE-45D6-AEC5-CB65C2E5D1B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{15CE1125-BACE-45D6-AEC5-CB65C2E5D1B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{15CE1125-BACE-45D6-AEC5-CB65C2E5D1B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A224B6C9-6385-404C-B60F-C97209B65816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A224B6C9-6385-404C-B60F-C97209B65816}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A224B6C9-6385-404C-B60F-C97209B65816}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A224B6C9-6385-404C-B60F-C97209B65816}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Reference in New Issue
Block a user